diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0455eb076807c12f993b02fd9e4dd4a10cfa4e9 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.ets @@ -0,0 +1,56 @@ +/** + * 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 FlexWrapReverse_fixedParent { + @State testWidth: number = 150 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParent Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParent page show called'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'width') { + this.testWidth = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_fixedParent page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest8').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(this.testWidth).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest22') + Text('2').width(this.testWidth).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest23') + Text('3').width(this.testWidth).height(150).backgroundColor(0xffa500).key('WrapReverseTest24') + } + .key('FlexWrapReverseTest8') + .height(300) + .width(500) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.ets new file mode 100644 index 0000000000000000000000000000000000000000..df9c7071d46faf21227f04afb9b46797665c0145 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.ets @@ -0,0 +1,59 @@ +/** + * 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 FlexWrapReverse_fixedParentChildDisplayPriority { + @State testHeight: number = 150 + @State testWidth: number = 450 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentChildDisplayPriority Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentChildDisplayPriority page show called'); + 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('FlexWrapReverse_fixedParentChildDisplayPriority page build done called'); + } + + build() { + Column() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(250).height(100).backgroundColor(0xF5DEB3).displayPriority(3).key('WrapReverseTest70') + Text('2').width(150).height(150).backgroundColor(0xD2B48C).displayPriority(2).key('WrapReverseTest71') + Text('3').width(150).height(200).backgroundColor(0xffa500).displayPriority(1).key('WrapReverseTest72') + } + .key('FlexWrapReverseTest24') + .height(this.testHeight) + .width(this.testWidth) + .backgroundColor(0xAFEEEE) + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.ets new file mode 100644 index 0000000000000000000000000000000000000000..a420bf9f9044466c6a400c012463c58894393397 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.ets @@ -0,0 +1,59 @@ +/** + * 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 FlexWrapReverse_fixedParentChildLayoutWeight { + @State testHeight: number = 150 + @State testWidth: number = 300 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentChildLayoutWeight Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentChildLayoutWeight page show called'); + 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('FlexWrapReverse_fixedParentChildLayoutWeight page build done called'); + } + + build() { + Column() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(100).backgroundColor(0xF5DEB3).layoutWeight(2).key('WrapReverseTest67') + Text('2').width(100).height(150).backgroundColor(0xD2B48C).layoutWeight(1).key('WrapReverseTest68') + Text('3').width(100).height(200).backgroundColor(0xffa500).layoutWeight(1).key('WrapReverseTest69') + } + .key('FlexWrapReverseTest23') + .height(this.testHeight) + .width(this.testWidth) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.ets new file mode 100644 index 0000000000000000000000000000000000000000..557553264c41946bd8f59dff189ce0853f191f60 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.ets @@ -0,0 +1,59 @@ +/** + * 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 FlexWrapReverse_fixedParentChildPosition { + @State testHeight: number = 150 + @State testWidth: number = 450 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentChildPosition Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentChildPosition page show called'); + 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('FlexWrapReverse_fixedParentChildPosition page build done called'); + } + + build() { + Column() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest64').position({x:20,y:40}) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest65') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest66') + } + .key('FlexWrapReverseTest22') + .height(this.testHeight) + .width(this.testWidth) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.ets new file mode 100644 index 0000000000000000000000000000000000000000..06d4b8b90634365b94e8bb8539fd34ab995c4b42 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.ets @@ -0,0 +1,64 @@ +/** + * 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 FlexWrapReverse_fixedParentChildVisibility { + @State test1Width: number = 150 + @State test2Width: number = 300 + @State testVisibility: number = Visibility.Visible + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentChildVisibility Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentChildVisibility page show called'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'test1Width') { + this.test1Width = message.value; + } + if (message.name == 'test2Width') { + this.test2Width = message.value; + } + if (message.name == 'visibility') { + this.testVisibility = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_fixedParentChildVisibility page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest19').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(this.test1Width).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest55').visibility(this.testVisibility) + Text('2').width(this.test2Width).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest56') + Text('3').width(this.test2Width).height(150).backgroundColor(0xffa500).key('WrapReverseTest57') + } + .key('FlexWrapReverseTest19') + .height(300) + .width(500) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ac7bafd354b8ebb08ab27971c7c9705b2fd1c91 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.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 FlexWrapReverse_fixedParentMarPad { + @State testPadding: number = 0 + @State testMargin: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentMarPad Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentMarPad page show called'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'padding') { + this.testPadding = message.value; + } + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_fixedParentMarPad page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest16').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).padding(this.testPadding).margin(this.testMargin).key('WrapReverseTest46') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest47') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest48') + } + .key('FlexWrapReverseTest16') + .height(300) + .width(500) + .padding(50) + .margin(20) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.ets new file mode 100644 index 0000000000000000000000000000000000000000..4df5488a940af893346592a8932c3ce8f39d6fc3 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.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 FlexWrapReverse_fixedParentMargin { + @State testPadding: number = 0 + @State testMargin: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentMargin Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentMargin page show called'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'padding') { + this.testPadding = message.value; + } + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_fixedParentMargin page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest13').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).padding(this.testPadding).margin(this.testMargin).key('WrapReverseTest37') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest38') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest39') + } + .key('FlexWrapReverseTest13') + .height(300) + .width(500) + .margin(20) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e593dfe27b0d284bcb2874afcd2a9a28edf4c6f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.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 FlexWrapReverse_fixedParentPadding { + @State testPadding: number = 10 + @State testMargin: number = 0 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_fixedParentPadding Page" + + onPageShow() { + console.info('FlexWrapReverse_fixedParentPadding page show called'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.log('message = ' + message.name + "--" + message.value); + if (message.name == 'padding') { + this.testPadding = message.value; + } + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_fixedParentPadding page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest10').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).padding(this.testPadding).margin(this.testMargin).key('WrapReverseTest28') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest29') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest30') + } + .key('FlexWrapReverseTest10') + .height(300) + .width(500) + .padding(50) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.ets new file mode 100644 index 0000000000000000000000000000000000000000..0bb432eb22d044259890670b8e90b6375554412a --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.ets @@ -0,0 +1,60 @@ +/** + * 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 FlexWrapReverse_notFixedParent { + @State testHeight: number = 150 + @State testWidth: number = 450 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_notFixedParent Page" + + onPageShow() { + console.info('FlexWrapReverse_notFixedParent page show called'); + 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('FlexWrapReverse_notFixedParent page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest1').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest2') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest3') + } + .key('FlexWrapReverseTest1') + .height(this.testHeight) + .width(this.testWidth) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.ets new file mode 100644 index 0000000000000000000000000000000000000000..58c9d434af588abed2727a4828fb38387137cbd8 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.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 { MessageManager, Callback } from '../../../../common/MessageManager'; + +@Entry +@Component +struct FlexWrapReverse_notFixedParentMargin { + @State testHeight: number = 150 + @State testWidth: number = 450 + @State testPadding: number = 0 + @State testMargin: number = 10 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_notFixedParentMargin Page" + + onPageShow() { + console.info('FlexWrapReverse_notFixedParentMargin page show called'); + 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; + } + if (message.name == 'padding') { + this.testPadding = message.value; + } + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_notFixedParentMargin page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest6').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest16') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest17') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest18') + } + .key('FlexWrapReverseTest6') + .height(this.testHeight) + .width(this.testWidth) + .padding(this.testPadding) + .margin(this.testMargin) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.ets new file mode 100644 index 0000000000000000000000000000000000000000..714a163c18ddc14945b9772824a310b895090d9c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.ets @@ -0,0 +1,65 @@ +/** + * 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 FlexWrapReverse_notFixedParentPaddind { + @State testHeight: number = 150 + @State testWidth: number = 450 + @State testPadding: number = 10 + messageManager:MessageManager = new MessageManager() + private content: string = "FlexWrapReverse_notFixedParentPaddind Page" + + onPageShow() { + console.info('FlexWrapReverse_notFixedParentPaddind page show called'); + 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; + } + if (message.name == 'padding') { + this.testPadding = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + onBuildDone() { + console.info('FlexWrapReverse_notFixedParentPaddind page build done called'); + } + + build() { + Column() { + Text('Wrap:WrapReverseTest4').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.WrapReverse }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('WrapReverseTest10') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('WrapReverseTest11') + Text('3').width(150).height(150).backgroundColor(0xffa500).key('WrapReverseTest12') + } + .key('FlexWrapReverseTest4') + .height(this.testHeight) + .width(this.testWidth) + .padding(this.testPadding) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc0bb462b88ca73f45d389232f944e2551429103 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent.test.ets @@ -0,0 +1,125 @@ +/* + * 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 flexWrapReverse_fixedParent() { + describe('FlexWrapReverse_fixedParent', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParent beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParent', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParent state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParent" == pages.name)) { + console.info("get FlexWrapReverse_fixedParent state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParent page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParent page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParent afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0100 + * @tc.name testWrapReverseParentfixedChangeChildWidthLessThanParent + * @tc.desc The layout space of the parent component is fixed, and the size of the child component is changed, + * child component width is smaller than parent component width + */ + it('testWrapReverseParentfixedChangeChildWidthLessThanParent', 0, async function (done) { + console.info('new testWrapReverseParentfixedChangeChildWidthLessThanParent START'); + globalThis.value.message.notify({name:'width', value:150}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest8'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest22'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest23'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest24'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest8'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(50)); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationText3.top); + expect(locationText3.top).assertEqual(locationFlex.top); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedChangeChildWidthLessThanParent END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0200 + * @tc.name testWrapReverseParentfixedChangeChildWidthLargerThanParent + * @tc.desc The layout space of the parent component is fixed, and the size of the child component is changed, + * child component width is larger than parent component width + */ + it('testWrapReverseParentfixedChangeChildWidthLargerThanParent', 0, async function (done) { + console.info('new testWrapReverseParentfixedChangeChildWidthLargerThanParent START'); + globalThis.value.message.notify({name:'width', value:200}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest8'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest22'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest23'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest24'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest8'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(200)); + console.info('new testWrapReverseParentfixedChangeChildWidthLargerThanParent END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..80c1e4cac7cd9e951959c2b1d0884bb5aeb25383 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority.test.ets @@ -0,0 +1,83 @@ +/* + * 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 flexWrapReverse_fixedParentChildDisplayPriority() { + describe('FlexWrapReverse_fixedParentChildDisplayPriority', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentChildDisplayPriority beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildDisplayPriority', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentChildDisplayPriority state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentChildDisplayPriority" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentChildDisplayPriority pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentChildDisplayPriority page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentChildDisplayPriority page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentChildDisplayPriority afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1700 + * @tc.name testWrapReverseParentfixedDisplayPriority + * @tc.desc The layout space of the parent component is fixed, and displayPriority is set for child component + */ + it('testWrapReverseParentfixedDisplayPriority', 0, async function (done) { + console.info('new testWrapReverseParentfixedDisplayPriority START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest24'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest70'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest71'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest72'); + let locationFlexParent = CommonFunc.getComponentRect('FlexWrapReverseTest24'); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText1.top).assertEqual(locationFlexParent.top); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(250)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(200)); + expect(Math.round(locationText2.left - locationFlexParent.left)).assertEqual(vp2px(100)); + expect(Math.round(locationFlexParent.bottom - locationText2.bottom)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedDisplayPriority END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c80c878e429742d994674a20a3ed07874b98001 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight.test.ets @@ -0,0 +1,86 @@ +/* + * 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 flexWrapReverse_fixedParentChildLayoutWeight() { + describe('FlexWrapReverse_fixedParentChildLayoutWeight', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentChildLayoutWeight beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildLayoutWeight', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentChildLayoutWeight state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentChildLayoutWeight" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentChildLayoutWeight pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentChildLayoutWeight page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentChildLayoutWeight page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentChildLayoutWeight afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1600 + * @tc.name testWrapReverseParentfixedLayoutWeight + * @tc.desc The layout space of the parent component is fixed, and the layoutweight is set for child component + */ + it('testWrapReverseParentfixedLayoutWeight', 0, async function (done) { + console.info('new testWrapReverseParentfixedLayoutWeight START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest23'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest67'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest68'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest69'); + let locationFlexParent = CommonFunc.getComponentRect('FlexWrapReverseTest23'); + expect(locationText1.top).assertEqual(locationFlexParent.top) + expect(locationText1.top).assertEqual(locationText2.top) + expect(locationText2.top).assertEqual(locationText3.top) + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(100)) + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(150)) + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(200)) + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(100)); + expect(Math.round(locationText2.right - locationText2.left)) + .assertEqual(Math.round(locationText3.right - locationText3.left)) + expect(Math.round((locationText1.right - locationText1.left)*100)/100) + .assertEqual(Math.round(150*(locationText3.right - locationText3.left))/100) + console.info('new testWrapReverseParentfixedLayoutWeight END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4548be341ee2cd345e9a9ad3adec00bd95fc570 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition.test.ets @@ -0,0 +1,85 @@ +/* + * 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 flexWrapReverse_fixedParentChildPosition() { + describe('FlexWrapReverse_fixedParentChildPosition', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentChildPosition beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildPosition', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentChildPosition state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentChildPosition" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentChildPosition state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentChildPosition page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentChildPosition page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentChildPosition afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1500 + * @tc.name testWrapReverseParentfixedPosition + * @tc.desc The layout space of the parent component is fixed, and the position is set for the child component + */ + it('testWrapReverseParentfixedPosition', 0, async function (done) { + console.info('new testWrapReverseParentfixedPosition START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest22'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest64'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest65'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest66'); + let locationFlexParent = CommonFunc.getComponentRect('FlexWrapReverseTest22'); + expect(locationText2.top).assertEqual(locationText3.top); + expect(locationText3.right).assertEqual(locationText2.left); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.top - locationFlexParent.top)).assertEqual(vp2px(40)); + expect(Math.round(locationText1.left - locationFlexParent.left)).assertEqual(vp2px(20)); + expect(Math.round(locationFlexParent.right - locationText2.right)).assertEqual(vp2px(0)); + expect(Math.round(locationText3.left - locationFlexParent.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedPosition END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c099b250598f724b330d369931628934a8a57406 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility.test.ets @@ -0,0 +1,167 @@ +/* + * 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 flexWrapReverse_fixedParentChildVisibility() { + describe('FlexWrapReverse_fixedParentChildVisibility', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentChildVisibility beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentChildVisibility', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentChildVisibility state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentChildVisibility" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentChildVisibility state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentChildVisibility page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentChildVisibility page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentChildVisibility afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1200 + * @tc.name testWrapReverseParentfixedVisibilityNoneAndOtherOutRange + * @tc.desc The layout space of the parent component is fixed, and the visibility none is set for the child + * component, and the layout range of remaining components exceeds the container space + */ + it('testWrapReverseParentfixedVisibilityNoneAndOtherOutRange', 0, async function (done) { + console.info('new testWrapReverseParentfixedVisibilityNoneAndOtherOutRange START'); + globalThis.value.message.notify({name:'test1Width', value:150}) + globalThis.value.message.notify({name:'test2Width', value:300}) + globalThis.value.message.notify({name:'visibility', value:Visibility.None}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest19'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let strJson2 = getInspectorByKey('WrapReverseTest55'); + let obj2 = JSON.parse(strJson2); + expect(obj2.$attrs.visibility).assertEqual('Visibility.None'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest55'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest56'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest57'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest19'); + expect(locationText2.left).assertEqual(locationText3.left); + expect(locationText2.right).assertEqual(locationText3.right); + expect(locationText2.right).assertEqual(locationFlex.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(300)); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedVisibilityNoneAndOtherOutRange END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1300 + * @tc.name testWrapReverseParentfixedVisibilityNoneAndOtherInRange + * @tc.desc The layout space of the parent component is fixed, and the visibility none is set for the child + * component, and the remaining component layout range does not exceed the container space + */ + it('testWrapReverseParentfixedVisibilityNoneAndOtherInRange', 0, async function (done) { + console.info('new testWrapReverseParentfixedVisibilityNoneAndOtherInRange START'); + globalThis.value.message.notify({name:'test1Width', value:200}) + globalThis.value.message.notify({name:'test2Width', value:200}) + globalThis.value.message.notify({name:'visibility', value:Visibility.None}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest19'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let strJson2 = getInspectorByKey('WrapReverseTest55'); + let obj2 = JSON.parse(strJson2); + expect(obj2.$attrs.visibility).assertEqual('Visibility.None'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest55'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest56'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest57'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest19'); + expect(locationText2.right).assertEqual(locationFlex.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(locationText3.top).assertEqual(locationText2.top); + expect(locationText3.top).assertEqual(locationFlex.top); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedVisibilityNoneAndOtherInRange END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1400 + * @tc.name testWrapReverseParentfixedVisibilityHiddenAndOtherInRange + * @tc.desc The layout space of the parent component is fixed, and visibility hidden is set for child component + */ + it('testWrapReverseParentfixedVisibilityHiddenAndOtherInRange', 0, async function (done) { + console.info('new testWrapReverseParentfixedVisibilityHiddenAndOtherInRange START'); + globalThis.value.message.notify({name:'test1Width', value:200}) + globalThis.value.message.notify({name:'test2Width', value:200}) + globalThis.value.message.notify({name:'visibility', value:Visibility.Hidden}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest19'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let strJson2 = getInspectorByKey('WrapReverseTest55'); + let obj2 = JSON.parse(strJson2); + expect(obj2.$attrs.visibility).assertEqual('Visibility.Hidden'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest55'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest56'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest57'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest19'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationFlex.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(50)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(200)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedVisibilityHiddenAndOtherInRange END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff6c0c80a4087f7a516e4b61f31a888afb8e3c23 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad.test.ets @@ -0,0 +1,173 @@ +/* + * 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 flexWrapReverse_fixedParentMarPad() { + describe('FlexWrapReverse_fixedParentMarPad', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentMarPad beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMarPad', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentMarPad state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentMarPad" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentMarPad state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentMarPad page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentMarPad page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentMarPad afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0900 + * @tc.name testWrapReverseParentfixedMarPadChildPadding + * @tc.desc The parent component layout space is fixed, and the parent component setting padding and margin, + * and sub component setting padding + */ + it('testWrapReverseParentfixedMarPadChildPadding', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarPadChildPadding START'); + globalThis.value.message.notify({name:'padding', value:10}) + globalThis.value.message.notify({name:'margin', value:0}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest16'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest46'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest47'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest48'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest16'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(50)); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(150)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText2.top).assertEqual(locationText1.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarPadChildPadding END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1000 + * @tc.name testWrapReverseParentfixedMarPadChildMargin + * @tc.desc The parent component layout space is fixed, and the parent component setting padding and margin, + * and sub component setting margin + */ + it('testWrapReverseParentfixedMarPadChildMargin', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarPadChildMargin START'); + globalThis.value.message.notify({name:'padding', value:0}) + globalThis.value.message.notify({name:'margin', value:20}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest16'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest46'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest47'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest48'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest16'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(70)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(20)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(110)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(20)); + expect(Math.round(locationFlex.right - locationText3.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(70)); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarPadChildMargin END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_1100 + * @tc.name testWrapReverseParentfixedMarPadChildMarginAndPadding + * @tc.desc The parent component layout space is fixed, and the parent component setting padding and margin, + * and sub component setting padding and margin + */ + it('testWrapReverseParentfixedMarPadChildMarginAndPadding', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarPadChildMarginAndPadding START'); + globalThis.value.message.notify({name:'padding', value:30}) + globalThis.value.message.notify({name:'margin', value:20}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest16'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest46'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest47'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest48'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest16'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(70)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(20)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(110)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(20)); + expect(Math.round(locationFlex.right - locationText3.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(70)); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(60)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarPadChildMarginAndPadding END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eff188871b3408cba7ce8b64322dc2d1770fa5c4 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin.test.ets @@ -0,0 +1,172 @@ +/* + * 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 flexWrapReverse_fixedParentMargin() { + describe('FlexWrapReverse_fixedParentMargin', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentMargin beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentMargin', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentMargin state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentMargin" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentMargin state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentMargin page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentMargin page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentMargin afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0600 + * @tc.name testWrapReverseParentfixedMarginChildPadding + * @tc.desc The parent component layout space is fixed, and the parent component setting margin, + * and sub component setting padding + */ + it('testWrapReverseParentfixedMarginChildPadding', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarginChildPadding START'); + globalThis.value.message.notify({name:'padding', value:10}) + globalThis.value.message.notify({name:'margin', value:0}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest13'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest37'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest38'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest39'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest13'); + expect(locationFlex.right).assertEqual(locationText1.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(50)); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationText3.top); + expect(locationText3.top).assertEqual(locationFlex.top); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarginChildPadding END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0700 + * @tc.name testWrapReverseParentfixedMarginChildMargin + * @tc.desc The parent component layout space is fixed, and the parent component setting margin, + * and sub component setting margin + */ + it('testWrapReverseParentfixedMarginChildMargin', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarginChildMargin START'); + globalThis.value.message.notify({name:'padding', value:0}) + globalThis.value.message.notify({name:'margin', value:50}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest13'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest37'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest38'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest39'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest13'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(50)); + expect(locationText3.right).assertEqual(locationFlex.right); + expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(Math.round(locationText3.top - locationText2.bottom)).assertEqual(vp2px(50)); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarginChildMargin END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0800 + * @tc.name testWrapReverseParentfixedMarginChildMarginAndPadding + * @tc.desc The parent component layout space is fixed, and the parent component setting margin, + * and set padding and margin for sub component + */ + it('testWrapReverseParentfixedMarginChildMarginAndPadding', 0, async function (done) { + console.info('new testWrapReverseParentfixedMarginChildMarginAndPadding START'); + globalThis.value.message.notify({name:'padding', value:10}) + globalThis.value.message.notify({name:'margin', value:30}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest13'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest37'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest38'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest39'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest13'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(30)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(30)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(140)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(30)); + expect(locationText3.right).assertEqual(locationFlex.right); + expect(Math.round(locationText1.top - locationFlex.top)).assertEqual(vp2px(30)); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(Math.round(locationText3.top - locationText2.bottom)).assertEqual(vp2px(10)); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(40)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedMarginChildMarginAndPadding END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..104929b2b442aedf299dd38e855d0b2f443b80e6 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding.test.ets @@ -0,0 +1,173 @@ +/* + * 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 flexWrapReverse_fixedParentPadding() { + describe('FlexWrapReverse_fixedParentPadding', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_fixedParentPadding beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_fixedParentPadding', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_fixedParentPadding state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_fixedParentPadding" == pages.name)) { + console.info("get FlexWrapReverse_fixedParentPadding state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_fixedParentPadding page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_fixedParentPadding page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_fixedParentPadding afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0300 + * @tc.name testWrapReverseParentfixedPaddingChildPadding + * @tc.desc The parent component layout space is fixed, and the parent component setting padding, + * and sub component setting padding + */ + it('testWrapReverseParentfixedPaddingChildPadding', 0, async function (done) { + console.info('new testWrapReverseParentfixedPaddingChildPadding START'); + globalThis.value.message.notify({name:'padding', value:20}) + globalThis.value.message.notify({name:'margin', value:0}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest10'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest28'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest29'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest30'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest10'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(50)); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(150)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedPaddingChildPadding END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0400 + * @tc.name testWrapReverseParentfixedPaddingChildMargin + * @tc.desc The parent component layout space is fixed, and the parent component setting padding, + * and sub component setting margin + */ + it('testWrapReverseParentfixedPaddingChildMargin', 0, async function (done) { + console.info('new testWrapReverseParentfixedPaddingChildMargin START'); + globalThis.value.message.notify({name:'padding', value:0}) + globalThis.value.message.notify({name:'margin', value:20}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest10'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest28'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest29'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest30'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest10'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(70)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(20)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(110)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(20)); + expect(Math.round(locationFlex.right - locationText3.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.top - locationText2.top)).assertEqual(vp2px(20)); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(locationFlex.bottom).assertEqual(locationText3.bottom); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedPaddingChildMargin END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_PARENTFIXED_TEST_0500 + * @tc.name testWrapReverseParentfixedPaddingChildPaddingAndMargin + * @tc.desc The parent component layout space is fixed, and the parent component setting padding, + * and sub component setting margin and padding + */ + it('testWrapReverseParentfixedPaddingChildPaddingAndMargin', 0, async function (done) { + console.info('new testWrapReverseParentfixedPaddingChildPaddingAndMargin START'); + globalThis.value.message.notify({name:'padding', value:10}) + globalThis.value.message.notify({name:'margin', value:30}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest10'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest28'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest29'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest30'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest10'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(80)); + expect(Math.round(locationText1.left - locationText2.right)).assertEqual(vp2px(30)); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(90)); + expect(Math.round(locationText3.left - locationText1.left)).assertEqual(vp2px(30)); + expect(Math.round(locationFlex.right - locationText3.right)).assertEqual(vp2px(50)); + expect(Math.round(locationText1.top - locationText2.top)).assertEqual(vp2px(30)); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText3.top - locationText2.bottom)).assertEqual(vp2px(10)); + expect(Math.round(locationText3.bottom - locationFlex.bottom)).assertEqual(vp2px(10)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseParentfixedPaddingChildPaddingAndMargin END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d7eb0a171a1f89a8c81ece6067ee8a966e8577b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent.test.ets @@ -0,0 +1,166 @@ +/* + * 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 flexWrapReverse_notFixedParent() { + describe('FlexWrapReverse_notFixedParent', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_notFixedParent beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParent', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_notFixedParent state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_notFixedParent" == pages.name)) { + console.info("get FlexWrapReverse_notFixedParent state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_notFixedParent page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_notFixedParent page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_notFixedParent afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0100 + * @tc.name testWrapReverseChildfixedChangeParentInRange + * @tc.desc The parent component changes the location and space of the layout, affecting the layout of child + * components, the width and height of parent component meets the requirements of the child components + */ + it('testWrapReverseChildfixedChangeParentInRange', 0, async function (done) { + console.info('new testWrapReverseChildfixedChangeParentInRange START'); + globalThis.value.message.notify({name:'height', value:150}) + globalThis.value.message.notify({name:'width', value:500}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest1'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest1'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest2'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest3'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest1'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(50)); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationText3.top); + expect(locationText3.top).assertEqual(locationFlex.top); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(locationText3.bottom).assertEqual(locationFlex.bottom); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedChangeParentInRange END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0200 + * @tc.name testWrapReverseChildfixedChangeParentChildWidthOutRange + * @tc.desc The parent component changes location and space of layout, affecting layout of child components, + * the width of parent component does not meet the requirements of child components, but height meets + */ + it('testWrapReverseChildfixedChangeParentChildWidthOutRange', 0, async function (done) { + console.info('new testWrapReverseChildfixedChangeParentChildWidthOutRange START'); + globalThis.value.message.notify({name:'height', value:250}) + globalThis.value.message.notify({name:'width', value:400}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest1'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest1'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest2'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest3'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest1'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(locationText3.bottom).assertEqual(locationFlex.bottom); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedChangeParentChildWidthOutRange END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0300 + * @tc.name testWrapReverseChildfixedChangeParentChildAllOutRange + * @tc.desc The parent component changes location and space of layout, affecting layout of child components, + * the width and height of parent component does not meet the requirements of the child components + */ + it('testWrapReverseChildfixedChangeParentChildAllOutRange', 0, async function (done) { + console.info('new testWrapReverseChildfixedChangeParentChildAllOutRange START'); + globalThis.value.message.notify({name:'height', value:100}) + globalThis.value.message.notify({name:'width', value:400}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest1'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest1'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest2'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest3'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest1'); + expect(locationText1.right).assertEqual(locationFlex.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(100)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationFlex.top); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.bottom - locationFlex.bottom)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedChangeParentChildAllOutRange END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd58f88cab2e2ad4dfa561ceb75c2c062e666e3a --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin.test.ets @@ -0,0 +1,135 @@ +/* + * 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 flexWrapReverse_notFixedParentMargin() { + describe('FlexWrapReverse_notFixedParentMargin', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_notFixedParentMargin beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentMargin', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_notFixedParentMargin state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_notFixedParentMargin" == pages.name)) { + console.info("get FlexWrapReverse_notFixedParentMargin state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_notFixedParentMargin page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_notFixedParentMargin page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_notFixedParentMargin afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0600 + * @tc.name testWrapReverseChildfixedParentMargin + * @tc.desc The parent component changes the location and space of the layout, affecting the layout of the + * child components, parent component setting margin + */ + it('testWrapReverseChildfixedParentMargin', 0, async function (done) { + console.info('new testWrapReverseChildfixedParentMargin START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + globalThis.value.message.notify({name:'padding', value:0}) + globalThis.value.message.notify({name:'margin', value:10}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest6'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest16'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest17'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest18'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest6'); + expect(locationFlex.right).assertEqual(locationText1.right); + expect(locationText1.left).assertEqual(locationText2.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(50)); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationText3.top); + expect(locationText3.top).assertEqual(locationFlex.top); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(150)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText2.right - locationText2.left)) + .assertEqual(Math.round(locationText1.right - locationText1.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedParentMargin END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0700 + * @tc.name testWrapReverseChildfixedParentMarPad + * @tc.desc The parent component changes the location and space of the layout, affecting the layout of the + * child components, parent component setting margin and padding + */ + it('testWrapReverseChildfixedParentMarPad', 0, async function (done) { + console.info('new testWrapReverseChildfixedParentMarPad START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + globalThis.value.message.notify({name:'padding', value:30}) + globalThis.value.message.notify({name:'margin', value:30}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest6'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest16'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest17'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest18'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest6'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(30)); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(170)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(30)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(20)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedParentMarPad END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c54ea3c7235554b10d4ab7f10b88796dd2966ea --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding.test.ets @@ -0,0 +1,133 @@ +/* + * 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 flexWrapReverse_notFixedParentPadding() { + describe('FlexWrapReverse_notFixedParentPadding', function () { + beforeEach(async function (done) { + console.info("FlexWrapReverse_notFixedParentPadding beforeEach called"); + let options = { + uri: 'MainAbility/pages/Flex/Wrap/WrapReverse/FlexWrapReverse_notFixedParentPadding', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get FlexWrapReverse_notFixedParentPadding state pages:" + JSON.stringify(pages)); + if (!("FlexWrapReverse_notFixedParentPadding" == pages.name)) { + console.info("get FlexWrapReverse_notFixedParentPadding state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push FlexWrapReverse_notFixedParentPadding page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push FlexWrapReverse_notFixedParentPadding page error:" + JSON.stringify(err)); + } + await CommonFunc.sleep(2000); + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("FlexWrapReverse_notFixedParentPadding afterEach called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0400 + * @tc.name testWrapReverseChildfixedParentPaddingInRange + * @tc.desc The parent component changes location and space of layout, affecting layout of child components, + * parent component setting padding, the remaining layout space meets the requirements + */ + it('testWrapReverseChildfixedParentPaddingInRange', 0, async function (done) { + console.info('new testWrapReverseChildfixedParentPaddingInRange START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + globalThis.value.message.notify({name:'padding', value:10}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest4'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + //expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest10'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest11'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest12'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest4'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(10)); + expect(locationText1.left).assertEqual(locationText2.right); + expect(locationText2.left).assertEqual(locationText3.right); + expect(Math.round(locationText3.left - locationFlex.left)).assertEqual(vp2px(40)); + expect(locationText1.top).assertEqual(locationText2.top); + expect(locationText2.top).assertEqual(locationText3.top); + expect(Math.round(locationText3.top - locationFlex.top)).assertEqual(vp2px(10)); + expect(Math.round(locationText2.right - locationText2.left)) + .assertEqual(Math.round(locationText1.right - locationText1.left)); + expect(Math.round(locationText2.right - locationText2.left)) + .assertEqual(Math.round(locationText3.right - locationText3.left)); + expect(Math.round(locationText2.right - locationText2.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedParentPaddingInRange END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEX_WRAPREVERSE_CHILDFIXED_TEST_0500 + * @tc.name testWrapReverseChildfixedParentPaddingOutRange + * @tc.desc The parent component changes location and space of layout, affecting layout of child components, + * parent component setting padding, the remaining layout space does not meet the requirements + */ + it('testWrapReverseChildfixedParentPaddingOutRange', 0, async function (done) { + console.info('new testWrapReverseChildfixedParentPaddingOutRange START'); + globalThis.value.message.notify({name:'height', value:300}) + globalThis.value.message.notify({name:'width', value:500}) + globalThis.value.message.notify({name:'padding', value:30}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('FlexWrapReverseTest4'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.WrapReverse'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start'); + let locationText1 = CommonFunc.getComponentRect('WrapReverseTest10'); + let locationText2 = CommonFunc.getComponentRect('WrapReverseTest11'); + let locationText3 = CommonFunc.getComponentRect('WrapReverseTest12'); + let locationFlex = CommonFunc.getComponentRect('FlexWrapReverseTest4'); + expect(Math.round(locationFlex.right - locationText1.right)).assertEqual(vp2px(30)); + expect(locationText1.left).assertEqual(locationText2.right); + expect(Math.round(locationText2.left - locationFlex.left)).assertEqual(vp2px(170)); + expect(locationText3.left).assertEqual(locationText1.left); + expect(locationText3.right).assertEqual(locationText1.right); + expect(locationText1.top).assertEqual(locationText2.top); + expect(Math.round(locationText2.top - locationFlex.top)).assertEqual(vp2px(30)); + expect(locationText3.top).assertEqual(locationText2.bottom); + expect(Math.round(locationFlex.bottom - locationText3.bottom)).assertEqual(vp2px(20)); + expect(Math.round(locationText3.right - locationText3.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)) + .assertEqual(Math.round(locationText2.right - locationText2.left)); + expect(Math.round(locationText1.right - locationText1.left)).assertEqual(vp2px(150)); + expect(Math.round(locationText1.bottom - locationText1.top)).assertEqual(vp2px(50)); + expect(Math.round(locationText2.bottom - locationText2.top)).assertEqual(vp2px(100)); + expect(Math.round(locationText3.bottom - locationText3.top)).assertEqual(vp2px(150)); + console.info('new testWrapReverseChildfixedParentPaddingOutRange END'); + done(); + }); + }) +} \ No newline at end of file