From 60761d05dce5d5c42975361fbaa0f21cb11069bc Mon Sep 17 00:00:00 2001 From: hekun Date: Thu, 31 Aug 2023 19:28:14 +0800 Subject: [PATCH] submit the code Signed-off-by: hekun --- .../src/main/ets/MainAbility/common/Utils.ets | 13 ++++++++++++ .../main/ets/test/flex/FlexBasisTest.test.ets | 20 ++++++++++++++++--- .../hitTestBehavior/HitTestBehaviorPage.ets | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/MainAbility/common/Utils.ets b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/MainAbility/common/Utils.ets index 34ab05597..5233c33b5 100644 --- a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/MainAbility/common/Utils.ets +++ b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/MainAbility/common/Utils.ets @@ -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); diff --git a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/test/flex/FlexBasisTest.test.ets b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/test/flex/FlexBasisTest.test.ets index 332b555cc..b34c5b62f 100644 --- a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/test/flex/FlexBasisTest.test.ets +++ b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_flex/entry/src/main/ets/test/flex/FlexBasisTest.test.ets @@ -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 diff --git a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_hitTestBehavior/entry/src/main/ets/MainAbility/pages/hitTestBehavior/HitTestBehaviorPage.ets b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_hitTestBehavior/entry/src/main/ets/MainAbility/pages/hitTestBehavior/HitTestBehaviorPage.ets index 0fd5893e0..046b4aba2 100644 --- a/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_hitTestBehavior/entry/src/main/ets/MainAbility/pages/hitTestBehavior/HitTestBehaviorPage.ets +++ b/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_hitTestBehavior/entry/src/main/ets/MainAbility/pages/hitTestBehavior/HitTestBehaviorPage.ets @@ -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({ -- GitLab