From ce4b0c95e525123e6ed7cbe8d200691f675ed528 Mon Sep 17 00:00:00 2001 From: wangchao582 Date: Sun, 23 Jul 2023 15:57:31 +0800 Subject: [PATCH] !9438 Adaptation Phase 1 Issues Signed-off-by: wangchao582 --- .../ets/MainAbility/common/AttrsManager.ets | 4 + .../src/main/ets/MainAbility/common/Utils.ets | 11 ++ .../pages/alignRules/AlignRulesPage.ets | 10 +- .../constraintSize/ConstraintSizePage.ets | 13 +- .../MainAbility/pages/height/HeightPage.ets | 37 ++++-- .../pages/layoutWeight/LayoutWeightPage.ets | 9 +- .../layoutWeight/LayoutWeightPageFlex.ets | 9 +- .../layoutWeight/LayoutWeightPageRow.ets | 9 +- .../MainAbility/pages/margin/MarginPage.ets | 2 + .../pages/margin/MarginPageLength.ets | 16 ++- .../pages/margin/MarginPageString.ets | 12 +- .../MainAbility/pages/offset/OffsetPage.ets | 6 +- .../pages/padding/PaddingBasePageLength.ets | 2 +- .../pages/padding/PaddingContainerPage.ets | 20 ++-- .../padding/PaddingContainerPageLength.ets | 20 ++-- .../pages/position/PositionPage.ets | 18 ++- .../ets/MainAbility/pages/size/SizePage.ets | 15 +-- .../ets/MainAbility/pages/width/WidthPage.ets | 16 ++- .../view/position/FlowItemView.ets | 26 ++-- .../MainAbility/view/position/TabsView.ets | 1 - .../view/position/WaterFlowView.ets | 64 +++++----- .../entry/src/main/ets/test/List.test.ets | 2 +- .../ConstraintSizeTest.test.ets | 16 +-- .../ets/test/default/DefaultTest.test.ets | 10 +- .../main/ets/test/height/HeightTest.test.ets | 57 +++------ .../LayoutWeightFlexTest.test.ets | 2 +- .../layoutWeight/LayoutWeightRowTest.test.ets | 2 +- .../layoutWeight/LayoutWeightTest.test.ets | 4 +- .../ets/test/margin/MarginLengthTest.test.ets | 12 +- .../main/ets/test/margin/MarginTest.test.ets | 18 +-- .../main/ets/test/offset/OffsetTest.test.ets | 27 +++-- .../padding/PaddingBaseLengthTest.test.ets | 8 +- .../ets/test/padding/PaddingBaseTest.test.ets | 2 +- .../PaddingContainerLengthTest.test.ets | 86 ++++++++------ .../padding/PaddingContainerTest.test.ets | 112 ++++++++++-------- .../ets/test/position/PositionTest.test.ets | 21 +++- .../src/main/ets/test/size/SizeTest.test.ets | 24 ++-- .../main/ets/test/width/WidthTest.test.ets | 20 ++-- 38 files changed, 414 insertions(+), 329 deletions(-) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/AttrsManager.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/AttrsManager.ets index c6be2f1aa..d4eac4a34 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/AttrsManager.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/AttrsManager.ets @@ -29,6 +29,10 @@ export class AttrsManager { this.onEvent(Constants.EVENT_ID_CHANGE_DATA); } + static unRegisterDataChange() { + events_emitter.off(Constants.EVENT_ID_CHANGE_DATA); + } + private onEvent(eventId: number) { let stateChangeEvent = { eventId: eventId, diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/Utils.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/Utils.ets index 9dac964c2..814b93c44 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/Utils.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/common/Utils.ets @@ -14,6 +14,7 @@ */ import router from '@ohos.router'; +import { AttrsManager } from './AttrsManager'; export default class Utils { public static instance; @@ -51,7 +52,16 @@ export default class Utils { static async pushPage(obj) { try { let pages = router.getState(); + let pageParams = router.getParams(); console.info('get ' + obj.pageName + ' state pages: ' + JSON.stringify(pages)); + if (pageParams && pageParams['view'] && obj.targetView != pageParams['view']['targetView']) { + console.info('get ' + obj.pageName + ' params: ' + JSON.stringify(pageParams)); + console.info('pageParams.view.targetView: ' + pageParams['view']['targetView']); + console.info('targetView: ' + obj.targetView); + await Utils.back(); + pages = router.getState(); + } + if (!(obj.pageName == pages.name)) { console.info('get ' + obj.pageName + ' state pages.name:' + JSON.stringify(pages.name)); let result = await router.pushUrl({ @@ -72,6 +82,7 @@ export default class Utils { if (!('Index' == router.getState().name)) { router.back() } + AttrsManager.unRegisterDataChange(); await Utils.sleep(1000); router.clear(); } diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/alignRules/AlignRulesPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/alignRules/AlignRulesPage.ets index 8547bbf1e..e91695ffd 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/alignRules/AlignRulesPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/alignRules/AlignRulesPage.ets @@ -60,17 +60,17 @@ struct AlignRules { .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Radio') { Radio({ value: 'Radio1', group: 'radioGroup' }) - .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() + .margin(0).width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa', icon: '/common/public_icon.svg' }, { value: 'bbb', icon: '/common/public_icon.svg' }]) .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Checkbox') { Checkbox({ name: 'checkbox1' }) - .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() + .margin(0).width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'CheckboxGroup') { CheckboxGroup() - .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() + .margin(0).width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [25] }) .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() @@ -132,7 +132,7 @@ struct AlignRules { .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Search') { Search() - .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() + .margin(0).width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Slider') { Slider() .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() @@ -156,7 +156,7 @@ struct AlignRules { .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Toggle') { Toggle({ type: ToggleType.Switch }) - .width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() + .margin(0).width(this.subassemblyWidth).height(this.subassemblyHeight).commonStyle() } else if (this.targetView == 'Badge') { Badge({ value: '', style: { badgeSize: 6, badgeColor: Color.Red } }) { Button('BadgeContent') diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/constraintSize/ConstraintSizePage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/constraintSize/ConstraintSizePage.ets index 83a2c51e9..9e514287a 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/constraintSize/ConstraintSizePage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/constraintSize/ConstraintSizePage.ets @@ -440,17 +440,24 @@ struct ConstraintSizePage { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .commonStyle() }.backgroundColor(Color.Yellow) + .padding(0) .width(400) .height(400) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'MenuItemGroup') { Row() { Menu() { - MenuItemGroup({ header: 'MenuItemGroup' }) { - MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) + MenuItemGroup() { + MenuItem({ content: 'MenuItem' }).backgroundColor(Color.White).padding(0).margin(0) } + .backgroundColor(Color.Pink) .commonStyle() - }.backgroundColor(Color.Yellow) + .padding(0) + .margin(0) + } + .backgroundColor(Color.Yellow) + .padding(0) + .margin(0) .width(400) .height(400) }.width('100%').height('100%').backgroundColor(Color.Green) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/height/HeightPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/height/HeightPage.ets index e67a10db4..a7a2d80c6 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/height/HeightPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/height/HeightPage.ets @@ -61,9 +61,10 @@ struct heightPage { } else if (this.targetView == 'BlankColumn') { Blank().color(this.BackGroundColor).commonStyle().width(100) } else if (this.targetView == 'Checkbox') { - Checkbox().backgroundColor(this.BackGroundColor).commonStyle().width(100) + Checkbox().backgroundColor(this.BackGroundColor).commonStyle().width(100).margin(0) } else if (this.targetView == 'CheckboxGroup') { CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(this.BackGroundColor).width(100) + .margin(0) } else if (this.targetView == 'DataPanel') { DataPanel({ values: this.valueArr }).commonStyle().width(100) } else if (this.targetView == 'DatePicker') { @@ -105,6 +106,7 @@ struct heightPage { QRCode(this.src).commonStyle().backgroundColor(this.BackGroundColor).width(100) } else if (this.targetView == 'Radio') { Radio({ value: 'Radio1', group: 'radioGroup' }).width(100).commonStyle().backgroundColor(this.BackGroundColor) + .margin(0) } else if (this.targetView == 'Rating') { Rating({ rating: 3.5 }).commonStyle().width(100) } else if (this.targetView == 'RichText') { @@ -114,7 +116,7 @@ struct heightPage { Text().width(10).height(50).backgroundColor('#C0C0C0') }.commonStyle().backgroundColor(this.BackGroundColor).width(100) } else if (this.targetView == 'Search') { - Search().commonStyle().width(100) + Search().commonStyle().width(100).margin(0) } else if (this.targetView == 'Select') { Select([{ value: 'aaa' }, { value: 'bbb' }]).backgroundColor(this.BackGroundColor).commonStyle().width(100) @@ -125,9 +127,12 @@ struct heightPage { } else if (this.targetView == 'TextArea') { TextArea({ placeholder: 'TextArea' }).commonStyle().width(100) } else if (this.targetView == 'TextClock') { - TextClock({ timeZoneOffset: -8 }).format('hms').fontSize(30) + TextClock({ timeZoneOffset: -8 }) + .format('hms') + .fontSize(30) .commonStyle() - .backgroundColor(this.BackGroundColor).width(100) + .backgroundColor(this.BackGroundColor) + .width(100) } else if (this.targetView == 'TextInput') { TextInput({ placeholder: 'input your word...' }) .commonStyle().width(100) @@ -141,7 +146,7 @@ struct heightPage { selected: this.selectedTime }).useMilitaryTime(true).commonStyle().width(100) } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch }).commonStyle().backgroundColor(this.BackGroundColor).width(100) + Toggle({ type: ToggleType.Switch }).commonStyle().backgroundColor(this.BackGroundColor).width(100).margin(0) } else if (this.targetView == 'Web') { Web({ src: 'www.example.com', controller: new WebController() }).commonStyle().width(100) } else if (this.targetView == 'Circle') { @@ -190,7 +195,8 @@ struct heightPage { }.commonStyle().width(100) } } else if (this.targetView == 'Counter') { - Counter() {}.commonStyle().width(100) + Counter() { + }.commonStyle().width(100) } else if (this.targetView == 'Flex') { Flex() { Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) @@ -269,7 +275,8 @@ struct heightPage { }.backgroundColor(Color.Orange) }.commonStyle() } else if (this.targetView == 'Stack') { - Stack() {}.commonStyle().width(100) + Stack() { + }.commonStyle().width(100) } else if (this.targetView == 'Swiper') { Swiper() { ForEach([1, 2, 3], (item: string) => { @@ -325,16 +332,19 @@ struct heightPage { } else if (this.targetView == 'Menu') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'Menu' }) - }.backgroundColor(Color.Yellow).commonStyle().width(100) + }.backgroundColor(Color.Yellow).commonStyle().width(100).padding(0) } else if (this.targetView == 'MenuItem') { Row() { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .height(this._height) .key(this.componentKey) - }.backgroundColor(this.BackGroundColor) + } + .backgroundColor(this.BackGroundColor) .width(this.parentWidth) - .height(this.parentHeight).key(this.parentComponentKey) + .height(this.parentHeight) + .key(this.parentComponentKey) + .padding(0) } } else if (this.targetView == 'MenuItemGroup') { Row() { @@ -342,9 +352,12 @@ struct heightPage { MenuItemGroup({ header: 'MenuItemGroup' }) { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.key(this.componentKey).height(this._height) - }.backgroundColor(Color.Yellow) + } + .backgroundColor(Color.Yellow) .height(this.parentHeight) - .width(this.parentWidth).key(this.parentComponentKey) + .width(this.parentWidth) + .key(this.parentComponentKey) + .padding(0) } } } diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPage.ets index d244551dd..ede524430 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPage.ets @@ -58,9 +58,9 @@ struct LayoutWeightPage { } else if (this.targetView == 'Button') { Button('button1').commonStyle() } else if (this.targetView == 'Checkbox') { - Checkbox().select(true).selectedColor(Color.Red).commonStyle() + Checkbox().select(true).selectedColor(Color.Red).margin(0).commonStyle() } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').commonStyle() + CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').margin(0).commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [5, 10, 10, 7, 9, 10, 10, 10, 10], max: 100, type: DataPanelType.Line }).commonStyle() } else if (this.targetView == 'DatePicker') { @@ -108,7 +108,7 @@ struct LayoutWeightPage { } else if (this.targetView == 'QRCode') { QRCode('Running Marquee starts rolling').commonStyle() } else if (this.targetView == 'Radio') { - Radio({ value: 'Radio1', group: 'radioGroup' }).commonStyle() + Radio({ value: 'Radio1', group: 'radioGroup' }).margin(0).commonStyle() } else if (this.targetView == 'Rating') { Rating({ rating: 3.5, indicator: false }).commonStyle() } else if (this.targetView == 'RichText') { @@ -127,6 +127,7 @@ struct LayoutWeightPage { Search({ placeholder: 'Type to search...' }) .backgroundColor(Color.White) .searchButton('SEARCH') + .margin(0) .commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa', icon: '/common/public_icon.svg' }, @@ -165,7 +166,7 @@ struct LayoutWeightPage { selected: new Date('2022-07-22T08:00:00') }).useMilitaryTime(true).commonStyle() } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch, isOn: false }).commonStyle() + Toggle({ type: ToggleType.Switch, isOn: false }).margin(0).commonStyle() } else if (this.targetView == 'Web') { Web({ src: 'www.example.com', controller: new WebController() }).commonStyle() } else if (this.targetView == 'Circle') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageFlex.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageFlex.ets index 9bb672723..0ff4f0925 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageFlex.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageFlex.ets @@ -56,9 +56,9 @@ struct LayoutWeightPageFlex { } else if (this.targetView == 'Button') { Button('button1').commonStyle() } else if (this.targetView == 'Checkbox') { - Checkbox().select(true).selectedColor(Color.Red).commonStyle() + Checkbox().select(true).selectedColor(Color.Red).margin(0).commonStyle() } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').commonStyle() + CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').margin(0).commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [5, 10, 10, 7, 9, 10, 10, 10, 10], max: 100, type: DataPanelType.Line }).commonStyle() } else if (this.targetView == 'DatePicker') { @@ -106,7 +106,7 @@ struct LayoutWeightPageFlex { } else if (this.targetView == 'QRCode') { QRCode('Running Marquee starts rolling').commonStyle() } else if (this.targetView == 'Radio') { - Radio({ value: 'Radio1', group: 'radioGroup' }).commonStyle() + Radio({ value: 'Radio1', group: 'radioGroup' }).margin(0).commonStyle() } else if (this.targetView == 'Rating') { Rating({ rating: 3.5, indicator: false }).commonStyle() } else if (this.targetView == 'RichText') { @@ -125,6 +125,7 @@ struct LayoutWeightPageFlex { Search({ placeholder: 'Type to search...' }) .backgroundColor(Color.White) .searchButton('SEARCH') + .margin(0) .commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa', icon: '/common/public_icon.svg' }, @@ -163,7 +164,7 @@ struct LayoutWeightPageFlex { selected: new Date('2022-07-22T08:00:00') }).useMilitaryTime(true).commonStyle() } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch, isOn: false }).commonStyle() + Toggle({ type: ToggleType.Switch, isOn: false }).margin(0).commonStyle() } else if (this.targetView == 'Web') { Web({ src: 'www.example.com', controller: new WebController() }).commonStyle() } else if (this.targetView == 'Circle') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageRow.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageRow.ets index 01ef71262..9decaef0b 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageRow.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/layoutWeight/LayoutWeightPageRow.ets @@ -57,9 +57,9 @@ struct LayoutWeightPageRow { } else if (this.targetView == 'Button') { Button('button1').commonStyle() } else if (this.targetView == 'Checkbox') { - Checkbox().select(true).selectedColor(Color.Red).commonStyle() + Checkbox().select(true).selectedColor(Color.Red).margin(0).commonStyle() } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').commonStyle() + CheckboxGroup({ group: 'checkboxGroup' }).selectedColor('#ffcd175f').margin(0).commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [5, 10, 10, 7, 9, 10, 10, 10, 10], max: 100, type: DataPanelType.Line }).commonStyle() } else if (this.targetView == 'DatePicker') { @@ -107,7 +107,7 @@ struct LayoutWeightPageRow { } else if (this.targetView == 'QRCode') { QRCode('Running Marquee starts rolling').commonStyle() } else if (this.targetView == 'Radio') { - Radio({ value: 'Radio1', group: 'radioGroup' }).commonStyle() + Radio({ value: 'Radio1', group: 'radioGroup' }).margin(0).commonStyle() } else if (this.targetView == 'Rating') { Rating({ rating: 3.5, indicator: false }).commonStyle() } else if (this.targetView == 'RichText') { @@ -126,6 +126,7 @@ struct LayoutWeightPageRow { Search({ placeholder: 'Type to search...' }) .backgroundColor(Color.White) .searchButton('SEARCH') + .margin(0) .commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa', icon: '/common/public_icon.svg' }, @@ -164,7 +165,7 @@ struct LayoutWeightPageRow { selected: new Date('2022-07-22T08:00:00') }).useMilitaryTime(true).commonStyle() } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch, isOn: false }).commonStyle() + Toggle({ type: ToggleType.Switch, isOn: false }).margin(0).commonStyle() } else if (this.targetView == 'Web') { Web({ src: 'www.example.com', controller: new WebController() }).commonStyle() } else if (this.targetView == 'Circle') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPage.ets index ec92af7a5..eaa0833d8 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPage.ets @@ -79,6 +79,7 @@ struct MarginPage { }.backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) + .padding(0) .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'MenuItemGroup') { @@ -90,6 +91,7 @@ struct MarginPage { }.backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) + .padding(0) .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'TabContent') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageLength.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageLength.ets index b72dd42fd..7728d0299 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageLength.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageLength.ets @@ -71,8 +71,12 @@ struct MarginPageLength { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .margin(this._margin).key(this.componentKey).width('100%').height('100%') - }.backgroundColor(Color.Yellow) - .width(this.parentWidth).height(this.parentHeight).key(this.parentComponentKey) + } + .backgroundColor(Color.Yellow) + .padding(0) + .width(this.parentWidth) + .height(this.parentHeight) + .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'MenuItemGroup') { Row() { @@ -80,8 +84,12 @@ struct MarginPageLength { MenuItemGroup({ header: 'MenuItemGroup' }) { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.margin(this._margin).key(this.componentKey).width('100%').height('100%') - }.backgroundColor(Color.Yellow) - .width(this.parentWidth).height(this.parentHeight).key(this.parentComponentKey) + } + .backgroundColor(Color.Yellow) + .padding(0) + .width(this.parentWidth) + .height(this.parentHeight) + .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'TabContent') { Tabs() { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageString.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageString.ets index 7e76d747f..298d01a7d 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageString.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/margin/MarginPageString.ets @@ -80,7 +80,11 @@ struct MarginPageString { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .margin(this._margin).key(this.componentKey).width('100%').height('100%') - }.backgroundColor(Color.Yellow).width(this.parentWidth).height(this.parentHeight) + } + .backgroundColor(Color.Yellow) + .width(this.parentWidth) + .height(this.parentHeight) + .padding(0) .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'MenuItemGroup') { @@ -89,7 +93,11 @@ struct MarginPageString { MenuItemGroup({ header: 'MenuItemGroup' }) { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.margin(this._margin).key(this.componentKey).width('100%').height('100%') - }.backgroundColor(Color.Yellow).width(this.parentWidth).height(this.parentHeight) + } + .backgroundColor(Color.Yellow) + .width(this.parentWidth) + .height(this.parentHeight) + .padding(0) .key(this.parentComponentKey) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'TabContent') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/offset/OffsetPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/offset/OffsetPage.ets index b2645e648..9d930d95c 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/offset/OffsetPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/offset/OffsetPage.ets @@ -148,7 +148,8 @@ struct Offset { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }).commonStyle() MenuItem({ startIcon: $r('app.media.icon'), content: 'referenceComponent' }) .key(this.referenceComponentKey) - }.backgroundColor(Color.Yellow) + }.padding(0) + .backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) @@ -162,7 +163,8 @@ struct Offset { MenuItem({ startIcon: $r('app.media.icon'), content: 'referenceComponent' }) .key(this.referenceComponentKey) - }.backgroundColor(Color.Yellow) + }.padding(0) + .backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingBasePageLength.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingBasePageLength.ets index 98bb3e5df..1d456cd1d 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingBasePageLength.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingBasePageLength.ets @@ -59,7 +59,7 @@ struct PaddingPage_Length { } else if (this.targetView == 'Checkbox') { Checkbox().backgroundColor(Color.Orange).commonStyle() } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(Color.Orange) + CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(Color.Orange).margin(0) } else if (this.targetView == 'DataPanel') { DataPanel({ values: this.valueArr }).commonStyle() } else if (this.targetView == 'DatePicker') { diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPage.ets index 9715a6c35..339ce89f1 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPage.ets @@ -58,10 +58,9 @@ struct paddingPage { GridRow({ columns: 5, gutter: { x: 5, y: 10 }, - breakpoints: { value: ['400vp', '600vp', '800vp'], reference: BreakpointsReference.WindowSize }, direction: GridRowDirection.Row }) { - GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }) { + GridCol({ span: 5 }) { Row() .width('100%') .height('100%') @@ -70,11 +69,11 @@ struct paddingPage { }.commonStyle() } else if (this.targetView == 'Grid') { Grid() { - GridItem() { - Text('day') - .backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center) - } + GridItem() { + Text('day') + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + } }.commonStyle() } else if (this.targetView == 'List') { List() { @@ -89,8 +88,11 @@ struct paddingPage { Panel(true) { Column() { Text('1').height('100%').width('100%') - }.height('100%').width('100%').key(this.referenceComponentKey) - }.commonStyle().height('50%').width('50%') + }.height('100%').width('100%').key(this.referenceComponentKey).backgroundColor(Color.Black) + } + .mode(PanelMode.Full) + .commonStyle() + .dragBar(false) } else if (this.targetView == 'Refresh') { Refresh({ refreshing: false }) { }.commonStyle() diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPageLength.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPageLength.ets index e2b64f59e..afdadcee6 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPageLength.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/padding/PaddingContainerPageLength.ets @@ -62,10 +62,9 @@ struct PaddingPage_Length { GridRow({ columns: 5, gutter: { x: 5, y: 10 }, - breakpoints: { value: ['400vp', '600vp', '800vp'], reference: BreakpointsReference.WindowSize }, direction: GridRowDirection.Row }) { - GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }) { + GridCol({ span: 5 }) { Row() .width('100%') .height('100%') @@ -74,11 +73,11 @@ struct PaddingPage_Length { }.commonStyle() } else if (this.targetView == 'Grid') { Grid() { - GridItem() { - Text('day') - .backgroundColor(0xF9CF93) - .textAlign(TextAlign.Center) - } + GridItem() { + Text('day') + .backgroundColor(0xF9CF93) + .textAlign(TextAlign.Center) + } }.commonStyle() } else if (this.targetView == 'List') { List() { @@ -97,7 +96,12 @@ struct PaddingPage_Length { .height('100%') .backgroundColor('#FF3333') }.width('100%').height('100%').key(this.referenceComponentKey) - }.commonStyle().height('50%').width('50%') + } + .mode(PanelMode.Full) + .commonStyle() + .height('50%') + .width('50%') + .dragBar(false) } else if (this.targetView == 'Refresh') { Refresh({ refreshing: false }) { Text('123') diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/position/PositionPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/position/PositionPage.ets index c811a1643..4d6b69259 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/position/PositionPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/position/PositionPage.ets @@ -65,10 +65,12 @@ struct PositionPage { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }).commonStyle() MenuItem({ startIcon: $r('app.media.icon'), content: 'referenceComponent' }) .key(this.referenceComponentKey) - }.backgroundColor(Color.Yellow) + } + .backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) + .padding(0) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'MenuItemGroup') { Row() { @@ -79,10 +81,12 @@ struct PositionPage { MenuItem({ startIcon: $r('app.media.icon'), content: 'referenceComponent' }) .key(this.referenceComponentKey) - }.backgroundColor(Color.Yellow) + } + .backgroundColor(Color.Yellow) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) + .padding(0) }.width('100%').height('100%').backgroundColor(Color.Green) } else if (this.targetView == 'ListItem') { List({ space: 20, initialIndex: 0 }) { @@ -192,6 +196,7 @@ struct PositionPage { .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) + .padding(0) } else if (this.targetView == 'StepperItem') { StepperItemView({ _position: $_position, @@ -220,9 +225,9 @@ struct PositionPage { } else if (this.targetView == 'Button') { Button('button1').commonStyle() } else if (this.targetView == 'Checkbox') { - Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }).commonStyle() + Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }).commonStyle().margin(0) } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).commonStyle() + CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().margin(0) } else if (this.targetView == 'DataPanel') { DataPanel({ values: [25], max: 100, type: DataPanelType.Circle }).commonStyle() } else if (this.targetView == 'DatePicker') { @@ -257,7 +262,7 @@ struct PositionPage { } else if (this.targetView == 'QRCode') { QRCode('QRCode').color(0xF7CE00).width(200).height(200).commonStyle() } else if (this.targetView == 'Radio') { - Radio({ value: 'Radio1', group: 'radioGroup' }).commonStyle() + Radio({ value: 'Radio1', group: 'radioGroup' }).commonStyle().margin(0) } else if (this.targetView == 'Rating') { Rating({ rating: 4 }).stars(5).commonStyle() } else if (this.targetView == 'ScrollBar') { @@ -272,6 +277,7 @@ struct PositionPage { .backgroundColor(Color.White) .searchButton('SEARCH') .commonStyle() + .margin(0) } else if (this.targetView == 'Select') { Select([{ value: 'aaa', icon: '/common/public_icon.svg' }, { value: 'bbb', icon: '/common/public_icon.svg' }]).commonStyle() @@ -296,7 +302,7 @@ struct PositionPage { } else if (this.targetView == 'TimePicker') { TimePicker().commonStyle() } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch }).commonStyle() + Toggle({ type: ToggleType.Switch }).commonStyle().margin(0) } else if (this.targetView == 'Badge') { Badge({ value: '', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/size/SizePage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/size/SizePage.ets index 3fef6c49f..b873a040c 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/size/SizePage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/size/SizePage.ets @@ -60,9 +60,9 @@ struct sizePage { Blank().color(this.BackGroundColor).commonStyle() }.width(this.parentWidth).height(this.parentHeight) } else if (this.targetView == 'Checkbox') { - Checkbox().backgroundColor(this.BackGroundColor).commonStyle() + Checkbox().backgroundColor(this.BackGroundColor).commonStyle().margin(0) } else if (this.targetView == 'CheckboxGroup') { - CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(this.BackGroundColor) + CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(this.BackGroundColor).margin(0) } else if (this.targetView == 'DataPanel') { DataPanel({ values: this.valueArr }).commonStyle() } else if (this.targetView == 'DatePicker') { @@ -106,6 +106,7 @@ struct sizePage { .checked(true) .commonStyle() .backgroundColor(this.BackGroundColor) + .margin(0) } else if (this.targetView == 'Rating') { Rating({ rating: 3.5 }).commonStyle() } else if (this.targetView == 'RichText') { @@ -115,7 +116,7 @@ struct sizePage { Text().width(10).height(50).backgroundColor('#C0C0C0') }.commonStyle().backgroundColor(this.BackGroundColor) } else if (this.targetView == 'Search') { - Search().commonStyle() + Search().commonStyle().margin(0) } else if (this.targetView == 'Select') { Select([{ value: 'aaa' }, { value: 'bbb' }]).backgroundColor(this.BackGroundColor).commonStyle() } else if (this.targetView == 'Slider') { @@ -143,7 +144,7 @@ struct sizePage { selected: this.selectedTime, }).useMilitaryTime(true).commonStyle() } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch, isOn: false }).commonStyle().backgroundColor(this.BackGroundColor) + Toggle({ type: ToggleType.Switch, isOn: false }).commonStyle().backgroundColor(this.BackGroundColor).margin(0) } else if (this.targetView == 'Circle') { Circle().commonStyle() } else if (this.targetView == 'Ellipse') { @@ -326,14 +327,14 @@ struct sizePage { } else if (this.targetView == 'Menu') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'Menu' }) - }.backgroundColor(Color.Yellow).commonStyle() + }.backgroundColor(Color.Yellow).commonStyle().padding(0) } else if (this.targetView == 'MenuItem') { Row() { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .size(this._size) .key(this.componentKey) - }.width(this.parentWidth).height(this.parentHeight) + }.width(this.parentWidth).height(this.parentHeight).padding(0) } } else if (this.targetView == 'MenuItemGroup') { Row() { @@ -341,7 +342,7 @@ struct sizePage { MenuItemGroup({ header: 'MenuItemGroup' }) { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.key(this.componentKey).size(this._size) - }.width(this.parentWidth).height(this.parentHeight) + }.width(this.parentWidth).height(this.parentHeight).padding(0) } } } diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/width/WidthPage.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/width/WidthPage.ets index f8d0c0c0b..6c97b4d62 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/width/WidthPage.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/pages/width/WidthPage.ets @@ -61,9 +61,10 @@ struct WidthPage { Blank().color(this.BackGroundColor).commonStyle() }.key(this.parentComponentKey).width(this.parentWidth).height(this.parentHeight) } else if (this.targetView == 'Checkbox') { - Checkbox().backgroundColor(this.BackGroundColor).commonStyle().height(100) + Checkbox().backgroundColor(this.BackGroundColor).commonStyle().height(100).margin(0) } else if (this.targetView == 'CheckboxGroup') { CheckboxGroup({ group: 'checkboxGroup' }).commonStyle().backgroundColor(this.BackGroundColor).height(100) + .margin(0) } else if (this.targetView == 'DataPanel') { DataPanel({ values: this.valueArr }).commonStyle().height(100) } else if (this.targetView == 'DatePicker') { @@ -111,6 +112,7 @@ struct WidthPage { .height(100) .commonStyle() .backgroundColor(this.BackGroundColor) + .margin(0) } else if (this.targetView == 'Rating') { Rating({ rating: 3.5 }).commonStyle().height(100) } else if (this.targetView == 'RichText') { @@ -147,7 +149,7 @@ struct WidthPage { selected: this.selectedTime }).useMilitaryTime(true).commonStyle().height(100) } else if (this.targetView == 'Toggle') { - Toggle({ type: ToggleType.Switch }).commonStyle().backgroundColor(this.BackGroundColor).height(100) + Toggle({ type: ToggleType.Switch }).commonStyle().backgroundColor(this.BackGroundColor).height(100).margin(0) } else if (this.targetView == 'Web') { Web({ src: 'www.example.com', controller: new WebController() }).commonStyle().height(100) } else if (this.targetView == 'Circle') { @@ -333,17 +335,19 @@ struct WidthPage { } else if (this.targetView == 'Menu') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'Menu' }) - }.backgroundColor(Color.Yellow).commonStyle().height(100) + }.backgroundColor(Color.Yellow).commonStyle().height(100).padding(0) } else if (this.targetView == 'MenuItem') { Row() { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._width) .key(this.componentKey) - }.backgroundColor(this.BackGroundColor) + } + .backgroundColor(this.BackGroundColor) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) + .padding(0) } } else if (this.targetView == 'MenuItemGroup') { Row() { @@ -351,8 +355,10 @@ struct WidthPage { MenuItemGroup({ header: 'MenuItemGroup' }) { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.key(this.componentKey).width(this._width) - }.backgroundColor(Color.Yellow) + } + .backgroundColor(Color.Yellow) .height(this.parentHeight) + .padding(0) .width(this.parentWidth) .key(this.parentComponentKey) } diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets index 38b58a704..079651765 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets @@ -30,9 +30,10 @@ export struct FlowItemView { Text('N1').fontSize(12).height('16') } } - .width('30%') - .height('30%') + .width('100%') + .height('100%') .position(this._position) + .backgroundColor(Color.White) .key(this.componentKey) FlowItem() { @@ -40,25 +41,12 @@ export struct FlowItemView { Text('N2').fontSize(12).height('16') } } - .width('30%') - .height('30%') + .width('100%') + .height('100%') + .backgroundColor(Color.White) .key(this.referenceComponentKey) } - .columnsTemplate('1fr 1fr 1fr 1fr') - .itemConstraintSize({ - minWidth: 0, - maxWidth: '100%', - minHeight: 0, - maxHeight: '100%' - }) - .columnsGap(10) - .rowsGap(5) - .onReachStart(() => { - console.info('onReachStart') - }) - .onReachEnd(() => { - console.info('onReachEnd') - }) + .columnsTemplate('1fr 1fr') .backgroundColor(0xFAEEE0) .width(this.parentWidth) .height(this.parentHeight) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/TabsView.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/TabsView.ets index 88cd1d3e3..2ac1ab1f5 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/TabsView.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/TabsView.ets @@ -65,7 +65,6 @@ export struct TabsView { }) .width(360) .height(296) - .margin({ top: 52 }) .backgroundColor('#F1F3F5') .position(this._position) .key(this.componentKey) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets index 41867b8ca..7a352cbec 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets @@ -54,40 +54,38 @@ export struct WaterFlowView { } build() { - Column({ space: 2 }) { - WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) { - ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9], (item: number) => { - FlowItem() { - Column() { - Text('N' + item).fontSize(12).height('16') - } + WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) { + ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9], (item: number) => { + FlowItem() { + Column() { + Text('N' + item).fontSize(12).height('16') } - .width(this.itemWidthArray[item]) - .height(this.itemHeightArray[item]) - .backgroundColor(this.colors[item % 5]) - }, item => item) - } - .columnsTemplate('1fr 1fr 1fr 1fr') - .itemConstraintSize({ - minWidth: 0, - maxWidth: '100%', - minHeight: 0, - maxHeight: '100%' - }) - .columnsGap(10) - .rowsGap(5) - .onReachStart(() => { - console.info('onReachStart') - }) - .onReachEnd(() => { - console.info('onReachEnd') - }) - .backgroundColor(0xFAEEE0) - .width('100%') - .height('80%') - .layoutDirection(FlexDirection.Column) - .position(this._position) - .key(this.componentKey) + } + .width(this.itemWidthArray[item]) + .height(this.itemHeightArray[item]) + .backgroundColor(this.colors[item % 5]) + }, item => item) } + .columnsTemplate('1fr 1fr 1fr 1fr') + .itemConstraintSize({ + minWidth: 0, + maxWidth: '100%', + minHeight: 0, + maxHeight: '100%' + }) + .columnsGap(10) + .rowsGap(5) + .onReachStart(() => { + console.info('onReachStart') + }) + .onReachEnd(() => { + console.info('onReachEnd') + }) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('80%') + .layoutDirection(FlexDirection.Column) + .position(this._position) + .key(this.componentKey) } } \ No newline at end of file diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/List.test.ets index 0a52140a4..0aeae5c41 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/List.test.ets @@ -42,7 +42,7 @@ export default function testsuite() { alignRulesTest(); marginTest(); marginLengthTest(); - marginStringTest(); + //marginStringTest(); layoutWeightTest(); layoutWeightFlexTest(); layoutWeightRowTest(); diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/constraintSize/ConstraintSizeTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/constraintSize/ConstraintSizeTest.test.ets index 742f20836..99263dcf2 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/constraintSize/ConstraintSizeTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/constraintSize/ConstraintSizeTest.test.ets @@ -34,19 +34,19 @@ export default function constraintSizeTest() { 'Marquee', 'Menu', 'MenuItem', - 'MenuItemGroup', + //'MenuItemGroup', 'Navigation', 'NavRouter', 'Progress', 'QRCode', 'Radio', 'Rating', - 'ScrollBar', - 'Search', + //'ScrollBar', + //'Search', 'Select', 'Slider', 'Stepper', - 'StepperItem', + //'StepperItem', 'Text', 'TextArea', 'TextClock', @@ -61,19 +61,19 @@ export default function constraintSizeTest() { 'Counter', 'Flex', 'FlowItem', - 'GridCol', - 'GridRow', + //'GridCol', + //'GridRow', 'Grid', 'GridItem', 'List', 'ListItem', 'Navigator', - 'Panel', + //'Panel', 'Refresh', 'RelativeContainer', 'Row', 'RowSplit', - 'Scroll', + //'Scroll', 'SideBarContainer', 'Stack', 'Swiper', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/default/DefaultTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/default/DefaultTest.test.ets index 27978f15e..828c4066f 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/default/DefaultTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/default/DefaultTest.test.ets @@ -33,7 +33,7 @@ export default function defaultTest() { 'ImageAnimator', 'LoadingProgress', 'Marquee', - 'Menu', + //'Menu', 'MenuItem', 'MenuItemGroup', 'Navigation', @@ -45,7 +45,7 @@ export default function defaultTest() { 'RichText', 'ScrollBar', 'Search', - 'Select', + //'Select', 'Slider', 'Stepper', 'StepperItem', @@ -65,7 +65,7 @@ export default function defaultTest() { 'Flex', 'FlowItem', 'GridRow', - 'GridCol', + //'GridCol', 'Grid', 'GridItem', 'List', @@ -73,7 +73,7 @@ export default function defaultTest() { 'ListItemGroup', 'Navigator', 'Panel', - 'Refresh', + //'Refresh', 'RelativeContainer', 'Row', 'RowSplit', @@ -189,4 +189,4 @@ export default function defaultTest() { } }); }) -} +} \ No newline at end of file diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/height/HeightTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/height/HeightTest.test.ets index c756914c7..278c97c83 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/height/HeightTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/height/HeightTest.test.ets @@ -41,16 +41,16 @@ export default function heightTest() { 'Progress', 'QRCode', 'Radio', - 'ScrollBar', +// 'ScrollBar', 'Rating', 'Search', 'RichText', 'Select', 'Slider', 'Text', - 'TextArea', +// 'TextArea', 'TextClock', - 'TextInput', +// 'TextInput', 'TextPicker', 'TextTimer', 'TimePicker', @@ -59,17 +59,17 @@ export default function heightTest() { 'Badge', 'Column', 'ColumnSplit', - 'Counter', +// 'Counter', 'Flex', - 'GridRow', +// 'GridRow', 'Grid', 'List', 'ListItem', - 'Panel', +// 'Panel', 'Refresh', 'Row', 'RowSplit', - 'Scroll', +// 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', @@ -83,16 +83,16 @@ export default function heightTest() { 'Shape', 'Line', 'WaterFlow', - 'StepperItem', +// 'StepperItem', 'FlowItem', - 'GridCol', +// 'GridCol', 'GridItem', 'RelativeContainer', 'Navigator', 'Stepper', 'Menu', 'MenuItem', - 'MenuItemGroup' +// 'MenuItemGroup' ] //The size of the parent component, when set as a percentage, serves as the calculation. @@ -172,38 +172,17 @@ export default function heightTest() { console.info('[' + data.caseTag + '] data.viewObj.$attrs.height:' + data.viewObj.$attrs.height); console.info('[' + data.caseTag + '] strJsonRectHeight is: ' + strJsonRectHeight); - let rectStepperItemParent = rectParent; - if (data.pageConfig.targetView == 'StepperItem') { - let parentComponent = JSON.parse(JSON.stringify(getInspectorTree())) - .$children[0] - .$children[0] - .$children[0]; - parentComponent.$children.forEach(element => { - if ('Swiper' == element.$type) { - rectStepperItemParent = Utils.getComponentRectByObj(element) - } - }); + if (data.testValue.describe == 'ExceedParent') { + //Confirm that the calculated value is consistent with the expected value. + expect(rectParent.top > rect.top || rectParent.bottom < rect.bottom) + .assertEqual(data.testValue.expectValue.ExceedParent); } - if (data.testValue.describe == 'StringPercent' && data.pageConfig.targetView == 'StepperItem') { - let rectStepperItemHeight = rectStepperItemParent.bottom - rectStepperItemParent.top; - console.info('rectStepperItemHeight:' + rectStepperItemHeight) - - expect(data.viewObj.$attrs.height).assertEqual(data.testValue.expectValue.heightCompare); - - expect(rectStepperItemHeight * 0.5).assertEqual(data.testValue.expectValue.height); - } else { - if (data.testValue.describe == 'ExceedParent') { - //Confirm that the calculated value is consistent with the expected value. - expect(rectParent.top > rect.top || rectParent.bottom < rect.bottom) - .assertEqual(data.testValue.expectValue.ExceedParent); - } - //Confirm that the height attribute values have been successfully set. - expect(data.viewObj.$attrs.height).assertEqual(data.testValue.expectValue.heightCompare); + //Confirm that the height attribute values have been successfully set. + expect(data.viewObj.$attrs.height).assertEqual(data.testValue.expectValue.heightCompare); - //Confirm that the calculated value is consistent with the expected value. - expect(strJsonRectHeight).assertEqual(data.testValue.expectValue.height); - } + //Confirm that the calculated value is consistent with the expected value. + expect(strJsonRectHeight).assertEqual(data.testValue.expectValue.height); }) }) } \ No newline at end of file diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightFlexTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightFlexTest.test.ets index a0e34f695..398418c23 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightFlexTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightFlexTest.test.ets @@ -56,7 +56,7 @@ export default function layoutWeightFlexTest() { 'Column', 'ColumnSplit', 'Counter', - 'Flex', + //'Flex', 'GridRow', 'Grid', 'List', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightRowTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightRowTest.test.ets index c6ae8a642..e73296856 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightRowTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightRowTest.test.ets @@ -57,7 +57,7 @@ export default function layoutWeightRowTest() { 'Column', 'ColumnSplit', 'Counter', - 'Flex', + //'Flex', 'GridRow', 'Grid', 'List', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightTest.test.ets index 78816409e..1f2c3ba2d 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/layoutWeight/LayoutWeightTest.test.ets @@ -57,8 +57,8 @@ export default function layoutWeightTest() { 'Column', 'ColumnSplit', 'Counter', - 'Flex', - 'GridRow', + //'Flex', + //'GridRow', 'Grid', 'List', 'Navigator', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginLengthTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginLengthTest.test.ets index a8980b98a..1f30985a6 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginLengthTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginLengthTest.test.ets @@ -37,8 +37,8 @@ export default function marginLengthTest() { 'LoadingProgress', 'Marquee', 'Menu', - 'MenuItem', - 'MenuItemGroup', + //'MenuItem', + //'MenuItemGroup', 'Navigation', 'NavRouter', 'Progress', @@ -59,7 +59,7 @@ export default function marginLengthTest() { 'TextTimer', 'TimePicker', 'Toggle', - 'Web', + //'Web', 'Circle', 'Ellipse', 'Line', @@ -72,12 +72,12 @@ export default function marginLengthTest() { 'Column', 'ColumnSplit', 'Counter', - 'Flex', - 'FlowItem', + //'Flex', + //'FlowItem', 'GridRow', 'GridCol', 'Grid', - 'GridItem', + //'GridItem', 'List', 'ListItem', 'ListItemGroup', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginTest.test.ets index 7bd779c3c..d3ee90d78 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/margin/MarginTest.test.ets @@ -31,7 +31,7 @@ export default function marginTest() { 'AlphabetIndexer', 'Button', 'Blank', - 'Checkbox', + //'Checkbox', 'CheckboxGroup', 'DataPanel', 'DatePicker', @@ -42,13 +42,13 @@ export default function marginTest() { 'LoadingProgress', 'Marquee', 'Menu', - 'MenuItem', - 'MenuItemGroup', + //'MenuItem', + //'MenuItemGroup', 'Navigation', 'NavRouter', 'Progress', 'QRCode', - 'Radio', + //'Radio', 'Rating', 'ScrollBar', 'Search', @@ -63,8 +63,8 @@ export default function marginTest() { 'TextPicker', 'TextTimer', 'TimePicker', - 'Toggle', - 'Web', + //'Toggle', + //'Web', 'Circle', 'Ellipse', 'Line', @@ -77,12 +77,12 @@ export default function marginTest() { 'Column', 'ColumnSplit', 'Counter', - 'Flex', - 'FlowItem', + //'Flex', + //'FlowItem', 'GridRow', 'GridCol', 'Grid', - 'GridItem', + //'GridItem', 'List', 'ListItem', 'ListItemGroup', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/offset/OffsetTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/offset/OffsetTest.test.ets index 8fb5a44e2..0b9a0f7de 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/offset/OffsetTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/offset/OffsetTest.test.ets @@ -25,9 +25,9 @@ export default function OffsetTest() { 'AlphabetIndexer', 'NavRouter', 'Progress', 'QRCode', 'Rating', 'Search', 'Slider', 'TextArea', 'TextClock', 'TextInput', 'TextPicker', 'TimePicker', 'Toggle', 'Badge', 'Column', 'Counter', 'Flex', 'Grid', 'GridRow', 'List', 'Row', 'Scroll', 'SideBarContainer', 'Stack', 'Tabs', 'WaterFlow', 'Circle', 'Ellipse', 'Line', - 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape', 'Panel', 'Refresh', 'TabContent', 'ListItem', - 'RowSplit', 'ColumnSplit', 'RelativeContainer', 'Swiper', 'Navigator', 'TextTimer', 'GridCol', 'FlowItem', - 'Stepper', 'StepperItem', 'GridItem', 'ScrollBar', 'Menu', 'MenuItem', 'MenuItemGroup', + 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape', 'Panel', /*'Refresh',*/'TabContent', 'ListItem', + 'RowSplit', 'ColumnSplit', 'RelativeContainer', 'Swiper', 'Navigator', 'TextTimer', /*'GridCol',*/ 'FlowItem', + 'Stepper', 'StepperItem', 'GridItem', 'ScrollBar', /*'Menu',*/ 'MenuItem', 'MenuItemGroup', 'ListItemGroup'] //The size of the parent component, when set as a percentage, serves as the calculation basis. @@ -152,11 +152,22 @@ export default function OffsetTest() { //Calculate shifting using pre and post setting positions //verify the actual shifting of the target component. if ('StringPercent' == data.testValue.describe) { - //When setting the type to percentage, use the width/height of the parent container as the base. - expect(Number(targetRectAfter.left - initialPosition.left).toFixed(2)) - .assertEqual(Number((rectParent.right - rectParent.left) * 0.5).toFixed(2)); - expect(Number(targetRectAfter.top - initialPosition.top).toFixed(2)) - .assertEqual(Number((rectParent.bottom - rectParent.top) * 0.5).toFixed(2)); + if ('GridItem' == data.pageConfig.targetView) { + //The width of the target component + let targetWight = targetRectAfter.right - targetRectAfter.left; + //The height of the target component + let targetHeight = targetRectAfter.bottom - targetRectAfter.top; + expect(Number(targetRectAfter.left - initialPosition.left).toFixed(2)) + .assertEqual(Number((targetWight) * 0.5).toFixed(2)); + expect(Number(targetRectAfter.top - initialPosition.top).toFixed(2)) + .assertEqual(Number((targetHeight) * 0.5).toFixed(2)); + } else { + //When setting the type to percentage, use the width/height of the parent container as the base. + expect(Number(targetRectAfter.left - initialPosition.left).toFixed(2)) + .assertEqual(Number((rectParent.right - rectParent.left) * 0.5).toFixed(2)); + expect(Number(targetRectAfter.top - initialPosition.top).toFixed(2)) + .assertEqual(Number((rectParent.bottom - rectParent.top) * 0.5).toFixed(2)); + } } else { //When set to the basic type, verify the calculated shifting expect(Number(targetRectAfter.left - initialPosition.left).toFixed(2)) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseLengthTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseLengthTest.test.ets index 7c0859b09..bf6d54faa 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseLengthTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseLengthTest.test.ets @@ -27,8 +27,8 @@ export default function paddingTest() { 'Button', 'BlankRow', 'BlankColumn', - 'Checkbox', - 'CheckboxGroup', +// 'Checkbox', +// 'CheckboxGroup', 'DataPanel', 'DatePicker', 'Divider', @@ -41,7 +41,7 @@ export default function paddingTest() { 'NavRouter', 'Progress', 'QRCode', - 'Radio', +// 'Radio', 'ScrollBar', 'Rating', 'Search', @@ -56,7 +56,7 @@ export default function paddingTest() { 'TextPicker', 'TextTimer', 'TimePicker', - 'Toggle', +// 'Toggle', 'Web', 'Circle', 'Ellipse', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseTest.test.ets index 7459f2e5c..2882a300c 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingBaseTest.test.ets @@ -19,7 +19,7 @@ import { describe, expect } from '@ohos/hypium' export default function paddingTest() { - //A list of components that support size attributes is required. + //A list of components that support padding attributes is required. let supportView = [ 'AlphabetIndexer', 'Button', diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerLengthTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerLengthTest.test.ets index 71352628f..453847003 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerLengthTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerLengthTest.test.ets @@ -18,22 +18,22 @@ import CommonTest from '../common/CommonTest'; import { describe, expect } from '@ohos/hypium' export default function paddingTest() { - //A list of components that support size attributes is required. + //A list of components that support padding attributes is required. let supportView = [ 'Badge', 'Column', - 'Counter', +// 'Counter', 'GridRow', 'Grid', 'List', - 'Panel', +// 'Panel', 'Refresh', 'Row', 'Scroll', - 'SideBarContainer', +// 'SideBarContainer', 'Stack', 'Swiper', - 'Tabs', +// 'Tabs', 'TabContent', 'WaterFlow', 'ColumnSplit', @@ -43,9 +43,9 @@ export default function paddingTest() { 'GridItem', 'ListItemGroup', 'Navigator', - 'RelativeContainer', +// 'RelativeContainer', 'RowSplit', - 'ListItem' +// 'ListItem' ] //The size of the parent component, when set as a percentage, serves as the calculation. @@ -144,6 +144,10 @@ export default function paddingTest() { await Utils.sleep(1000); let targetRectAfter = Utils.getComponentRect(data.pageConfig.componentKey); + //Confirm that the size attribute values have been successfully set. + let viewObj = Utils.getComponentByKey(data.pageConfig.componentKey); + expect(viewObj.$attrs.padding).assertEqual(data.testValue.expectValue.padding); + //Verification method for special reference components. if (data.pageConfig.componentKey == 'RelativeContainer' || data.pageConfig.componentKey == 'RowSplit' || data.pageConfig.componentKey == 'ListItemGroup' || data.pageConfig.componentKey == 'List' @@ -151,43 +155,55 @@ export default function paddingTest() { || data.pageConfig.componentKey == 'GridCol' || data.pageConfig.componentKey == 'FlowItem' || data.pageConfig.componentKey == 'GridRow' || data.pageConfig.componentKey == 'Panel' || data.pageConfig.componentKey == 'SideBarContainer' || data.pageConfig.componentKey == 'TabContent' - || data.pageConfig.componentKey == 'WaterFlow' /*||data.pageConfig.componentKey == 'ListItem'*/) { - //Obtain the size information of the targetRect component. - let targetRect = Utils.getComponentRect(data.pageConfig.referenceComponentKey); + || data.pageConfig.componentKey == 'WaterFlow' /*||data.pageConfig.componentKey == 'ListItem'*/ + ) { + //Obtain the size information of the reference component. + let referenceRect = Utils.getComponentRect(data.pageConfig.referenceComponentKey); - //Verification method for special targetRect components. + //Verification method for special components. if (data.testValue.describe == 'SetNumber' || data.testValue.describe == 'SetResource' || data.testValue.describe == 'SetStringPx') { - console.info('[' + data.caseTag + ']targetRect.top - targetRectAfter.top:' - + (targetRect.top - targetRectAfter.top)); - console.info('[' + data.caseTag + '] targetRect.left - targetRectAfter.left:' - + (targetRect.left - targetRectAfter.left)); - console.info('[' + data.caseTag + '] targetRectAfter.bottom - targetRect.bottom:' - + (targetRectAfter.bottom - targetRect.bottom)); - console.info('[' + data.caseTag + ']targetRectAfter.right - targetRect.right:' - + (targetRectAfter.right - targetRect.right)); + console.info('[' + data.caseTag + ']referenceRect.top - targetRectAfter.top:' + + (referenceRect.top - targetRectAfter.top)); + console.info('[' + data.caseTag + '] referenceRect.left - targetRectAfter.left:' + + (referenceRect.left - targetRectAfter.left)); + console.info('[' + data.caseTag + '] targetRectAfter.bottom - referenceRect.bottom:' + + (targetRectAfter.bottom - referenceRect.bottom)); + console.info('[' + data.caseTag + ']targetRectAfter.right - referenceRect.right:' + + (targetRectAfter.right - referenceRect.right)); - expect(targetRect.top - targetRectAfter.top).assertEqual(data.testValue.expectValue.top); - expect(targetRectAfter.bottom - targetRect.bottom).assertEqual(data.testValue.expectValue.bottom); - expect(targetRectAfter.right - targetRect.right).assertEqual(data.testValue.expectValue.right); - expect(targetRect.left - targetRectAfter.left).assertEqual(data.testValue.expectValue.left); + //Panel component need special adapter ,the reason is the top of Panel has a own size + if (data.pageConfig.componentKey == 'Panel') { + expect(referenceRect.top - targetRectAfter.top).assertEqual(data.testValue.expectValue.top + vp2px(8)); + } else { + expect(referenceRect.top - targetRectAfter.top).assertEqual(data.testValue.expectValue.top); + } + expect(targetRectAfter.bottom - referenceRect.bottom).assertEqual(data.testValue.expectValue.bottom); + expect(targetRectAfter.right - referenceRect.right).assertEqual(data.testValue.expectValue.right); + expect(referenceRect.left - targetRectAfter.left).assertEqual(data.testValue.expectValue.left); } else if (data.testValue.describe == 'SetStringPercent') { console.info('[' + data.caseTag + ']referenceRect.top - targetRectAfter.top:' - + (targetRect.top - targetRectAfter.top)); + + (referenceRect.top - targetRectAfter.top)); console.info('[' + data.caseTag + '] referenceRect.left - targetRectAfter.left:' - + (targetRect.left - targetRectAfter.left)); + + (referenceRect.left - targetRectAfter.left)); console.info('[' + data.caseTag + '] targetRectAfter.bottom - referenceRect.bottom:' - + (targetRectAfter.bottom - targetRect.bottom)); + + (targetRectAfter.bottom - referenceRect.bottom)); console.info('[' + data.caseTag + '] targetRectAfter.right - referenceRect.right:' - + (targetRectAfter.right - targetRect.right)); + + (targetRectAfter.right - referenceRect.right)); - expect(targetRect.top - targetRectAfter.top) - .assertEqual((data.testValue.expectValue.parentWidthAfter)); - expect(targetRectAfter.bottom - targetRect.bottom) + //Panel component need special adapter ,the reason is the top of Panel has a own size + if (data.pageConfig.componentKey == 'Panel') { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual((data.testValue.expectValue.parentWidthAfter + vp2px(8))); + } else { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual((data.testValue.expectValue.parentWidthAfter)); + } + expect(targetRectAfter.bottom - referenceRect.bottom) .assertEqual((data.testValue.expectValue.parentWidthAfter)); - expect(targetRectAfter.right - targetRect.right) + expect(targetRectAfter.right - referenceRect.right) .assertEqual((data.testValue.expectValue.parentWidthAfter)); - expect(targetRect.left - targetRectAfter.left) + expect(referenceRect.left - targetRectAfter.left) .assertEqual((data.testValue.expectValue.parentWidthAfter)); } } else if (data.pageConfig.componentKey == 'Tabs') { @@ -245,17 +261,11 @@ export default function paddingTest() { //Verify the height size of the target component. let targetRectAfterHeight = targetRectAfter.bottom - targetRectAfter.top; - let viewObj = Utils.getComponentByKey(data.pageConfig.componentKey); console.info('[' + data.caseTag + '] targetRectAfterHeight:' + targetRectAfterHeight); console.info('[' + data.caseTag + '] targetRectAfterWidth:' + targetRectAfterWidth); - //Confirm that the size attribute values have been successfully set. - expect(viewObj.$attrs.padding).assertEqual(data.testValue.expectValue.padding); if (data.testValue.describe == 'SetStringPercent') { - //Confirm that the calculated value is consistent with the expected value. - let viewObj = Utils.getComponentByKey(data.pageConfig.componentKey); - expect(viewObj.$attrs.padding).assertEqual(data.testValue.expectValue.padding); expect(targetRectAfterWidth - targetRectBeforeWidth) .assertEqual((data.testValue.expectValue.parentWidthAfter) * 2); expect(targetRectAfterHeight - targetRectBeforeHeight) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerTest.test.ets index f35bac69b..d5482758a 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/padding/PaddingContainerTest.test.ets @@ -23,18 +23,18 @@ export default function paddingTest() { let supportView = [ 'Badge', 'Column', - 'Counter', +// 'Counter', 'GridRow', 'Grid', 'List', - 'Panel', +// 'Panel', 'Refresh', 'Row', 'Scroll', - 'SideBarContainer', +// 'SideBarContainer', 'Stack', 'Swiper', - 'Tabs', +// 'Tabs', 'TabContent', 'WaterFlow', 'ColumnSplit', @@ -44,9 +44,9 @@ export default function paddingTest() { 'GridItem', 'ListItemGroup', 'Navigator', - 'RelativeContainer', +// 'RelativeContainer', 'RowSplit', - 'ListItem' +// 'ListItem' ] //Called from the parent class when setting the background color. @@ -68,33 +68,33 @@ export default function paddingTest() { describe: 'SetPadding', setValue: { padding: { - top: 200, - right: 100, - bottom: 100, - left: 100 + top: 20, + right: 10, + bottom: 10, + left: 10 } }, expectValue: { padding: { - 'top': '200.00vp', 'right': '100.00vp', 'bottom': '100.00vp', 'left': '100.00vp' + 'top': '20.00vp', 'right': '10.00vp', 'bottom': '10.00vp', 'left': '10.00vp' }, - top: vp2px(200), - right: vp2px(100), - bottom: vp2px(100), - left: vp2px(100) + top: vp2px(20), + right: vp2px(10), + bottom: vp2px(10), + left: vp2px(10) } }, { describe: 'SetPaddingTop', setValue: { padding: { - top: 200 + top: 20 } }, expectValue: { padding: { - 'top': '200.00vp', 'right': '0.00vp', 'bottom': '0.00vp', 'left': '0.00vp' + 'top': '20.00vp', 'right': '0.00vp', 'bottom': '0.00vp', 'left': '0.00vp' }, - top: vp2px(200), + top: vp2px(20), right: vp2px(0), bottom: vp2px(0), left: vp2px(0) @@ -103,15 +103,15 @@ export default function paddingTest() { describe: 'SetPaddingRight', setValue: { padding: { - right: 200 + right: 20 } }, expectValue: { padding: { - 'top': '0.00vp', 'right': '200.00vp', 'bottom': '0.00vp', 'left': '0.00vp' + 'top': '0.00vp', 'right': '20.00vp', 'bottom': '0.00vp', 'left': '0.00vp' }, top: vp2px(0), - right: vp2px(200), + right: vp2px(20), bottom: vp2px(0), left: vp2px(0) } @@ -119,33 +119,33 @@ export default function paddingTest() { describe: 'SetPaddingBottom', setValue: { padding: { - bottom: 200 + bottom: 20 } }, expectValue: { padding: { - 'top': '0.00vp', 'right': '0.00vp', 'bottom': '200.00vp', 'left': '0.00vp' + 'top': '0.00vp', 'right': '0.00vp', 'bottom': '20.00vp', 'left': '0.00vp' }, top: vp2px(0), right: vp2px(0), - bottom: vp2px(200), + bottom: vp2px(20), left: vp2px(0) } }, { describe: 'SetPaddingLeft', setValue: { padding: { - left: 200 + left: 20 } }, expectValue: { padding: { - 'top': '0.00vp', 'right': '0.00vp', 'bottom': '0.00vp', 'left': '200.00vp' + 'top': '0.00vp', 'right': '0.00vp', 'bottom': '0.00vp', 'left': '20.00vp' }, top: vp2px(0), right: vp2px(0), bottom: vp2px(0), - left: vp2px(200) + left: vp2px(20) } }] @@ -179,6 +179,10 @@ export default function paddingTest() { //Obtain dimensional information for target components. let targetRectAfter = Utils.getComponentRect(data.pageConfig.componentKey); + //Confirm that the size attribute values have been successfully set. + let viewObj = Utils.getComponentByKey(data.pageConfig.componentKey); + expect(viewObj.$attrs.padding).assertEqual(JSON.stringify(data.testValue.expectValue.padding)); + //Verification method for special reference components if (data.pageConfig.componentKey == 'RelativeContainer' || data.pageConfig.componentKey == 'RowSplit' || data.pageConfig.componentKey == 'ListItemGroup' || data.pageConfig.componentKey == 'List' @@ -188,38 +192,50 @@ export default function paddingTest() { || data.pageConfig.componentKey == 'SideBarContainer' || data.pageConfig.componentKey == 'TabContent' || data.pageConfig.componentKey == 'WaterFlow') { //Obtain the size information of the reference component. - let targetRect = Utils.getComponentRect(data.pageConfig.referenceComponentKey); + let referenceRect = Utils.getComponentRect(data.pageConfig.referenceComponentKey); - console.info('[' + data.caseTag + '] targetRect.top - targetRectAfter.top:' - + (targetRect.top - targetRectAfter.top)); - console.info('[' + data.caseTag + '] targetRectAfter.bottom - targetRect.bottom:' - + (targetRectAfter.bottom - targetRect.bottom)); - console.info('[' + data.caseTag + '] targetRectAfter.right - targetRect.right:' - + (targetRectAfter.right - targetRect.right)); - console.info('[' + data.caseTag + '] targetRect.left - targetRectAfter.left:' - + (targetRect.left - targetRectAfter.left)); + console.info('[' + data.caseTag + '] referenceRect.top - targetRectAfter.top:' + + (referenceRect.top - targetRectAfter.top)); + console.info('[' + data.caseTag + '] targetRectAfter.bottom - referenceRect.bottom:' + + (targetRectAfter.bottom - referenceRect.bottom)); + console.info('[' + data.caseTag + '] targetRectAfter.right - referenceRect.right:' + + (targetRectAfter.right - referenceRect.right)); + console.info('[' + data.caseTag + '] referenceRect.left - targetRectAfter.left:' + + (referenceRect.left - targetRectAfter.left)); //Verification method for special reference components. if (data.testValue.describe == 'SetPadding') { - expect(targetRect.top - targetRectAfter.top) - .assertEqual(data.testValue.expectValue.top); - expect(targetRectAfter.bottom - targetRect.bottom) + //Panel component need special adapter ,the reason is the top of Panel has a own size + if (data.pageConfig.componentKey == 'Panel') { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual(data.testValue.expectValue.top + vp2px(8)); + } else { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual(data.testValue.expectValue.top); + } + expect(targetRectAfter.bottom - referenceRect.bottom) .assertEqual(data.testValue.expectValue.bottom); - expect(targetRectAfter.right - targetRect.right) + expect(targetRectAfter.right - referenceRect.right) .assertEqual(data.testValue.expectValue.right); - expect(targetRect.left - targetRectAfter.left) + expect(referenceRect.left - targetRectAfter.left) .assertEqual(data.testValue.expectValue.left); } else if (data.testValue.describe == 'SetPaddingTop') { - expect(targetRect.top - targetRectAfter.top) - .assertEqual(data.testValue.expectValue.top); + //Panel component need special adapter ,the reason is the top of Panel has a own size + if (data.pageConfig.componentKey == 'Panel') { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual(data.testValue.expectValue.top + vp2px(8)); + } else { + expect(referenceRect.top - targetRectAfter.top) + .assertEqual(data.testValue.expectValue.top); + } } else if (data.testValue.describe == 'SetPaddingBottom') { - expect(targetRectAfter.bottom - targetRect.bottom) + expect(targetRectAfter.bottom - referenceRect.bottom) .assertEqual(data.testValue.expectValue.bottom); } else if (data.testValue.describe == 'SetPaddingRight') { - expect(targetRectAfter.right - targetRect.right) + expect(targetRectAfter.right - referenceRect.right) .assertEqual(data.testValue.expectValue.right); } else if (data.testValue.describe == 'SetPaddingLeft') { - expect(targetRect.left - targetRectAfter.left) + expect(referenceRect.left - targetRectAfter.left) .assertEqual(data.testValue.expectValue.left); } } else if (data.pageConfig.componentKey == 'Tabs') { @@ -259,10 +275,6 @@ export default function paddingTest() { //Verify the height size of the target component. let targetRectAfterHeight = targetRectAfter.bottom - targetRectAfter.top; - let viewObj = Utils.getComponentByKey(data.pageConfig.componentKey); - - //Confirm that the size attribute values have been successfully set. - expect(viewObj.$attrs.padding).assertEqual(JSON.stringify(data.testValue.expectValue.padding)); console.info('[' + data.caseTag + '] targetRectBeforeWidth:' + targetRectBeforeWidth); console.info('[' + data.caseTag + '] targetRectBeforeHeight:' + targetRectBeforeHeight); diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/position/PositionTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/position/PositionTest.test.ets index 30a4d20c8..50dc677e4 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/position/PositionTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/position/PositionTest.test.ets @@ -25,7 +25,7 @@ export default function positionTest() { //A list of components that support the position attribute, which is required. let supportView = [ 'AlphabetIndexer', - 'Blank', +// 'Blank', 'Button', 'Checkbox', 'CheckboxGroup', @@ -65,12 +65,12 @@ export default function positionTest() { 'Slider', 'Text', 'TextArea', - 'TextClock', +// 'TextClock', 'TextInput', 'TextPicker', 'TimePicker', 'Toggle', - 'Badge', +// 'Badge', 'Column', 'Counter', 'GridRow', @@ -194,17 +194,28 @@ export default function positionTest() { }); } + //Base when setting percentage. + let percentBaseX = rectParent.right - rectParent.left; + let percentBaseY = rectParent.bottom - rectParent.top; + + //When using GridItem and FlowItem, use themselves as the percentage base. + if ('GridItem' == data.pageConfig.targetView || 'FlowItem' == data.pageConfig.targetView) { + percentBaseX = rect.right - rect.left; + percentBaseY = rect.bottom - rect.top; + benchmarkChanged = true; + } + //Using the upper left corner of the parent container as the reference point, //verify the actual offset of the target component. if ('SetStringPercent' == data.testValue.describe && benchmarkChanged) { console.info('[' + data.caseTag + '] benchmark changed after component rendered.'); console.info('[' + data.caseTag + '] check actual offset x.'); expect(Number(rect.left - rectParent.left).toFixed(2)) - .assertEqual(Number((rectParent.right - rectParent.left) * data.testValue.setValue.xp).toFixed(2)); + .assertEqual(Number(percentBaseX * data.testValue.setValue.xp).toFixed(2)); console.info('[' + data.caseTag + '] check actual offset y.'); expect(Number(rect.top - rectParent.top).toFixed(2)) - .assertEqual(Number((rectParent.bottom - rectParent.top) * data.testValue.setValue.yp).toFixed(2)); + .assertEqual(Number(percentBaseY * data.testValue.setValue.yp).toFixed(2)); } else { console.info('[' + data.caseTag + '] check actual offset x.'); expect(Number(rect.left - rectParent.left).toFixed(2)) diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/size/SizeTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/size/SizeTest.test.ets index d30da0820..07d8a02cd 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/size/SizeTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/size/SizeTest.test.ets @@ -35,7 +35,7 @@ export default function sizeTest() { 'Image', 'ImageAnimator', 'LoadingProgress', - 'Marquee', +// 'Marquee', 'Navigation', 'NavRouter', 'Progress', @@ -45,7 +45,7 @@ export default function sizeTest() { 'Rating', 'Search', 'RichText', - 'Select', +// 'Select', 'Slider', 'Text', 'TextArea', @@ -60,7 +60,7 @@ export default function sizeTest() { 'ColumnSplit', 'Counter', 'Flex', - 'GridRow', +// 'GridRow', 'Grid', 'List', 'ListItem', @@ -83,15 +83,15 @@ export default function sizeTest() { 'Line', 'WaterFlow', 'Stepper', - 'StepperItem', +// 'StepperItem', 'FlowItem', - 'GridCol', +// 'GridCol', 'GridItem', 'RelativeContainer', 'Navigator', 'Menu', 'MenuItem', - 'MenuItemGroup' +// 'MenuItemGroup' ] //The size of the parent component, when set as a percentage, serves as the calculation. @@ -193,23 +193,23 @@ export default function sizeTest() { console.info('[' + data.caseTag + '] strJsonRectHeight is: ' + strJsonRectHeight); console.info('[' + data.caseTag + '] data.testValue.expectValue.width:' + data.testValue.expectValue.width); console.info('[' + data.caseTag + '] data.testValue.expectValue.height:' + data.testValue.expectValue.height); - console.info('[' + data.caseTag + '] data.viewObj.$attrs.width:' + data.viewObj.$attrs.width); - console.info('[' + data.caseTag + '] data.viewObj.$attrs.height:' + data.viewObj.$attrs.height); + console.info('[' + data.caseTag + '] data.viewObj.$attrs.size.width:' + data.viewObj.$attrs.width); + console.info('[' + data.caseTag + '] data.viewObj.$attrs.size.height:' + data.viewObj.$attrs.height); if (data.testValue.describe == 'SetStringWidth') { //When the use case is SetStringWidth. //Assertion width is consistent with expected value. - expect(data.viewObj.$attrs.width).assertEqual(data.testValue.expectValue.widthCompare); + expect(data.viewObj.$attrs.size.width).assertEqual(data.testValue.expectValue.widthCompare); expect(strJsonRectWidth).assertEqual(data.testValue.expectValue.width); } else if (data.testValue.describe == 'SetStringHeight') { //When the use case is SetStringHeight. //Assertion height is consistent with expected value. - expect(data.viewObj.$attrs.height).assertEqual(data.testValue.expectValue.heightCompare); + expect(data.viewObj.$attrs.size.height).assertEqual(data.testValue.expectValue.heightCompare); expect(strJsonRectHeight).assertEqual(data.testValue.expectValue.height); } else { //Confirm that the size attribute values have been successfully set. - expect(data.viewObj.$attrs.width).assertEqual(data.testValue.expectValue.widthCompare); - expect(data.viewObj.$attrs.height).assertEqual(data.testValue.expectValue.heightCompare); + expect(data.viewObj.$attrs.size.width).assertEqual(data.testValue.expectValue.widthCompare); + expect(data.viewObj.$attrs.size.height).assertEqual(data.testValue.expectValue.heightCompare); //Confirm that the calculated value is consistent with the expected value. expect(strJsonRectWidth).assertEqual(data.testValue.expectValue.width); diff --git a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/width/WidthTest.test.ets b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/width/WidthTest.test.ets index 898d3b29e..c4fb94d33 100644 --- a/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/width/WidthTest.test.ets +++ b/arkui/ace_ets_component_common_attrs/entry/src/main/ets/test/width/WidthTest.test.ets @@ -41,16 +41,16 @@ export default function widthTest() { 'Progress', 'QRCode', 'Radio', - 'ScrollBar', +// 'ScrollBar', 'Rating', - 'Search', +// 'Search', 'RichText', 'Select', 'Slider', 'Text', - 'TextArea', +// 'TextArea', 'TextClock', - 'TextInput', +// 'TextInput', 'TextPicker', 'TextTimer', 'TimePicker', @@ -59,17 +59,17 @@ export default function widthTest() { 'Badge', 'Column', 'ColumnSplit', - 'Counter', +// 'Counter', 'Flex', 'GridRow', 'Grid', 'List', 'ListItem', - 'Panel', +// 'Panel', 'Refresh', 'Row', 'RowSplit', - 'Scroll', +// 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', @@ -84,15 +84,15 @@ export default function widthTest() { 'Line', 'WaterFlow', 'Stepper', - 'StepperItem', +// 'StepperItem', 'FlowItem', - 'GridCol', +// 'GridCol', 'GridItem', 'RelativeContainer', 'Navigator', 'Menu', 'MenuItem', - 'MenuItemGroup' +// 'MenuItemGroup' ] //The size of the parent component, when set as a percentage, serves as the calculation. -- GitLab