diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridItemJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridItemJsunit.test.ets index 54c829684a45272c6f1603419ff81e451dfbafd5..0bee830f85ba8da107a799398a0c44f150086c19 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridItemJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridItemJsunit.test.ets @@ -166,14 +166,12 @@ export default function GridItemJsunit() { it('GridJsunit_0500', 0, async function (done) { // Verify the columnsTemplate of Grid component console.info('[GridJsunit_0500] START'); - let gridItem1 = CommonFunc.getComponentRect('gridItem1'); - let left1 = gridItem1.left - let gridItem2 = CommonFunc.getComponentRect('gridItem1'); - let right1 = gridItem2.right + let gridItem1 = CommonFunc.getComponentRect('0'); + let right1 = gridItem1.right; await CommonFunc.sleep(1000); - let gridItem3 = CommonFunc.getComponentRect('3'); - let right2 = gridItem3.right - expect(right2 - left1 - 4 * 6).assertEqual((right1 - left1) * 5); + let gridItem3 = CommonFunc.getComponentRect('1'); + let left3 = gridItem3.left; + expect(left3 - right1).assertEqual(vp2px(4)); console.info('[GridJsunit_0500] END'); done(); }); @@ -183,12 +181,10 @@ export default function GridItemJsunit() { console.info('[GridJsunit_0600] START'); await CommonFunc.sleep(1000); let gridItem1 = CommonFunc.getComponentRect('0'); - let top1 = gridItem1.top - let gridItem2 = CommonFunc.getComponentRect('gridItem3'); - let top2 = gridItem2.top - let gridItem3 = CommonFunc.getComponentRect('gridItem3'); - let bottom2 = gridItem3.bottom - expect((bottom2 - top2) * 4 + 7.5).assertEqual(bottom2 - top1 - 5 * 3); + let bottom1 = gridItem1.bottom; + let gridItem3 = CommonFunc.getComponentRect('4'); + let top3 = gridItem3.top; + expect(top3 - bottom1).assertEqual(vp2px(5)); console.info('[GridJsunit_0600] END'); done(); }); @@ -199,10 +195,10 @@ export default function GridItemJsunit() { await CommonFunc.sleep(1000); let driver = await UiDriver.create() let gridItem1 = CommonFunc.getComponentRect('gridItem1'); - let right1 = gridItem1.right + let right1 = gridItem1.right; let gridItem2 = CommonFunc.getComponentRect('0'); - let left1 = gridItem2.left - expect(left1 - right1).assertEqual(6); + let left1 = gridItem2.left; + expect(left1 - right1).assertEqual(vp2px(4)); console.info('[GridJsunit_0700] END'); done(); }); @@ -216,10 +212,10 @@ export default function GridItemJsunit() { await CommonFunc.sleep(1000); let driver = await UiDriver.create() let gridItem1 = CommonFunc.getComponentRect('gridItem1'); - let bottom1 = gridItem1.bottom + let bottom1 = gridItem1.bottom; let gridItem2 = CommonFunc.getComponentRect('gridItem3'); - let top1 = gridItem2.top - expect(top1 - bottom1).assertEqual(7.5); + let top1 = gridItem2.top; + expect(top1 - bottom1).assertEqual(vp2px(5)); console.info('[GridJsunit_0800] END'); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridRowJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridRowJsunit.test.ets index 488008f284d5431d6c88773688d4c7cc1a440bd7..063b971d044205d84f2c3357c4afabf18221193b 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridRowJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/GridRowJsunit.test.ets @@ -57,7 +57,11 @@ export default function GridRowJsunit() { expect(obj.$attrs.columns).assertEqual('4'); expect(obj.$attrs.breakpoints).assertEqual('4'); expect(obj.$attrs.direction).assertEqual('4'); - expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000'); + // fix the vp2px + let x = vp2px(5).toFixed(6); + let y = vp2px(10).toFixed(6); + let str = '<' + x + ', '+y; + expect(obj.$attrs.gutter).assertEqual(str); console.info('[GridRowJsunit_0100] END'); done(); }); @@ -65,13 +69,15 @@ export default function GridRowJsunit() { it('GridRowJsunit_0200', 0, async function (done) { // Modify the properties of component GridRow console.info('[GridRowJsunit_0200] START'); - globalThis.value.message.notify({name:'columns',value:12}) + globalThis.value.message.notify({name:'columns',value:'12'}) await CommonFunc.sleep(2000); - globalThis.value.message.notify({name:'gutter',value:{ x: 12, y: 27}}) + globalThis.value.message.notify({name:'gutter',value:'x: 7.5, y: 15'}) await CommonFunc.sleep(2000); - globalThis.value.message.notify({name:'breakpoints',value:{ value: ["200vp", "400vp", "600vp"], reference: BreakpointsReference.ComponentSize }}) + globalThis.value.message.notify({name:'breakpoints',value:'12'}) await CommonFunc.sleep(2000); - globalThis.value.message.notify({name:'grDirection',value:GridRowDirection.RowReverse }) + globalThis.value.message.notify({name:'grDirection',value:'12'}) + await CommonFunc.sleep(2000); + globalThis.value.message.notify({name:'currentBp',value:'sm'}) await CommonFunc.sleep(2000); // Get the propoties value of the GridRow component @@ -83,9 +89,12 @@ export default function GridRowJsunit() { console.info("[GridRowJsunit_0200] direction: " + JSON.stringify(obj.$attrs.direction)); console.info("[GridRowJsunit_0200] gutter: " + JSON.stringify(obj.$attrs.gutter)); expect(obj.$attrs.columns).assertEqual('12'); - expect(obj.$attrs.gutter).assertEqual('<18.000000, 40.500000'); expect(obj.$attrs.breakpoints).assertEqual('12'); expect(obj.$attrs.direction).assertEqual('12'); + let x = vp2px(5).toFixed(6); + let y = vp2px(10).toFixed(6); + let str = '<' + x + ', '+y; + expect(obj.$attrs.gutter).assertEqual(str); console.info('[GridRowJsunit_0200] END'); done(); }); @@ -113,9 +122,12 @@ export default function GridRowJsunit() { console.info("[GridRowJsunit_0300] direction: " + JSON.stringify(obj.$attrs.direction)); console.info("[GridRowJsunit_0300] gutter: " + JSON.stringify(obj.$attrs.gutter)); expect(obj.$attrs.columns).assertEqual('12'); - expect(obj.$attrs.gutter).assertEqual('<18.000000, 40.500000'); expect(obj.$attrs.breakpoints).assertEqual('12'); expect(obj.$attrs.direction).assertEqual('12'); + let x = vp2px(5).toFixed(6); + let y = vp2px(10).toFixed(6); + let str = '<' + x + ', '+y; + expect(obj.$attrs.gutter).assertEqual(str); console.info('[GridRowJsunit_0300] END'); done(); }); @@ -126,8 +138,14 @@ export default function GridRowJsunit() { let strJson = getInspectorByKey('gridRow_default'); let obj = JSON.parse(strJson); console.info("[GridRowJsunit_0400] component obj is: " + JSON.stringify(obj)); + console.info("[GridRowJsunit_0400] columns: " + JSON.stringify(obj.$attrs.columns)); console.info("[GridRowJsunit_0400] breakpoints: " + JSON.stringify(obj.$attrs.breakpoints)); + console.info("[GridRowJsunit_0400] direction: " + JSON.stringify(obj.$attrs.direction)); + console.info("[GridRowJsunit_0400] gutter: " + JSON.stringify(obj.$attrs.gutter)); + expect(obj.$attrs.columns).assertEqual('12'); + expect(obj.$attrs.gutter).assertEqual('<0.000000, 0.000000'); expect(obj.$attrs.breakpoints).assertEqual('12'); + expect(obj.$attrs.direction).assertEqual('12'); console.info('[GridRowJsunit_0400] END'); done(); });