From 65b27d901e39512c31dcbc2bb1848c73e265eb1a Mon Sep 17 00:00:00 2001 From: hekun Date: Mon, 27 Mar 2023 19:45:17 +0800 Subject: [PATCH] fix the test code Signed-off-by: hekun --- .../entry/src/main/ets/test/SwiperJsunit.test.ets | 2 +- .../entry/src/main/ets/test/TextStyleJsunit.test.ets | 2 +- .../entry/src/main/ets/MainAbility/pages/page2.ets | 4 ++-- .../entry/src/main/ets/test/ShapeClippingJsunit.test.ets | 8 ++++++-- .../entry/src/main/ets/test/TextJsunit.test.ets | 4 ++-- .../src/main/ets/MainAbility/pages/imageAnimator.ets | 4 ++-- .../entry/src/main/ets/test/ImageAnimatorJsunit.test.ets | 5 +++-- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets index 84c213f76..2cd211802 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets @@ -321,7 +321,7 @@ export default function swiperJsunit() { try { let eventData = { data: { - "indicator": "false" + "indicator": false } } let indexEvent = { diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/TextStyleJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/TextStyleJsunit.test.ets index d7dca8a5c..e8c834790 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/TextStyleJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/TextStyleJsunit.test.ets @@ -219,7 +219,7 @@ export default function textStyleJsunit() { console.info("[testTextStyle008] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testTextStyle008] fontSize: " + obj.$attrs.fontSize); - expect(obj.$attrs.fontSize).assertEqual('-2147483648.00fp'); + expect(obj.$attrs.fontSize).assertEqual('16.00fp'); done(); }); diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets index fd5d47452..72be9f573 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets @@ -25,7 +25,7 @@ const TAG = 'ets_apiLack_add'; struct Second { private content: string = "这是第二页" @State text: string = router.getParams()['text'] - @State data: number[] = router.getParams()['data'] + @State data: any = router.getParams()['data'] @State secondData : string = '' build() { @@ -37,7 +37,7 @@ struct Second { .fontSize(30) .key("SingleDataText") .onClick(()=>{ - this.secondData = (this.data[1]).toString() + this.secondData = (this.data.array[1]).toString() try { var backData = { data: { diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/ShapeClippingJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/ShapeClippingJsunit.test.ets index ed14f108f..eb1dbfc7e 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/ShapeClippingJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/ShapeClippingJsunit.test.ets @@ -68,7 +68,9 @@ export default function shapeClippingJsunit() { let strJson = getInspectorByKey('image_mask'); let obj = JSON.parse(strJson); console.info("[testShapeClipping002] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.mask.shape).assertEqual('Rect'); + console.info("[testShapeClipping002] component mask obj is: " + JSON.stringify(obj.$attrs.mask)); + let mask = JSON.parse(JSON.stringify(obj.$attrs.mask)); + expect(mask.shape).assertEqual('Rect'); expect(obj.$attrs.clip).assertEqual('false'); console.info('[testShapeClipping002] END'); done(); @@ -95,7 +97,9 @@ export default function shapeClippingJsunit() { let strJsonNew = getInspectorByKey('image_mask'); let objNew = JSON.parse(strJsonNew); console.info("[testShapeClipping003] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.mask.shape).assertEqual('Circle'); + console.info("[testShapeClipping003] component mask obj is: " + JSON.stringify(objNew.$attrs.mask)); + let mask = JSON.parse(JSON.stringify(objNew.$attrs.mask)); + expect(mask.shape).assertEqual('Circle'); console.info('[testShapeClipping003] END'); done(); }); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets index 6e690d5cd..62e630cd2 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets @@ -296,7 +296,7 @@ export default function textJsunit() { let strJsonNew = getInspectorByKey('text'); let objNew = JSON.parse(strJsonNew); console.info("testText_1300 component objNew is: " + JSON.stringify(objNew.$attrs.fontSize)); - expect(objNew.$attrs.fontSize).assertEqual('nanfp'); + expect(objNew.$attrs.fontSize).assertEqual('16.00fp'); console.info('testText_1300 END'); done(); }); @@ -322,7 +322,7 @@ export default function textJsunit() { let strJsonNew = getInspectorByKey('text'); let objNew = JSON.parse(strJsonNew); console.info("testText_1400 component objNew is: " + JSON.stringify(objNew.$attrs.fontSize)); - expect(objNew.$attrs.fontSize).assertEqual('-20.00fp'); + expect(objNew.$attrs.fontSize).assertEqual('16.00fp'); console.info('testText_1400 END'); done(); }); diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets index e59ffb7d2..db1a42521 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets @@ -97,7 +97,7 @@ struct ImageAnimatorExample { console.info('Finish') }) Row() { - Button('start').key('button').width(100).padding(5).onClick(() => { + Button('start').key('button_0').width(100).padding(5).onClick(() => { this.state = AnimationStatus.Running try { var backData = { @@ -106,7 +106,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 115, + eventId: 1150, priority: events_emitter.EventPriority.LOW } console.info("imageAnimator 115 button start to emit action state") diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/test/ImageAnimatorJsunit.test.ets b/arkui/ace_ets_component_two/entry/src/main/ets/test/ImageAnimatorJsunit.test.ets index 563aaa702..9dd851395 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/test/ImageAnimatorJsunit.test.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/test/ImageAnimatorJsunit.test.ets @@ -56,15 +56,16 @@ export default function imageAnimatorJsunit(){ done(); } let indexEvent = { - eventId: 115, + eventId: 1150, priority: events_emitter.EventPriority.LOW } try { events_emitter.on(indexEvent, callback); - console.info("imageAnimatorTest_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); } catch (err) { console.info("imageAnimatorTest_0100 on events_emitter err : " + JSON.stringify(err)); } + console.info("imageAnimatorTest_0100 click result is: " + JSON.stringify(sendEventByKey('button_0',10,""))); + await Utils.sleep(1000); console.info('imageAnimatorTest_0100 END'); }); -- GitLab