diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetDisplayPriority_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetDisplayPriority_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba0ed3bf58d1d4a400e507542db4c250db08096a --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetDisplayPriority_SubChange.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetDisplayPriorityTest { + @State testDisplayPriority1: number = 0 + @State testDisplayPriority2: number = 0 + @State testDisplayPriority3: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "SetDisplayPriority Page"; + onPageShow() { + console.info('SetDisplayPriority onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'testpriority1') { + this.testDisplayPriority1 = message.value; + } + if (message.name == 'testpriority2') { + this.testDisplayPriority2 = message.value; + } + if (message.name == 'testpriority3') { + this.testDisplayPriority3 = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('SetDisplayPriority page build done called'); + } + + build() { + Column() { + Column() { + Text('SetDisplayPriority').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(100).backgroundColor(0xF5DEB3).key('setDisplayPriority1').displayPriority(this.testDisplayPriority1) + Column(){Text('2')}.width(300).height(200).backgroundColor(0xD2B48C).key('setDisplayPriority2').displayPriority(this.testDisplayPriority2) + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('setDisplayPriority3').displayPriority(this.testDisplayPriority3) + } + .key('setDisplayPriority') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShinkNone_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShinkNone_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..390f03caa50bdb0976336d5e4752a3cc2b968b70 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShinkNone_SubChange.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetFlexShinkTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetFlexShink Page"; + onPageShow() { + console.info('ColumnSetFlexShink onPageShow'); + } + + onBuildDone() { + console.info('ColumnSetFlexShink page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetFlexShink').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetFlexShinkNone_1') + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetFlexShinkNone_2') + Column(){Text('3')}.width(300).height(300).backgroundColor(0xF5DEB3).key('columnSetFlexShinkNone_3').flexShrink(1) + } + .key('columnSetFlexShinkNone') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShink_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShink_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a8fea35c483ff64b1a931d05480e620bef93474 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShink_SubChange.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetFlexShinkTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetFlexShink Page"; + onPageShow() { + console.info('ColumnSetFlexShink onPageShow'); + } + + onBuildDone() { + console.info('ColumnSetFlexShink page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetFlexShink').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetFlexShink_1').flexShrink(3) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetFlexShink_2').flexShrink(2) + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetFlexShink_3').flexShrink(1) + } + .key('columnSetFlexShink') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeightNone_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeightNone_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..579e3af34746851fe5d1df2aebde6985d4ab393a --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeightNone_SubChange.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetLayoutWeightTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetLayoutWeight Page"; + onPageShow() { + console.info('ColumnSetLayoutWeight onPageShow'); + } + + onBuildDone() { + console.info('FlexBase_Auto page build done called'); + } + + build() { + Column() { + Column() { + Text('SetLayoutWeight').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('setLayoutWeightNone1').layoutWeight(3) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('setLayoutWeightNone2').layoutWeight(2) + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('setLayoutWeightNone3') + } + .key('setLayoutWeightNone') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeight_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeight_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..1446776d3692c6f8e688420770d1684d67da03ef --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeight_SubChange.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetLayoutWeightTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetLayoutWeight Page"; + onPageShow() { + console.info('ColumnSetLayoutWeight onPageShow'); + } + + onBuildDone() { + console.info('FlexBase_Auto page build done called'); + } + + build() { + Column() { + Column() { + Text('SetLayoutWeight').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('setLayoutWeight1').layoutWeight(3) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('setLayoutWeight2').layoutWeight(2) + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('setLayoutWeight3').layoutWeight(1) + } + .key('setLayoutWeight') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..65add85268bd07e64939979d73e224e943eed670 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChange.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetMargin Page"; + onPageShow() { + console.info('SetMargin onPageShow'); + } + + onBuildDone() { + console.info('ColumnSetMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetMargin_1').padding(20).margin(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetMargin_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetMargin_3') + } + .key('columnSetMargin') + .height(400) + .width(350) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangeMar.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangeMar.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b0d8a4acb9583c94350f54991a8ad603d1f87bd --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangeMar.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetMargin Page"; + onPageShow() { + console.info('ColumnSetMargin onPageShow'); + } + + onBuildDone() { + console.info('ColumnSetMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetMar_1').margin(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetMar_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetMar_3') + } + .key('columnSetMar') + .height(400) + .width(350) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangePad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangePad.ets new file mode 100644 index 0000000000000000000000000000000000000000..18a2fee270b7f286287aa53e525b4aa5b4734145 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangePad.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetMargin Page"; + onPageShow() { + console.info('SetMargin onPageShow'); + } + + onBuildDone() { + console.info('ColumnSetMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetMar_SubPad_1').padding(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetMar_SubPad_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetMar_SubPad_3') + } + .key('columnSetMar_SubPad') + .height(400) + .width(350) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetOffset_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetOffset_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..17184cf39d7d8126b456098ec387c66b43594da2 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetOffset_SubChange.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetOffsetTest { + @State testOffsetX: number = 0 + @State testOffsetY: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetOffset Page"; + onPageShow() { + console.info('ColumnSetOffset onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'offset_x') { + this.testOffsetX = message.value; + } + if (message.name == 'offset_y') { + this.testOffsetY = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('ColumnSetOffset page build done called'); + } + + build() { + Column() { + Column() { + Text('subComponenSetOffset').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnOffset_1').offset({x:this.testOffsetX,y:this.testOffsetY}) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnOffset_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnOffset_3') + } + .key('columnOffset') + .height(400) + .width(350) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fbfa8c0c0a37fdc17cd79f895fa0e909bf8eb59 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChange.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "SetPaddingMargin Page"; + onPageShow() { + console.info('SetPaddingMargin onPageShow'); + } + + onBuildDone() { + console.info('SetPaddingMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('SetPaddingMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Text('1').width(300).height(50).backgroundColor(0xF5DEB3).key('setPaddingMargin01').margin(20).padding(20) + Text('2').width(300).height(100).backgroundColor(0xD2B48C).key('setPaddingMargin02') + Text('3').width(300).height(150).backgroundColor(0xF5DEB3).key('setPaddingMargin03') + } + .key('setPaddingMargin') + .height(400) + .width(350) + .padding(20) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangeMar.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangeMar.ets new file mode 100644 index 0000000000000000000000000000000000000000..b21d45dcb5aae1629816a7f99ed835ba9bf47c7c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangeMar.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "SetPaddingMargin Page"; + onPageShow() { + console.info('SetPaddingMargin onPageShow'); + } + + onBuildDone() { + console.info('SetPaddingMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('SetPaddingMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Text('1').width(300).height(50).backgroundColor(0xF5DEB3).key('setPadMar01').margin(20) + Text('2').width(300).height(100).backgroundColor(0xD2B48C).key('setPadMar02') + Text('3').width(300).height(150).backgroundColor(0xF5DEB3).key('setPadMar03') + } + .key('setPadMar') + .height(400) + .width(350) + .padding(20) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangePad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangePad.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0e8fbb8dec0777c410d3685a073eb927e83e351 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangePad.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingMarginTest { + messageManager:MessageManager = new MessageManager() + private content: string = "SetPaddingMargin Page"; + onPageShow() { + console.info('SetPaddingMargin onPageShow'); + } + + onBuildDone() { + console.info('SetPaddingMargin page build done called'); + } + + build() { + Column() { + Column() { + Text('SetPaddingMargin').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Text('1').width(300).height(50).backgroundColor(0xF5DEB3).key('setPaddingMargin_SubPad01').padding(20) + Text('2').width(300).height(100).backgroundColor(0xD2B48C).key('setPaddingMargin_SubPad02') + Text('3').width(300).height(150).backgroundColor(0xF5DEB3).key('setPaddingMargin_SubPad03') + } + .key('setPaddingMargin_SubPad') + .height(400) + .width(350) + .padding(20) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..966db15e0ddc4c7ea16aee4971a882e35932f0d1 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChange.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetPadding Page"; + onPageShow() { + console.info('ColumnSetPadding onPageShow'); + } + onBuildDone() { + console.info('ColumnSetPadding page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetPadding').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetPadding_1').padding(20).margin(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetPadding_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetPadding_3') + } + .key('columnSetPadding') + .height(400) + .width(350) + .padding(20) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangeMar.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangeMar.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a47d1ef041f8a940d8d1d9515d2d08b6e458ab5 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangeMar.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetPaddingMar__SubChange"; + onPageShow() { + console.info('ColumnSetPadding onPageShow'); + } + onBuildDone() { + console.info('ColumnSetPadding page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetPadding').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetPad_1').margin(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetPad_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetPad_3') + } + .key('columnSetPad') + .height(400) + .width(350) + .padding(20) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangePad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangePad.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3209c488f8cb316dc5273d7ebd7b42f82b44ae7 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangePad.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPaddingTest { + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetPadding Page"; + onPageShow() { + console.info('ColumnSetPadding onPageShow'); + } + + build() { + Column() { + Column() { + Text('ColumnSetPadding').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetPadding_SubPad1').padding(20) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetPadding_SubPad2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetPadding_SubPad3') + } + .key('columnSetPadding_SubPad') + .height(400) + .width(350) + .padding(20) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPosition_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPosition_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..464d540ef37506ce65b76a07ffca3982d6342873 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetPosition_SubChange.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetPositionTest { + @State testPosx: number = 0 + @State testPosy: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetPosition Page"; + onPageShow() { + console.info('ColumnSetPosition onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'position_x') { + this.testPosx = message.value; + } + if (message.name == 'position_y') { + this.testPosy = message.value; + } + } + this.messageManager.registerCallback(callback); + } + onBuildDone() { + console.info('ColumnSetPosition page build done called'); + } + build() { + Column() { + Column() { + Text('subComponenSetPosition').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnPosition_1').position({x:this.testPosx,y:this.testPosy}) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnPosition_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnPosition_3') + } + .key('columnPosition') + .height(400) + .width(350) + .margin(5) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetVisibility_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetVisibility_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..5968300bf4d37dd5090ff0a71ed7a42fec69f3e6 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnSetVisibility_SubChange.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetVisibilityTest { + @State testVisibility1: number = Visibility.Visible + @State testVisibility2: number = Visibility.Visible + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnSetVisibility Page"; + onPageShow() { + console.info('ColumnSetVisibility onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'testVisibility1') { + this.testVisibility1 = message.value; + } + if (message.name == 'testVisibility2') { + this.testVisibility2 = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('ColumnSetVisibility page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnSetVisibility').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(300).height(50).backgroundColor(0xF5DEB3).key('columnSetVisibility_1').visibility(this.testVisibility1) + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnSetVisibility_2').visibility(this.testVisibility2) + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnSetVisibility_3') + } + .key('columnSetVisibility') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnWidthHeight_SubChange.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnWidthHeight_SubChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfcc58a32c5249a5316a502000def1717d640dcd --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Column/subcomponentChanged/ColumnWidthHeight_SubChange.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MessageManager,Callback } from '../../../common/MessageManager'; +@Entry +@Component +struct ColumnSetWidthHeightTest { + @State testHeight: number = 50 + @State testWidth: number = 300 + messageManager:MessageManager = new MessageManager() + private content: string = "ColumnWidthHeight Page"; + onPageShow() { + console.info('ColumnWidthHeight onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'height') { + this.testHeight = message.value; + } + if (message.name == 'width') { + this.testWidth = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('ColumnWidthHeight page build done called'); + } + + build() { + Column() { + Column() { + Text('ColumnWidthHeight').fontSize(9).fontColor(0xCCCCCC).width('90%') + Column({ + space: 30, + }) { + Column(){Text('1')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xF5DEB3).key('columnWidthHeight_1') + Column(){Text('2')}.width(300).height(100).backgroundColor(0xD2B48C).key('columnWidthHeight_2') + Column(){Text('3')}.width(300).height(150).backgroundColor(0xF5DEB3).key('columnWidthHeight_3') + } + .key('columnWidthHeight') + .height(400) + .width(350) + .backgroundColor(0xAFEEEE) + }.width('100%').alignItems(HorizontalAlign.Start) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetDisplayPriority_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetDisplayPriority_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cfb27e88ede23034b4265c7697a7eb84c085e7e --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetDisplayPriority_SubChange.test.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetDisplayPriority_SubChange() { + describe('ColumnSetDisplayPriorityTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetDisplayPriority_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetDisplayPriority state success " + JSON.stringify(pages)); + if (!("SetDisplayPriority" == pages.name)) { + console.info("get SetDisplayPriority state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetDisplayPriority page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetDisplayPriority page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetDisplayPriority after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1400 + * @tc.name testColumnSetDisplayPriorityWithRateOneTwoThree + * @tc.desc Subcomponents set display priority(1-2-3) attribute. + */ + it('testColumnSetDisplayPriorityWithRateOneTwoThree', 0, async function (done) { + console.info('new testColumnSetDisplayPriorityWithRateOneTwoThree START'); + globalThis.value.message.notify({name:'testpriority1', value:1}); + globalThis.value.message.notify({name:'testpriority2', value:2}); + globalThis.value.message.notify({name:'testpriority3', value:3}); + await CommonFunc.sleep(2000); + let setDisplayPriority1 = CommonFunc.getComponentRect('setDisplayPriority1'); + let setDisplayPriority2 = CommonFunc.getComponentRect('setDisplayPriority2'); + let setDisplayPriority3 = CommonFunc.getComponentRect('setDisplayPriority3'); + let setDisplayPriority = CommonFunc.getComponentRect('setDisplayPriority'); + expect(setDisplayPriority.top).assertEqual(setDisplayPriority1.top) + expect(setDisplayPriority1.top).assertEqual(setDisplayPriority2.top) + expect(Math.round(setDisplayPriority3.top - setDisplayPriority2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setDisplayPriority.bottom - setDisplayPriority3.bottom)).assertEqual(vp2px(20)) + + expect(Math.round(setDisplayPriority1.right - setDisplayPriority1.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority2.right - setDisplayPriority2.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority3.right - setDisplayPriority3.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority1.bottom - setDisplayPriority1.top)).assertEqual(vp2px(100)) + expect(Math.round(setDisplayPriority2.bottom - setDisplayPriority2.top)).assertEqual(vp2px(200)) + expect(Math.round(setDisplayPriority3.bottom - setDisplayPriority3.top)).assertEqual(vp2px(150)) + console.info('new testColumnSetDisplayPriorityWithRateOneTwoThree END'); + done(); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1500 + * @tc.name testColumnSetDisplayPriorityWithRateTwoOneTwo + * @tc.desc Subcomponents set display priority(1-0.5-1) attribute. + */ + it('testColumnSetDisplayPriorityWithRateTwoOneTwo', 0, async function (done) { + console.info('new testColumnSetDisplayPriorityWithRateTwoOneTwo START'); + globalThis.value.message.notify({name:'testpriority1', value:1}); + globalThis.value.message.notify({name:'testpriority2', value:0.5}); + globalThis.value.message.notify({name:'testpriority3', value:1}); + await CommonFunc.sleep(2000); + let setDisplayPriority1 = CommonFunc.getComponentRect('setDisplayPriority1'); + let setDisplayPriority2 = CommonFunc.getComponentRect('setDisplayPriority2'); + let setDisplayPriority3 = CommonFunc.getComponentRect('setDisplayPriority3'); + let setDisplayPriority = CommonFunc.getComponentRect('setDisplayPriority'); + expect(setDisplayPriority.top).assertEqual(setDisplayPriority1.top) + expect(setDisplayPriority1.top).assertEqual(setDisplayPriority2.top) + expect(Math.round(setDisplayPriority3.top - setDisplayPriority2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setDisplayPriority.bottom - setDisplayPriority3.bottom)).assertEqual(vp2px(20)) + + expect(Math.round(setDisplayPriority1.right - setDisplayPriority1.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority2.right - setDisplayPriority2.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority3.right - setDisplayPriority3.left)).assertEqual(vp2px(300)) + expect(Math.round(setDisplayPriority1.bottom - setDisplayPriority1.top)).assertEqual(vp2px(100)) + expect(Math.round(setDisplayPriority2.bottom - setDisplayPriority2.top)).assertEqual(vp2px(200)) + expect(Math.round(setDisplayPriority3.bottom - setDisplayPriority3.top)).assertEqual(vp2px(150)) + console.info('new testColumnSetDisplayPriorityWithRateTwoOneTwo END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShinkNone_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShinkNone_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ba07b24cc340e1e603c64f9ee686f4ebc6ac74c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShinkNone_SubChange.test.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetFlexShinkNone_SubChange() { + describe('ColumnSetFlexShinkTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShinkNone_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetFlexShink state success " + JSON.stringify(pages)); + if (!("SetFlexShink" == pages.name)) { + console.info("get SetFlexShink state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetFlexShink page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetFlexShink page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("SetFlexShink after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1900 + * @tc.name testColumnSetFlexShinkNone + * @tc.desc Subcomponents set flexshink (0-0-1) attribute. + */ + it('testColumnSetFlexShinkNone', 0, async function (done) { + console.info('new testColumnSetFlexShinkNone START'); + await CommonFunc.sleep(2000); + let columnSetFlexShinkNone_1 = CommonFunc.getComponentRect('columnSetFlexShinkNone_1'); + let columnSetFlexShinkNone_2 = CommonFunc.getComponentRect('columnSetFlexShinkNone_2'); + let columnSetFlexShinkNone_3 = CommonFunc.getComponentRect('columnSetFlexShinkNone_3'); + let columnSetFlexShinkNone = CommonFunc.getComponentRect('columnSetFlexShinkNone'); + + expect(columnSetFlexShinkNone.top).assertEqual(columnSetFlexShinkNone_1.top) + expect(columnSetFlexShinkNone.bottom).assertEqual(columnSetFlexShinkNone_3.bottom) + expect(Math.round(columnSetFlexShinkNone_2.top - columnSetFlexShinkNone_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetFlexShinkNone_3.top - columnSetFlexShinkNone_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetFlexShinkNone_3.bottom - columnSetFlexShinkNone_3.top)).assertEqual(vp2px(190)) + console.info('new testColumnSetFlexShinkNone END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShink_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShink_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0e7095ba7129c30c0984a9f7011aa03360866e3 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetFlexShink_SubChange.test.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetFlexShink_SubChange() { + describe('ColumnSetFlexShinkTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetFlexShink_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetFlexShink state success " + JSON.stringify(pages)); + if (!("SetFlexShink" == pages.name)) { + console.info("get SetFlexShink state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetFlexShink page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetFlexShink page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("SetFlexShink after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1800 + * @tc.name testColumnSetFlexShink + * @tc.desc Subcomponents set flexshink (3-2-1) attribute. + */ + it('testColumnSetFlexShink', 0, async function (done) { + console.info('new testColumnSetFlexShink START'); + await CommonFunc.sleep(2000); + let columnSetFlexShink_1 = CommonFunc.getComponentRect('columnSetFlexShink_1'); + let columnSetFlexShink_2 = CommonFunc.getComponentRect('columnSetFlexShink_2'); + let columnSetFlexShink_3 = CommonFunc.getComponentRect('columnSetFlexShink_3'); + let columnSetFlexShink = CommonFunc.getComponentRect('columnSetFlexShink'); + + expect(columnSetFlexShink.top).assertEqual(columnSetFlexShink_1.top) + expect(Math.round(columnSetFlexShink_2.top - columnSetFlexShink_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetFlexShink_3.top - columnSetFlexShink_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetFlexShink.bottom - columnSetFlexShink_3.bottom)).assertEqual(vp2px(40)) + console.info('new testColumnSetFlexShink END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeightNone_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeightNone_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2b4d6eee65bc6f5190067aca22b6191d6377bd8 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeightNone_SubChange.test.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetLayoutWeightNone_SubChange() { + describe('ColumnSetLayoutWeightTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeightNone_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetLayoutWeight state success " + JSON.stringify(pages)); + if (!("SetLayoutWeight" == pages.name)) { + console.info("get SetLayoutWeight state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetLayoutWeight page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetLayoutWeight page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetLayoutWeight after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1600 + * @tc.name testColumnSetLayoutWeightWithRateThreeTwoZero + * @tc.desc Subcomponents set layout weight(3-2-0) attribute. + */ + it('testColumnSetLayoutWeightWithRateThreeTwoZero', 0, async function (done) { + console.info('new testColumnSetLayoutWeightWithRateThreeTwoZero START'); + await CommonFunc.sleep(1000); + let layoutExpectHeight1 = (190/5)*3; + let layoutExpectHeight2 = (190/5)*2; + let layoutExpectHeight3 = 150; + let setLayoutWeightNone1 = CommonFunc.getComponentRect('setLayoutWeightNone1'); + let setLayoutWeightNone2 = CommonFunc.getComponentRect('setLayoutWeightNone2'); + let setLayoutWeightNone3 = CommonFunc.getComponentRect('setLayoutWeightNone3'); + let setLayoutWeightNone = CommonFunc.getComponentRect('setLayoutWeightNone'); + + expect(setLayoutWeightNone1.top).assertEqual(setLayoutWeightNone.top) + expect(Math.round(setLayoutWeightNone2.top - setLayoutWeightNone1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setLayoutWeightNone3.top - setLayoutWeightNone2.bottom)).assertEqual(vp2px(30)) + + expect(Math.round(setLayoutWeightNone1.bottom - setLayoutWeightNone1.top)).assertEqual(vp2px(layoutExpectHeight1)) + expect(Math.round(setLayoutWeightNone2.bottom - setLayoutWeightNone2.top)).assertEqual(vp2px(layoutExpectHeight2)) + expect(Math.round(setLayoutWeightNone3.bottom - setLayoutWeightNone3.top)).assertEqual(vp2px(layoutExpectHeight3)) + console.info('new testColumnSetLayoutWeightWithRateThreeTwoZero END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeight_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeight_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1285e8798b58d49c13f6c0cafdd86bdc6b2b726b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetLayoutWeight_SubChange.test.ets @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetLayoutWeight_SubChange() { + describe('ColumnSetLayoutWeightTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetLayoutWeight_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetLayoutWeight state success " + JSON.stringify(pages)); + if (!("SetLayoutWeight" == pages.name)) { + console.info("get SetLayoutWeight state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetLayoutWeight page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetLayoutWeight page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetLayoutWeight after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1700 + * @tc.name testColumnSetLayoutWeightWithRateThreeTwoOne + * @tc.desc Subcomponents set layout weight(3-2-1) attribute. + */ + it('testColumnSetLayoutWeightWithRateThreeTwoOne', 0, async function (done) { + console.info('new testColumnSetLayoutWeightWithRateThreeTwoOne START'); + await CommonFunc.sleep(1000); + let layoutExpectHeight1 = 510/3; + let layoutExpectHeight2 = 340/3; + let layoutExpectHeight3 = 170/3; + let setLayoutWeight1 = CommonFunc.getComponentRect('setLayoutWeight1'); + let setLayoutWeight2 = CommonFunc.getComponentRect('setLayoutWeight2'); + let setLayoutWeight3 = CommonFunc.getComponentRect('setLayoutWeight3'); + let setLayoutWeight = CommonFunc.getComponentRect('setLayoutWeight'); + + expect(setLayoutWeight1.top).assertEqual(setLayoutWeight.top) + expect(Math.round(setLayoutWeight2.top - setLayoutWeight1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setLayoutWeight3.top - setLayoutWeight2.bottom)).assertEqual(vp2px(30)) + expect(setLayoutWeight.bottom).assertEqual(setLayoutWeight3.bottom) + + expect(Math.round(setLayoutWeight1.bottom - setLayoutWeight1.top)).assertEqual(vp2px(510/3)) + expect(Math.round(setLayoutWeight2.bottom - setLayoutWeight2.top)).assertEqual(vp2px(340/3)) + expect(Math.round(setLayoutWeight3.bottom - setLayoutWeight3.top)).assertEqual(vp2px(170/3)) + console.info('new testColumnSetLayoutWeightWithRateThreeTwoOne END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1623d3564108657ef479a0dda4e973a9e0295742 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChange.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetMargin_SubChange() { + describe('ColumnSetMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetMargin state success " + JSON.stringify(pages)); + if (!("FlexBase" == pages.name)) { + console.info("get SetMargin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetMargin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0800 + * @tc.name testColumnParentMarginPadSubMarPad + * @tc.desc Parent component set margin,subcomponent set margin and paddding. + */ + it('testColumnParentMarginPadSubMarPad', 0, async function (done) { + console.info('new testColumnParentMarginPadSubMarPad START'); + await CommonFunc.sleep(2000); + let columnSetMargin_1 = CommonFunc.getComponentRect('columnSetMargin_1'); + let columnSetMargin_2 = CommonFunc.getComponentRect('columnSetMargin_2'); + let columnSetMargin_3 = CommonFunc.getComponentRect('columnSetMargin_3'); + let columnSetMargin = CommonFunc.getComponentRect('columnSetMargin'); + expect(Math.round(columnSetMargin_1.top - columnSetMargin.top)).assertEqual(vp2px(20)) + expect(Math.round(columnSetMargin_2.top - columnSetMargin_1.bottom)).assertEqual(vp2px(50)) + expect(Math.round(columnSetMargin_3.top - columnSetMargin_2.bottom)).assertEqual(vp2px(30)) + expect(columnSetMargin.bottom).assertEqual(columnSetMargin_3.bottom) + expect(Math.round(columnSetMargin_1.right - columnSetMargin_1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMargin_2.right - columnSetMargin_2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMargin_3.right - columnSetMargin_3.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentMarginPadSubMarPad END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangeMar.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangeMar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..89208556f24b1080a92730d699d15d109d215221 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangeMar.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetMargin_SubChangeMar() { + describe('ColumnSetMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangeMar', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get ColumnSetMargin_SubChangeMar state success " + JSON.stringify(pages)); + if (!("ColumnSetMargin_SubChangeMar" == pages.name)) { + console.info("get ColumnSetMargin_SubChangeMar state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push ColumnSetMargin_SubChangeMar page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ColumnSetMargin_SubChangeMar page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(3000); + console.info("ColumnSetMargin_SubChangeMar after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0700 + * @tc.name testColumnParentMarginSubMargin + * @tc.desc Parent component and subcomponent both set margin. + */ + it('testColumnParentMarginSubMargin', 0, async function (done) { + console.info('new testColumnParentMarginSubMargin START'); + await CommonFunc.sleep(2000); + let columnSetMar_1 = CommonFunc.getComponentRect('columnSetMar_1'); + let columnSetMar_2 = CommonFunc.getComponentRect('columnSetMar_2'); + let columnSetMar_3 = CommonFunc.getComponentRect('columnSetMar_3'); + let columnSetMar = CommonFunc.getComponentRect('columnSetMar'); + expect(Math.round(columnSetMar_1.top - columnSetMar.top)).assertEqual(vp2px(20)) + expect(Math.round(columnSetMar_2.top - columnSetMar_1.bottom)).assertEqual(vp2px(50)) + expect(Math.round(columnSetMar_3.top - columnSetMar_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetMar_1.right - columnSetMar_1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMar_2.right - columnSetMar_2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMar_3.right - columnSetMar_3.left)).assertEqual(vp2px(300)) + expect(columnSetMar.bottom).assertEqual(columnSetMar_3.bottom) + console.info('new testColumnParentMarginSubMargin END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangePad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangePad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b6bc0ff92bd8fdcab2b227807694cf7228e9d31 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetMargin_SubChangePad.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetMargin_SubChangePad() { + describe('ColumnSetMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetMargin_SubChangePad', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetMargin state success " + JSON.stringify(pages)); + if (!("FlexBase" == pages.name)) { + console.info("get SetMargin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetMargin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(3000); + console.info("SetMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0600 + * @tc.name testColumnParentMarginSubPaddding + * @tc.desc Parent component set margin,subcomponent set paddding. + */ + it('testColumnParentMarginSubPaddding', 0, async function (done) { + console.info('new testColumnParentMarginSubPaddding START'); + await CommonFunc.sleep(2000); + let columnSetMar_SubPad_1 = CommonFunc.getComponentRect('columnSetMar_SubPad_1'); + let columnSetMar_SubPad_2 = CommonFunc.getComponentRect('columnSetMar_SubPad_2'); + let columnSetMar_SubPad_3 = CommonFunc.getComponentRect('columnSetMar_SubPad_3'); + let columnSetMar_SubPad = CommonFunc.getComponentRect('columnSetMar_SubPad'); + expect(columnSetMar_SubPad_1.top).assertEqual(columnSetMar_SubPad.top) + expect(Math.round(columnSetMar_SubPad.bottom - columnSetMar_SubPad_3.bottom)).assertEqual(vp2px(40)) + expect(Math.round(columnSetMar_SubPad_2.top - columnSetMar_SubPad_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetMar_SubPad_3.top - columnSetMar_SubPad_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetMar_SubPad_1.right - columnSetMar_SubPad_1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMar_SubPad_2.right - columnSetMar_SubPad_2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetMar_SubPad_3.right - columnSetMar_SubPad_3.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentMarginSubPaddding END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetOffset_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetOffset_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f75b56322d0bf4cc08f019bf0fb58125db7ae5b1 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetOffset_SubChange.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetOffset_SubChange() { + describe('ColumnSetOffsetTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetOffset_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetOffset state success " + JSON.stringify(pages)); + if (!("SetOffset" == pages.name)) { + console.info("get SetOffset state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetOffset page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetOffset page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetOffset after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1300 + * @tc.name testColumnSubcomponentSetOffset + * @tc.desc The first subcomponent set offset attribute. + */ + it('testColumnSubcomponentSetOffset', 0, async function (done) { + console.info('new testColumnSubcomponentSetOffset START'); + globalThis.value.message.notify({name:'offset_x', value:10}); + globalThis.value.message.notify({name:'offset_y', value:10}); + await CommonFunc.sleep(2000); + let columnOffset_1 = CommonFunc.getComponentRect('columnOffset_1'); + let columnOffset_2 = CommonFunc.getComponentRect('columnOffset_2'); + let columnOffset_3 = CommonFunc.getComponentRect('columnOffset_3'); + let columnOffset = CommonFunc.getComponentRect('columnOffset'); + expect(Math.round(columnOffset_1.left - columnOffset_2.left)).assertEqual(vp2px(10)) + expect(Math.round(columnOffset_1.top - columnOffset.top)).assertEqual(vp2px(10)) + expect(Math.round(columnOffset_2.top - columnOffset_1.bottom)).assertEqual(vp2px(20)) + expect(Math.round(columnOffset_3.top - columnOffset_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnOffset.bottom - columnOffset_3.bottom)).assertEqual(vp2px(40)) + console.info('new testColumnSubcomponentSetOffset END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c11a597706dce5cc9c49ebef200371a1f3f5b26b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChange.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPaddingMargin_SubChange() { + describe('ColumnSetPaddingMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get ColumnSetPaddingMargin state success " + JSON.stringify(pages)); + if (!("ColumnSetPaddingMargin" == pages.name)) { + console.info("get ColumnSetPaddingMargin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push ColumnSetPaddingMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ColumnSetPaddingMargin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("ColumnSetPaddingMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1100 + * @tc.name testColumnParentMarPadSubMarPad + * @tc.desc Parent component and subcomponent both set paddding and margin. + */ + it('testColumnParentMarPadSubMarPad', 0, async function (done) { + console.info('new testColumnParentMarPadSubMarPad START'); + await CommonFunc.sleep(2000); + let setPaddingMargin01 = CommonFunc.getComponentRect('setPaddingMargin01'); + let setPaddingMargin02 = CommonFunc.getComponentRect('setPaddingMargin02'); + let setPaddingMargin03 = CommonFunc.getComponentRect('setPaddingMargin03'); + let setPaddingMargin = CommonFunc.getComponentRect('setPaddingMargin'); + expect(Math.round(setPaddingMargin01.top - setPaddingMargin.top)).assertEqual(vp2px(40)) + expect(Math.round(setPaddingMargin02.top - setPaddingMargin01.bottom)).assertEqual(vp2px(50)) + expect(Math.round(setPaddingMargin03.top - setPaddingMargin02.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setPaddingMargin03.bottom - setPaddingMargin.bottom)).assertEqual(vp2px(20)) + expect(Math.round(setPaddingMargin01.right - setPaddingMargin01.left)).assertEqual(vp2px(300)) + expect(Math.round(setPaddingMargin02.right - setPaddingMargin02.left)).assertEqual(vp2px(300)) + expect(Math.round(setPaddingMargin03.right - setPaddingMargin03.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentMarPadSubMarPad END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangeMar.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangeMar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..34e3ab35535d49e5ab463fcd45be8427811ef2df --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangeMar.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPaddingMargin_SubChangeMar() { + describe('ColumnSetPaddingMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangeMar', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get ColumnSetPaddingMargin_SubChangeMar state success " + JSON.stringify(pages)); + if (!("ColumnSetPaddingMargin_SubChangeMar" == pages.name)) { + console.info("get ColumnSetPaddingMargin_SubChangeMar state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push ColumnSetPaddingMargin_SubChangeMar page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ColumnSetPaddingMargin_SubChangeMar page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("ColumnSetPaddingMargin_SubChangeMar after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1000 + * @tc.name testColumnParentMarPadSubMargin + * @tc.desc Parent component set paddding and margin,subcomponent set margin. + */ + it('testColumnParentMarPadSubMargin', 0, async function (done) { + console.info('new testColumnParentMarPadSubMargin START'); + await CommonFunc.sleep(2000); + let setPadMar01 = CommonFunc.getComponentRect('setPadMar01'); + let setPadMar02 = CommonFunc.getComponentRect('setPadMar02'); + let setPadMar03 = CommonFunc.getComponentRect('setPadMar03'); + let setPadMar = CommonFunc.getComponentRect('setPadMar'); + expect(Math.round(setPadMar01.top - setPadMar.top)).assertEqual(vp2px(40)) + expect(Math.round(setPadMar02.top - setPadMar01.bottom)).assertEqual(vp2px(50)) + expect(Math.round(setPadMar03.top - setPadMar02.bottom)).assertEqual(vp2px(30)) + expect(setPadMar.bottom).assertLess(setPadMar03.bottom) + expect(Math.round(setPadMar01.right - setPadMar01.left)).assertEqual(vp2px(300)) + expect(Math.round(setPadMar02.right - setPadMar02.left)).assertEqual(vp2px(300)) + expect(Math.round(setPadMar03.right - setPadMar03.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentMarPadSubMargin END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangePad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangePad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d14b97e9259eb9e9dac874c9da8aa1a70981f0d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPaddingMargin_SubChangePad.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPaddingMargin_SubChange() { + describe('ColumnSetPaddingMarginTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPaddingMargin_SubChangePad', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get ColumnSetPaddingMargin state success " + JSON.stringify(pages)); + if (!("ColumnSetPaddingMargin" == pages.name)) { + console.info("get ColumnSetPaddingMargin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push ColumnSetPaddingMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ColumnSetPaddingMargin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("ColumnSetPaddingMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0900 + * @tc.name testColumnParentMarPadSubPaddding + * @tc.desc Parent component set paddding and margin,subcomponent set paddding. + */ + it('testColumnParentMarPadSubPaddding', 0, async function (done) { + console.info('new testColumnParentMarPadSubPaddding START'); + await CommonFunc.sleep(2000); + let setPaddingMargin_SubPad01 = CommonFunc.getComponentRect('setPaddingMargin_SubPad01'); + let setPaddingMargin_SubPad02 = CommonFunc.getComponentRect('setPaddingMargin_SubPad02'); + let setPaddingMargin_SubPad03 = CommonFunc.getComponentRect('setPaddingMargin_SubPad03'); + let setPaddingMargin_SubPad = CommonFunc.getComponentRect('setPaddingMargin_SubPad'); + expect(Math.round(setPaddingMargin_SubPad01.top - setPaddingMargin_SubPad.top)).assertEqual(vp2px(20)) + expect(Math.round(setPaddingMargin_SubPad02.top - setPaddingMargin_SubPad01.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setPaddingMargin_SubPad03.top - setPaddingMargin_SubPad02.bottom)).assertEqual(vp2px(30)) + expect(Math.round(setPaddingMargin_SubPad.bottom - setPaddingMargin_SubPad03.bottom)).assertEqual(vp2px(20)) + expect(Math.round(setPaddingMargin_SubPad01.right - setPaddingMargin_SubPad01.left)).assertEqual(vp2px(300)) + expect(Math.round(setPaddingMargin_SubPad02.right - setPaddingMargin_SubPad02.left)).assertEqual(vp2px(300)) + expect(Math.round(setPaddingMargin_SubPad03.right - setPaddingMargin_SubPad03.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentMarPadSubPaddding END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9041ac92856ba88acf0058d4c3c144f885d075d2 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChange.test.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPadding__SubChange() { + describe('ColumnSetPaddingTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages)); + if (!("parentComponentSetPadding" == pages.name)) { + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push parentComponentSetPadding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push parentComponentSetPadding page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + console.info("parentComponentSetPadding after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0500 + * @tc.name testColumnParentPaddingSubMarPad + * @tc.desc Parent component set paddding,subcomponent set paddding and margin. + */ + it('testColumnParentPaddingSubMarPad', 0, async function (done) { + console.info('new testColumnParentPaddingSubMarPad START'); + await CommonFunc.sleep(2000); + let columnSetPadding_1 = CommonFunc.getComponentRect('columnSetPadding_1'); + let columnSetPadding_2 = CommonFunc.getComponentRect('columnSetPadding_2'); + let columnSetPadding_3 = CommonFunc.getComponentRect('columnSetPadding_3'); + let columnSetPadding = CommonFunc.getComponentRect('columnSetPadding'); + expect(Math.round(columnSetPadding_1.top - columnSetPadding.top)).assertEqual(vp2px(40)) + expect(Math.round(columnSetPadding_2.top - columnSetPadding_1.bottom)).assertEqual(vp2px(50)) + expect(Math.round(columnSetPadding_3.top - columnSetPadding_2.bottom)).assertEqual(vp2px(30)) + expect(columnSetPadding.bottom).assertLess(columnSetPadding_3.bottom) + expect(Math.round(columnSetPadding_1.right - columnSetPadding_1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPadding_2.right - columnSetPadding_2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPadding_3.right - columnSetPadding_3.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentPaddingSubMarPad END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangeMar.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangeMar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b31ef6c9603612710770f20e9520f1af2baeb390 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangeMar.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPadding__SubChangeMar() { + describe('ColumnSetPaddingTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangeMar', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages)); + if (!("parentComponentSetPadding" == pages.name)) { + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push parentComponentSetPadding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push parentComponentSetPadding page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("parentComponentSetPadding after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0400 + * @tc.name testColumnParentPaddingSubMargin + * @tc.desc Parent component set paddding,subcomponent set margin. + */ + it('testColumnParentPaddingSubMargin', 0, async function (done) { + console.info('new testColumnParentPaddingSubMargin START'); + await CommonFunc.sleep(2000); + let columnSetPad_1 = CommonFunc.getComponentRect('columnSetPad_1'); + let columnSetPad_2 = CommonFunc.getComponentRect('columnSetPad_2'); + let columnSetPad_3 = CommonFunc.getComponentRect('columnSetPad_3'); + let columnSetPad = CommonFunc.getComponentRect('columnSetPad'); + expect(Math.round(columnSetPad_1.top - columnSetPad.top)).assertEqual(vp2px(40)) + expect(Math.round(columnSetPad_2.top - columnSetPad_1.bottom)).assertEqual(vp2px(50)) + expect(Math.round(columnSetPad_3.top - columnSetPad_2.bottom)).assertEqual(vp2px(30)) + expect(columnSetPad.bottom).assertLess(columnSetPad_3.bottom) + expect(Math.round(columnSetPad_1.right - columnSetPad_1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPad_2.right - columnSetPad_2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPad_3.right - columnSetPad_3.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentPaddingSubMargin END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangePad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangePad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..17b3fbc9bd5249c3ed2a9d1b51df4a8efddb053f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPadding_SubChangePad.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPadding_SubChangePad() { + describe('ColumnSetPaddingTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPadding_SubChangePad', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages)); + if (!("parentComponentSetPadding" == pages.name)) { + console.info("get parentComponentSetPadding state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push parentComponentSetPadding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push parentComponentSetPadding page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("parentComponentSetPadding after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0300 + * @tc.name testColumnParentPaddingSubPadding + * @tc.desc Parent component and subcomponent both set paddding. + */ + it('testColumnParentPaddingSubPadding', 0, async function (done) { + console.info('new testColumnParentPaddingSubPadding START'); + await CommonFunc.sleep(2000); + let columnSetPadding_SubPad1 = CommonFunc.getComponentRect('columnSetPadding_SubPad1'); + let columnSetPadding_SubPad2 = CommonFunc.getComponentRect('columnSetPadding_SubPad2'); + let columnSetPadding_SubPad3 = CommonFunc.getComponentRect('columnSetPadding_SubPad3'); + let columnSetPadding_SubPad = CommonFunc.getComponentRect('columnSetPadding_SubPad'); + expect(Math.round(columnSetPadding_SubPad1.top - columnSetPadding_SubPad.top)).assertEqual(vp2px(20)) + expect(Math.round(columnSetPadding_SubPad.bottom - columnSetPadding_SubPad3.bottom)).assertEqual(vp2px(20)) + expect(Math.round(columnSetPadding_SubPad2.top - columnSetPadding_SubPad1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetPadding_SubPad3.top - columnSetPadding_SubPad2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetPadding_SubPad1.right - columnSetPadding_SubPad1.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPadding_SubPad2.right - columnSetPadding_SubPad2.left)).assertEqual(vp2px(300)) + expect(Math.round(columnSetPadding_SubPad3.right - columnSetPadding_SubPad3.left)).assertEqual(vp2px(300)) + console.info('new testColumnParentPaddingSubPadding END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPosition_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPosition_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0cbd0ffe270601f26a1b88bc864b749541c80375 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetPosition_SubChange.test.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetPosition_SubChange() { + describe('ColumnSetPositionTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetPosition_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get SetPosition state success " + JSON.stringify(pages)); + if (!("SetPosition" == pages.name)) { + console.info("get SetPosition state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SetPosition page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SetPosition page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("SetPosition after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_1200 + * @tc.name testColumnSubcomponentSetPosition + * @tc.desc The first subcomponent set position attribute. + */ + it('testColumnSubcomponentSetPosition', 0, async function (done) { + console.info('new testColumnSubcomponentSetPosition START'); + globalThis.value.message.notify({name:'position_x', value:10}); + globalThis.value.message.notify({name:'position_y', value:10}); + await CommonFunc.sleep(2000); + let columnPosition_1 = CommonFunc.getComponentRect('columnPosition_1'); + let columnPosition_2 = CommonFunc.getComponentRect('columnPosition_2'); + let columnPosition_3 = CommonFunc.getComponentRect('columnPosition_3'); + let columnPosition = CommonFunc.getComponentRect('columnPosition'); + + expect(Math.round(columnPosition_1.top - columnPosition.top)).assertEqual(vp2px(10)) + expect(Math.round(columnPosition_1.left - columnPosition.left)).assertEqual(vp2px(10)) + expect(columnPosition_2.top).assertEqual (columnPosition.top) + expect(Math.round(columnPosition_3.top - columnPosition_2.bottom)).assertEqual(vp2px(30)) + expect(columnPosition_3.bottom).assertLess( columnPosition.bottom) + console.info('new testColumnSubcomponentSetPosition END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetVisibility_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetVisibility_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4b743793de7da432751751d5920ae74349b5e7f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnSetVisibility_SubChange.test.ets @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnSetVisibility_SubChange() { + describe('ColumnSetVisibilityTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnSetVisibility_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get ColumnSetVisibility state success " + JSON.stringify(pages)); + if (!("ColumnSetVisibility" == pages.name)) { + console.info("get ColumnSetVisibility state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push ColumnSetVisibility page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ColumnSetVisibility page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(3000); + console.info("ColumnSetVisibility after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_2000 + * @tc.name testColumnSetVisibilityNoneVisible + * @tc.desc The subcomponents set visibility.none and visibility.visible. + */ + it('testColumnSetVisibilityNoneVisible', 0, async function (done) { + console.info('new testColumnSetVisibilityNoneVisible START'); + try{ + globalThis.value.message.notify({name:'testVisibility1', value:Visibility.None}); + globalThis.value.message.notify({name:'testVisibility2', value:Visibility.Visible}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('columnSetVisibility_1'); + let obj = JSON.parse(strJson); + expect(obj.$attrs.visibility).assertEqual("Visibility.None"); + let columnSetVisibility_1 = CommonFunc.getComponentRect('columnSetVisibility_1'); + let columnSetVisibility_2 = CommonFunc.getComponentRect('columnSetVisibility_2'); + let columnSetVisibility_3 = CommonFunc.getComponentRect('columnSetVisibility_3'); + let columnSetVisibility = CommonFunc.getComponentRect('columnSetVisibility'); + expect(columnSetVisibility_1.bottom - columnSetVisibility_1.top).assertEqual(vp2px(0)) + expect(columnSetVisibility_1.right - columnSetVisibility_1.left).assertEqual(vp2px(0)) + expect(columnSetVisibility_2.top).assertEqual (columnSetVisibility.top) + expect(Math.round(columnSetVisibility_3.top - columnSetVisibility_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility.bottom - columnSetVisibility_3.bottom)).assertEqual(vp2px(120)) + + } catch (err) { + console.error('[testColumnSetVisibilityNoneVisible] failed'); + expect().assertFail(); + } + console.info('new testColumnSetVisibilityNoneVisible END'); + done(); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_2100 + * @tc.name testColumnSetVisibilityHiddenVisible + * @tc.desc The subcomponents set visibility.hidden and visibility.visible. + */ + it('testColumnSetVisibilityHiddenVisible', 0, async function (done) { + console.info('new testColumnSetVisibilityHiddenVisible START'); + try{ + globalThis.value.message.notify({name:'testVisibility1', value:Visibility.Hidden}); + globalThis.value.message.notify({name:'testVisibility2', value:Visibility.Visible}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('columnSetVisibility_1'); + let obj = JSON.parse(strJson); + expect(obj.$attrs.visibility).assertEqual("Visibility.Hidden"); + let columnSetVisibility_1 = CommonFunc.getComponentRect('columnSetVisibility_1'); + let columnSetVisibility_2 = CommonFunc.getComponentRect('columnSetVisibility_2'); + let columnSetVisibility_3 = CommonFunc.getComponentRect('columnSetVisibility_3'); + let columnSetVisibility = CommonFunc.getComponentRect('columnSetVisibility'); + expect(columnSetVisibility.top).assertEqual(columnSetVisibility_1.top) + expect(Math.round(columnSetVisibility_2.top - columnSetVisibility_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility_3.top - columnSetVisibility_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility.bottom - columnSetVisibility_3.bottom)).assertEqual(vp2px(40)) + } catch (err) { + console.error('[testColumnSetVisibilityHiddenVisible] failed'); + expect().assertFail(); + } + console.info('new testColumnSetVisibilityHiddenVisible END'); + done(); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_2200 + * @tc.name testColumnSetVisibilityVisible + * @tc.desc The subcomponents both set visibility.visible. + */ + it('testColumnSetVisibilityVisible', 0, async function (done) { + console.info('new testColumnSetVisibilityVisible START'); + try{ + globalThis.value.message.notify({name:'testVisibility1', value:Visibility.Visible}); + globalThis.value.message.notify({name:'testVisibility2', value:Visibility.Visible}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('columnSetVisibility_1'); + let obj = JSON.parse(strJson); + expect(obj.$attrs.visibility).assertEqual("Visibility.Visible"); + let columnSetVisibility_1 = CommonFunc.getComponentRect('columnSetVisibility_1'); + let columnSetVisibility_2 = CommonFunc.getComponentRect('columnSetVisibility_2'); + let columnSetVisibility_3 = CommonFunc.getComponentRect('columnSetVisibility_3'); + let columnSetVisibility = CommonFunc.getComponentRect('columnSetVisibility'); + expect(columnSetVisibility.top).assertEqual(columnSetVisibility_1.top) + expect(Math.round(columnSetVisibility_2.top - columnSetVisibility_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility_3.top - columnSetVisibility_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility.bottom - columnSetVisibility_3.bottom)).assertEqual(vp2px(40)) + } catch (err) { + console.error('[testColumnSetVisibilityVisible] failed'); + expect().assertFail(); + } + console.info('new testColumnSetVisibilityVisible END'); + done(); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_2300 + * @tc.name testColumnSetVisibilityVisibleNone + * @tc.desc The subcomponents set visibility.visible and visibility.none. + */ + it('testColumnSetVisibilityVisibleNone', 0, async function (done) { + console.info('new testColumnSetVisibilityVisibleNone START'); + try{ + globalThis.value.message.notify({name:'testVisibility1', value:Visibility.Visible}); + globalThis.value.message.notify({name:'testVisibility2', value:Visibility.None}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('columnSetVisibility_2'); + let obj = JSON.parse(strJson); + expect(obj.$attrs.visibility).assertEqual("Visibility.None"); + let columnSetVisibility_1 = CommonFunc.getComponentRect('columnSetVisibility_1'); + let columnSetVisibility_2 = CommonFunc.getComponentRect('columnSetVisibility_2'); + let columnSetVisibility_3 = CommonFunc.getComponentRect('columnSetVisibility_3'); + let columnSetVisibility = CommonFunc.getComponentRect('columnSetVisibility'); + expect(columnSetVisibility_2.bottom).assertEqual (columnSetVisibility_2.top) + expect(columnSetVisibility_2.right).assertEqual (columnSetVisibility_2.left) + expect(columnSetVisibility_1.top).assertEqual (columnSetVisibility.top) + expect(Math.round(columnSetVisibility_3.top - columnSetVisibility_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnSetVisibility.bottom - columnSetVisibility_3.bottom)).assertEqual(vp2px(170)) + } catch (err) { + console.error('[testColumnSetVisibilityVisibleNone] failed'); + expect().assertFail(); + } + console.info('new testColumnSetVisibilityVisibleNone END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnWidthHeight_SubChange.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnWidthHeight_SubChange.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff598647294365b32ed8a09ab06c37a8780aecf4 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Column/subComponentChanged/ColumnWidthHeight_SubChange.test.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import router from '@system.router'; +import CommonFunc from "../../../MainAbility/common/Common"; +import { MessageManager,Callback } from '../../../MainAbility/common/MessageManager'; +export default function ColumnWidthHeight_SubChange() { + describe('ColumnSetWidthHeightTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Column/subcomponentChanged/ColumnWidthHeight_SubChange', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexBase state success " + JSON.stringify(pages)); + if (!("FlexBase" == pages.name)) { + console.info("get FlexBase state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push FlexBase page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexBase page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + globalThis.value.message.notify({name:'height', value:50}); + globalThis.value.message.notify({name:'width', value:300}); + console.info("FlexBase after each called"); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0100 + * @tc.name testColumnSubcomponentModifyHeight + * @tc.desc Modify the first subcomponent's height. + */ + it('testColumnSubcomponentModifyHeight', 0, async function (done) { + console.info('new testColumnSubcomponentModifyHeight START'); + globalThis.value.message.notify({name:'height', value:80}); + globalThis.value.message.notify({name:'width', value:300}); + await CommonFunc.sleep(2000); + let columnWidthHeight_1 = CommonFunc.getComponentRect('columnWidthHeight_1'); + let columnWidthHeight_2 = CommonFunc.getComponentRect('columnWidthHeight_2'); + let columnWidthHeight_3 = CommonFunc.getComponentRect('columnWidthHeight_3'); + let columnWidthHeight = CommonFunc.getComponentRect('columnWidthHeight'); + expect(columnWidthHeight.top).assertEqual(columnWidthHeight_1.top) + expect(Math.round(columnWidthHeight_2.top - columnWidthHeight_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnWidthHeight_3.top - columnWidthHeight_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnWidthHeight.bottom - columnWidthHeight_3.bottom)).assertEqual(vp2px(10)) + console.info('new testColumnSubcomponentModifyHeight END'); + done(); + }); + + /** + * @tc.number SUB_ACE_COLUMN_SUBCOMPONENTCHANGED_0200 + * @tc.name testColumnSubcomponentModifyWidth + * @tc.desc Modify the first subcomponent's width. + */ + it('testColumnSubcomponentModifyWidth', 0, async function (done) { + console.info('new testColumnSubcomponentModifyWidth START'); + globalThis.value.message.notify({name:'height', value:50}); + globalThis.value.message.notify({name:'width', value:200}); + await CommonFunc.sleep(2000); + let columnWidthHeight_1 = CommonFunc.getComponentRect('columnWidthHeight_1'); + let columnWidthHeight_2 = CommonFunc.getComponentRect('columnWidthHeight_2'); + let columnWidthHeight_3 = CommonFunc.getComponentRect('columnWidthHeight_3'); + let columnWidthHeight = CommonFunc.getComponentRect('columnWidthHeight'); + expect(columnWidthHeight.top).assertEqual(columnWidthHeight_1.top) + expect(Math.round(columnWidthHeight_2.top - columnWidthHeight_1.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnWidthHeight_3.top - columnWidthHeight_2.bottom)).assertEqual(vp2px(30)) + expect(Math.round(columnWidthHeight.bottom - columnWidthHeight_3.bottom)).assertEqual(vp2px(40)) + console.info('new testColumnSubcomponentModifyWidth END'); + done(); + }); + }) +}