diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7647d9448adafa03a23f2e09e3a27761b10852e --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.ets @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_04{ + @State testMargin: number = 0 + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexMar01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexMar02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexMar03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexMar04') + } + .width(200) + .height(400) + .margin(this.testMargin) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_FlexMar_Container01') + } + .width('100%') + .height('100%') + .key('Column_Align_SpaceAround_FlexMar_Container01') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ee9a0b1fe58aa425d36cffb85ecf72cadd29da5 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.ets @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_03{ + @State testPadding: number = 0; + @State testMargin: number = 0; + messageManager:MessageManager = new MessageManager(); + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('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); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexMarPad01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexMarPad02') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexMarPad03') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexMarPad04') + } + .width(200) + .height(540) + .padding(this.testPadding) + .margin(this.testMargin) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_FlexMarPad_Container01') + } + .width('100%') + .height('100%') + .key('Column_Align_SpaceAround_FlexMarPad_Container01') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4f64fa1c44a9ab7b5c77257ebee2290a71ea600 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.ets @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_02{ + @State testPadding: number = 0 + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_02 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'padding') { + this.testPadding = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexPad01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexPad02') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexPad03') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexPad04') + } + .width(200) + .height(540) + .padding(this.testPadding) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_FlexPad_Container01') + } + .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/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8cb9990dbae633283cc554479482a75a7883b3e --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_01{ + @State testWidth: number = 400 + @State testHeight: number = 100 + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'width') { + this.testWidth = message.value; + } + if (message.name == 'height') { + this.testHeight = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexSize01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexSize02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_FlexSize03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_FlexSize04') + } + .width(this.testWidth) + .height(this.testHeight) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_FlexSize_Container01') + } + .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/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.ets new file mode 100644 index 0000000000000000000000000000000000000000..19ca01fbfd13c46a385af0da6851d34e3e2719bd --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_04{ + @State testMargin: number = 0 + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'margin') { + this.testMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1') + .width(150) + .height(50) + .backgroundColor(0xD2B48C) + .margin(this.testMargin) + .key('AlignContent_SpaceAround_TextMar01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextMar02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_TextMar03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextMar04') + } + .width(200) + .height(400) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_TextMar_Container01') + } + .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/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5ed5a44c478812b4a30dd9065dd47eedf0e2797 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_05{ + @State testOffset: object = {x:0, y:0} + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'offset') { + this.testOffset = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1') + .width(150) + .height(50) + .backgroundColor(0xD2B48C) + .offset(this.testOffset) + .key('AlignContent_SpaceAround_TextOffset01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextOffset02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_TextOffset03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextOffset04') + } + .width(200) + .height(400) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_TextOffset_Container01') + } + .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/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2e759516ae0bea6b9cabe7f67d6432e03c99cee --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_06{ + @State testHeight: number = 50 + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'height') { + this.testHeight = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1') + .width(150) + .height(this.testHeight) + .backgroundColor(0xD2B48C) + .key('AlignContent_SpaceAround_TextSize01') + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextSize02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_TextSize03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextSize04') + } + .width(200) + .height(400) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_TextSize_Container01') + } + .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/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d26da4aa93139a96210189500fe5da017e17940 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2023-2030 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 FlexAlignContent_SpaceAround_07{ + @State testVisibility: number = Visibility.Visible + messageManager:MessageManager = new MessageManager() + + onPageShow() { + console.info('FlexAlignContent_SpaceAround_01 onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'visibility') { + this.testVisibility = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build(){ + Column({space:30}){ + Flex({wrap:FlexWrap.Wrap, alignContent:FlexAlign.SpaceAround}){ + Text('1') + .width(150) + .height(50) + .backgroundColor(0xD2B48C) + .key('AlignContent_SpaceAround_TextVisibility01') + .visibility(this.testVisibility) + Text('2').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextVisibility02') + Text('3').width(150).height(50).backgroundColor(0xD2B48C).key('AlignContent_SpaceAround_TextVisibility03') + Text('4').width(150).height(100).backgroundColor(0xF5DEB3).key('AlignContent_SpaceAround_TextVisibility04') + } + .width(200) + .height(400) + .backgroundColor(0xAFEEEE) + .key('FlexAlign_SpaceAround_TextVisibility_Container01') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..edcaa39a17cbf061d06d5199c1610d8a2ff4bfb2 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.test.ets @@ -0,0 +1,88 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_FlexMarTest() { + describe('Flex_AlignContent_SpaceAround_FlexMarTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_FlexMar beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_FlexMar state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_FlexMar" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_FlexMar state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_FlexMar page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_FlexMar page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_FlexMarTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0100 + * @tc.name alignContent_SpaceAround_FlexMargin + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the height and width of parent component changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0100', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0100] START'); + globalThis.value.message.notify({name:'margin', value:10}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMar01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMar02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMar03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMar04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexMar_Container01'); + let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceAround_FlexMar_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexMar_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(flexContainer.top - columnContainer.top).assertEqual(vp2px(10)); //margin =10 + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + + expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + + expect(firstText.top - flexContainer.top).assertEqual(flexContainer.bottom - fourthText.bottom); + expect(firstText.top - flexContainer.top).assertEqual((secondText.top - firstText.bottom) / 2); //上下间距是组件间距的一半 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0100] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e01cb1c0da1e5e0eb27a05838999ebd11bdb312d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.test.ets @@ -0,0 +1,129 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_FlexMarPadTest() { + describe('Flex_AlignContent_SpaceAround_FlexMarPadTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_FlexMarPad beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_FlexMarPad state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_FlexMarPad" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_FlexMarPad state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_FlexMarPad page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_FlexMarPad page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_FlexMarPadTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0200 + * @tc.name alignContent_SpaceAround_FlexMarPad + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when the padding and margin of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0200', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0200] START'); + globalThis.value.message.notify({name:'padding', value:50}); + globalThis.value.message.notify({name:'margin', value:20}); + + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexMarPad_Container01'); + let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceAround_FlexMarPad_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexMarPad_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200 + expect(flexContainer.top - columnContainer.top).assertEqual(vp2px(20)); //margin =20 + expect(firstText.top - flexContainer.top).assertEqual(vp2px(50)); + expect(firstText.left - flexContainer.left).assertEqual(vp2px(50)); //padding =50 + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + + expect(firstText.bottom).assertEqual(secondText.top); + expect(secondText.bottom).assertEqual(thirdText.top); + expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距 + expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(10)); //行首贴边行尾溢出 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0200] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0300 + * @tc.name alignContent_SpaceAround_FlexMarPad + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the padding and margin of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0300', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0300] START'); + globalThis.value.message.notify({name:'margin', value:30}) + globalThis.value.message.notify({name:'padding', value:10}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexMarPad04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexMarPad_Container01'); + let columnContainer = CommonFunc.getComponentRect('Column_Align_SpaceAround_FlexMarPad_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexMarPad_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200 + + expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //padding =10 + expect(flexContainer.top - columnContainer.top).assertEqual(vp2px(30)); //margin =30 + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(flexContainer.bottom - fourthText.bottom).assertEqual(firstText.top - flexContainer.top); //行首行尾间距相等 + + expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + expect((thirdText.top - secondText.bottom) / 2).assertEqual(firstText.top - flexContainer.top - vp2px(10)) + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0300] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bd8b28b55c8c63727dab1e34ae3bd5b2041b8f4 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.test.ets @@ -0,0 +1,122 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_FlexPadTest() { + describe('Flex_AlignContent_SpaceAround_FlexPadTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_FlexPad beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_FlexPad state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_FlexPad" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_FlexPad state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_FlexPad page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_FlexPad page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_FlexPadTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0400 + * @tc.name alignContent_SpaceAround_FlexPad + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when the padding and margin of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0400', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0400] START'); + globalThis.value.message.notify({name:'padding', value:50}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexPad_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexPad_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200 + + expect(firstText.left - flexContainer.left).assertEqual(vp2px(50)); //padding =50 + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + + expect(firstText.bottom).assertEqual(secondText.top); + expect(secondText.bottom).assertEqual(thirdText.top); + expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距 + expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(10)); //行首贴边行尾溢出 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0400] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0500 + * @tc.name alignContent_SpaceAround_FlexPad + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the padding of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0500', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0500] START'); + globalThis.value.message.notify({name:'padding', value:10}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexPad04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexPad_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexPad_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(150)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(200)); //四个子组件的高度分别为50、100、150、200 + + expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //padding =10 + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(flexContainer.bottom - fourthText.bottom).assertEqual(firstText.top - flexContainer.top); //行首行尾间距相等 + + expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + expect((thirdText.top - secondText.bottom) / 2).assertEqual(firstText.top - flexContainer.top - vp2px(10)); + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0500] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdb9eb76b834598257bd4cf32937084bd6f4a14a --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.test.ets @@ -0,0 +1,126 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_FlexSizeTest() { + describe('Flex_AlignContent_SpaceAround_FlexSizeTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_FlexSize beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_FlexSize state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_FlexSize" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_FlexSize state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_FlexSize page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_FlexSize page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_FlexSizeTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0600 + * @tc.name alignContent_SpaceAround_FlexSize + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the height and width of parent component changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0600', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0600] START'); + globalThis.value.message.notify({name:'width', value:200}) + globalThis.value.message.notify({name:'height', value:400}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexSize_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexSize_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + + expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + expect(firstText.top - flexContainer.top).assertEqual(flexContainer.bottom - fourthText.bottom); + expect(firstText.top - flexContainer.top).assertEqual((secondText.top - firstText.bottom) / 2); //上下间距是组件间距的一半 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0600] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0700 + * @tc.name alignContent_SpaceAround_FlexSize + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when the height and width of parent component changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0700', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0700] START'); + globalThis.value.message.notify({name:'width', value:200}) + globalThis.value.message.notify({name:'height', value:250}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_FlexSize04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_FlexSize_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_FlexSize_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(firstText.bottom).assertEqual(secondText.top); + expect(secondText.bottom).assertEqual(thirdText.top); + expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距 + + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + expect(firstText.top).assertEqual(flexContainer.top); + expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(50)); //行首贴边行尾溢出 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0700] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac76f16758b181522de85fe1e23efedee2819177 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.test.ets @@ -0,0 +1,121 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_TextMarTest() { + describe('Flex_AlignContent_SpaceAround_TextMarTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_TextMar beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_TextMar state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_TextMar" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_TextMar state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_TextMar page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_TextMar page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_TextMarTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0800 + * @tc.name alignContent_SpaceAround_TextMargin + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when the padding and margin of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0800', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0800] START'); + globalThis.value.message.notify({name:'margin', value:65}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextMar_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextMar_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(firstText.left - flexContainer.left).assertEqual(vp2px(65)); //margin =65 + expect(flexContainer.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + + expect(secondText.top - firstText.bottom).assertEqual(vp2px(65)); + expect(secondText.bottom).assertEqual(thirdText.top); + expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距 + expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(30)); //行首贴边行尾溢出 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0800] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0900 + * @tc.name alignContent_SpaceAround_TextMargin + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the padding of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0900', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0900] START'); + globalThis.value.message.notify({name:'margin', value:10}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextMar04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextMar_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextMar_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(firstText.left - flexContainer.left).assertEqual(vp2px(10)); //margin =10 + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(firstText.top - flexContainer.top - vp2px(10)).assertEqual(flexContainer.bottom - fourthText.bottom); + + expect(secondText.top - firstText.bottom - vp2px(10)).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + expect(flexContainer.bottom - fourthText.bottom).assertEqual((fourthText.top - thirdText.bottom) / 2); //行首行尾距离是组件间距的一半 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_0900] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..75104f40b7713c086f122830001032ada561d5ad --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.test.ets @@ -0,0 +1,93 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_TextOffsetTest() { + describe('Flex_AlignContent_SpaceAround_TextOffsetTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_TextOffset beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_TextOffset state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_TextOffset" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_TextOffset state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_TextOffset page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_TextOffset page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_TextOffsetTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1000 + * @tc.name alignContent_SpaceAround_TextOffset + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when position of first child component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1000', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1000] START'); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset02'); + let distanceBefore = secondText.top - firstText.bottom; + let secondTextTop = secondText.top; + let firstTextTop = firstText.top; + let firstTextLeft = firstText.left; + globalThis.value.message.notify({name:'offset', value:{x:10, y:10}}) + await CommonFunc.sleep(3000); + firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset01'); + secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextOffset04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextOffset_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextOffset_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(50)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为50、100、50、100 + + expect(firstText.top - firstTextTop).assertEqual(vp2px(10)); + expect(firstText.left - firstTextLeft).assertEqual(vp2px(10)); //offset =10 + + expect(secondText.top).assertEqual(secondTextTop); + expect(flexContainer.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(distanceBefore); + expect(flexContainer.bottom - fourthText.bottom).assertEqual(distanceBefore / 2); //其余组件行间距相等,未改变 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1000] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce0369334744af5cdde63cfd0034a8185a74615c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.test.ets @@ -0,0 +1,126 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_TextSizeTest() { + describe('Flex_AlignContent_SpaceAround_TextSizeTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_TextSize beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_TextSize state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_TextSize" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_TextSize state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_TextSize page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_TextSize page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("Flex_AlignContent_SpaceAround_TextSizeTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1100 + * @tc.name alignContent_SpaceAround_TextSize + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the height and width of parent component changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1100', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1100] START'); + globalThis.value.message.notify({name:'height', value:70}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextSize_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextSize_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(firstText.bottom - firstText.top).assertEqual(vp2px(70)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为70、100、50、100 + + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + + expect(secondText.top - firstText.bottom).assertEqual(thirdText.top - secondText.bottom); + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //行间距相等 + + expect(firstText.top - flexContainer.top).assertEqual(flexContainer.bottom - fourthText.bottom); + expect(firstText.top - flexContainer.top).assertEqual((secondText.top - firstText.bottom) / 2); + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1100] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1200 + * @tc.name alignContent_SpaceAround_TextSize + * @tc.desc The size of the parent component in the cross direction is not enough for the layout + * of the child components when the height and width of parent component changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1200', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1200] START'); + globalThis.value.message.notify({name:'height', value:200}) + await CommonFunc.sleep(3000); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextSize04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextSize_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextSize_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + expect(firstText.bottom - firstText.top).assertEqual(vp2px(200)); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //四个子组件的高度分别为200、100、50、100 + + expect(firstText.bottom).assertEqual(secondText.top); + expect(secondText.bottom).assertEqual(thirdText.top); + expect(thirdText.bottom).assertEqual(fourthText.top); //无行间距 + + expect(firstText.left).assertEqual(secondText.left); + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); //子组件靠左 + + expect(firstText.top).assertEqual(flexContainer.top); + expect(fourthText.bottom - flexContainer.bottom).assertEqual(vp2px(50)); //行首贴边行尾溢出 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1200] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b87ea7884cf621f81f5081b4efd583b12d21cc1 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.test.ets @@ -0,0 +1,124 @@ + +/** + * Copyright (c) 2023-2030 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 '@ohos.router'; +import CommonFunc from '../../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager'; +export default function flex_AlignContent_SpaceAround_TextVisibilityTest() { + describe('Flex_AlignContent_SpaceAround_TextVisibilityTest', function () { + beforeEach(async function (done) { + console.info("Flex_AlignContent_SpaceAround_TextVisibility beforeEach start"); + let options = { + url: 'MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get Flex_AlignContent_SpaceAround_TextVisibility state pages:" + JSON.stringify(pages)); + if (!("Flex_AlignContent_SpaceAround_TextVisibility" == pages.name)) { + console.info("get Flex_AlignContent_SpaceAround_TextVisibility state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push Flex_AlignContent_SpaceAround_TextVisibility page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push Flex_AlignContent_SpaceAround_TextVisibility page error:" + err); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(1000); + globalThis.value.message.notify({name:'visibility', value:Visibility.Visible}); + console.info("Flex_AlignContent_SpaceAround_TextVisibilityTest after each called"); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1300 + * @tc.name alignContent_SpaceAround_TextVisibility + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the visibility of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1300', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1300] START'); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility02'); + let distanceBefore = secondText.top - firstText.bottom; + globalThis.value.message.notify({name:'visibility', value:Visibility.Hidden}); + await CommonFunc.sleep(3000); + secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextVisibility_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextVisibility_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //三个子组件的高度分别为100、50、100 + + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + expect(secondText.top - flexContainer.top).assertEqual(distanceBefore * 1.5 + vp2px(50)); //text1占位 + + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //剩余子组件行间距相等 + expect(thirdText.top - secondText.bottom).assertEqual(distanceBefore); //子组件距离不变 + expect(flexContainer.bottom -fourthText.bottom).assertEqual(distanceBefore / 2); //行首距离为子组件距离一半 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1300] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1400 + * @tc.name alignContent_SpaceAround_TextVisibility + * @tc.desc The size of the parent component in the cross direction meets the layout + * of the child components when the visibility of parent component was changed + */ + it('SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1400', 0, async function (done) { + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1400] START'); + let firstText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility01'); + let secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility02'); + let distanceBefore = secondText.top - firstText.bottom; + globalThis.value.message.notify({name:'visibility', value:Visibility.None}) + await CommonFunc.sleep(3000); + secondText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility02'); + let thirdText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility03'); + let fourthText = CommonFunc.getComponentRect('AlignContent_SpaceAround_TextVisibility04'); + let flexContainer = CommonFunc.getComponentRect('FlexAlign_SpaceAround_TextVisibility_Container01'); + let flexContainerStrJson = getInspectorByKey('FlexAlign_SpaceAround_TextVisibility_Container01'); + let flexContainerObj = JSON.parse(flexContainerStrJson); + expect(flexContainerObj.$type).assertEqual('Flex'); + expect(flexContainerObj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap'); + expect(flexContainerObj.$attrs.constructor.alignContent).assertEqual('FlexAlign.SpaceAround'); + + expect(secondText.bottom - secondText.top).assertEqual(vp2px(100)); + expect(thirdText.bottom - thirdText.top).assertEqual(vp2px(50)); + expect(fourthText.bottom - fourthText.top).assertEqual(vp2px(100)); //三个子组件的高度分别为100、50、100 + + expect(secondText.left).assertEqual(thirdText.left); + expect(thirdText.left).assertEqual(fourthText.left); + expect(fourthText.left).assertEqual(flexContainer.left); + + expect(thirdText.top - secondText.bottom).assertEqual(fourthText.top - thirdText.bottom); //剩余子组件行间距相等 + expect(thirdText.top - secondText.bottom).assertLarger(distanceBefore); //行距大于设置前 + + expect(secondText.top - flexContainer.top).assertEqual(flexContainer.bottom - fourthText.bottom); //text1不参与占位 + expect(secondText.top - flexContainer.top).assertEqual((thirdText.top - secondText.bottom) / 2); //行首行尾间距为子组件间距一半 + console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEAROUND_1400] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets index 816950d4215a015b992299c3599a482bb7a7fcfd..b4119a31cff515443a112aab29d74660259a24ff 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets @@ -70,6 +70,22 @@ import AlignEnd_AddLayoutWeight from './Flex/justifyContent/End/AlignEnd_AddLayoutWeight.test.ets'; import AlignEnd_AddOneWidth from './Flex/justifyContent/End/AlignEnd_AddOneWidth.test.ets'; import AlignEnd_AddOneMargin from './Flex/justifyContent/End/AlignEnd_AddOneMargin.test.ets'; + import flex_AlignContent_SpaceBetween_FlexSizeTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexSize.test'; + import flex_AlignContent_SpaceBetween_FlexPadTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexPad.test'; + import flex_AlignContent_SpaceBetween_FlexMarTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMar.test'; + import flex_AlignContent_SpaceBetween_FlexMarPadTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_FlexMarPad.test'; + import flex_AlignContent_SpaceBetween_TextSizeTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextSize.test'; + import flex_AlignContent_SpaceBetween_TextMarTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextMar.test'; + import flex_AlignContent_SpaceBetween_TextOffsetTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test'; + import flex_AlignContent_SpaceBetween_TextVisibilityTest from './Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextVisibility.test'; + import flex_AlignContent_SpaceAround_FlexSizeTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize.test'; + import flex_AlignContent_SpaceAround_FlexPadTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad.test'; + import flex_AlignContent_SpaceAround_FlexMarTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar.test'; + import flex_AlignContent_SpaceAround_FlexMarPadTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad.test'; + import flex_AlignContent_SpaceAround_TextSizeTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize.test'; + import flex_AlignContent_SpaceAround_TextMarTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar.test'; + import flex_AlignContent_SpaceAround_TextOffsetTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset.test'; + import flex_AlignContent_SpaceAround_TextVisibilityTest from './Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility.test'; export default function testsuite() { flexBase_AutoJsunit() flexPadding_AutoJsunit() @@ -129,4 +145,20 @@ export default function testsuite() { AlignEnd_AddLayoutWeight() AlignEnd_AddOneWidth() AlignEnd_AddOneMargin() + flex_AlignContent_SpaceBetween_FlexSizeTest(); + flex_AlignContent_SpaceBetween_FlexPadTest(); + flex_AlignContent_SpaceBetween_FlexMarTest(); + flex_AlignContent_SpaceBetween_FlexMarPadTest(); + flex_AlignContent_SpaceBetween_TextSizeTest(); + flex_AlignContent_SpaceBetween_TextMarTest(); + flex_AlignContent_SpaceBetween_TextOffsetTest(); + flex_AlignContent_SpaceBetween_TextVisibilityTest(); + flex_AlignContent_SpaceAround_FlexSizeTest(); + flex_AlignContent_SpaceAround_FlexPadTest(); + flex_AlignContent_SpaceAround_FlexMarTest(); + flex_AlignContent_SpaceAround_FlexMarPadTest(); + flex_AlignContent_SpaceAround_TextSizeTest(); + flex_AlignContent_SpaceAround_TextMarTest(); + flex_AlignContent_SpaceAround_TextOffsetTest(); + flex_AlignContent_SpaceAround_TextVisibilityTest(); } \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json index 7063bbe0b1e8101bfb8192201cd0eae1bbca3310..29879ab4a063812f63cf0c8dbab5223dd39fb21c 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json @@ -58,6 +58,22 @@ "MainAbility/pages/Flex/justifyContent/End/AlignEnd_AddVisibility", "MainAbility/pages/Flex/justifyContent/End/AlignEnd_AddLayoutWeight", "MainAbility/pages/Flex/justifyContent/End/AlignEnd_AddOneWidth", - "MainAbility/pages/Flex/justifyContent/End/AlignEnd_AddOneMargin" + "MainAbility/pages/Flex/justifyContent/End/AlignEnd_AddOneMargin", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexSize", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexPad", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMar", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_FlexMarPad", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextSize", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextMar", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextOffset", + "MainAbility/pages/Flex/alignContent/SpaceBetween/Flex_AlignContent_SpaceBetween_TextVisibility", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexSize", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexPad", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMar", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_FlexMarPad", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextSize", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextMar", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextOffset", + "MainAbility/pages/Flex/alignContent/SpaceAround/Flex_AlignContent_SpaceAround_TextVisibility" ] } \ No newline at end of file