From 4634ec10225bba2ebf9b01034af9d9fd320759ff Mon Sep 17 00:00:00 2001 From: e Date: Tue, 7 Feb 2023 11:03:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20flex=5FSpaceEvenly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: e --- .../SpaceEvenly/AlignSpaceEvenly_AddAlign.ets | 51 +++++++ .../AlignSpaceEvenly_AddAllSpace.ets | 56 ++++++++ .../AlignSpaceEvenly_AddLayoutWeight.ets | 55 ++++++++ .../AlignSpaceEvenly_AddMargin.ets | 55 ++++++++ .../AlignSpaceEvenly_AddOffset.ets | 51 +++++++ .../AlignSpaceEvenly_AddOneMargin.ets | 55 ++++++++ .../AlignSpaceEvenly_AddOneWidth.ets | 50 +++++++ .../AlignSpaceEvenly_AddPadding.ets | 51 +++++++ .../AlignSpaceEvenly_AddVisibility.ets | 55 ++++++++ .../SpaceEvenly/AlignSpaceEvenly_NoSpace.ets | 50 +++++++ .../AlignSpaceEvenly_AddAlign.test.ets | 85 ++++++++++++ .../AlignSpaceEvenly_AddAllSpace.test.ets | 124 ++++++++++++++++++ .../AlignSpaceEvenly_AddLayoutWeight.test.ets | 83 ++++++++++++ .../AlignSpaceEvenly_AddMargin.test.ets | 86 ++++++++++++ .../AlignSpaceEvenly_AddOffset.test.ets | 83 ++++++++++++ .../AlignSpaceEvenly_AddOneMargin.test.ets | 119 +++++++++++++++++ .../AlignSpaceEvenly_AddOneWidth.test.ets | 84 ++++++++++++ .../AlignSpaceEvenly_AddPadding.test.ets | 117 +++++++++++++++++ .../AlignSpaceEvenly_AddVisibility.test.ets | 118 +++++++++++++++++ .../AlignSpaceEvenly_NoSpace.test.ets | 117 +++++++++++++++++ 20 files changed, 1545 insertions(+) create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.test.ets create mode 100644 arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.test.ets diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.ets new file mode 100644 index 000000000..645845af3 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.ets @@ -0,0 +1,51 @@ +/* + * 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 AlignSpaceEvenly_AddAlign { + @State DadAddAlign: number = Alignment.TopStart; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_NoSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'DadAddAlign') { + this.DadAddAlign = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddAlign_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddAlign_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddAlign_013") + } + .key("SpaceEvenly_AddAlign_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + .align(this.DadAddAlign) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.ets new file mode 100644 index 000000000..7a5564a5f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.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 AlignSpaceEvenly_AddAllSpace { + @State DadAllSpace: number = 10 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_AddAllSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'DadAllSpace') { + this.DadAllSpace = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddAllSpace_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddAllSpace_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddAllSpace_013") + } + .key("SpaceEvenly_AddAllSpace_01") + .width(500) + .height(200) + .padding(this.DadAllSpace) + .margin(10) + .backgroundColor(0xAFEEEE) + } + .key("SpaceEvenly_AddAllSpace_01_Box") + .width("100%") + .height(200) + .backgroundColor(0xAFEEE) + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.ets new file mode 100644 index 000000000..ee773baf6 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.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 AlignSpaceEvenly_AddLayoutWeight { + @State OneLayoutWeight: number = 2; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_NoSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'OneLayoutWeight') { + this.OneLayoutWeight = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1') + .width(150) + .height(50) + .backgroundColor(0xF5DEB3) + .key("SpaceEvenly_AddLayoutWeight_011") + .layoutWeight(this.OneLayoutWeight) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddLayoutWeight_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddLayoutWeight_013") + } + .key("SpaceEvenly_AddLayoutWeight_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.ets new file mode 100644 index 000000000..49c1a2963 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.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 AlignSpaceEvenly_AddMargin { + @State DadMargin: number = 10 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_AddMargin onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'DadMargin') { + this.DadMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddMargin_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddMargin_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddMargin_013") + } + .key("SpaceEvenly_AddMargin_01") + .width(500) + .height(200) + .margin(this.DadMargin) + .backgroundColor(0xAFEEEE) + } + .key("SpaceEvenly_AddMargin_01_Box") + .width("100%") + .height(200) + .backgroundColor(0xAFEEE) + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.ets new file mode 100644 index 000000000..3cc835777 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.ets @@ -0,0 +1,51 @@ +/* + * 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 AlignSpaceEvenly_AddOffset { + @State OneOffset: any = { x: 0, y: 0 } + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_NoSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'OneOffset') { + this.OneOffset = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddOffset_011") + .offset(this.OneOffset) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddOffset_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddOffset_013") + } + .key("SpaceEvenly_AddOffset_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.ets new file mode 100644 index 000000000..5feebff1c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.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 AlignSpaceEvenly_AddOneMargin { + @State OneMargin: number = 10 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_AddOneMargin onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'OneMargin') { + this.OneMargin = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1') + .width(150) + .height(50) + .backgroundColor(0xF5DEB3) + .key("SpaceEvenly_AddOneMargin_011") + .margin(this.OneMargin) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddOneMargin_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddOneMargin_013") + } + .key("SpaceEvenly_AddOneMargin_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.ets new file mode 100644 index 000000000..edd288490 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.ets @@ -0,0 +1,50 @@ +/* + * 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 AlignSpaceEvenly_AddOneWidth { + @State OneWidth: number = 100 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_NoSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'OneWidth') { + this.OneWidth = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(this.OneWidth).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddOneWidth_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddOneWidth_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddOneWidth_013") + } + .key("SpaceEvenly_AddOneWidth_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.ets new file mode 100644 index 000000000..8cc975c4b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.ets @@ -0,0 +1,51 @@ +/* + * 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 AlignSpaceEvenly_AddPadding { + @State DadPadding: number = 10 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_AddPadding onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'DadPadding') { + this.DadPadding = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('alignContent:SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('100%') + Flex({ justifyContent: this.justifyContent, direction:FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddPadding_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddPadding_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddPadding_013") + } + .key("SpaceEvenly_AddPadding_01") + .width(500) + .height(200) + .padding(this.DadPadding) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.ets new file mode 100644 index 000000000..b3d714eeb --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.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 AlignSpaceEvenly_AddVisibility { + @State OneVisibility: number = Visibility.None; + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_AddVisibility onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'OneVisibility') { + this.OneVisibility = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1') + .width(150) + .height(50) + .backgroundColor(0xF5DEB3) + .key("SpaceEvenly_AddVisibility_011") + .visibility(this.OneVisibility) + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_AddVisibility_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_AddVisibility_013") + } + .key("SpaceEvenly_AddVisibility_01") + .width(500) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.ets new file mode 100644 index 000000000..bf273d479 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.ets @@ -0,0 +1,50 @@ +/* + * 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 AlignSpaceEvenly_NoSpace { + @State DadWidth: number = 200 + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('AlignSpaceEvenly_NoSpace onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'DadWidth') { + this.DadWidth = message.value; + } + } + this.messageManager.registerCallback(callback); + } + @State justifyContent: FlexAlign = FlexAlign.SpaceEvenly + build() { + Column() { + Text('justifyContent:FlexAlign.SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ justifyContent: this.justifyContent, direction: FlexDirection.Row }) { + Text('1').width(150).height(50).backgroundColor(0xF5DEB3).key("SpaceEvenly_NoSpace_011") + Text('2').width(150).height(100).backgroundColor(0xD2B48C).key("SpaceEvenly_NoSpace_012") + Text('3').width(150).height(150).backgroundColor(0xF5DEB3).key("SpaceEvenly_NoSpace_013") + } + .key("SpaceEvenly_NoSpace_01") + .width(this.DadWidth) + .height(200) + .backgroundColor(0xAFEEEE) + } + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.test.ets new file mode 100644 index 000000000..0c9008ea0 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign.test.ets @@ -0,0 +1,85 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddAlign() { + describe('AlignSpaceEvenly_AddAlign', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAlign' + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddAlign state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddAlign" == pages.name)) { + console.info("get AlignSpaceEvenly_AddAlign state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddAlign page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddAlign page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddAlign after each called") + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0800 + * @tc.name Align_SpaceEvenly_Row_AddAlign + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0800', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0800] START'); + globalThis.value.message.notify({name:'DadAlign', value:Alignment.BottomEnd}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddAlign_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddAlign_011 = CommonFunc.getComponentRect('SpaceEvenly_AddAlign_011'); + let SpaceEvenly_AddAlign_012 = CommonFunc.getComponentRect('SpaceEvenly_AddAlign_012'); + let SpaceEvenly_AddAlign_013 = CommonFunc.getComponentRect('SpaceEvenly_AddAlign_013'); + let SpaceEvenly_AddAlign_01 = CommonFunc.getComponentRect('SpaceEvenly_AddAlign_01'); + expect(SpaceEvenly_AddAlign_011.top).assertEqual(SpaceEvenly_AddAlign_012.top); + expect(SpaceEvenly_AddAlign_012.top).assertEqual(SpaceEvenly_AddAlign_013.top); + expect(SpaceEvenly_AddAlign_011.top).assertEqual(SpaceEvenly_AddAlign_01.top); + expect(SpaceEvenly_AddAlign_012.left - SpaceEvenly_AddAlign_011.right) + .assertEqual(SpaceEvenly_AddAlign_013.left - SpaceEvenly_AddAlign_012.right); + expect(SpaceEvenly_AddAlign_011.left - SpaceEvenly_AddAlign_01.left) + .assertEqual(SpaceEvenly_AddAlign_01.right - SpaceEvenly_AddAlign_013.right); + expect(SpaceEvenly_AddAlign_012.left - SpaceEvenly_AddAlign_011.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddAlign_01.right - SpaceEvenly_AddAlign_013.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddAlign_011.right - SpaceEvenly_AddAlign_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAlign_012.right - SpaceEvenly_AddAlign_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAlign_013.right - SpaceEvenly_AddAlign_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAlign_011.bottom - SpaceEvenly_AddAlign_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddAlign_012.bottom - SpaceEvenly_AddAlign_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddAlign_013.bottom - SpaceEvenly_AddAlign_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0800] END'); + done() + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets new file mode 100644 index 000000000..db0b3efde --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddAllSpace() { + describe('AlignSpaceEvenly_AddAllSpace', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace' + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddAllSpace state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddAllSpace" == pages.name)) { + console.info("get AlignSpaceEvenly_AddAllSpace state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddAllSpace page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignAlignSpaceEvenly_AddAllSpace page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignAlignSpaceEvenly_AddAllSpace after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600 + * @tc.name Align_SpaceEvenly_Row_AddAllSpace + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600] START'); + globalThis.value.message.notify({name:'DadAllSpace', value:30}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddAllSpace_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddAllSpace_011 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_011'); + let SpaceEvenly_AddAllSpace_012 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_012'); + let SpaceEvenly_AddAllSpace_013 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_013'); + let SpaceEvenly_AddAllSpace_01 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_01'); + let SpaceEvenly_AddAllSpace_01_Box = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_01_Box'); + expect(SpaceEvenly_AddAllSpace_011.top).assertEqual(SpaceEvenly_AddAllSpace_012.top); + expect(SpaceEvenly_AddAllSpace_012.top).assertEqual(SpaceEvenly_AddAllSpace_013.top); + expect(SpaceEvenly_AddAllSpace_011.top - SpaceEvenly_AddAllSpace_01.top).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddAllSpace_01.right - SpaceEvenly_AddAllSpace_013.right).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddAllSpace_011.left - SpaceEvenly_AddAllSpace_01.left).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddAllSpace_012.left).assertEqual(SpaceEvenly_AddAllSpace_011.right); + expect(SpaceEvenly_AddAllSpace_013.left).assertEqual(SpaceEvenly_AddAllSpace_012.right); + expect(SpaceEvenly_AddAllSpace_01.left - SpaceEvenly_AddAllSpace_01_Box.left ).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddAllSpace_01.top - SpaceEvenly_AddAllSpace_01_Box.top).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddAllSpace_011.bottom - SpaceEvenly_AddAllSpace_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddAllSpace_012.bottom - SpaceEvenly_AddAllSpace_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddAllSpace_013.bottom - SpaceEvenly_AddAllSpace_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left).assertEqual(vp2px(440/3)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0700 + * @tc.name Align_SpaceEvenly_Row_AddAllSpace + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0700', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0700] START'); + globalThis.value.message.notify({name:'DadAllSpace', value:20}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddAllSpace_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddAllSpace_011 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_011'); + let SpaceEvenly_AddAllSpace_012 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_012'); + let SpaceEvenly_AddAllSpace_013 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_013'); + let SpaceEvenly_AddAllSpace_01 = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_01'); + let SpaceEvenly_AddAllSpace_01_Box = CommonFunc.getComponentRect('SpaceEvenly_AddAllSpace_01_Box'); + expect(SpaceEvenly_AddAllSpace_011.top).assertEqual(SpaceEvenly_AddAllSpace_012.top); + expect(SpaceEvenly_AddAllSpace_012.top).assertEqual(SpaceEvenly_AddAllSpace_013.top); + expect(SpaceEvenly_AddAllSpace_011.top - SpaceEvenly_AddAllSpace_01.top).assertEqual(vp2px(20)); + expect(SpaceEvenly_AddAllSpace_01.right - SpaceEvenly_AddAllSpace_013.right).assertEqual(vp2px(22.5)); + expect(SpaceEvenly_AddAllSpace_011.left - SpaceEvenly_AddAllSpace_01.left).assertEqual(vp2px(22.5)); + expect(SpaceEvenly_AddAllSpace_01.left - SpaceEvenly_AddAllSpace_01_Box.left).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddAllSpace_01.top - SpaceEvenly_AddAllSpace_01_Box.top).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAllSpace_011.bottom - SpaceEvenly_AddAllSpace_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddAllSpace_012.bottom - SpaceEvenly_AddAllSpace_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddAllSpace_013.bottom - SpaceEvenly_AddAllSpace_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddAllSpace_012.left - SpaceEvenly_AddAllSpace_011.right) + .assertEqual(SpaceEvenly_AddAllSpace_013.left - SpaceEvenly_AddAllSpace_012.right); + expect(SpaceEvenly_AddAllSpace_012.left - SpaceEvenly_AddAllSpace_011.right).assertEqual(vp2px(2.5)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0700] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets new file mode 100644 index 000000000..7155d7521 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets @@ -0,0 +1,83 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddLayoutWeight() { + describe('AlignSpaceEvenly_AddLayoutWeight', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddLayoutWeight state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddLayoutWeight" == pages.name)) { + console.info("get AlignSpaceEvenly_AddLayoutWeight state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddLayoutWeight page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddLayoutWeight page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddLayoutWeight after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1200 + * @tc.name Align_SpaceEvenly_Row_AddLayoutWeight + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1200', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1200] START'); + globalThis.value.message.notify({name:'OneLayoutWeight', value:1}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddLayoutWeight_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddLayoutWeight_011 = CommonFunc.getComponentRect('SpaceEvenly_AddLayoutWeight_011'); + let SpaceEvenly_AddLayoutWeight_012 = CommonFunc.getComponentRect('SpaceEvenly_AddLayoutWeight_012'); + let SpaceEvenly_AddLayoutWeight_013 = CommonFunc.getComponentRect('SpaceEvenly_AddLayoutWeight_013'); + let SpaceEvenly_AddLayoutWeight_01 = CommonFunc.getComponentRect('SpaceEvenly_AddLayoutWeight_01'); + expect(SpaceEvenly_AddLayoutWeight_011.top).assertEqual(SpaceEvenly_AddLayoutWeight_012.top); + expect(SpaceEvenly_AddLayoutWeight_013.top).assertEqual(SpaceEvenly_AddLayoutWeight_012.top); + expect(SpaceEvenly_AddLayoutWeight_011.top).assertEqual(SpaceEvenly_AddLayoutWeight_01.top); + expect(SpaceEvenly_AddLayoutWeight_011.right).assertEqual(SpaceEvenly_AddLayoutWeight_012.left); + expect(SpaceEvenly_AddLayoutWeight_012.right).assertEqual(SpaceEvenly_AddLayoutWeight_013.left); + expect(SpaceEvenly_AddLayoutWeight_011.left).assertEqual(SpaceEvenly_AddLayoutWeight_01.left); + expect(SpaceEvenly_AddLayoutWeight_013.right).assertEqual(SpaceEvenly_AddLayoutWeight_01.right); + expect(SpaceEvenly_AddLayoutWeight_011.bottom - SpaceEvenly_AddLayoutWeight_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddLayoutWeight_012.bottom - SpaceEvenly_AddLayoutWeight_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddLayoutWeight_013.bottom - SpaceEvenly_AddLayoutWeight_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddLayoutWeight_011.right - SpaceEvenly_AddLayoutWeight_011.left).assertEqual(vp2px(200)); + expect(SpaceEvenly_AddLayoutWeight_012.right - SpaceEvenly_AddLayoutWeight_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddLayoutWeight_013.right - SpaceEvenly_AddLayoutWeight_013.left).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1200] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.test.ets new file mode 100644 index 000000000..f80e38bcd --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin.test.ets @@ -0,0 +1,86 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddMargin() { + describe('AlignSpaceEvenly_AddMargin', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddMargin', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddMargin state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddMargin" == pages.name)) { + console.info("get AlignSpaceEvenly_AddMargin state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddMargin page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0500 + * @tc.name Align_SpaceEvenly_Row_AddMargin + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0500', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0500] START'); + globalThis.value.message.notify({name:'DadMargin',value:20}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddMargin_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddMargin_011 = CommonFunc.getComponentRect('SpaceEvenly_AddMargin_011'); + let SpaceEvenly_AddMargin_012 = CommonFunc.getComponentRect('SpaceEvenly_AddMargin_012'); + let SpaceEvenly_AddMargin_013 = CommonFunc.getComponentRect('SpaceEvenly_AddMargin_013'); + let SpaceEvenly_AddMargin_01 = CommonFunc.getComponentRect('SpaceEvenly_AddMargin_01'); + let SpaceEvenly_AddMargin_01_Box = CommonFunc.getComponentRect('SpaceEvenly_AddMargin_01_Box'); + expect(SpaceEvenly_AddMargin_011.top).assertEqual(SpaceEvenly_AddMargin_012.top); + expect(SpaceEvenly_AddMargin_013.top).assertEqual(SpaceEvenly_AddMargin_012.top); + expect(SpaceEvenly_AddMargin_011.top).assertEqual(SpaceEvenly_AddMargin_01.top); + expect(SpaceEvenly_AddMargin_011.left - SpaceEvenly_AddMargin_01.left).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddMargin_013.right - SpaceEvenly_AddMargin_01.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddMargin_012.left - SpaceEvenly_AddMargin_011.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddMargin_013.left - SpaceEvenly_AddMargin_012.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddMargin_01.left - SpaceEvenly_AddMargin_01_Box.left).assertEqual(vp2px(20)); + expect(SpaceEvenly_AddMargin_01.top - SpaceEvenly_AddMargin_01_Box.top).assertEqual(vp2px(20)); + expect(SpaceEvenly_AddMargin_011.right - SpaceEvenly_AddMargin_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddMargin_012.right - SpaceEvenly_AddMargin_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddMargin_013.right - SpaceEvenly_AddMargin_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddMargin_011.bottom - SpaceEvenly_AddMargin_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddMargin_012.bottom - SpaceEvenly_AddMargin_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddMargin_013.bottom - SpaceEvenly_AddMargin_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0500] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.test.ets new file mode 100644 index 000000000..8b8464a26 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset.test.ets @@ -0,0 +1,83 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddOffset() { + describe('AlignSpaceEvenly_AddOffset', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOffset', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddOffset state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddOffset" == pages.name)) { + console.info("get AlignSpaceEvenly_AddOffset state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddOffset page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddOffset page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddOffset after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0900 + * @tc.name Align_SpaceEvenly_Row_AddOffset + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0900', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0900] START'); + globalThis.value.message.notify({name:'OneOffset', value:{ x: 10, y: 15 }}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddOffset_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddOffset_011 = CommonFunc.getComponentRect('SpaceEvenly_AddOffset_011'); + let SpaceEvenly_AddOffset_012 = CommonFunc.getComponentRect('SpaceEvenly_AddOffset_012'); + let SpaceEvenly_AddOffset_013 = CommonFunc.getComponentRect('SpaceEvenly_AddOffset_013'); + let SpaceEvenly_AddOffset_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOffset_01'); + expect(SpaceEvenly_AddOffset_011.top - SpaceEvenly_AddOffset_01.top).assertEqual(vp2px(15)); + expect(SpaceEvenly_AddOffset_011.left - SpaceEvenly_AddOffset_01.left).assertEqual(vp2px(22.5)); + expect(SpaceEvenly_AddOffset_012.top).assertEqual(SpaceEvenly_AddOffset_013.top); + expect(SpaceEvenly_AddOffset_012.top).assertEqual(SpaceEvenly_AddOffset_01.top); + expect(SpaceEvenly_AddOffset_01.right - SpaceEvenly_AddOffset_013.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddOffset_012.left - SpaceEvenly_AddOffset_011.right).assertEqual(vp2px(2.5)); + expect(SpaceEvenly_AddOffset_013.left - SpaceEvenly_AddOffset_012.right ).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddOffset_011.right - SpaceEvenly_AddOffset_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOffset_012.right - SpaceEvenly_AddOffset_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOffset_013.right - SpaceEvenly_AddOffset_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOffset_011.bottom - SpaceEvenly_AddOffset_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddOffset_012.bottom - SpaceEvenly_AddOffset_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddOffset_013.bottom - SpaceEvenly_AddOffset_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0900] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.test.ets new file mode 100644 index 000000000..48503334b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin.test.ets @@ -0,0 +1,119 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddOneMargin() { + describe('AlignSpaceEvenly_AddOneMargin', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneMargin', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddOneMargin state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddOneMargin" == pages.name)) { + console.info("get AlignSpaceEvenly_AddOneMargin state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddOneMargin page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddOneMargin page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddOneMargin after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1400 + * @tc.name Align_SpaceEvenly_Row_AddOneMargin + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1400', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1400] START'); + globalThis.value.message.notify({name:'OneMargin', value:20}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddOneMargin_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddOneMargin_011 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_011'); + let SpaceEvenly_AddOneMargin_012 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_012'); + let SpaceEvenly_AddOneMargin_013 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_013'); + let SpaceEvenly_AddOneMargin_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_01'); + expect(SpaceEvenly_AddOneMargin_011.top - SpaceEvenly_AddOneMargin_01.top).assertEqual(vp2px(20)); + expect(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left).assertEqual(vp2px(22.5)); + expect(SpaceEvenly_AddOneMargin_013.left - SpaceEvenly_AddOneMargin_012.right).assertEqual(vp2px(2.5)); + expect(SpaceEvenly_AddOneMargin_012.left - SpaceEvenly_AddOneMargin_011.right - vp2px(20)) + .assertEqual(SpaceEvenly_AddOneMargin_013.left - SpaceEvenly_AddOneMargin_012.right); + expect(SpaceEvenly_AddOneMargin_013.top).assertEqual(SpaceEvenly_AddOneMargin_012.top); + expect(SpaceEvenly_AddOneMargin_012.top).assertEqual(SpaceEvenly_AddOneMargin_01.top); + expect(SpaceEvenly_AddOneMargin_01.right - SpaceEvenly_AddOneMargin_013.right).assertEqual(vp2px(2.5)); + expect(SpaceEvenly_AddOneMargin_011.bottom - SpaceEvenly_AddOneMargin_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddOneMargin_012.bottom - SpaceEvenly_AddOneMargin_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddOneMargin_013.bottom - SpaceEvenly_AddOneMargin_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneMargin_011.right - SpaceEvenly_AddOneMargin_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneMargin_012.right - SpaceEvenly_AddOneMargin_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneMargin_013.right - SpaceEvenly_AddOneMargin_013.left).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1400] END'); + done(); + }) + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1500 + * @tc.name Align_SpaceEvenly_Row_AddOneMargin + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1500', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1500] START'); + globalThis.value.message.notify({name:'OneMargin', value:30}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddOneMargin_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddOneMargin_011 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_011'); + let SpaceEvenly_AddOneMargin_012 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_012'); + let SpaceEvenly_AddOneMargin_013 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_013'); + let SpaceEvenly_AddOneMargin_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_01'); + expect(SpaceEvenly_AddOneMargin_011.top - SpaceEvenly_AddOneMargin_01.top).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddOneMargin_012.left - SpaceEvenly_AddOneMargin_011.right) + .assertEqual(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left); + expect(SpaceEvenly_AddOneMargin_013.right).assertEqual(SpaceEvenly_AddOneMargin_01.right); + expect(SpaceEvenly_AddOneMargin_013.top).assertEqual(SpaceEvenly_AddOneMargin_012.top); + expect(SpaceEvenly_AddOneMargin_012.top).assertEqual(SpaceEvenly_AddOneMargin_01.top); + expect(SpaceEvenly_AddOneMargin_012.right).assertEqual(SpaceEvenly_AddOneMargin_013.left); + expect(SpaceEvenly_AddOneMargin_011.bottom - SpaceEvenly_AddOneMargin_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddOneMargin_012.bottom - SpaceEvenly_AddOneMargin_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddOneMargin_013.bottom - SpaceEvenly_AddOneMargin_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneMargin_011.right - SpaceEvenly_AddOneMargin_011.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddOneMargin_012.right - SpaceEvenly_AddOneMargin_012.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddOneMargin_013.right - SpaceEvenly_AddOneMargin_013.left).assertEqual(vp2px(440/3)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1500] END'); + done(); + }) + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.test.ets new file mode 100644 index 000000000..9a2d43579 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth.test.ets @@ -0,0 +1,84 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddOneWidth() { + describe('AlignSpaceEvenly_AddOneWidth', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddOneWidth', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddOneWidth state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddOneWidth" == pages.name)) { + console.info("get AlignSpaceEvenly_AddOneWidth( state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddOneWidth( page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddOneWidth( page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddOneWidth after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1300 + * @tc.name Align_SpaceEvenly_Row_ChangeOneWidth + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1300', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1300] START'); + globalThis.value.message.notify({name:'OneWidth', value:160}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddOneWidth_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddOneWidth_011 = CommonFunc.getComponentRect('SpaceEvenly_AddOneWidth_011'); + let SpaceEvenly_AddOneWidth_012 = CommonFunc.getComponentRect('SpaceEvenly_AddOneWidth_012'); + let SpaceEvenly_AddOneWidth_013 = CommonFunc.getComponentRect('SpaceEvenly_AddOneWidth_013'); + let SpaceEvenly_AddOneWidth_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOneWidth_01'); + expect(SpaceEvenly_AddOneWidth_012.left - SpaceEvenly_AddOneWidth_011.right) + .assertEqual(SpaceEvenly_AddOneWidth_013.left - SpaceEvenly_AddOneWidth_012.right); + expect(SpaceEvenly_AddOneWidth_012.left - SpaceEvenly_AddOneWidth_011.right).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddOneWidth_011.top).assertEqual(SpaceEvenly_AddOneWidth_012.top); + expect(SpaceEvenly_AddOneWidth_013.top).assertEqual(SpaceEvenly_AddOneWidth_012.top); + expect(SpaceEvenly_AddOneWidth_011.top).assertEqual(SpaceEvenly_AddOneWidth_01.top); + expect(SpaceEvenly_AddOneWidth_011.left - SpaceEvenly_AddOneWidth_01.left).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddOneWidth_01.right - SpaceEvenly_AddOneWidth_013.right).assertEqual(vp2px(10)); + expect(SpaceEvenly_AddOneWidth_011.right - SpaceEvenly_AddOneWidth_011.left).assertEqual(vp2px(160)); + expect(SpaceEvenly_AddOneWidth_012.right - SpaceEvenly_AddOneWidth_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneWidth_013.right - SpaceEvenly_AddOneWidth_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddOneWidth_011.bottom - SpaceEvenly_AddOneWidth_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddOneWidth_012.bottom - SpaceEvenly_AddOneWidth_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddOneWidth_013.bottom - SpaceEvenly_AddOneWidth_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1300] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.test.ets new file mode 100644 index 000000000..da9fb5412 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding.test.ets @@ -0,0 +1,117 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddPadding() { + describe('AlignSpaceEvenly_AddPadding', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddPadding', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddPadding state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddPadding" == pages.name)) { + console.info("get AlignSpaceEvenly_AddPadding state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddPadding page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddPadding page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddPadding after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0300 + * @tc.name Align_SpaceEvenly_Row_AddPadding + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0300', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0300] START'); + globalThis.value.message.notify({name:'DadPadding', value:30}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddPadding_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddPadding_011 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_011') + let SpaceEvenly_AddPadding_012 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_012') + let SpaceEvenly_AddPadding_013 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_013') + let SpaceEvenly_AddPadding_01 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_01'); + expect( SpaceEvenly_AddPadding_011.top ).assertEqual(SpaceEvenly_AddPadding_012.top); + expect( SpaceEvenly_AddPadding_012.top ).assertEqual(SpaceEvenly_AddPadding_013.top); + expect( SpaceEvenly_AddPadding_012.left ).assertEqual(SpaceEvenly_AddPadding_011.right); + expect( SpaceEvenly_AddPadding_013.left ).assertEqual(SpaceEvenly_AddPadding_012.right); + expect(SpaceEvenly_AddPadding_011.top - SpaceEvenly_AddPadding_01.top).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddPadding_011.bottom - SpaceEvenly_AddPadding_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddPadding_012.bottom - SpaceEvenly_AddPadding_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddPadding_013.bottom - SpaceEvenly_AddPadding_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddPadding_011.right - SpaceEvenly_AddPadding_011.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddPadding_012.right - SpaceEvenly_AddPadding_012.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddPadding_013.right - SpaceEvenly_AddPadding_013.left).assertEqual(vp2px(440/3)); + expect(SpaceEvenly_AddPadding_011.left - SpaceEvenly_AddPadding_01.left).assertEqual(vp2px(30)); + expect(SpaceEvenly_AddPadding_01.right - SpaceEvenly_AddPadding_013.right).assertEqual(vp2px(30)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0300] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0400 + * @tc.name Align_SpaceAround_Row_AddPadding + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0400', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0400] START'); + globalThis.value.message.notify({name:'DadPadding', value:20}) + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddPadding_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_AddPadding_011 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_011'); + let SpaceEvenly_AddPadding_012 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_012'); + let SpaceEvenly_AddPadding_013 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_013'); + let SpaceEvenly_AddPadding_01 = CommonFunc.getComponentRect('SpaceEvenly_AddPadding_01'); + expect(SpaceEvenly_AddPadding_011.top).assertEqual(SpaceEvenly_AddPadding_012.top); + expect(SpaceEvenly_AddPadding_012.top).assertEqual(SpaceEvenly_AddPadding_013.top); + expect(SpaceEvenly_AddPadding_011.top - SpaceEvenly_AddPadding_01.top).assertEqual(vp2px(20)); + expect(SpaceEvenly_AddPadding_011.right - SpaceEvenly_AddPadding_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddPadding_012.right - SpaceEvenly_AddPadding_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddPadding_013.right - SpaceEvenly_AddPadding_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddPadding_011.bottom - SpaceEvenly_AddPadding_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddPadding_012.bottom - SpaceEvenly_AddPadding_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddPadding_013.bottom - SpaceEvenly_AddPadding_013.top).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddPadding_013.left - SpaceEvenly_AddPadding_012.right).assertEqual(vp2px(2.5)); + expect(SpaceEvenly_AddPadding_012.left - SpaceEvenly_AddPadding_011.right).assertEqual(vp2px(2.5)); + expect(SpaceEvenly_AddPadding_011.left - SpaceEvenly_AddPadding_01.left).assertEqual(vp2px(22.5)); + expect(SpaceEvenly_AddPadding_01.right - SpaceEvenly_AddPadding_013.right).assertEqual(vp2px(22.5)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0400] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.test.ets new file mode 100644 index 000000000..e2866e23d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility.test.ets @@ -0,0 +1,118 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_AddVisibility() { + describe('AlignSpaceEvenly_AddVisibility', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddVisibility', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_AddVisibility state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_AddVisibility" == pages.name)) { + console.info("get AlignSpaceEvenly_AddVisibility state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_AddVisibility page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_AddVisibility page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_AddVisibility after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1000 + * @tc.name Align_SpaceEvenly_Row_AddVisibility + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1000', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1000] START'); + globalThis.value.message.notify({name:'OneVisibility', value:Visibility.None}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddVisibility_01'); + let obj = JSON.parse(strJson); + let strJson2 = getInspectorByKey('SpaceEvenly_AddVisibility_011'); + let obj2 = JSON.parse(strJson2); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + expect(obj2.$attrs.visibility).assertEqual("Visibility.None"); + let SpaceEvenly_AddVisibility_012 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_012'); + let SpaceEvenly_AddVisibility_013 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_013'); + let SpaceEvenly_AddVisibility_01 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_01'); + expect(SpaceEvenly_AddVisibility_012.top).assertEqual(SpaceEvenly_AddVisibility_013.top); + expect(SpaceEvenly_AddVisibility_012.top).assertEqual(SpaceEvenly_AddVisibility_01.top); + expect(SpaceEvenly_AddVisibility_012.left - SpaceEvenly_AddVisibility_01.left).assertEqual(vp2px(200/3)); + expect(SpaceEvenly_AddVisibility_01.right - SpaceEvenly_AddVisibility_013.right).assertEqual(vp2px(200/3)); + expect(SpaceEvenly_AddVisibility_013.left - SpaceEvenly_AddVisibility_012.right).assertEqual(vp2px(200/3)); + expect(SpaceEvenly_AddVisibility_012.right - SpaceEvenly_AddVisibility_012.left ).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddVisibility_013.right - SpaceEvenly_AddVisibility_013.left ).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddVisibility_012.bottom - SpaceEvenly_AddVisibility_012.top ).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddVisibility_013.bottom - SpaceEvenly_AddVisibility_013.top ).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1000] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1100 + * @tc.name Align_SpaceEvenly_Row_AddVisibility + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1100', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1100] START'); + globalThis.value.message.notify({name:'OneVisibility',value:Visibility.Hidden}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_AddVisibility_01'); + let obj = JSON.parse(strJson); + let strJson2 = getInspectorByKey('SpaceEvenly_AddVisibility_011'); + let obj2 = JSON.parse(strJson2); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + expect(obj2.$attrs.visibility).assertEqual("Visibility.Hidden"); + let SpaceEvenly_AddVisibility_011 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_011'); + let SpaceEvenly_AddVisibility_012 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_012'); + let SpaceEvenly_AddVisibility_013 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_013'); + let SpaceEvenly_AddVisibility_01 = CommonFunc.getComponentRect('SpaceEvenly_AddVisibility_01'); + expect(SpaceEvenly_AddVisibility_012.top).assertEqual(SpaceEvenly_AddVisibility_013.top); + expect(SpaceEvenly_AddVisibility_012.top).assertEqual(SpaceEvenly_AddVisibility_01.top); + expect(SpaceEvenly_AddVisibility_012.top).assertEqual(SpaceEvenly_AddVisibility_011.top); + expect(SpaceEvenly_AddVisibility_011.left - SpaceEvenly_AddVisibility_01.left).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddVisibility_01.right - SpaceEvenly_AddVisibility_013.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddVisibility_012.left - SpaceEvenly_AddVisibility_011.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddVisibility_013.left - SpaceEvenly_AddVisibility_012.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_AddVisibility_011.right - SpaceEvenly_AddVisibility_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddVisibility_012.right - SpaceEvenly_AddVisibility_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddVisibility_013.right - SpaceEvenly_AddVisibility_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_AddVisibility_011.bottom - SpaceEvenly_AddVisibility_011.top ).assertEqual(vp2px(50)); + expect(SpaceEvenly_AddVisibility_012.bottom - SpaceEvenly_AddVisibility_012.top ).assertEqual(vp2px(100)); + expect(SpaceEvenly_AddVisibility_013.bottom - SpaceEvenly_AddVisibility_013.top ).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1100] END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.test.ets new file mode 100644 index 000000000..29a821301 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace.test.ets @@ -0,0 +1,117 @@ +/* + * 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 '@system.router'; +import CommonFunc from "./../../../../MainAbility/common/Common" +import {MessageManager,Callback} from './../../../../MainAbility/common/MessageManager'; +export default function AlignSpaceEvenly_NoSpace() { + describe('AlignSpaceEvenly_NoSpace', function () { + beforeEach(async function (done) { + let options = { + uri: 'MainAbility/pages/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_NoSpace' + } + try { + router.clear(); + let pages = router.getState(); + console.info("get AlignSpaceEvenly_NoSpace state success " + JSON.stringify(pages)); + if (!("AlignSpaceEvenly_NoSpace" == pages.name)) { + console.info("get AlignSpaceEvenly_NoSpace state pages.name " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push AlignSpaceEvenly_NoSpace page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push AlignSpaceEvenly_NoSpace page error " + JSON.stringify(err)); + expect().assertFail(); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("AlignSpaceEvenly_NoSpace after each called"); + }); + + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0100 + * @tc.name Align_SpaceEvenly_Row_ChangeWidth + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0100] START'); + globalThis.value.message.notify({name:'DadWidth', value:400}); + await CommonFunc.sleep(3000); + let strJson = getInspectorByKey('SpaceEvenly_NoSpace_01'); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_NoSpace_011 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_011'); + let SpaceEvenly_NoSpace_012 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_012'); + let SpaceEvenly_NoSpace_013 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_013'); + let SpaceEvenly_NoSpace_01 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_01'); + expect(SpaceEvenly_NoSpace_011.top).assertEqual(SpaceEvenly_NoSpace_012.top); + expect(SpaceEvenly_NoSpace_012.top).assertEqual(SpaceEvenly_NoSpace_013.top); + expect(SpaceEvenly_NoSpace_011.top).assertEqual(SpaceEvenly_NoSpace_01.top); + expect(SpaceEvenly_NoSpace_011.left).assertEqual(SpaceEvenly_NoSpace_01.left); + expect(SpaceEvenly_NoSpace_01.right).assertEqual(SpaceEvenly_NoSpace_013.right); + expect(SpaceEvenly_NoSpace_012.left).assertEqual(SpaceEvenly_NoSpace_011.right); + expect(SpaceEvenly_NoSpace_013.left).assertEqual(SpaceEvenly_NoSpace_012.right); + expect(SpaceEvenly_NoSpace_011.right - SpaceEvenly_NoSpace_011.left).assertEqual(vp2px(400/3)); + expect(SpaceEvenly_NoSpace_012.right - SpaceEvenly_NoSpace_012.left).assertEqual(vp2px(400/3)); + expect(SpaceEvenly_NoSpace_013.right - SpaceEvenly_NoSpace_013.left).assertEqual(vp2px(400/3)); + expect(SpaceEvenly_NoSpace_011.bottom - SpaceEvenly_NoSpace_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_NoSpace_012.bottom - SpaceEvenly_NoSpace_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_NoSpace_013.bottom - SpaceEvenly_NoSpace_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0100] END'); + done(); + }); + /** + * @tc.number SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0200 + * @tc.name Align_SpaceEvenly_Row_ChangeWidth + * @tc.desc aceFlexAlignSpaceEvenlyTest + */ + it('SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0200', 0, async function (done) { + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0200] START'); + let strJson = getInspectorByKey('SpaceEvenly_NoSpace_01'); + globalThis.value.message.notify({name:'DadWidth', value:500}); + await CommonFunc.sleep(3000); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Flex'); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly'); + let SpaceEvenly_NoSpace_011 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_011'); + let SpaceEvenly_NoSpace_012 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_012'); + let SpaceEvenly_NoSpace_013 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_013'); + let SpaceEvenly_NoSpace_01 = CommonFunc.getComponentRect('SpaceEvenly_NoSpace_01'); + expect(SpaceEvenly_NoSpace_011.top).assertEqual(SpaceEvenly_NoSpace_012.top); + expect(SpaceEvenly_NoSpace_012.top).assertEqual(SpaceEvenly_NoSpace_013.top); + expect(SpaceEvenly_NoSpace_011.top).assertEqual(SpaceEvenly_NoSpace_01.top); + expect(SpaceEvenly_NoSpace_012.left - SpaceEvenly_NoSpace_011.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_NoSpace_011.left - SpaceEvenly_NoSpace_01.left).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_NoSpace_013.left - SpaceEvenly_NoSpace_012.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_NoSpace_01.right - SpaceEvenly_NoSpace_013.right).assertEqual(vp2px(12.5)); + expect(SpaceEvenly_NoSpace_011.right - SpaceEvenly_NoSpace_011.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_NoSpace_012.right - SpaceEvenly_NoSpace_012.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_NoSpace_013.right - SpaceEvenly_NoSpace_013.left).assertEqual(vp2px(150)); + expect(SpaceEvenly_NoSpace_011.bottom - SpaceEvenly_NoSpace_011.top).assertEqual(vp2px(50)); + expect(SpaceEvenly_NoSpace_012.bottom - SpaceEvenly_NoSpace_012.top).assertEqual(vp2px(100)); + expect(SpaceEvenly_NoSpace_013.bottom - SpaceEvenly_NoSpace_013.top).assertEqual(vp2px(150)); + console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0200] END'); + done(); + }); + }); +} -- GitLab