diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContentFlex_Center.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContentFlex_Center.ets new file mode 100644 index 0000000000000000000000000000000000000000..30ff027553a62dd128d3b86b9e6b13fced7cbb5d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContentFlex_Center.ets @@ -0,0 +1,57 @@ +/* +* 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 AlignContentFlex_Center { + @State flexHeight: number = 300; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignContentFlex 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.flexHeight = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Text('AlignContentFlex_Center').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexCenter_flex001_1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexCenter_flex001_2') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexCenter_flex001_3') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexCenter_flex001_4') + } + .key('AlignContentFlexCenter_flex001') + .width(400) + .height(this.flexHeight) + .backgroundColor(0xAFEEEE) + + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.ets new file mode 100644 index 0000000000000000000000000000000000000000..aae362e8270df8febaced94b9a9f447d97b3d8d7 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.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 AlignContent_Center_FlexP_Fixed_Margin { + @State textMargin: number = 5; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignContentFlex 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.textMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Margin_1') + .margin(this.textMargin) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Margin_2') + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Margin_3') + Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Margin_4') + } + .key('AlignContent_Center_FlexP_Fixed_Margin_flex001') + .width(500) + .height(400) + .backgroundColor(0xAFEEEE) + + } + .width('100%') + .alignItems(HorizontalAlign.Start) + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3ddbf117182f777ddeb15d62679ea51c7376a5f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.ets @@ -0,0 +1,42 @@ +/* +* 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. + */ + +@Entry +@Component +struct AlignContent_Center_FlexP_Fixed_Offset { + alignContent: number + + build() { + Column() { + Text('AlignContent_Center_FlexP_Fixed_Offset').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Offset_1') + .offset({ x: 15, y: 30 }) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Offset_2') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Offset_3') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Offset_4') + } + .key('AlignContent_Center_FlexP_Fixed_Offset_flex001') + .width(500) + .height(400) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3da8fc8d6fd06fbd172adc3e970c85efe4fc80f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.ets @@ -0,0 +1,58 @@ +/* +* 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 AlignContent_Center_FlexP_Fixed_Visibility { + @State textVisibility : number = Visibility.Visible; + messageManager:MessageManager = new MessageManager(); + onPageShow() { + console.info('AlignContentFlex 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.textVisibility = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Text('AlignContent_Center_FlexP_Fixed_Visibility').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Visibility_1') + .visibility(this.textVisibility) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Visibility_2') + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContent_Center_FlexP_Fixed_Visibility_3') + Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContent_Center_FlexP_Fixed_Visibility_4') + } + .key('AlignContent_Center_FlexP_Fixed_Visibility_flex001') + .width(500) + .height(400) + .backgroundColor(0xAFEEEE) + + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.ets new file mode 100644 index 0000000000000000000000000000000000000000..403cb593310378a42e7fb911df165fd8b1b88cf5 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.ets @@ -0,0 +1,57 @@ +/* +* 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 AlignContent_Center_FlexP_fixed { + @State textHeight: number = 50; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignContentFlex 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.textHeight = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Text('AlignContent_Center_FlexP_fixed').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(this.textHeight).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterP_fixed_1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexCenterP_fixed_2') + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterP_fixed_3') + Text('4').width(150).height(200).backgroundColor(0xD2B48C).key('AlignContentFlexCenterP_fixed_4') + } + .key('AlignContentFlexCenterP_fixed_flex001') + .width(500) + .height(400) + .backgroundColor(0xAFEEEE) + + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.ets new file mode 100644 index 0000000000000000000000000000000000000000..f677736aa4f51b32b9d5e8ee8fcb58563488bf5f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.ets @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct AlignContent_FlexAlign_Center_Margin { + + build() { + Column() { + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterMargin_flex_1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexCenterMargin_flex_2') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexCenterMargin_flex_3') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterMargin_flex_4') + + } + .key('AlignContentFlexCenterMargin_flex') + .width(400) + .height(360) + .backgroundColor(0xAFEEEE) + .margin(15) + } + .width('100%') + .alignItems(HorizontalAlign.Start) + .key('AlignContentFlexCenterMargin_Column') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c9725ce9f82e4ec716b3962d807ecde1cd8424c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.ets @@ -0,0 +1,68 @@ + +/* +* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MessageManager,Callback } from '../../../../common/MessageManager'; +@Entry +@Component +struct AlignContent_FlexAlign_Center_Margin_padding { + @State flexPadding: number = 10; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignContentFlex 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.flexPadding = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Column(){ + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3) + .key('AlignContentFlexCenterMargin&padding_flex001_1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C) + .key('AlignContentFlexCenterMargin&padding_flex001_2') + Text('3').width(150).height(150).backgroundColor(0xD2B48C) + .key('AlignContentFlexCenterMargin&padding_flex001_3') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3) + .key('AlignContentFlexCenterMargin&padding_flex001_4') + } + .key('AlignContentFlexCenterMargin&padding_flex001') + .width(400) + .height(360) + .backgroundColor(0xAFEEEE) + .margin(10) + .padding(this.flexPadding) + + }.key('AlignContentFlexCenterMargin&padding_Column_1') + } + .width('100%') + .alignItems(HorizontalAlign.Start) + .key('AlignContentFlexCenterMargin&padding_Column') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bd21b446c539307820c7fbec6d83508f4d1cd74 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.ets @@ -0,0 +1,58 @@ +/* +* 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 AlignContent_FlexAlign_Center_padding { + @State flexPadding: number = 10; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignContentFlex 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.flexPadding = message.value; + } + } + this.messageManager.registerCallback(callback); + } + + build() { + Column() { + Text('AlignContent_FlexAlign_Center_padding').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ + direction: FlexDirection.Row, + wrap: FlexWrap.Wrap, + alignContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterPadding_flex001_1') + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key('AlignContentFlexCenterPadding_flex001_2') + Text('3').width(150).height(150).backgroundColor(0xD2B48C).key('AlignContentFlexCenterPadding_flex001_3') + Text('4').width(150).height(200).backgroundColor(0xF5DEB3).key('AlignContentFlexCenterPadding_flex001_4') + } + .key('AlignContentFlexCenterPadding_flex001') + .width(400) + .height(360) + .backgroundColor(0xAFEEEE) + .padding(this.flexPadding) + + }.width('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContentFlex_Center.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContentFlex_Center.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bed624a49338ac9f0a2e42204ee26f985a3fa98 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContentFlex_Center.test.ets @@ -0,0 +1,158 @@ +/* + * 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 AlignContentFlex_Center() { + + describe('AlignContentFlex_CenterTest', function () { + beforeEach(async function (done) { + console.info("AlignContentFlex_CenterTest beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContentFlex_Center', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContentFlex_Center state success " + JSON.stringify(pages)); + if (!("AlignContentFlex_Center" == pages.name)) { + console.info("get AlignContentFlex_Center state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContentFlex_Center page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContentFlex_Center page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContentFlex_CenterTest beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + console.info("AlignContentFlex_Center after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0100 + * @tc.name testAlignContentCenterFlexHeightSatisfy + * @tc.desc The Flex component alignContent property is set to FlexAlign.Center, and the height of the Flex + * component meets the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexHeightSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexHeightSatisfy START'); + globalThis.value.message.notify({ name:'height', value:360 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenter_flex001'); + let obj = JSON.parse(strJson); + console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj)); + console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor)); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_4'); + + console.log('AlignContentFlexCenter_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex001.top); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + console.info('testAlignContentCenterFlexHeightSatisfy END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_Center_0200 + * @tc.name testAlignContentCenterFlexHeightNoSatisfy + * @tc.desc The AlignContent property of the Flex component is set to FlexAlign.Center, and the height of the + * Flex component does not meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexHeightNoSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexHeightNoSatisfy START'); + globalThis.value.message.notify({ name:'height', value:250 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenter_flex001'); + let obj = JSON.parse(strJson); + let AlignContentFlexCenter_flex002 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenter_flex001_4'); + + console.log('AlignContentFlexCenter_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex002)) + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_1.top).assertEqual(AlignContentFlexCenter_flex002.top); + + expect(AlignContentFlexCenter_4.bottom).assertLarger(AlignContentFlexCenter_flex002.bottom); + + expect(AlignContentFlexCenter_2.bottom).assertEqual(AlignContentFlexCenter_4.top); + console.info('testAlignContentCenterFlexHeightNoSatisfy END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..adf6c94a5d798bc11b79f069128c1978c8df542f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin.test.ets @@ -0,0 +1,165 @@ +/* + * 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 AlignContent_Center_FlexP_Fixed_Margin() { + + describe('AlignContent_Center_FlexP_Fixed_Margin', function () { + beforeEach(async function (done) { + console.info("AlignContent_Center_FlexP_Fixed_Margin beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Margin', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_Center_FlexP_Fixed_Margin state success " + JSON.stringify(pages)); + if (!("AlignContent_Center_FlexP_Fixed_Margin" == pages.name)) { + console.info("get AlignContent_Center_FlexP_Fixed_Margin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_Center_FlexP_Fixed_Margin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_Center_FlexP_Fixed_Margin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_Center_FlexP_Fixed_Margin beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + + console.info("AlignContent_Center_FlexP_Fixed_Margin after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_1100 + * @tc.name testAlignContentCenterFlexfixedMarginSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, and set the margin for + * the subcomponents to meet the height requirements of the flex container + */ + + it('testAlignContentCenterFlexfixedMarginSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedMarginSatisfy START'); + globalThis.value.message.notify({ name:'margin', value:10 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Margin_flex001'); + let obj = JSON.parse(strJson); + console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj)); + console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor)); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_4'); + + console.log('AlignContent_Center_FlexP_Fixed_Margin_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_2.top - AlignContentFlexCenter_flex001.top); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_2.top)).assertEqual(vp2px(10)); + expect(Math.round(AlignContentFlexCenter_2.left - AlignContentFlexCenter_1.right)).assertEqual(vp2px(10)); + + expect(Math.round((AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom)*10)/10).assertEqual(vp2px(25)); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_3.bottom); + console.info('testAlignContentCenterFlexfixedMarginSatisfy END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_1200 + * @tc.name testAlignContentCenterFlexfixedMarginNoSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, and set the margin for + * the subcomponents to prevent the flex container from meeting the height requirements. + */ + + it('testAlignContentCenterFlexfixedMarginNoSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedMarginNoSatisfy START'); + globalThis.value.message.notify({ name:'margin', value:100 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Margin_flex001'); + let obj = JSON.parse(strJson); + let AlignContentFlexCenter_flex002 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Margin_4'); + + console.log('AlignContent_Center_FlexP_Fixed_Margin_flex002 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex002)) + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex002.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_1.left - AlignContentFlexCenter_flex002.left)).assertEqual(vp2px(100)); + + expect(AlignContentFlexCenter_4.bottom).assertLarger(AlignContentFlexCenter_flex002.bottom); + + expect(Math.round(AlignContentFlexCenter_3.top - AlignContentFlexCenter_1.bottom)).assertEqual(vp2px(100)); + console.info('testAlignContentCenterFlexfixedMarginNoSatisfy END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..535e3c439d4761e8a3b589706a6305f69697c798 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset.test.ets @@ -0,0 +1,112 @@ +/* + * 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' + +export default function AlignContent_Center_FlexP_Fixed_Offset() { + + describe('AlignContent_Center_FlexP_Fixed_Offset', function () { + beforeEach(async function (done) { + console.info("AlignContent_Center_FlexP_Fixed_Offset beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Offset', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_Center_FlexP_Fixed_Offset state success " + JSON.stringify(pages)); + if (!("AlignContent_Center_FlexP_Fixed_Offset" == pages.name)) { + console.info("get AlignContent_Center_FlexP_Fixed_Offset state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_Center_FlexP_Fixed_Offset page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_Center_FlexP_Fixed_Offset page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_Center_FlexP_Fixed_Offset beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + + console.info("AlignContent_Center_FlexP_Fixed_Offset after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_1000 + * @tc.name testAlignContentCenterFlexPfixedOffset + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center and set the offsize for + * the subcomponent + */ + + it('testAlignContentCenterFlexPfixedOffset', 0, async function (done) { + console.info('testAlignContentCenterFlexPfixedOffset START'); + let strJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Offset_flex001'); + let obj = JSON.parse(strJson); + console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj)); + console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor)); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Offset_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Offset_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Offset_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Offset_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Offset_4'); + + console.log('AlignContent_Center_FlexP_Fixed_Offset_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round(AlignContentFlexCenter_2.left - AlignContentFlexCenter_flex001.left)).assertEqual(vp2px(150)); + expect(Math.round((AlignContentFlexCenter_4.top - AlignContentFlexCenter_flex001.top)*10)/10).assertEqual(vp2px(175)); + expect(Math.round((AlignContentFlexCenter_1.right - AlignContentFlexCenter_2.left)*10)/10).assertEqual(vp2px(15)); + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_2.top)).assertEqual(vp2px(30)); + + expect(AlignContentFlexCenter_2.top - AlignContentFlexCenter_flex001.top) + .assertEqual(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom); + expect(Math.round((AlignContentFlexCenter_2.top - AlignContentFlexCenter_flex001.top)*10)/10) + .assertEqual(vp2px(25)); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_3.bottom) + console.info('testAlignContentCenterFlexPfixedOffset END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25f6f455273252a7e5efe0dfe7237af05bcb1b23 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility.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 AlignContent_Center_FlexP_Fixed_Visibility() { + + describe('AlignContent_Center_FlexP_Fixed_Visibility', function () { + beforeEach(async function (done) { + console.info("AlignContent_Center_FlexP_Fixed_Visibility beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_Fixed_Visibility', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_Center_FlexP_Fixed_Visibility state success " + JSON.stringify(pages)); + if (!("AlignContent_Center_FlexP_Fixed_Visibility" == pages.name)) { + console.info("get AlignContent_Center_FlexP_Fixed_Visibility state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_Center_FlexP_Fixed_Visibility page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_Center_FlexP_Fixed_Visibility page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_Center_FlexP_Fixed_Visibility beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + console.info("AlignContent_Center_FlexP_Fixed_Visibility after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_1300 + * @tc.name testAlignContentCenterFlexfixedVisibilityHidden + * @tc.desc The AlignContent property of the Flex component is set to FlexAlign. Center, and the visibility + * property of the sub component is set to Visibility.Hidden. + */ + + it('testAlignContentCenterFlexfixedVisibilityHidden', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedVisibilityHidden START'); + globalThis.value.message.notify({ name:'visibility', value:Visibility.Hidden }) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Visibility_flex001'); + let obj = JSON.parse(strJson); + let textStrJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Visibility_1'); + let textObj = JSON.parse(textStrJson); + console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj)); + console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor)); + console.info('Text1 textObj.$attrs is:' + JSON.stringify(textObj.$attrs)); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_flex001'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_4'); + + console.log('AlignContent_Center_FlexP_Fixed_Visibility_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + expect(textObj.$attrs.visibility).assertEqual("Visibility.Hidden"); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_3.top - AlignContentFlexCenter_flex001.top); + + expect(Math.round((AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom)*10)/10).assertEqual(vp2px(25)); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_3.bottom); + + expect(Math.round(AlignContentFlexCenter_2.left - AlignContentFlexCenter_flex001.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.top - AlignContentFlexCenter_2.top)).assertEqual(vp2px(150)); + console.info('testAlignContentCenterFlexfixedVisibilityHidden END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_1400 + * @tc.name testAlignContentCenterFlexfixedVisibilityNone + * @tc.desc The AlignContent property of the Flex component is set to FlexAlign. Center, and the visibility + * property of the sub component is set to Visibility.None + */ + + it('testAlignContentCenterFlexfixedVisibilityNone', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedVisibilityNone START'); + globalThis.value.message.notify({ name:'visibility', value:Visibility.None }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Visibility_flex001'); + let obj = JSON.parse(strJson); + let textStrJson = getInspectorByKey('AlignContent_Center_FlexP_Fixed_Visibility_1'); + let textObj = JSON.parse(textStrJson); + let AlignContentFlexCenter_flex002 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_flex001'); + + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContent_Center_FlexP_Fixed_Visibility_4'); + + console.log('AlignContent_Center_FlexP_Fixed_Visibility_flex002 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex002)) + + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + expect(textObj.$attrs.visibility).assertEqual("Visibility.None"); + + expect(AlignContentFlexCenter_flex002.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_3.top - AlignContentFlexCenter_flex002.top); + + expect(Math.round(AlignContentFlexCenter_2.top - AlignContentFlexCenter_flex002.top)) + .assertEqual(vp2px(100)); + + expect(AlignContentFlexCenter_2.top).assertEqual(AlignContentFlexCenter_3.top); + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_3.top); + + expect(AlignContentFlexCenter_2.left).assertEqual(AlignContentFlexCenter_flex002.left); + console.info('testAlignContentCenterFlexfixedVisibilityNone END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecd2dbce692d1a92afc2af29c4d48a3fd6bd288b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed.test.ets @@ -0,0 +1,156 @@ +/* + * 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 AlignContent_Center_FlexP_fixed() { + + describe('AlignContent_Center_FlexP_fixed', function () { + beforeEach(async function (done) { + console.info("AlignContent_Center_FlexP_fixed beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_Center_FlexP_fixed', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_Center_FlexP_fixed state success " + JSON.stringify(pages)); + if (!("AlignContent_Center_FlexP_fixed" == pages.name)) { + console.info("get AlignContent_Center_FlexP_fixed state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_Center_FlexP_fixed page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_Center_FlexP_fixed page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_Center_FlexP_fixed beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + console.info("AlignContent_Center_FlexP_fixed after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0800 + * @tc.name testAlignContentCenterFlexfixedSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center to change the height of + * the subcomponent so that the flex container meets the height of the subcomponent. + */ + + it('testAlignContentCenterFlexfixedSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedSatisfy START'); + globalThis.value.message.notify({ name:'height', value:80 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterP_fixed_flex001'); + let obj = JSON.parse(strJson); + console.info('flex [getInspectorByKey] is:'+ JSON.stringify(obj)); + console.info('flex obj.$attrs.constructor is:' + JSON.stringify(obj.$attrs.constructor)); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_4'); + + console.log('AlignContentFlexCenter_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(80)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex001.top); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_3.bottom); + console.info('testAlignContentCenterFlexfixedSatisfy END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0900 + * @tc.name testAlignContentCenterFlexfixedNoSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, change the height of the + * subcomponent to make the flex container less than the height of the subcomponent. + */ + + it('testAlignContentCenterFlexfixedNoSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexfixedNoSatisfy START'); + globalThis.value.message.notify({ name:'height', value:300 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterP_fixed_flex001'); + let obj = JSON.parse(strJson); + let AlignContentFlexCenter_flex002 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterP_fixed_4'); + + console.log('AlignContentFlexCenterP_fixed_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex002)) + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(300)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_1.top).assertEqual(AlignContentFlexCenter_flex002.top); + expect(AlignContentFlexCenter_4.bottom).assertLarger(AlignContentFlexCenter_flex002.bottom); + + expect(AlignContentFlexCenter_1.bottom).assertEqual(AlignContentFlexCenter_4.top); + console.info('testAlignContentCenterFlexfixedNoSatisfy END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d758124f4e2e87ba8c42387db5133bbd6b656f80 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin.test.ets @@ -0,0 +1,112 @@ +/* + * 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' + +export default function AlignContent_FlexAlign_Center_Margin() { + + describe('AlignContent_FlexAlign_Center_Margin', function () { + beforeEach(async function (done) { + console.info("AlignContent_FlexAlign_Center_Margin beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_FlexAlign_Center_Margin state success " + JSON.stringify(pages)); + if (!("AlignContent_FlexAlign_Center_Margin" == pages.name)) { + console.info("get AlignContent_FlexAlign_Center_Margin state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_FlexAlign_Center_Margin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_FlexAlign_Center_Margin page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_FlexAlign_Center_Margin beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + + console.info("AlignContent_FlexAlign_Center_Margin after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0500 + * @tc.name testAlignContentCenterFlexMarginSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, and set the margin for + * the flex component to meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexMarginSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexMarginSatisfy START'); + let strJson = getInspectorByKey('AlignContentFlexCenterMargin_flex'); + let obj = JSON.parse(strJson); + let Center_Margin_Column = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_Column'); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_flex'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_flex_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_flex_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_flex_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin_flex_4'); + + console.log('AlignContentFlexCenterMargin_flex rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + console.log('AlignContentFlexCenterMargin_flex_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenterMargin_flex_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenterMargin_flex_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenterMargin_flex_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round((AlignContentFlexCenter_flex001.top - Center_Margin_Column.top)*10)/10) + .assertEqual(vp2px(15)) + expect(Math.round((AlignContentFlexCenter_1.top - Center_Margin_Column.top)*10)/10) + .assertEqual(vp2px(45)) + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex001.top); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex001.top)) + .assertEqual(vp2px(30)); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + + console.info('testAlignContentCenterFlexMarginSatisfy END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bbd282347d998bcd3fef5b607d63fbcda2a37ed --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding.test.ets @@ -0,0 +1,175 @@ +/* + * 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 AlignContent_FlexAlign_Center_Margin_padding() { + + describe('AlignContent_FlexAlign_Center_Margin_padding', function () { + beforeEach(async function (done) { + console.info("AlignContent_FlexAlign_Center_Margin_padding beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_Margin_padding', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + + let pages = router.getState(); + console.info("get AlignContent_FlexAlign_Center_Margin_padding state success " + JSON.stringify(pages)); + if (!("AlignContent_FlexAlign_Center_Margin_padding" == pages.name)) { + console.info("get AlignContent_FlexAlign_Center_Margin_padding state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_FlexAlign_Center_Margin_padding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_FlexAlign_Center_Margin_padding page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_FlexAlign_Center_Margin_padding beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + + console.info("AlignContent_FlexAlign_Center_Margin_padding after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0600 + * @tc.name testAlignContentCenterFlexMargin&PaddingNOSatisfy + * @tc.desc The AlignContent property of the Flex component is set to FlexAlign.Center, while the margin and + * padding settings of the flex component do not meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexMargin&PaddingNOSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexMargin&PaddingNOSatisfy START'); + globalThis.value.message.notify({ name:'padding', value:40 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterMargin&padding_flex001'); + let obj = JSON.parse(strJson); + let Center_Margin_Column_1 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_Column_1'); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterMargin&padding_flex001_4'); + + console.log('AlignContentFlexCenterMargin&padding_flex001 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_flex001)); + console.log('AlignContentFlexCenterMargin&padding_flex001_1 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenterMargin&padding_flex001_2 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenterMargin&padding_flex001_3 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenterMargin&padding_flex001_4 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round(AlignContentFlexCenter_flex001.top - Center_Margin_Column_1.top)).assertEqual(vp2px(10)) + expect(Math.round(AlignContentFlexCenter_1.top - Center_Margin_Column_1.top)).assertEqual(vp2px(50)) + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom).assertLess(vp2px(40)); + console.info('testAlignContentCenterFlexMargin&PaddingNOSatisfy END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0700 + * @tc.name testAlignContentCenterFlexMargin&PaddingSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, and set the margin and + * padding for the flex component to meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexMargin&PaddingSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexMargin&PaddingSatisfy START'); + globalThis.value.message.notify({ name:'padding', value:15 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterMargin&padding_flex001'); + let obj = JSON.parse(strJson); + let Center_Margin_Column_2 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_Column_1'); + let AlignContentFlexCenter_flex002 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_flex001'); + let AlignContentFlexCenter_1 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc + .getComponentRect('AlignContentFlexCenterMargin&padding_flex001_4'); + + console.log('AlignContentFlexCenterMargin&padding_flex001 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_flex002)); + console.log('AlignContentFlexCenterMargin&padding_flex001_1 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenterMargin&padding_flex001_2 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenterMargin&padding_flex001_3 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenterMargin&padding_flex001_4 rect_value is:' + + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round(AlignContentFlexCenter_flex002.top - Center_Margin_Column_2.top)) + .assertEqual(vp2px(10)) + + expect(Math.round(AlignContentFlexCenter_1.top - Center_Margin_Column_2.top)) + .assertEqual(vp2px(40)) + + expect(AlignContentFlexCenter_flex002.bottom - AlignContentFlexCenter_4.bottom) + .assertEqual(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex002.top); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex002.top)) + .assertEqual(vp2px(30)); + + console.info('testAlignContentCenterFlexMargin&PaddingSatisfy END') + done(); + }); + + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..92198b9cba08994605ab528b37a4e462d717cb39 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding.test.ets @@ -0,0 +1,156 @@ +/* + * 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 AlignContent_FlexAlign_Center_padding() { + + describe('AlignContent_FlexAlign_Center_padding', function () { + beforeEach(async function (done) { + console.info("AlignContent_FlexAlign_Center_padding beforeEach start") + let options = { + uri: 'MainAbility/pages/Flex/alignContent/Center/AlignContent_FlexAlign_Center_padding', + } + try { + router.clear(); + await CommonFunc.sleep(1000); + let pages = router.getState(); + console.info("get AlignContent_FlexAlign_Center_padding state success " + JSON.stringify(pages)); + if (!("AlignContent_FlexAlign_Center_padding" == pages.name)) { + console.info("get AlignContent_FlexAlign_Center_padding state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push AlignContent_FlexAlign_Center_padding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignContent_FlexAlign_Center_padding page error " + JSON.stringify(err)); + } + await CommonFunc.sleep(1000) + console.info("AlignContent_FlexAlign_Center_padding beforeEach end") + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000) + console.info("AlignContent_FlexAlign_Center_padding after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0300 + * @tc.name testAlignContentCenterFlexPaddingNoSatisfy + * @tc.desc The AlignContent property of the Flex component is set to FlexAlign.Center, and the padding + * setting of the Flex component does not meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexPaddingNoSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexPaddingNoSatisfy START'); + globalThis.value.message.notify({ name:'padding', value:40 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterPadding_flex001'); + let obj = JSON.parse(strJson); + let AlignContentFlexCenter_flex001 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_4'); + + console.log('AlignContentFlexCenterPadding_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_flex001)); + + console.log('AlignContentFlexCenterPadding_flex001_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenterPadding_flex001_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenterPadding_flex001_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenterPadding_flex001_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenter_flex001.top)).assertEqual(vp2px(40)); + + expect(AlignContentFlexCenter_flex001.bottom - AlignContentFlexCenter_4.bottom).assertLess(vp2px(40)); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + console.info('testAlignContentCenterFlexPaddingNoSatisfy END'); + done(); + }); + + /** + * @tc.number SUB_ACE_FLEXALIGNCONTENT_CENTER_0400 + * @tc.name testAlignContentCenterFlexPaddingSatisfy + * @tc.desc Set the AlignContent property of the Flex component to FlexAlign.Center, and set the padding for + * the Flex component to meet the size requirements of the subcomponent. + */ + + it('testAlignContentCenterFlexPaddingSatisfy', 0, async function (done) { + console.info('testAlignContentCenterFlexPaddingSatisfy START'); + globalThis.value.message.notify({ name:'padding', value:15 }) + await CommonFunc.sleep(3000) + let strJson = getInspectorByKey('AlignContentFlexCenterPadding_flex001'); + let obj = JSON.parse(strJson); + let AlignContentFlexCenterPadding_flex002 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001'); + let AlignContentFlexCenter_1 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_1'); + let AlignContentFlexCenter_2 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_2'); + let AlignContentFlexCenter_3 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_3'); + let AlignContentFlexCenter_4 = CommonFunc.getComponentRect('AlignContentFlexCenterPadding_flex001_4'); + + console.log('AlignContentFlexCenterPadding_flex001 rect_value is:'+ + JSON.stringify(AlignContentFlexCenterPadding_flex002)) + + console.log('AlignContentFlexCenter_1 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_1)); + console.log('AlignContentFlexCenter_2 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_2)); + console.log('AlignContentFlexCenter_3 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_3)); + console.log('AlignContentFlexCenter_4 rect_value is:'+ + JSON.stringify(AlignContentFlexCenter_4)); + + expect(Math.round(AlignContentFlexCenter_1.bottom - AlignContentFlexCenter_1.top)).assertEqual(vp2px(50)); + expect(Math.round(AlignContentFlexCenter_2.bottom - AlignContentFlexCenter_2.top)).assertEqual(vp2px(100)); + expect(Math.round(AlignContentFlexCenter_3.bottom - AlignContentFlexCenter_3.top)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.bottom - AlignContentFlexCenter_4.top)).assertEqual(vp2px(200)); + expect(Math.round(AlignContentFlexCenter_1.right - AlignContentFlexCenter_1.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_2.right - AlignContentFlexCenter_2.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_3.right - AlignContentFlexCenter_3.left)).assertEqual(vp2px(150)); + expect(Math.round(AlignContentFlexCenter_4.right - AlignContentFlexCenter_4.left)).assertEqual(vp2px(150)); + + expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Row"); + expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center"); + + expect(AlignContentFlexCenter_4.top).assertEqual(AlignContentFlexCenter_2.bottom); + + expect(Math.round(AlignContentFlexCenter_1.top - AlignContentFlexCenterPadding_flex002.top)).assertEqual(vp2px(30)); + + expect(Math.round(AlignContentFlexCenterPadding_flex002.bottom - AlignContentFlexCenter_4.bottom)).assertEqual(vp2px(30)); + console.info('testAlignContentCenterFlexPaddingSatisfy END'); + done(); + }); + }) +}