From ccbd3e31cd70413ababe390ced80bbf7cc2676fb Mon Sep 17 00:00:00 2001 From: hekun Date: Sat, 1 Apr 2023 16:01:26 +0800 Subject: [PATCH] fix the layout case Signed-off-by: hekun --- .../Flex_AlignContent_SpaceBetween_TextOffset.test.ets | 2 +- .../Center/AlignCenter_AddLayoutWeight.test.ets | 2 +- .../justifyContent/End/AlignEnd_AddLayoutWeight.test.ets | 2 +- .../Flex/justifyContent/End/AlignEnd_AddPadding.test.ets | 6 +++--- .../SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets | 6 +++--- .../SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets | 2 +- .../Start/AlignStart_AddLayoutWeight.test.ets | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets index 713803b11..d26ba913b 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/alignContent/SpaceBeTween/Flex_AlignContent_SpaceBetween_TextOffset.test.ets @@ -81,7 +81,7 @@ export default function flex_AlignContent_SpaceBetween_TextOffsetTest() { expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首贴边行尾溢出 expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(Math.round(fourthText.top - thirdText.bottom)); - expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(distanceBefore); + expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(Math.round(distanceBefore)); console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000] END');//其余组件行间距相等,未改变 done(); }); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Center/AlignCenter_AddLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Center/AlignCenter_AddLayoutWeight.test.ets index 2c42b1110..76729e94e 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Center/AlignCenter_AddLayoutWeight.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Center/AlignCenter_AddLayoutWeight.test.ets @@ -110,7 +110,7 @@ export default function AlignCenter_AddLayoutWeight() { expect(Center_AddLayoutWeight_013.right).assertEqual(Center_AddLayoutWeight_01.right); let oneWidth = Math.round(Center_AddLayoutWeight_011.right - Center_AddLayoutWeight_011.left); let twoWidth = Math.round(Center_AddLayoutWeight_012.right - Center_AddLayoutWeight_012.left); - expect(twoWidth / oneWidth).assertEqual(2); + expect(Math.round(twoWidth / oneWidth)).assertEqual(2); expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(Math.round(Center_AddLayoutWeight_013.right - Center_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(Center_AddLayoutWeight_011.bottom - Center_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddLayoutWeight.test.ets index 4ebab6b9c..6097c2689 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddLayoutWeight.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddLayoutWeight.test.ets @@ -110,7 +110,7 @@ export default function AlignEnd_AddLayoutWeight() { expect(End_AddLayoutWeight_013.right).assertEqual(End_AddLayoutWeight_01.right); let oneWidth = Math.round(End_AddLayoutWeight_011.right - End_AddLayoutWeight_011.left); let twoWidth = Math.round(End_AddLayoutWeight_012.right - End_AddLayoutWeight_012.left); - expect(twoWidth / oneWidth).assertEqual(2); + expect(Math.round(twoWidth / oneWidth)).assertEqual(2); expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(Math.round(End_AddLayoutWeight_013.right - End_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(End_AddLayoutWeight_011.bottom - End_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddPadding.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddPadding.test.ets index e2a2de32f..0989c5532 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddPadding.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/End/AlignEnd_AddPadding.test.ets @@ -74,9 +74,9 @@ export default function AlignEnd_AddPadding() { expect(Math.round(End_AddPadding_011.bottom - End_AddPadding_011.top)).assertEqual(vp2px(50)); expect(Math.round(End_AddPadding_012.bottom - End_AddPadding_012.top)).assertEqual(vp2px(100)); expect(Math.round(End_AddPadding_013.bottom - End_AddPadding_013.top)).assertEqual(vp2px(150)); - expect(Math.round(End_AddPadding_011.right - End_AddPadding_011.left)).assertEqual(vp2px(440/3)); - expect(Math.round(End_AddPadding_012.right - End_AddPadding_012.left)).assertEqual(vp2px(440/3)); - expect(Math.round(End_AddPadding_013.right - End_AddPadding_013.left)).assertEqual(vp2px(440/3)); + expect(Math.round(End_AddPadding_011.right - End_AddPadding_011.left)).assertEqual(Math.round(vp2px(440/3))); + expect(Math.round(End_AddPadding_012.right - End_AddPadding_012.left)).assertEqual(Math.round(vp2px(440/3))); + expect(Math.round(End_AddPadding_013.right - End_AddPadding_013.left)).assertEqual(Math.round(vp2px(440/3))); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_END_TEST_0300] END'); done(); }); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets index 839aae505..48a0c4d7b 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddAllSpace.test.ets @@ -77,9 +77,9 @@ export default function AlignSpaceEvenly_AddAllSpace() { expect(Math.round(SpaceEvenly_AddAllSpace_011.bottom - SpaceEvenly_AddAllSpace_011.top)).assertEqual(vp2px(50)); expect(Math.round(SpaceEvenly_AddAllSpace_012.bottom - SpaceEvenly_AddAllSpace_012.top)).assertEqual(vp2px(100)); expect(Math.round(SpaceEvenly_AddAllSpace_013.bottom - SpaceEvenly_AddAllSpace_013.top)).assertEqual(vp2px(150)); - expect(Math.round(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left)).assertEqual(vp2px(440/3)); - expect(Math.round(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left)).assertEqual(vp2px(440/3)); - expect(Math.round(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left)).assertEqual(vp2px(440/3)); + expect(Math.round(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left)).assertEqual(Math.round(vp2px(440/3))); + expect(Math.round(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left)).assertEqual(Math.round(vp2px(440/3))); + expect(Math.round(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left)).assertEqual(Math.round(vp2px(440/3))); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600] END'); done(); }); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets index daffab809..487f2b8f3 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/SpaceEvenly/AlignSpaceEvenly_AddLayoutWeight.test.ets @@ -122,7 +122,7 @@ export default function AlignSpaceEvenly_AddLayoutWeight() { .assertEqual(vp2px(150)); let oneWidth = Math.round(SpaceEvenly_AddLayoutWeight_011.right - SpaceEvenly_AddLayoutWeight_011.left); let twoWidth = Math.round(SpaceEvenly_AddLayoutWeight_012.right - SpaceEvenly_AddLayoutWeight_012.left); - expect(twoWidth / oneWidth).assertEqual(2); + expect(Math.round(twoWidth / oneWidth)).assertEqual(2); expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(Math.round(SpaceEvenly_AddLayoutWeight_013.right - SpaceEvenly_AddLayoutWeight_013.left)). assertEqual(vp2px(150)); diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Start/AlignStart_AddLayoutWeight.test.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Start/AlignStart_AddLayoutWeight.test.ets index ba74c9920..c044ab48d 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Start/AlignStart_AddLayoutWeight.test.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/test/Flex/justifyContent/Start/AlignStart_AddLayoutWeight.test.ets @@ -110,7 +110,7 @@ export default function AlignStart_AddLayoutWeight() { expect(Start_AddLayoutWeight_013.right).assertEqual(Start_AddLayoutWeight_01.right); let oneWidth = Math.round(Start_AddLayoutWeight_011.right - Start_AddLayoutWeight_011.left); let twoWidth = Math.round(Start_AddLayoutWeight_012.right - Start_AddLayoutWeight_012.left); - expect(twoWidth / oneWidth).assertEqual(2); + expect(Math.round(twoWidth / oneWidth)).assertEqual(2); expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(Math.round(Start_AddLayoutWeight_013.right - Start_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(Start_AddLayoutWeight_011.bottom - Start_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); -- GitLab