提交 60761d05 编写于 作者: H hekun

submit the code

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 1fa35886
......@@ -15,6 +15,7 @@
import router from '@ohos.router';
import { AttrsManager } from './AttrsManager';
import display from '@ohos.display';
export default class Utils {
public static instance;
......@@ -111,7 +112,19 @@ export default class Utils {
console.info(JSON.stringify(rect_value));
return rect_value;
}
static getDensityDPI() {
let displayClass = null;
let densityDPI;
try {
displayClass = display.getDefaultDisplaySync();
densityDPI = displayClass.densityDPI;
} catch (exception) {
console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
}
return densityDPI;
}
static getComponentByKey(componentKey) {
let strJson = getInspectorByKey(componentKey);
let obj = JSON.parse(strJson);
......
......@@ -132,10 +132,24 @@ export default function flexBasisTest() {
//Verify the flexBasis is or not be set success
console.info('[' + data.caseTag + '] check the flexBasis is or not be set success');
let densityDPI = Utils.getDensityDPI();
console.info('the densityDPI is' + densityDPI);
if (data.testValue.describe == 'SetNumber' || data.testValue.describe == 'SetStringPx') {
expect(data.viewObj.$attrs.flexBasis).assertEqual(data.testValue.expectValue.expectFlexBasis);
console.info('[' + data.caseTag + '] data.viewObj.$attrs.flexBasis' + data.viewObj.$attrs.flexBasis);
if (densityDPI == 1.5) {
expect(data.viewObj.$attrs.flexBasis).assertEqual(data.testValue.expectValue.expectFlexBasis);
console.info('[' + data.caseTag + '] data.viewObj.$attrs.flexBasis' + data.viewObj.$attrs.flexBasis);
}
if (densityDPI == 3.5 ) {
if (supportView[12] == 'Menu') {
expect(data.viewObj.$attrs.flexBasis).assertEqual(64*3.5);
} else if (supportView[28] == 'Select') {
expect(data.viewObj.$attrs.flexBasis).assertEqual(66*3.5);
} else {
expect(data.viewObj.$attrs.flexBasis).assertEqual(data.testValue.expectValue.expectFlexBasis);
}
console.info('[' + data.caseTag + '] data.viewObj.$attrs.flexBasis' + data.viewObj.$attrs.flexBasis);
}
}
//Get target component rect
......
......@@ -115,6 +115,7 @@ struct HitTestBehaviorPage {
.colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1]])
} else if (this.targetView == 'Image') {
Image($r('app.media.icon'))
.draggable(false)
.commonStyle()
} else if (this.targetView == 'Marquee') {
Marquee({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册