diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.ets new file mode 100644 index 0000000000000000000000000000000000000000..632ca767d143a09c971a708b4a180903d3c223ad --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Absent { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Absent onPageShow'); + + } + + build() { + Row() { + RelativeContainer() { + Button("Button1") + .width(120) + .height(30) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + middle: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .key("RelativeContainer_AnchorPoint_Absent_bt1") + .id("RelativeContainer_AnchorPoint_Absent_bt1") + .borderWidth(5) + .borderColor(Color.Black) + + Text("This is text") + .fontSize(20) + .padding(10) + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Absent_bt2", align: HorizontalAlign.Center }, + top: { anchor: "RelativeContainer_AnchorPoint_Absent_bt2", align: VerticalAlign.Bottom }, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + }) + .key("RelativeContainer_AnchorPoint_Absent_tx2") + .id("RelativeContainer_AnchorPoint_Absent_tx2") + .borderWidth(2) + .borderColor(Color.Green) + .height(30) + .width(150) + } + .key("RelativeContainer_AnchorPoint_Absent_r1") + .width(300).height(300) + } + .key("RelativeContainer_AnchorPoint_Absent_row1") + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.ets new file mode 100644 index 0000000000000000000000000000000000000000..e833be0576e77509a3a2ebe72d0b910d992e670b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.ets @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Circular_Dependency { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Absent onPageShow'); + + } + build() { + Row() { + RelativeContainer() { + Row().width(100).height(100) + .backgroundColor("#FF3333") + .alignRules({ + middle: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row3", align: HorizontalAlign.End}, + bottom: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row3", align:VerticalAlign.Top} + }) + .key("RelativeContainer_AnchorPoint_Circular_Dependency_row1") + .id("RelativeContainer_AnchorPoint_Circular_Dependency_row1") + + Row().width(100).height(100) + .backgroundColor("#FFCC00") + .alignRules({ + top: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row1", align: VerticalAlign.Bottom}, + left: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row1", align: HorizontalAlign.End} + }) + .key("RelativeContainer_AnchorPoint_Circular_Dependency_row2") + .id("RelativeContainer_AnchorPoint_Circular_Dependency_row2") + + Row().width(100).height(100) + .backgroundColor("#FF6633") + .alignRules({ + top: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row2", align: VerticalAlign.Top}, + right: {anchor: "RelativeContainer_AnchorPoint_Circular_Dependency_row2", align: HorizontalAlign.Start}, + }) + .key("RelativeContainer_AnchorPoint_Circular_Dependency_row3") + .id("RelativeContainer_AnchorPoint_Circular_Dependency_row3") + + Row().width(100).height(100) + .backgroundColor("#FF9966") + .alignRules({ + top: {anchor: "__container__", align: VerticalAlign.Top}, + bottom: {anchor: "__container__", align: VerticalAlign.Bottom}, + left: {anchor: "__container__", align: HorizontalAlign.Start}, + }) + .key("RelativeContainer_AnchorPoint_Circular_Dependency_row4") + .id("RelativeContainer_AnchorPoint_Circular_Dependency_row4") + } + .key("RelativeContainer_AnchorPoint_Circular_Dependency_r1") + .width(300).height(300) + + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.ets new file mode 100644 index 0000000000000000000000000000000000000000..71aacc6ef1274598aa4536904f620312e229b00c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Id_Null { + + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Id_Null onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Row() + .width(100) + .height(100) + .backgroundColor("#FF3333") + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + top: { anchor: "__container__", align: VerticalAlign.Top } + }) + .key("RelativeContainer_AnchorPoint_Id_Null_row1") + .id("RelativeContainer_AnchorPoint_Id_Null_row1") + + Row() + .width(100) + .height(100) + .backgroundColor("#FFCC00") + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + right: { anchor: "__container__", align: HorizontalAlign.End } + }) + .key("RelativeContainer_AnchorPoint_Id_Null_row2") + .id(null) + } + .key("RelativeContainer_AnchorPoint_Id_Null_r1") + .width(300).height(300) + .border({ color: "#6699FF" }) + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc30a20c5441787bbaaa31101014e6c01d039902 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Id_Undefined { + + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Id_Undefined onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Row() + .width(100) + .height(100) + .backgroundColor("#FF3333") + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + top: { anchor: "__container__", align: VerticalAlign.Top } + }) + .key("RelativeContainer_AnchorPoint_Id_Undefined_row1") + .id("RelativeContainer_AnchorPoint_Id_Undefined_row1") + + Row() + .width(100) + .height(100) + .backgroundColor("#FFCC00") + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + right: { anchor: "__container__", align: HorizontalAlign.End } + }) + .key("RelativeContainer_AnchorPoint_Id_Undefined_row2") + .id(undefined) + } + .key("RelativeContainer_AnchorPoint_Id_Undefined_r1") + .width(300).height(300) + .border({ color: "#6699FF" }) + } + .height('100%') + } +} diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fedaba8c307f0069c87b8714d83f4ec15db0806 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.ets @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Interdependence { + + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Interdependence onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Row() + .width(100) + .height(100) + .backgroundColor("#FF3333") + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Interdependence_row2", align: HorizontalAlign.Start }, + bottom: { anchor: "RelativeContainer_AnchorPoint_Interdependence_row2", align: VerticalAlign.Top } + }) + .key("RelativeContainer_AnchorPoint_Interdependence_row1") + .id("RelativeContainer_AnchorPoint_Interdependence_row1") + + Row() + .width(100) + .height(100) + .backgroundColor("#FFCC00") + .alignRules({ + top: { anchor: "RelativeContainer_AnchorPoint_Interdependence_row1", align: VerticalAlign.Bottom }, + left: { anchor: "RelativeContainer_AnchorPoint_Interdependence_row1", align: HorizontalAlign.End } + }) + .key("RelativeContainer_AnchorPoint_Interdependence_row2") + .id("RelativeContainer_AnchorPoint_Interdependence_row2") + + + Row() + .width(100) + .height(100) + .backgroundColor("#FF9966") + .alignRules({ + top: {anchor: "__container__", align: VerticalAlign.Top}, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + left: { anchor: "__container__", align: HorizontalAlign.Start }, + }) + .key("RelativeContainer_AnchorPoint_Interdependence_row3") + .id("RelativeContainer_AnchorPoint_Interdependence_row3") + + } + .key("RelativeContainer_AnchorPoint_Interdependence_re1") + .width(300).height(300) + + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdc65b6c084eeca881b19f16d1c6fe41cecc036f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Margin { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Margin onPageShow'); + } + build() { + Row() { + RelativeContainer() { + Button("Button1") + .width(120) + .height(30) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + middle: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .key("RelativeContainer_AnchorPoint_Margin_bt1") + .id("RelativeContainer_AnchorPoint_Margin_bt1") + .borderWidth(5) + .borderColor(Color.Black) + + Text("This is text") + .fontSize(20) + .padding(10) + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Margin_bt1", align: HorizontalAlign.Center }, + top: { anchor: "RelativeContainer_AnchorPoint_Margin_bt1", align: VerticalAlign.Bottom }, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + }) + .key("RelativeContainer_AnchorPoint_Margin_tx2") + .id("RelativeContainer_AnchorPoint_Margin_tx2") + .borderWidth(2) + .borderColor(Color.Green) + .height(30) + .width(150) + } + .key("RelativeContainer_AnchorPoint_Margin_r1") + .width(300).height(300) + + } + .key("RelativeContainer_AnchorPoint_Margin_row1") + .margin({ left: 100 }) + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.ets new file mode 100644 index 0000000000000000000000000000000000000000..26d81f3c9c66acf85afe604a100ec2464b22559b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_NoId { + + onPageShow() { + console.info('RelativeContainer_AnchorPoint_NoId onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Row() + .width(100) + .height(100) + .backgroundColor("#FF3333") + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + top: { anchor: "__container__", align: VerticalAlign.Top } + }) + .key("RelativeContainer_AnchorPoint_NoId_row1") + .id("RelativeContainer_AnchorPoint_NoId_row1") + + Row() + .width(100) + .height(100) + .backgroundColor("#FFCC00") + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + right: { anchor: "__container__", align: HorizontalAlign.End } + }) + .key("RelativeContainer_AnchorPoint_NoId_row2") + // .id("RelativeContainer_AnchorPoint_NoId_row2") + } + .key("RelativeContainer_AnchorPoint_NoId_r1") + .width(300).height(300) + .border({ color: "#6699FF" }) + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.ets new file mode 100644 index 0000000000000000000000000000000000000000..70bc0551020e8ed5888d08900437b9f8f1f3955d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Offset { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Offset onPageShow'); + + } + + build() { + Row() { + RelativeContainer() { + Button("Button1") + .width(120) + .height(30) + .alignRules({ + middle: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .key("RelativeContainer_AnchorPoint_Offset_bt1") + .id("RelativeContainer_AnchorPoint_Offset_bt1") + .borderWidth(5) + .borderColor(Color.Black) + + Text("This is text") + .fontSize(20) + .padding(10) + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Offset_bt1", align: HorizontalAlign.Center }, + top: { anchor: "RelativeContainer_AnchorPoint_Offset_bt1", align: VerticalAlign.Bottom }, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + }) + .key("RelativeContainer_AnchorPoint_Offset_tx2") + .id("RelativeContainer_AnchorPoint_Offset_tx2") + .borderWidth(2) + .borderColor(Color.Green) + .height(30) + .width(150) + .offset({ x: 50, y: 0 }) + } + .key("RelativeContainer_AnchorPoint_Offset_r1") + .width(300).height(300) + + } + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.ets new file mode 100644 index 0000000000000000000000000000000000000000..3dc9f6e5b13737ef20e5f2937c6e895e689bb7e5 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.ets @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Padding { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Padding onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Button("Button1") + .width(120) + .height(30) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + middle: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .key("RelativeContainer_AnchorPoint_Padding_bt1") + .id("RelativeContainer_AnchorPoint_Padding_bt1") + .borderWidth(5) + .borderColor(Color.Black) + + Text("This is text") + .fontSize(20) + .padding(10) + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Padding_bt1", align: HorizontalAlign.Center }, + top: { anchor: "RelativeContainer_AnchorPoint_Padding_bt1", align: VerticalAlign.Bottom }, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + }) + .key("RelativeContainer_AnchorPoint_Padding_tx2") + .id("RelativeContainer_AnchorPoint_Padding_tx2") + .borderWidth(2) + .borderColor(Color.Green) + .height(30) + .width(150) + } + .key("RelativeContainer_AnchorPoint_Padding_r1") + .width(300).height(300) + + } + .key("RelativeContainer_AnchorPoint_Padding_row1") + + .padding({ left: 100 }) + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.ets new file mode 100644 index 0000000000000000000000000000000000000000..318ae8798ddcb787afd3a569587ee83ee409d355 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Position { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Position onPageShow'); + } + + build() { + Row() { + RelativeContainer() { + Button("Button1") + .width(120) + .height(30) + .alignRules({ + middle: { anchor: "__container__", align: HorizontalAlign.Center } + }) + .key("RelativeContainer_AnchorPoint_Position_bt1") + .id("RelativeContainer_AnchorPoint_Position_bt1") + .borderWidth(5) + .borderColor(Color.Black) + + Text("This is text") + .fontSize(20) + .padding(10) + .alignRules({ + right: { anchor: "RelativeContainer_AnchorPoint_Position_bt1", align: HorizontalAlign.Center }, + top: { anchor: "RelativeContainer_AnchorPoint_Position_bt1", align: VerticalAlign.Bottom }, + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, + }) + .key("RelativeContainer_AnchorPoint_Position_tx2") + .id("RelativeContainer_AnchorPoint_Position_tx2") + .borderWidth(2) + .borderColor(Color.Green) + .height(30) + .width(150) + .position({ x: 10, y: 10 }) + } + .key("RelativeContainer_AnchorPoint_Position_r1") + .width(300).height(300) + + } + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b22550971cc3f54a6abf7729fc96a30b5d86f1e --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.ets @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_ThreeDirection { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_ThreeDirection onPageShow'); + + } + build() { + Row() { + RelativeContainer() { + Button("Button1").width(120).height(30) + .alignRules({ + top: { anchor: "__container__", align: VerticalAlign.Top }, + middle:{anchor:"__container__",align:HorizontalAlign.Center} + }) + .key("RelativeContainer_AnchorPoint_ThreeDirection_bt1") + .id("RelativeContainer_AnchorPoint_ThreeDirection_bt1").borderWidth(5).borderColor(Color.Black) + + Text("This is text").fontSize(20).padding(10) + .alignRules({ + right:{anchor:"RelativeContainer_AnchorPoint_ThreeDirection_bt1",align:HorizontalAlign.Center}, + top:{anchor:"__container__",align:VerticalAlign.Top}, + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + center:{anchor:"__container__",align:VerticalAlign.Center}, + }) + .key("RelativeContainer_AnchorPoint_ThreeDirection_tx2") + .id("RelativeContainer_AnchorPoint_ThreeDirection_tx2").borderWidth(2).borderColor(Color.Green) + .height(30) + .width(250) + } + .key("RelativeContainer_AnchorPoint_ThreeDirection_r1") + .width(300).height(300) + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.ets new file mode 100644 index 0000000000000000000000000000000000000000..93cfc080ff268b8fb336cd41acdc4c343d0f7ba4 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.ets @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_TwoDirection { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_TwoDirection onPageShow'); + + } + build() { + Row() { + RelativeContainer() { + Row().width(100).height(100).backgroundColor("#FF66FF") + .alignRules({ + top:{anchor:"__container__",align:VerticalAlign.Top}, + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + left:{anchor:"__container__",align:HorizontalAlign.Start}, + right:{anchor:"__container__",align:HorizontalAlign.End}, + }) + .key("RelativeContainer_AnchorPoint_TwoDirection_row1") + .id("RelativeContainer_AnchorPoint_TwoDirection_row1") + } + .key("RelativeContainer_AnchorPoint_TwoDirection_r1") + .width(300).height(300) + + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.ets new file mode 100644 index 0000000000000000000000000000000000000000..07cd45148b21844ee9b64b5a3e6c3ce713cdaacf --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct RelativeContainer_AnchorPoint_Visibility_Hidden { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Visibility_Hidden onPageShow'); + + } + build() { + Row() { + RelativeContainer() { + Button("Button1").width(120).height(30) + .alignRules({ + middle:{anchor:"__container__",align:HorizontalAlign.Center} + }) + .visibility(Visibility.Hidden) + .key("RelativeContainer_AnchorPoint_Visibility_Hidden_bt1") + .id("RelativeContainer_AnchorPoint_Visibility_Hidden_bt1").borderWidth(5).borderColor(Color.Black) + + Text("This is text").fontSize(20).padding(10) + .alignRules({ + right:{anchor:"RelativeContainer_AnchorPoint_Visibility_Hidden_bt1",align:HorizontalAlign.Center}, + top:{anchor:"RelativeContainer_AnchorPoint_Visibility_Hidden_bt1",align:VerticalAlign.Bottom}, + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + }) + .key("RelativeContainer_AnchorPoint_Visibility_Hidden_tx2") + .id("RelativeContainer_AnchorPoint_Visibility_Hidden_tx2").borderWidth(2).borderColor(Color.Green) + .height(30) + .width(150) + + Button("Button2").width(120).height(30) + .alignRules({ + right:{anchor:"__container__",align:HorizontalAlign.End} + }) + .key("RelativeContainer_AnchorPoint_Visibility_Hidden_bt2") + .id("RelativeContainer_AnchorPoint_Visibility_Hidden_bt2").borderWidth(5).borderColor(Color.Black) + + } + .key("RelativeContainer_AnchorPoint_Visibility_Hidden_r1") + .width(300).height(300) + } + .key("RelativeContainer_AnchorPoint_Visibility_Hidden_row1") + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb419162be5259d6a08987010c1151889612d532 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2023 Huawei Device 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 RelativeContainer_AnchorPoint_Visibility_None { + onPageShow() { + console.info('RelativeContainer_AnchorPoint_Visibility_None onPageShow'); + + } + build() { + Row() { + RelativeContainer() { + Button("Button1").width(120).height(30) + .alignRules({ + middle:{anchor:"__container__",align:HorizontalAlign.Center} + }) + .visibility(Visibility.None) + .key("RelativeContainer_AnchorPoint_Visibility_None_bt1") + .id("RelativeContainer_AnchorPoint_Visibility_None_bt1").borderWidth(5).borderColor(Color.Black) + + Text("This is text").fontSize(20).padding(10) + .alignRules({ + right:{anchor:"RelativeContainer_AnchorPoint_Visibility_None_bt1",align:HorizontalAlign.Center}, + top:{anchor:"RelativeContainer_AnchorPoint_Visibility_None_bt1",align:VerticalAlign.Bottom}, + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + }) + .key("RelativeContainer_AnchorPoint_Visibility_None_tx2") + .id("RelativeContainer_AnchorPoint_Visibility_None_tx2").borderWidth(2).borderColor(Color.Green) + .height(30) + .width(150) + + Button("Button2").width(120).height(30) + .alignRules({ + right:{anchor:"__container__",align:HorizontalAlign.End} + }) + .key("RelativeContainer_AnchorPoint_Visibility_None_bt2") + .id("RelativeContainer_AnchorPoint_Visibility_None_bt2").borderWidth(5).borderColor(Color.Black) + + } + .key("RelativeContainer_AnchorPoint_Visibility_None_r1") + .width(300).height(300) + } + .key("RelativeContainer_AnchorPoint_Visibility_None_row1") + .height('100%') + } + +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.ets new file mode 100644 index 0000000000000000000000000000000000000000..92c95a7d053e953f6b8a7678efb561039f4be3bb --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2023 Huawei Device 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 RelativeContainer_Level { + @State addalign : HorizontalAlign = HorizontalAlign.Start + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('RelativeContainer_Level onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'addalign') { + this.addalign = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build() { + Row() { + RelativeContainer() { + Button("Button1").width(120).height(30) + .alignRules({ + middle:{anchor:"__container__",align:HorizontalAlign.Center} + }) + .key("RelativeContainer_Level_bt1") + .id("RelativeContainer_Level_bt1").borderWidth(5).borderColor(Color.Black) + + Text("This is text").fontSize(20).padding(10) + .alignRules({ + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + top:{anchor:"RelativeContainer_Level_bt1",align:VerticalAlign.Bottom}, + right:{anchor:"RelativeContainer_Level_bt1",align:this.addalign} + }) + .key("RelativeContainer_Level_bt1") + .id("RelativeContainer_Level_tx2").borderWidth(2).borderColor(Color.Green) + .height(30) + .width(250) + } + .width(300).height(300) + .border({width:2, color: "#6699FF"}) + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f5991112327b0ad9e21f901bbc2ec65b0ed7ecf --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/pages/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.ets @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2023 Huawei Device 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 RelativeContainer_Vertical { + @State addalign : VerticalAlign = VerticalAlign.Top + messageManager:MessageManager = new MessageManager() + onPageShow() { + console.info('RelativeContainer_Vertical onPageShow'); + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value); + if (message.name == 'addalign') { + this.addalign = message.value; + } + } + this.messageManager.registerCallback(callback); + } + build() { + Row() { + RelativeContainer() { + Button("Button1").width(120).height(30) + .alignRules({ + center:{anchor:"__container__",align:VerticalAlign.Center} + }) + .key("RelativeContainer_Vertical_bt1") + .id("RelativeContainer_Vertical_bt1").borderWidth(5).borderColor(Color.Black) + + Text("This is text").fontSize(20).padding(10) + .alignRules({ + bottom:{anchor:"__container__",align:VerticalAlign.Bottom}, + top:{anchor:"RelativeContainer_Vertical_bt1",align:this.addalign}, + left:{anchor:"RelativeContainer_Vertical_bt1",align:HorizontalAlign.End} + }) + .key("RelativeContainer_Vertical_tx2") + .id("RelativeContainer_Vertical_tx2").borderWidth(2).borderColor(Color.Green) + .height(30) + .width(250) + } + .width(300).height(300) + .border({width:2, color: "#6699FF"}) + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets index 1e6a6f6a2de619c5b85599e6bfb15cccbed5b06a..56a388d081f3b1b0e35408a9fa34d35cfbb98a9d 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/List.test.ets @@ -91,6 +91,23 @@ import swiperItemMargin from './Swiper/Swiper_ItemChange/swiperItemMargin.test.e import swiperItemPadMar from './Swiper/Swiper_ItemChange/swiperItemPadMar.test.ets'; import swiperItemVisibility from './Swiper/Swiper_ItemChange/swiperItemVisibility.test.ets'; +import RelativeContainer_Level from './RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.test.ets'; + import RelativeContainer_Vertical from './RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.test.ets'; + import RelativeContainer_AnchorPoint_Absent from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.test.ets'; + import RelativeContainer_AnchorPoint_Circular_Dependency from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.test.ets'; + import RelativeContainer_AnchorPoint_Interdependence from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.test.ets'; + import RelativeContainer_AnchorPoint_Margin from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.test.ets'; + import RelativeContainer_AnchorPoint_Padding from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.test.ets'; + import RelativeContainer_AnchorPoint_ThreeDirection from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.test.ets'; + import RelativeContainer_AnchorPoint_TwoDirection from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.test.ets'; + import RelativeContainer_AnchorPoint_Visibility_Hidden from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.test.ets'; + import RelativeContainer_AnchorPoint_Visibility_None from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.test.ets'; + import RelativeContainer_AnchorPoint_NoId from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.test.ets'; + import RelativeContainer_AnchorPoint_Id_Null from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.test.ets'; + import RelativeContainer_AnchorPoint_Id_Undefined from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.test.ets'; + import RelativeContainer_AnchorPoint_Offset from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.test.ets'; + import RelativeContainer_AnchorPoint_Position from './RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.test.ets'; + import Row_Space from './Row/spaceChanged/Row_Space.test.ets'; import Row_Space_String from './Row/spaceChanged/Row_Space_String.test.ets'; import Row_Space_Default from './Row/spaceChanged/Row_Space_Default.test.ets'; @@ -271,6 +288,22 @@ swiperItemMargin() swiperItemPadMar() swiperItemVisibility() +RelativeContainer_Level() +RelativeContainer_Vertical() +RelativeContainer_AnchorPoint_Absent() +RelativeContainer_AnchorPoint_Circular_Dependency() +RelativeContainer_AnchorPoint_Interdependence() +RelativeContainer_AnchorPoint_Margin() +RelativeContainer_AnchorPoint_Padding() +RelativeContainer_AnchorPoint_ThreeDirection() +RelativeContainer_AnchorPoint_TwoDirection() +RelativeContainer_AnchorPoint_Visibility_Hidden() +RelativeContainer_AnchorPoint_Visibility_None() +RelativeContainer_AnchorPoint_NoId() +RelativeContainer_AnchorPoint_Id_Null() +RelativeContainer_AnchorPoint_Id_Undefined() +RelativeContainer_AnchorPoint_Offset() +RelativeContainer_AnchorPoint_Position() Row_Space() Row_Space_String() diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fff81962742631876d8da7f495505098fb85470 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent.test.ets @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Absent() { + describe('RelativeContainer_AnchorPoint_Absent', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Absent beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Absent state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Absent" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Absent pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Absent page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Absent page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Absent after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Absent_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Relying on non-existent elements as anchors + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Absent_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Absent_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Absent_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Absent_bt1'); + let RelativeContainer_AnchorPoint_Absent_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Absent_tx2'); + let RelativeContainer_AnchorPoint_Absent_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Absent_r1'); + let RelativeContainer_AnchorPoint_Absent_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Absent_row1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_Absent_r1.left).assertEqual(RelativeContainer_AnchorPoint_Absent_row1.left); + + expect(RelativeContainer_AnchorPoint_Absent_bt1.top).assertEqual(RelativeContainer_AnchorPoint_Absent_r1.top ); + expect(RelativeContainer_AnchorPoint_Absent_bt1.left + (RelativeContainer_AnchorPoint_Absent_bt1.right - RelativeContainer_AnchorPoint_Absent_bt1.left)/2 ).assertEqual(RelativeContainer_AnchorPoint_Absent_r1.left + (RelativeContainer_AnchorPoint_Absent_r1.right - RelativeContainer_AnchorPoint_Absent_r1.left)/2); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Absent_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..200384dbcf35f8f00d321630ba50c6d9584efad4 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency.test.ets @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Circular_Dependency() { + describe('RelativeContainer_AnchorPoint_Circular_Dependency', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Circular_Dependency beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Circular_Dependency state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Circular_Dependency" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Circular_Dependency pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Circular_Dependency page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Circular_Dependency page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Circular_Dependency after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Circular_Dependency_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Circular dependencies between subcomponents + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Circular_Dependency_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Circular_Dependency_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Circular_Dependency_row4 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Circular_Dependency_row4'); + + let RelativeContainer_AnchorPoint_Circular_Dependency_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Circular_Dependency_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Circular_Dependency_row4.left).assertEqual(RelativeContainer_AnchorPoint_Circular_Dependency_r1.left); + expect(RelativeContainer_AnchorPoint_Circular_Dependency_row4.top).assertEqual(RelativeContainer_AnchorPoint_Circular_Dependency_r1.top); +// expect(RelativeContainer_AnchorPoint_Circular_Dependency_row4.bottom).assertEqual(RelativeContainer_AnchorPoint_Circular_Dependency_r1.bottom); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Circular_Dependency_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..84aed476eab6302209a15ac50b20e2c8681b345b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null.test.ets @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Id_Null() { + describe('RelativeContainer_AnchorPoint_Id_Null', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Id_Null beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Id_Null state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Id_Null" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Id_Null pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Id_Null page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Id_Null page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Id_Null after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Id_Null_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set the id of the child element to null + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Id_Null_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Id_Null_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Id_Null_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Null_row1'); +// let RelativeContainer_AnchorPoint_Id_Null_row2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Null_row2'); + + let RelativeContainer_AnchorPoint_Id_Null_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Null_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Id_Null_row1.left).assertEqual(RelativeContainer_AnchorPoint_Id_Null_r1.left); + expect(RelativeContainer_AnchorPoint_Id_Null_row1.top).assertEqual(RelativeContainer_AnchorPoint_Id_Null_r1.top); + +// expect(RelativeContainer_AnchorPoint_Id_Null_row2.right).assertEqual(RelativeContainer_AnchorPoint_Id_Null_r1.right); +// expect(RelativeContainer_AnchorPoint_Id_Null_row2.top).assertEqual(RelativeContainer_AnchorPoint_Id_Null_r1.top); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Id_Null_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8977e4a81c236ae4d1bdd2113420c94ea5e92d36 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined.test.ets @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Id_Undefined() { + describe('RelativeContainer_AnchorPoint_Id_Undefined', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Id_Undefined beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Id_Undefined state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Id_Undefined" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Id_Undefined pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Id_Undefined page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Id_Undefined page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Id_Undefined after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Id_Undefined_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set the id of the child element to undefined + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Id_Undefined_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Id_Undefined_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Id_Undefined_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Undefined_row1'); +// let RelativeContainer_AnchorPoint_Id_Undefined_row2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Undefined_row2'); + + let RelativeContainer_AnchorPoint_Id_Undefined_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Id_Undefined_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Id_Undefined_row1.left).assertEqual(RelativeContainer_AnchorPoint_Id_Undefined_r1.left); + expect(RelativeContainer_AnchorPoint_Id_Undefined_row1.top).assertEqual(RelativeContainer_AnchorPoint_Id_Undefined_r1.top); + +// expect(RelativeContainer_AnchorPoint_Id_Undefined_row2.right).assertEqual(RelativeContainer_AnchorPoint_Id_Undefined_r1.right); +// expect(RelativeContainer_AnchorPoint_Id_Undefined_row2.top).assertEqual(RelativeContainer_AnchorPoint_Id_Undefined_r1.top); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Id_Undefined_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6149b599092a95477f026e0af20bcbe6c2851c6b --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence.test.ets @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Interdependence() { + describe('RelativeContainer_AnchorPoint_Interdependence', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Interdependence beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Interdependence state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Interdependence" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Interdependence pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Interdependence page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Interdependence page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Interdependence after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Interdependence_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Subcomponent interdependence + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Interdependence_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Interdependence_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Interdependence_row3 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Interdependence_row3'); + + let RelativeContainer_AnchorPoint_Interdependence_re1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Interdependence_re1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Interdependence_row3.left).assertEqual(RelativeContainer_AnchorPoint_Interdependence_re1.left); + expect(RelativeContainer_AnchorPoint_Interdependence_row3.top).assertEqual(RelativeContainer_AnchorPoint_Interdependence_re1.top); +// expect(RelativeContainer_AnchorPoint_Interdependence_row3.bottom).assertEqual(RelativeContainer_AnchorPoint_Interdependence_re1.bottom); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Interdependence_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..99b73ddd29978efc600051e10d0d7b2bfd44932c --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin.test.ets @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Margin() { + describe('RelativeContainer_AnchorPoint_Margin', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Margin beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Margin state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Margin" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Margin pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Margin page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Margin page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Margin after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Margin_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Parent component setting margin property + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Margin_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Margin_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Margin_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Margin_bt1'); + let RelativeContainer_AnchorPoint_Margin_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Margin_tx2'); + let RelativeContainer_AnchorPoint_Margin_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Margin_r1'); + let RelativeContainer_AnchorPoint_Margin_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Margin_row1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_Margin_row1.left).assertEqual(vp2px(100)); + expect(RelativeContainer_AnchorPoint_Margin_r1.left).assertEqual(RelativeContainer_AnchorPoint_Margin_row1.left); + + expect(RelativeContainer_AnchorPoint_Margin_tx2.top).assertEqual(RelativeContainer_AnchorPoint_Margin_bt1.bottom); + expect(RelativeContainer_AnchorPoint_Margin_tx2.bottom).assertEqual(RelativeContainer_AnchorPoint_Margin_r1.bottom); + expect(RelativeContainer_AnchorPoint_Margin_tx2.right).assertEqual((RelativeContainer_AnchorPoint_Margin_bt1.right - RelativeContainer_AnchorPoint_Margin_bt1.left)/2 + RelativeContainer_AnchorPoint_Margin_bt1.left); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Margin_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c8114d371f8706e20a8043b09db78f065ae09d5 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId.test.ets @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_NoId() { + describe('RelativeContainer_AnchorPoint_NoId', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_NoId beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_NoId state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_NoId" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_NoId pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_NoId page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_NoId page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_NoId after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_NoId_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set ID for one subcomponent, do not set ID for one subcomponent + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_NoId_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_NoId_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_NoId_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_NoId_row1'); + +// let RelativeContainer_AnchorPoint_NoId_row2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_NoId_row2'); + let RelativeContainer_AnchorPoint_NoId_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_NoId_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_NoId_row1.left).assertEqual(RelativeContainer_AnchorPoint_NoId_r1.left); + expect(RelativeContainer_AnchorPoint_NoId_row1.top).assertEqual(RelativeContainer_AnchorPoint_NoId_r1.top); + +// expect(RelativeContainer_AnchorPoint_NoId_row2.right).assertEqual(RelativeContainer_AnchorPoint_NoId_r1.right); +// expect(RelativeContainer_AnchorPoint_NoId_row2.top).assertEqual(RelativeContainer_AnchorPoint_NoId_r1.top); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_NoId_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eed7a8255540ba26163f2650835f4889142fe923 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset.test.ets @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Offset() { + describe('RelativeContainer_AnchorPoint_Offset', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Offset beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Offset state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Offset" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Offset pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Offset page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Offset page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Offset after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Offset_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set offset after alignment + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Offset_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Offset_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Offset_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Offset_bt1'); + let RelativeContainer_AnchorPoint_Offset_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Offset_tx2'); + let RelativeContainer_AnchorPoint_Offset_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Offset_r1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_Offset_tx2.top).assertEqual(RelativeContainer_AnchorPoint_Offset_bt1.bottom); + expect(RelativeContainer_AnchorPoint_Offset_tx2.bottom).assertEqual(RelativeContainer_AnchorPoint_Offset_r1.bottom); + expect(RelativeContainer_AnchorPoint_Offset_tx2.right).assertEqual((RelativeContainer_AnchorPoint_Offset_bt1.right - RelativeContainer_AnchorPoint_Offset_bt1.left)/2 + RelativeContainer_AnchorPoint_Offset_bt1.left + vp2px(50)); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Offset_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1e8052f67a3265235594d1177397efee5eab07f --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding.test.ets @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Padding() { + describe('RelativeContainer_AnchorPoint_Padding', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Padding beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Padding state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Padding" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Padding pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Padding page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Padding page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Padding after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Padding_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Parent component setting padding property + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Padding_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Padding_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Padding_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Padding_bt1'); + let RelativeContainer_AnchorPoint_Padding_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Padding_tx2'); + let RelativeContainer_AnchorPoint_Padding_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Padding_r1'); + let RelativeContainer_AnchorPoint_Padding_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Padding_row1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_Padding_r1.left).assertEqual(RelativeContainer_AnchorPoint_Padding_row1.left + vp2px(100)); + + expect(RelativeContainer_AnchorPoint_Padding_tx2.top).assertEqual(RelativeContainer_AnchorPoint_Padding_bt1.bottom); + expect(RelativeContainer_AnchorPoint_Padding_tx2.bottom).assertEqual(RelativeContainer_AnchorPoint_Padding_r1.bottom); + expect(RelativeContainer_AnchorPoint_Padding_tx2.right).assertEqual((RelativeContainer_AnchorPoint_Padding_bt1.right - RelativeContainer_AnchorPoint_Padding_bt1.left)/2 + RelativeContainer_AnchorPoint_Padding_bt1.left); + + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Padding_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b99f8d086b0bd929e4a71b842c86e0ee3602ea8d --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position.test.ets @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Position() { + describe('RelativeContainer_AnchorPoint_Position', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Position beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Position state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Position" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Position pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Position page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Position page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Position after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Position_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set position after alignment + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Position_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Position_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Position_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Position_bt1'); + let RelativeContainer_AnchorPoint_Position_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Position_tx2'); + let RelativeContainer_AnchorPoint_Position_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Position_r1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_Position_tx2.top).assertEqual(RelativeContainer_AnchorPoint_Position_bt1.bottom ); + expect(RelativeContainer_AnchorPoint_Position_tx2.left).assertEqual(RelativeContainer_AnchorPoint_Position_r1.left ); + expect(RelativeContainer_AnchorPoint_Position_tx2.right).assertEqual((RelativeContainer_AnchorPoint_Position_bt1.right - RelativeContainer_AnchorPoint_Position_bt1.left)/2 + RelativeContainer_AnchorPoint_Position_bt1.left); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Position_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bc20cdbcf05d37c8587e91391248ac5c4dc6fad --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection.test.ets @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_ThreeDirection() { + describe('RelativeContainer_AnchorPoint_ThreeDirection', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_ThreeDirection beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_ThreeDirection state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_ThreeDirection" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_ThreeDirection pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_ThreeDirection page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_ThreeDirection page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_ThreeDirection after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_ThreeDirection_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc row set two directions anchor piont + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_ThreeDirection_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_ThreeDirection_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_ThreeDirection_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_ThreeDirection_bt1'); + let RelativeContainer_AnchorPoint_ThreeDirection_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_ThreeDirection_tx2'); + let RelativeContainer_AnchorPoint_ThreeDirection_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_ThreeDirection_r1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_ThreeDirection_tx2.top).assertEqual(RelativeContainer_AnchorPoint_ThreeDirection_r1.top); + expect(RelativeContainer_AnchorPoint_ThreeDirection_tx2.bottom).assertEqual(RelativeContainer_AnchorPoint_ThreeDirection_r1.bottom); + expect(RelativeContainer_AnchorPoint_ThreeDirection_tx2.right).assertEqual((RelativeContainer_AnchorPoint_ThreeDirection_bt1.right - RelativeContainer_AnchorPoint_ThreeDirection_bt1.left)/2 + RelativeContainer_AnchorPoint_ThreeDirection_bt1.left); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_ThreeDirection_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..65d5522d8ba1398024e6b191296623b16b575a10 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection.test.ets @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_TwoDirection() { + describe('RelativeContainer_AnchorPoint_TwoDirection', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_TwoDirection beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_TwoDirection state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_TwoDirection" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_TwoDirection pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_TwoDirection page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_TwoDirection page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_TwoDirection after each called") + }); + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_TwoDirection_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc row set two directions anchor piont + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_TwoDirection_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_TwoDirection_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_TwoDirection_row1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_TwoDirection_row1'); + let RelativeContainer_AnchorPoint_TwoDirection_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_TwoDirection_r1'); + + + console.log('assert position') + expect(RelativeContainer_AnchorPoint_TwoDirection_row1.top).assertEqual(RelativeContainer_AnchorPoint_TwoDirection_r1.top); + expect(RelativeContainer_AnchorPoint_TwoDirection_row1.bottom).assertEqual(RelativeContainer_AnchorPoint_TwoDirection_r1.bottom); + expect(RelativeContainer_AnchorPoint_TwoDirection_row1.left).assertEqual(RelativeContainer_AnchorPoint_TwoDirection_r1.left); + expect(RelativeContainer_AnchorPoint_TwoDirection_row1.right).assertEqual(RelativeContainer_AnchorPoint_TwoDirection_r1.right); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_TwoDirection_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2f5f1743b84a9677c50c6e39957323125a7595e --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden.test.ets @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Visibility_Hidden() { + describe('RelativeContainer_AnchorPoint_Visibility_Hidden', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Visibility_Hidden beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Visibility_Hidden state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Visibility_Hidden" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Visibility_Hidden pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Visibility_Hidden page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Visibility_Hidden page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Visibility_Hidden after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Visibility_Hidden_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set visibility.none for btn1 + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Visibility_Hidden_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Visibility_Hidden_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_AnchorPoint_Visibility_Hidden_bt1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_Hidden_bt1'); + let RelativeContainer_AnchorPoint_Visibility_Hidden_bt2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_Hidden_bt2'); + let RelativeContainer_AnchorPoint_Visibility_Hidden_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_Hidden_tx2'); + let RelativeContainer_AnchorPoint_Visibility_Hidden_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_Hidden_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Visibility_Hidden_bt1.top).assertEqual(RelativeContainer_AnchorPoint_Visibility_Hidden_r1.top ); + expect(RelativeContainer_AnchorPoint_Visibility_Hidden_bt2.right).assertEqual(RelativeContainer_AnchorPoint_Visibility_Hidden_r1.right ); + + expect(RelativeContainer_AnchorPoint_Visibility_Hidden_tx2.top).assertEqual(RelativeContainer_AnchorPoint_Visibility_Hidden_bt1.bottom ); + expect(RelativeContainer_AnchorPoint_Visibility_Hidden_tx2.bottom).assertEqual(RelativeContainer_AnchorPoint_Visibility_Hidden_r1.bottom ); + expect(RelativeContainer_AnchorPoint_Visibility_Hidden_tx2.right).assertEqual((RelativeContainer_AnchorPoint_Visibility_Hidden_bt1.right - RelativeContainer_AnchorPoint_Visibility_Hidden_bt1.left)/2 + RelativeContainer_AnchorPoint_Visibility_Hidden_bt1.left); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Visibility_Hidden_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e85cf6b98a7c52eb3a24284c0ac41c0c4784228 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None.test.ets @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_AnchorPoint_Visibility_None() { + describe('RelativeContainer_AnchorPoint_Visibility_None', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_AnchorPoint_Visibility_None beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_AnchorPoint_Visibility_None state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_AnchorPoint_Visibility_None" == pages.name)) { + console.info("get RelativeContainer_AnchorPoint_Visibility_None pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_AnchorPoint_Visibility_None page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_AnchorPoint_Visibility_None page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_AnchorPoint_Visibility_None after each called") + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_AnchorPoint_Visibility_None_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc Set visibility.none for btn1 + */ + it('SUB_ACE_RelativeContainer_AnchorPoint_Visibility_None_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Visibility_None_TEST_0100] START'); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + + console.log('get RelativeContainer_AnchorPoint_Visibility_None_bt2 value') + let RelativeContainer_AnchorPoint_Visibility_None_bt2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_None_bt2'); + + console.log('get RelativeContainer_AnchorPoint_Visibility_None_tx2 value') +// let RelativeContainer_AnchorPoint_Visibility_None_tx2 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_None_tx2'); + let RelativeContainer_AnchorPoint_Visibility_None_r1 = CommonFunc.getComponentRect('RelativeContainer_AnchorPoint_Visibility_None_r1'); + + console.log('assert position') + + expect(RelativeContainer_AnchorPoint_Visibility_None_bt2.right).assertEqual(RelativeContainer_AnchorPoint_Visibility_None_r1.right); + + console.info('[SUB_ACE_RelativeContainer_AnchorPoint_Visibility_None_TEST_0100] END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..398e2cdef011e34017ed51e4aba84334f6c341ed --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level.test.ets @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_Level() { + describe('RelativeContainer_Level', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_Level beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_Level state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_Level" == pages.name)) { + console.info("get RelativeContainer_Level pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_Level page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_Level page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_Level after each called") + }); + /** + * @tc.number SUB_ACE_RelativeContainer_Level_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc text set align:HorizontalAlign.Start + */ + it('SUB_ACE_RelativeContainer_Level_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0100] START'); + globalThis.value.message.notify({name:'addalign', value:HorizontalAlign.Start}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Level_bt1 = CommonFunc.getComponentRect('RelativeContainer_Level_bt1'); + let RelativeContainer_Level_tx2 = CommonFunc.getComponentRect('RelativeContainer_Level_tx2'); + + + console.log('assert position') + expect(RelativeContainer_Level_tx2.top).assertEqual(RelativeContainer_Level_bt1.bottom); + expect(RelativeContainer_Level_tx2.right).assertEqual(RelativeContainer_Level_bt1.left); + + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0100] END'); + done(); + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_Level_TEST_0200 + * @tc.name testRelativeContainer + * @tc.desc text set align:HorizontalAlign.Center + */ + it('SUB_ACE_RelativeContainer_Level_TEST_0200', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0200] START'); + globalThis.value.message.notify({name:'addalign', value:HorizontalAlign.Center}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Level_bt1 = CommonFunc.getComponentRect('RelativeContainer_Level_bt1'); + let RelativeContainer_Level_tx2 = CommonFunc.getComponentRect('RelativeContainer_Level_tx2'); + + + console.log('assert position') + expect(RelativeContainer_Level_tx2.top).assertEqual(RelativeContainer_Level_bt1.bottom); + expect(RelativeContainer_Level_tx2.right).assertEqual((RelativeContainer_Level_bt1.right - RelativeContainer_Level_bt1.left)/2 + RelativeContainer_Level_bt1.left); + + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0200] END'); + done(); + + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_Level_TEST_0300 + * @tc.name testRelativeContainer + * @tc.desc text set align:HorizontalAlign.End + */ + it('SUB_ACE_RelativeContainer_Level_TEST_0300', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0300] START'); + globalThis.value.message.notify({name:'addalign', value:HorizontalAlign.End}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Level_bt1 = CommonFunc.getComponentRect('RelativeContainer_Level_bt1'); + let RelativeContainer_Level_tx2 = CommonFunc.getComponentRect('RelativeContainer_Level_tx2'); + + + console.log('assert position') + expect(RelativeContainer_Level_tx2.top).assertEqual(RelativeContainer_Level_bt1.bottom); + expect(RelativeContainer_Level_tx2.right).assertEqual(RelativeContainer_Level_bt1.right); + + console.info('[SUB_ACE_RelativeContainer_Level_TEST_0300] END'); + done(); + + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1336ac6855c0d24d69a48e1f1e9d9509ae16d475 --- /dev/null +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical.test.ets @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import router from '@ohos.router'; +import CommonFunc from '../../../MainAbility/common/Common'; +import {MessageManager,Callback} from '../../../MainAbility/common/MessageManager'; +export default function RelativeContainer_Vertical() { + describe('RelativeContainer_Vertical', function () { + beforeEach(async function (done) { + console.info("RelativeContainer_Vertical beforeEach start"); + let options = { + url: "MainAbility/pages/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get RelativeContainer_Vertical state pages:" + JSON.stringify(pages)); + if (!("RelativeContainer_Vertical" == pages.name)) { + console.info("get RelativeContainer_Vertical pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push RelativeContainer_Vertical page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push RelativeContainer_Vertical page error " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + }); + afterEach(async function () { + await CommonFunc.sleep(2000); + console.info("RelativeContainer_Vertical after each called") + }); + /** + * @tc.number SUB_ACE_RelativeContainer_Vertical_TEST_0100 + * @tc.name testRelativeContainer + * @tc.desc text set align:VerticalAlign.Top + */ + it('SUB_ACE_RelativeContainer_Vertical_TEST_0100', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0100] START'); + globalThis.value.message.notify({name:'addalign', value:VerticalAlign.Top}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Vertical_bt1 = CommonFunc.getComponentRect('RelativeContainer_Vertical_bt1'); + let RelativeContainer_Vertical_tx2 = CommonFunc.getComponentRect('RelativeContainer_Vertical_tx2'); + + + console.log('assert position') + expect(RelativeContainer_Vertical_tx2.top).assertEqual(RelativeContainer_Vertical_bt1.top); + expect(RelativeContainer_Vertical_tx2.left).assertEqual(RelativeContainer_Vertical_bt1.right); + + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0100] END'); + done(); + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_Vertical_TEST_0200 + * @tc.name testRelativeContainer + * @tc.desc text set align:VerticalAlign.Center + */ + it('SUB_ACE_RelativeContainer_Vertical_TEST_0200', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0200] START'); + globalThis.value.message.notify({name:'addalign', value:VerticalAlign.Center}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Vertical_bt1 = CommonFunc.getComponentRect('RelativeContainer_Vertical_bt1'); + let RelativeContainer_Vertical_tx2 = CommonFunc.getComponentRect('RelativeContainer_Vertical_tx2'); + + + console.log('assert position') + expect(RelativeContainer_Vertical_tx2.top).assertEqual((RelativeContainer_Vertical_bt1.bottom - RelativeContainer_Vertical_bt1.top)/2 + RelativeContainer_Vertical_bt1.top); + expect(RelativeContainer_Vertical_tx2.left).assertEqual(RelativeContainer_Vertical_bt1.right); + + + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0200] END'); + done(); + + }); + + /** + * @tc.number SUB_ACE_RelativeContainer_Vertical_TEST_0300 + * @tc.name testRelativeContainer + * @tc.desc text set align:VerticalAlign.Bottom + */ + it('SUB_ACE_RelativeContainer_Vertical_TEST_0300', 0, async function (done) { + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0300] START'); + globalThis.value.message.notify({name:'addalign', value:VerticalAlign.Bottom}); + + await CommonFunc.sleep(3000); + console.log('get Initial value') + let RelativeContainer_Vertical_bt1 = CommonFunc.getComponentRect('RelativeContainer_Vertical_bt1'); + let RelativeContainer_Vertical_tx2 = CommonFunc.getComponentRect('RelativeContainer_Vertical_tx2'); + + + console.log('assert position') + + expect(RelativeContainer_Vertical_tx2.top).assertEqual(RelativeContainer_Vertical_bt1.bottom); + expect(RelativeContainer_Vertical_tx2.left).assertEqual(RelativeContainer_Vertical_bt1.right); + + console.info('[SUB_ACE_RelativeContainer_Vertical_TEST_0300] END'); + done(); + + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json index 1a0b026149716572cd065fd00593bb206764835e..5bb15097a8a826e0a87f68bcae32a5dc198d62ae 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_layout_test/entry/src/main/resources/base/profile/main_pages.json @@ -80,6 +80,23 @@ "MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemMargin", "MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemVisibility", + "MainAbility/pages/RelativeContainer/RelativeContainer_Level/RelativeContainer_Level", + "MainAbility/pages/RelativeContainer/RelativeContainer_Vertical/RelativeContainer_Vertical", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Absent", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Circular_Dependency", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Interdependence", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Margin", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Padding", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_ThreeDirection", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_TwoDirection", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_Hidden", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Visibility_None", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_NoId", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Null", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Id_Undefined", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Offset", + "MainAbility/pages/RelativeContainer/RelativeContainer_AnchorPoint/RelativeContainer_AnchorPoint_Position", + "MainAbility/pages/Row/spaceChanged/Row_Space", "MainAbility/pages/Row/spaceChanged/Row_Space_String", "MainAbility/pages/Row/spaceChanged/Row_Space_Default",