diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets index 867a4feb0d32fb4e7108cc53a17057ff51548743..19fc8d379ece82fa719317c5b0875a97c68f072f 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/scroll.test.ets @@ -126,7 +126,7 @@ export default function scrollOnScrollBeginJsunit() { console.info("[testscrollOnScrollBegin0005] component align strJson:" + strJson); let obj = JSON.parse(strJson); expect(obj.$type).assertEqual('Scroll'); - expect(obj.$attrs.scrollBarWidth).assertEqual("30.00px"); + expect(obj.$attrs.scrollBarWidth).assertEqual("30.00vp"); console.info("[testscrollOnScrollBegin0005] scrollBarWidth value :" + obj.$attrs.scrollBarWidth); done(); }); diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets index d1d4b22716f28e9e1758bcf205a36a159d5ba770..22391561f22653c402ec10f63c508c3a7d866786 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets @@ -56,7 +56,7 @@ export default function appVersionCodeJsunit() { } var callback = (eventData) => { console.info("testappVersionCode_0011 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.Code).assertEqual("1"); + expect(eventData.data.Code).assertEqual(1000000); } console.info("testappVersion click result is: " + JSON.stringify(sendEventByKey('versionCodeText', 10, ""))); events_emitter.on(innerEvent, callback); diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets index 016a559d7ff620d57688b867695d037e03744ae8..a84a75d5c72d38d4d26c8ee42de205dcb7ce1edb 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets @@ -62,7 +62,7 @@ export default function unitsModuleNameJsunit() { } var callback = (eventData) => { console.info("testunitsModuleName0001 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ModuleName).assertEqual(true); + expect(eventData.data.ModuleName).assertFalse(); } events_emitter.on(innerEvent, callback); } catch (err) { diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets index 5107adb63d53f6d674a0e6702236968bec114652..e84fb952d380231575557b7b1cc1ab279703bb41 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets @@ -1,4 +1,4 @@ -// @ts-nocheck + /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,36 +20,36 @@ import prompt from '@system.prompt' @Entry @Component struct ohosMatrix4 { - @State rotateValue: object= { + @State rotateValue:RotateOptions = { x: 1, y: 1, z: 1, - centerX: '50%', - centerY: '50%', + centerX: 7, + centerY: 8, angle: 300 } @State translateValue: object= { x: 100, y: 5 } @State scaleValue: object= { x: 2, y: 0.5 } @State transformValue: object= Matrix4.identity().translate({ x: 100, y: 100, z: 30 }) - @State transformValue: object= Matrix4.identity().translate({ x: 100, y: 100, z: 30 }) + @State transformValue1: object= Matrix4.identity().translate({ x: 100, y: 100, z: 30 }) @State matrix1: object= Matrix4.identity().transformPoint([100, 10]) - @State matrix2: object = Matrix4.identity().translate({ x: 300 }).copy() - @State matrix3: object = Matrix4.identity().scale({ x: 3 }).copy() + @State matrix2: Matrix4.Matrix4Transit = Matrix4.identity().translate({ x: 300 }).copy() + @State matrix3: Matrix4.Matrix4Transit= Matrix4.identity().scale({ x: 3 }).copy() @State matrix4: object = Matrix4.identity().rotate({x:1, y:1, z:2, angle:30}) @State matrix5: object = Matrix4.identity().scale({x:5, y:1, z:1, centerX:50, centerY:50}) @State matrix6: object = Matrix4.identity().translate({x:100, y:200, z:30}) - + @State matrix7: Matrix4.Matrix4Transit = Matrix4.identity().translate({ x: 300 }).combine(Matrix4.identity().scale({ x: 3 })); + @State onClickValue:boolean = false; private stateChangCallBack = (eventData) => { console.info("transFormExample page state change called:" + JSON.stringify(eventData)); if (eventData != null) { console.info("eventData value is"); if (eventData.data.matrix2 != null && eventData.data.matrix3 != null) { - console.info("this.matrix2 value is" + Matrix4.identity() - .translate(eventData.data.matrix2) - .copy() + "2" + JSON.stringify(Matrix4.identity().translate(eventData.data.matrix2).copy())); - this.matrix2 = Matrix4.identity().translate(eventData.data.matrix2).copy(); - console.info("this.matrix3 value is"); - this.matrix3 = Matrix4.identity().scale(eventData.data.matrix3).copy(); + let matrixV = Matrix4.identity().translate(eventData.data.matrix2); + if (matrixV != null) { + this.matrix2 = Matrix4.identity().translate(eventData.data.matrix2).copy(); + this.matrix3 = Matrix4.identity().scale(eventData.data.matrix3).copy(); + } } else { console.info("this.matrix value is not"); } @@ -129,7 +129,7 @@ struct ohosMatrix4 { }).backgroundColor(0x2788D9).key('rotate5') Image('/images/bg.jpg') .padding(5) - .transform(this.matrix2.combine(this.matrix3)) + .transform(this.matrix7) .width("40%") .height(100) .margin({ top: 5 }) diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets index d90aa5c17b0ec558865d20230db0037cd923e764..3456a5b93ce6cfda49f45ba23b4e2819481e7f31 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets @@ -169,9 +169,7 @@ export default function ohosMatrix4Jsunit() { let objNew = JSON.parse(strJsonNew); console.info("[test_OhosMatrix4_006] component objNew is: " + JSON.stringify(objNew)); console.info("[test_OhosMatrix4_006] component transform is: " + JSON.stringify(objNew.$attrs.transform)); - expect(JSON.stringify(objNew.$attrs.transform)).assertEqual('{"type":"matrix",' + - '"matrix":"0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,' + - '0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,"}'); + expect(JSON.stringify(objNew.$attrs.transform)).assertEqual('{"type":"matrix","matrix":"3.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,900.000000,0.000000,0.000000,1.000000,"}'); done(); }); }) diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets index f0f93297639601c67d5a6d179c703a4158e908fc..90304fb6f595c0d88043ded8eda9ca2cfad0fe88 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets @@ -28,9 +28,9 @@ struct QrCode { var colorValue = eventData.data.color; if (colorValue != null && colorValue.length != 0) { this.qrCodeColor = colorValue; - console.info("qrCodeColor:" + qrCodeColor); + console.info("qrCodeColor:" + this.qrCodeColor); } else { - console.info("qrCodeColor is null or empty " + qrCodeColor); + console.info("qrCodeColor is null or empty " + this.qrCodeColor); } } else { console.info("qrCode page color not change called:" + JSON.stringify(eventData)); @@ -42,9 +42,9 @@ struct QrCode { var backgroundColorValue = eventData.data.backgroundColor; if (backgroundColorValue != null && backgroundColorValue.length != 0) { this.qrCodeBackgroundColor = backgroundColorValue; - console.info("qrCodeBackgroundColor:" + qrCodeBackgroundColor); + console.info("qrCodeBackgroundColor:" + this.qrCodeBackgroundColor); } else { - console.info("backgroundColorValue is null or empty " + qrCodeColor); + console.info("backgroundColorValue is null or empty " + this.qrCodeColor); } } else { console.info("qrCode page backgroundColorValue not change called:" + JSON.stringify(eventData)); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets index 6fb068ebe68e6fd6892911dbae2b55eeef443b17..821d506566db9599c254fe17afb76d4089a8550c 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets @@ -1,4 +1,4 @@ -// @ts-nocheck + /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -92,6 +92,31 @@ struct ButtonExample { console.info("button2 emit action state err: " + JSON.stringify(err.message)) } }) + + Button('ok2') + .type(this.buttonTypeValue) + .key('buttontest') + .fontSize(this.fontSizeValue) + .backgroundColor(0x317aff) + .width(90) + .fontColor(this.fontColorValue) + .onClick(() => { + try { + var backData = { + data: { + "fontColorValue": this.fontColorValue, + } + } + var backEvent = { + eventId: 9907, + priority: events_emitter.EventPriority.LOW + } + console.info("buttontest start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("buttontest emit action state err: " + JSON.stringify(err.message)) + } + }) Button('ok!') .type(this.buttonTypeValue) .key('button3') diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets index ed3fe96ee9585e5c1ec00dbc308447de918783ab..662041d0be1a57d649e97044a5ae0ca437bbd418 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets @@ -1,4 +1,4 @@ -// @ts-nocheck + /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -243,7 +243,7 @@ export default function buttonJsunit() { } let callback = (indexEvent) => { console.info("testButton10 get state result is: " + JSON.stringify(indexEvent)) - except(indexEvent.data.fontColorValue).assertEqual(Color.Pink) + expect(indexEvent.data.fontColorValue).assertEqual(Color.Pink) } try { events_emitter.on(indexEvent, callback); @@ -280,7 +280,7 @@ export default function buttonJsunit() { } let callback = (indexEvent) => { console.info("testButton11 get state result is: " + JSON.stringify(indexEvent)) - except(indexEvent.data.fontColorValue).assertEqual(332) + expect(indexEvent.data.fontColorValue).assertEqual(332) } try { events_emitter.on(indexEvent, callback); @@ -327,7 +327,7 @@ export default function buttonJsunit() { try { var eventData = { data: { - "buttonTypeValue": qaq, + "buttonTypeValue": "qaq", } } var innerEvent = { @@ -378,7 +378,7 @@ export default function buttonJsunit() { try { let eventData = { data: { - "fontColorValue": ab996 + "fontColorValue": "ab996" } } let indexEventOne = { @@ -390,21 +390,21 @@ export default function buttonJsunit() { } catch (err) { console.log("testButton15 change component data error: " + err.message); } - await Utils.sleep(1000); + await Utils.sleep(2000); let indexEvent = { - eventId: 77, + eventId: 9907, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("testButton15 get state result is: " + JSON.stringify(indexEvent)) - except(indexEvent.data.fontColorValue).assertEqual('ab996') + expect(indexEvent.data.fontColorValue).assertEqual("ab996") } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("testButton15 on events_emitter err : " + JSON.stringify(err)); } - console.info("testButton15 click result is: " + JSON.stringify(sendEventByKey('button4', 10, ""))); + console.info("testButton15 click result is: " + JSON.stringify(sendEventByKey('buttontest', 10, ""))); await Utils.sleep(1000); console.info('[testButton15] END'); done(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ScrollCodeJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ScrollCodeJsunit.test.ets index 1f396b7d50a19f0cfc981991bf9f4371614edfd9..113a4f402b383bba70757ed7e560945013186025 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ScrollCodeJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ScrollCodeJsunit.test.ets @@ -55,7 +55,7 @@ export default function scrollCodeJsunit() { expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical'); expect(obj.$attrs.scrollBar).assertEqual('BarState.On'); expect(obj.$attrs.scrollBarColor).assertEqual('#FF0000FF'); - expect(obj.$attrs.scrollBarWidth).assertEqual('30.00px'); + expect(obj.$attrs.scrollBarWidth).assertEqual('30.00vp'); done(); }); @@ -159,7 +159,7 @@ export default function scrollCodeJsunit() { let strJson = getInspectorByKey('ScrollCode'); let obj = JSON.parse(strJson); console.info("[test_scrollCode_005] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.scrollBarWidth).assertEqual('40.00px'); + expect(obj.$attrs.scrollBarWidth).assertEqual('40.00vp'); done(); }); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TimeStampJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TimeStampJsunit.test.ets index 575358e6456c33fe2e47380b995a53808d1e21f2..0459ef47a7057cfb90de8ddd9412acf5f7de1b2d 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TimeStampJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TimeStampJsunit.test.ets @@ -50,7 +50,7 @@ export default function timeStampJsunit() { await Utils.sleep(1500); let callback = (indexEvent) => { console.info("timeStampTest_0100 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.Text).assertNotEqual(null); + expect(isNaN(indexEvent.data.Text)).assertFalse(); } let indexEvent = { eventId: 230,