diff --git a/arkui/ace_ets_component_five/AppScope/app.json b/arkui/ace_ets_component_five/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..5f2ad72d5b5f0bf3502598ec045a1ed7b2766166 --- /dev/null +++ b/arkui/ace_ets_component_five/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetestfive", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/AppScope/resources/base/element/string.json b/arkui/ace_ets_component_five/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/arkui/ace_ets_component_five/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_component_five/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_component_five/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_component_five/BUILD.gn b/arkui/ace_ets_component_five/BUILD.gn index 7ad7049dcce8a02ab12f61742db7d9d1207fd956..d7a778f0e12527f13fa216c72276792d821c159b 100644 --- a/arkui/ace_ets_component_five/BUILD.gn +++ b/arkui/ace_ets_component_five/BUILD.gn @@ -14,25 +14,33 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAceEtsComponentFiveTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" deps = [ - ":ace_ets_component_assets", + ":ace_ets_component_resources", ":ace_ets_component_test_assets", ] ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" + certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsAceEtsComponentFiveTest" subsystem_name = "arkui" part_name = "ace_engine" } + +ohos_app_scope("ace_ets_component_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" } ohos_js_assets("ace_ets_component_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" + source_dir = "entry/src/main/ets" } ohos_resources("ace_ets_component_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "entry/src/main/resources" ] + deps = [ ":ace_ets_component_app_profile" ] + hap_profile = "entry/src/main/module.json" } diff --git a/arkui/ace_ets_component_five/Test.json b/arkui/ace_ets_component_five/Test.json index ceb7856dc41dc0ee8897ba7dcfd721dfcea838c3..12692c4d7e917c5eb183d0964819cd52ae3c2e95 100644 --- a/arkui/ace_ets_component_five/Test.json +++ b/arkui/ace_ets_component_five/Test.json @@ -1,11 +1,12 @@ { - "description": "Configuration for aceceshi Tests", + "description": "Configuration for hjunit demo Tests", "driver": { "type": "OHJSUnitTest", "test-timeout": "700000", - "bundle-name": "com.open.harmony.acetestfive", - "package-name": "com.open.harmony.acetestfive", - "shell-timeout": "700000" + "bundle-name": "com.open.harmony.acetestfive", + "module-name": "phone", + "shell-timeout": "700000", + "testcase-timeout": "180000" }, "kits": [ { diff --git a/arkui/ace_ets_component_five/entry/src/main/config.json b/arkui/ace_ets_component_five/entry/src/main/config.json deleted file mode 100644 index 9fde6227de0649082fd8e4c45b72244afb50bcd0..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_five/entry/src/main/config.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.acetestfive", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 8 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.acetestfive", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.acetestfive.MainAbility", - "deviceType": [ - "tablet", - "default", - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/checkbox", - "pages/enumsImage", - "pages/fillMode", - "pages/ohosMatrix4", - "pages/select", - "pages/colorGradient", - "pages/checkboxGroup", - "pages/edgeEffect", - "pages/slider", - "pages/backgroundAndSizeSetting", - "pages/border", - "pages/positionSetting", - "pages/shapeClipping", - "pages/transForm", - "pages/visibility", - "pages/enumsFlexAlign", - "pages/enumsVerticalAlign", - "pages/enumsHorizontalAlign" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/Application/AbilityStage.ts b/arkui/ace_ets_component_five/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0e0206ea9fb5ce94ef140d69510b6280969dd8e --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.app.ability.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/MainAbility.ts b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d66065e88c907379883364a43ec02989cfd626b --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,37 @@ +import Ability from '@ohos.app.ability.UIAbility' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets index 56a99cac708ea85da1be32614ee59635fc4b2060..12ec901d5b5d8b69690dab8a341111cd8ea3a2a7 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets @@ -1,4 +1,4 @@ -// @ts-nocheck + /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,6 +44,7 @@ struct CheckboxExample { Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) .select(true) .key('Checkbox1') + .selectedColor(0xed6f21) .onChange((value: boolean) => { console.info('Checkbox1 change is'+ value) diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index/index.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..97504e2440a9a6110fd5c9c02985914ef8d9e655 --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets index 8706480b63e61bd0f5df82af138aa1bb9a1ffed5..b6d20a58e1ad9acbdca0a42d8d152a8bec196e22 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets @@ -1,4 +1,4 @@ -// @ts-nocheck + /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,20 +18,20 @@ import events_emitter from '@ohos.events.emitter'; @Entry @Component struct PositionSetting { - @State align: Alignment = Alignment.TopStart; - @State direction: Direction = Direction.Rtl; - @State position1: {x: string, y: string} = {x: 25, y: 15}; + @State alignT: Alignment = Alignment.TopStart; + @State directionT: Direction = Direction.Rtl; + @State position1: {x: number, y: number} = {x: 25, y: 15}; @State position2: {x: string, y: string} = {x: '50%', y: '70%'}; - @State anchor: {x: string, y: string} = {x: 25, y: 25}; - @State offset: {x: string, y: string} = {x: 10, y: 15}; - @State opacityValue: string = 1; + @State anchor: {x: number, y: number} = {x: 25, y: 25}; + @State offsetT: {x: number, y: number} = {x: 10, y: 15}; + @State opacityValue: number = 1; build() { Column() { Column({space: 10}) { - Text('opacity(1)').fontSize(20).fontColor(Color.Black).width('90%').opacity(`${this.opacityValue}`).key("opacity") + Text('opacity(1)').fontSize(20).fontColor(Color.Black).width('90%').opacity(this.opacityValue).key("opacity") Text('top start') - .align(this.align) + .align(this.alignT) .height(50) .width('90%') .fontSize(20) @@ -46,7 +46,7 @@ struct PositionSetting { Text('4').height(50).width('25%').fontSize(20).backgroundColor(0xD2B48C) } .width('90%') - .direction(this.direction) + .direction(this.directionT) .key('rowDirection') Text('position').fontSize(20).fontColor(Color.Black).width('90%') @@ -92,10 +92,10 @@ struct PositionSetting { Text('offset').fontSize(20).fontColor(Color.Black).width('90%') Row() { Text('1').size({ width: '15%', height: '100' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(20) - Text(`2\noffset(${this.offset.x}, ${this.offset.y})`) + Text(`2\noffset(${this.offsetT.x}, ${this.offsetT.y})`) .size({ width: 170, height: '50' }).backgroundColor(0xbbb2cb).border({ width: 1 }) .fontSize(20).align(Alignment.Start) - .offset({ x: this.offset.x, y: this.offset.y }) + .offset({ x: this.offsetT.x, y: this.offsetT.y }) .key('offset') Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(20) Text('4\noffset(-10%, 20%)') @@ -141,16 +141,16 @@ struct PositionSetting { console.info("position page stateChangCallBack" + JSON.stringify(eventData)); if (eventData) { if (eventData.data.textAlign) { - this.align = Alignment.BottomEnd; + this.alignT = Alignment.BottomEnd; } else if (eventData.data.direction) { - this.direction = eventData.data.direction; + this.directionT = eventData.data.direction; } else if (eventData.data.position1) { this.position1 = JSON.parse(eventData.data.position1); this.position2 = JSON.parse(eventData.data.position2); } else if (eventData.data.markAnchor) { this.anchor = JSON.parse(eventData.data.markAnchor); } else if (eventData.data.offset) { - this.offset = JSON.parse(eventData.data.offset); + this.offsetT = JSON.parse(eventData.data.offset); } else if (eventData.data.opacityValue) { this.opacityValue = eventData.data.opacityValue; } diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/second/second.ets b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/TestAbility.ts b/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8028a70f8af44690b95a08bd177bca6b09f24687 --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 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 Ability from '@ohos.app.ability.UIAbility' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/pages/index.ets b/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/pages/index.ets index f87ca6e18f4a4dd9c1804b8edabe664029341e78..e29d33fb1f74914762edf3a6b3abc01b92299ad3 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/pages/index.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/TestAbility/pages/index.ets @@ -1,6 +1,5 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 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 @@ -13,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import router from '@system.router'; +import router from '@ohos.router'; @Entry @Component @@ -21,7 +20,6 @@ struct Index { aboutToAppear() { console.info('TestAbility index aboutToAppear') } - @State message: string = 'Hello World' build() { Row() { diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_five/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts index dfbf1f268a45e4a2f30b8c836f42d76f3a9f5ad3..62b493a11c91e924795200bfdfbd91e75d7d98dd 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/arkui/ace_ets_component_five/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -1,6 +1,5 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 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 @@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined function translateParamsToString(parameters) { const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', + '-s class', '-s notClass', '-s suite', '-s it', '-s level', '-s testType', '-s size', '-s timeout', - '-s package' + '-s dryRun' ]) let targetParams = ''; for (const key in parameters) { if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] + targetParams = `${targetParams} ${key} ${parameters[key]}` } } return targetParams.trim() } async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); + console.log("onAbilityCreateCallback"); } async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) } export default class OpenHarmonyTestRunner implements TestRunner { @@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { } onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') + console.info("OpenHarmonyTestRunner OnPrepare ") } - onRun() { + async onRun() { console.log('OpenHarmonyTestRunner onRun run') abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' let lMonitor = { abilityName: testAbilityName, onAbilityCreate: onAbilityCreateCallback, }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + var cmd = 'aa start -d 0 -a com.open.harmony.acetestfive.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } console.info('cmd : '+cmd) abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { @@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.exitCode); }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) console.info('OpenHarmonyTestRunner onRun end') } }; \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/BackgroundAndSizeSettingJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/BackgroundAndSizeSettingJsunit.test.ets index 48a2396571046e72d0063e3889f1363bc71809d3..452b65aa09b21c5caa290f49aa336f19a4a57f54 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/BackgroundAndSizeSettingJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/BackgroundAndSizeSettingJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function backgroundAndSizeSettingJsunit() { beforeEach(async function (done) { console.info("backgroundAndSizeSetting beforeEach start"); let options = { - uri: 'pages/backgroundAndSizeSetting', + uri: 'MainAbility/pages/backgroundAndSizeSetting', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/BorderJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/BorderJsunit.test.ets index a9e6eed892315465096990f6b2ecdb718179e86a..85fb9135b8b268e7bf9ca1fee54230ebe6379444 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/BorderJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/BorderJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function borderJsunit() { beforeEach(async function (done) { console.info("border beforeEach start"); let options = { - uri: 'pages/border', + uri: 'MainAbility/pages/border', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxGroupJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxGroupJsunit.test.ets index 0633c3a4730ac758b9efc3f45adf5fd0cf1e32ff..dbb765932a433c7a2c50cae0e819594a965b4b6b 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxGroupJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxGroupJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import Utils from './Utils'; @@ -21,7 +21,7 @@ export default function checkboxGroupJsunit() { describe('checkboxGroupTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/checkboxGroup', + uri: 'MainAbility/pages/checkboxGroup', } try { router.clear(); @@ -83,7 +83,8 @@ export default function checkboxGroupJsunit() { let strJson = getInspectorByKey('CheckboxGroup'); let obj = JSON.parse(strJson); console.info("testCheckboxGroup_400 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); + let assertObjet = obj.$attrs.borderRadius; + expect(assertObjet instanceof Object).assertTrue(); console.info('testCheckboxGroup_400 END'); done(); }); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxJsunit.test.ets index 54656eb41fa7dc06f838e213da1b3a1cdef5be6b..8d237221142129f4977aa2505565b4c7db2e17e6 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/CheckboxJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; @@ -21,7 +21,7 @@ export default function checkboxJsunit() { describe('checkboxTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/checkbox', + uri: 'MainAbility/pages/checkbox', } try { router.clear(); @@ -71,8 +71,9 @@ export default function checkboxJsunit() { await Utils.sleep(1000); let strJson = getInspectorByKey('Checkbox1'); let obj = JSON.parse(strJson); - console.info("testCheckbox_300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); + console.info("testCheckbox_300 component obj is: " + JSON.stringify(obj.$attrs.borderRadius)); + let assertObjet = obj.$attrs.borderRadius; + expect(assertObjet instanceof Object).assertTrue(); console.info('testCheckbox_300 END'); done(); }); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/ColorGradientJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/ColorGradientJsunit.test.ets index 9337994cea730cb6d014c64b591373607103d55c..8b5557791a46a5c9cba4c4e8a9706e556bb0a60d 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/ColorGradientJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/ColorGradientJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function colorGradientJsunit() { beforeEach(async function (done) { console.info("colorGradient beforeEach start"); let options = { - uri: 'pages/colorGradient', + uri: 'MainAbility/pages/colorGradient', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/EdgeEffectJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/EdgeEffectJsunit.test.ets index 839cb5196632bb25be504f2cdf6c6de90d727384..96146fea7a690b0aca120cd5c9c2f4a70b322a1c 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/EdgeEffectJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/EdgeEffectJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function edgeEffectJsunit(){ describe('edgeEffectTest', function (){ beforeEach(async function (done) { let options = { - uri: 'pages/edgeEffect', + uri: 'MainAbility/pages/edgeEffect', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusFlexAlignJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusFlexAlignJsunit.test.ets index 5c257ebe216855cdf0fe97f6904a39a0eb2b8ea1..8911b1ef238613aea572cc21f6c4fe3da46dbe5e 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusFlexAlignJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusFlexAlignJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function enumsFlexItemJsunit() { beforeEach(async function (done) { console.info('beforeEach ===================enumsFlexItem test beforeEach called==================='); let options = { - uri: 'pages/enumsFlexAlign', + uri: 'MainAbility/pages/enumsFlexAlign', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusHorizontalAlignJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusHorizontalAlignJsunit.test.ets index f5ac9555a9ff3ebaadf83f7d3cf3fda7aa18ee06..39db4c9ba497aef8334c261cf71b94502f9654f7 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusHorizontalAlignJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusHorizontalAlignJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() { beforeEach(async function (done) { console.info('beforeEach ===================enumsHorizontalAlign test beforeEach called==================='); let options = { - uri: 'pages/enumsHorizontalAlign', + uri: 'MainAbility/pages/enumsHorizontalAlign', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusImageJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusImageJsunit.test.ets index 6ff56af0bbd960de82de7695efbc98f933fffd95..7bc1d8d6ed23b5a4a27d9d736e8f787e18946bfd 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusImageJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusImageJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function enumsImageJsunit() { beforeEach(async function (done) { console.info('beforeEach ===================enumsImage test beforeEach called==================='); let options = { - uri: 'pages/enumsImage', + uri: 'MainAbility/pages/enumsImage', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusVerticalAlignJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusVerticalAlignJsunit.test.ets index 4c8f606705ed20d8c92cc00072422fca4a488a1a..8b8774deebd4bf0994dd2007d831b528cf2518f1 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusVerticalAlignJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/EnmusVerticalAlignJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() { beforeEach(async function (done) { console.info('beforeEach ===================enumsFlexItem test beforeEach called==================='); let options = { - uri: 'pages/enumsVerticalAlign', + uri: 'MainAbility/pages/enumsVerticalAlign', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/FillModeJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/FillModeJsunit.test.ets index e534c4837ad2891fda9737fab841c68e801ddf5c..5af80926bd68d750bbe906f4c10037aa5d6b5ceb 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/FillModeJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/FillModeJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function fillModeJsunit(){ beforeEach(async function (done) { console.info('fillModeTest beforeEach called'); let options = { - uri: 'pages/fillMode', + uri: 'MainAbility/pages/fillMode', } try { router.clear(); 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 3456a5b93ce6cfda49f45ba23b4e2819481e7f31..3f7f7e5632b2d1083c45f2797130118527ff2da9 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 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function ohosMatrix4Jsunit() { beforeEach(async function (done) { console.info("ohosMatrix4 beforeEach start"); let options = { - uri: 'pages/ohosMatrix4', + uri: 'MainAbility/pages/ohosMatrix4', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/PositionSettingJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/PositionSettingJsunit.test.ets index ed5780a2ec11ec82d42055984245f35f00747bd5..2e9d50105025a1f73906e5d5dedab03a02071bbc 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/PositionSettingJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/PositionSettingJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function positionSettingJsunit() { beforeEach(async function (done) { console.info("positionSetting beforeEach start"); let options = { - uri: 'pages/positionSetting', + uri: 'MainAbility/pages/positionSetting', } try { router.clear(); @@ -52,8 +52,8 @@ export default function positionSettingJsunit() { let strJson = getInspectorByKey('textAlign'); console.info("[testPositionSetting001] component strJson:" + strJson); let obj = JSON.parse(strJson); - console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign); - expect(obj.$attrs.textAlign).assertEqual('TextAlign.Left'); + console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign + "_" + obj.$attrs.align); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); console.info('[testPositionSetting001] END'); done(); }); @@ -92,7 +92,7 @@ export default function positionSettingJsunit() { console.info("[testPositionSetting003] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testPositionSetting003] textAlign: " + obj.$attrs.textAlign); - expect(obj.$attrs.textAlign).assertEqual("TextAlign.Right"); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Start"); console.info('[testPositionSetting003] END'); done(); }); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/SelectJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/SelectJsunit.test.ets index 6264c9286248cb8bc7dddae6f0f6c4b5c4a85e2b..7f4f6a81ec7caf1b574a8595b17f844d2622c490 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/SelectJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/SelectJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function selectJsunit() { describe('appInfoTest_five_2', function () { beforeEach(async function (done) { let options = { - uri: 'pages/select', + uri: 'MainAbility/pages/select', } try { router.clear(); 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 eb1dbfc7e7c512f79ccdb3e991efb04a2708ad33..dff02f9a44425574aa9b27f3b6ed47f894f6b1ac 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 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function shapeClippingJsunit() { beforeEach(async function (done) { console.info("shapeClipping beforeEach start"); let options = { - uri: 'pages/shapeClipping', + uri: 'MainAbility/pages/shapeClipping', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/SliderJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/SliderJsunit.test.ets index ec6ae032bb236bfe5aa07a0840c961223d0a7f7a..f8b950d69a37decc8200367c274ebe6239ab7c59 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/SliderJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/SliderJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function sliderJsunit() { describe('appInfoTest_five_3', function () { beforeEach(async function (done) { let options = { - uri: 'pages/slider', + uri: 'MainAbility/pages/slider', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/TransFormJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/TransFormJsunit.test.ets index da15397e90a5a54e84f521b920ec20dd388e368b..6811c23b7d70e78799ca17f6537f405fd9593371 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/TransFormJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/TransFormJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function transFormJsunit() { beforeEach(async function (done) { console.info("transForm beforeEach start"); let options = { - uri: 'pages/transForm', + uri: 'MainAbility/pages/transForm', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/VisibilityJsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/VisibilityJsunit.test.ets index fa2141f0a4aeaa5ca1c23188760ac68eb11a8f70..daf796125eefa8067b008f6fa61cec390187ebfd 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/VisibilityJsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/VisibilityJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function visibilityJsunit() { beforeEach(async function (done) { console.info("visibility beforeEach start"); let options = { - uri: 'pages/visibility', + uri: 'MainAbility/pages/visibility', } try { router.clear(); diff --git a/arkui/ace_ets_component_five/entry/src/main/module.json b/arkui/ace_ets_component_five/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..0aa73fb399abfd70c103df4abd82e4902a8c31a0 --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/module.json @@ -0,0 +1,35 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.open.harmony.acetestfive.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }] + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_component_five/entry/src/main/resources/base/element/string.json index f6488bb9ccc6588f4a68440a5a320c1d2d952a99..508ea47151547079f426623c17273599224cde5f 100644 --- a/arkui/ace_ets_component_five/entry/src/main/resources/base/element/string.json +++ b/arkui/ace_ets_component_five/entry/src/main/resources/base/element/string.json @@ -28,5 +28,34 @@ "name":"message_arrive", "value":"We will arrive at %s." } + , + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } ] } \ No newline at end of file diff --git a/arkui/ace_ets_component_five/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_component_five/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..740a01a722b21bb8d2d1836f75eb8b8bea9e2e47 --- /dev/null +++ b/arkui/ace_ets_component_five/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,24 @@ +{ + "src": [ + "MainAbility/pages/index", + "MainAbility/pages/checkbox", + "MainAbility/pages/enumsImage", + "MainAbility/pages/fillMode", + "MainAbility/pages/index/index", + "MainAbility/pages/ohosMatrix4", + "MainAbility/pages/select", + "MainAbility/pages/colorGradient", + "MainAbility/pages/checkboxGroup", + "MainAbility/pages/edgeEffect", + "MainAbility/pages/slider", + "MainAbility/pages/backgroundAndSizeSetting", + "MainAbility/pages/border", + "MainAbility/pages/positionSetting", + "MainAbility/pages/shapeClipping", + "MainAbility/pages/transForm", + "MainAbility/pages/visibility", + "MainAbility/pages/enumsFlexAlign", + "MainAbility/pages/enumsVerticalAlign", + "MainAbility/pages/enumsHorizontalAlign" + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/AppScope/app.json b/arkui/ace_ets_component_three/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4bc3f011708d0d1d216fa720047658093c5524e1 --- /dev/null +++ b/arkui/ace_ets_component_three/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetestthree", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/AppScope/resources/base/element/string.json b/arkui/ace_ets_component_three/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/arkui/ace_ets_component_three/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_component_three/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_component_three/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_component_three/BUILD.gn b/arkui/ace_ets_component_three/BUILD.gn index c354e24d6f4c353b86ecf1e86ae9cbfce13d7627..6083915a5c5af4a6d675b620df43dc0335974ea6 100644 --- a/arkui/ace_ets_component_three/BUILD.gn +++ b/arkui/ace_ets_component_three/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 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 @@ -14,25 +14,29 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAceEtsComponentThreeTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" deps = [ ":ace_ets_component_assets", ":ace_ets_component_resources", - ":ace_ets_component_test_assets", ] ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" + certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsAceEtsComponentThreeTest" subsystem_name = "arkui" part_name = "ace_engine" } -ohos_js_assets("ace_ets_component_assets") { - source_dir = "./entry/src/main/ets/MainAbility" + +ohos_app_scope("ace_ets_component_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] } -ohos_js_assets("ace_ets_component_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" + +ohos_js_assets("ace_ets_component_assets") { + source_dir = "entry/src/main/ets" } ohos_resources("ace_ets_component_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "entry/src/main/resources" ] + deps = [ ":ace_ets_component_app_profile" ] + hap_profile = "entry/src/main/module.json" } diff --git a/arkui/ace_ets_component_three/Test.json b/arkui/ace_ets_component_three/Test.json index dcf5f9347f214bb0d380e01c1897fbd959188117..17a831db458a8888cec800350e09710b0462b2f5 100644 --- a/arkui/ace_ets_component_three/Test.json +++ b/arkui/ace_ets_component_three/Test.json @@ -1,10 +1,11 @@ { - "description": "Configuration for aceceshi Tests", + "description": "Configuration for hjunit demo Tests", "driver": { "type": "OHJSUnitTest", "test-timeout": "1200000", - "bundle-name": "com.open.harmony.acetestthree", - "package-name": "com.open.harmony.acetestthree", + "bundle-name": "com.open.harmony.acetestthree", + + "module-name": "phone", "shell-timeout": "1200000" }, "kits": [ diff --git a/arkui/ace_ets_component_three/entry/src/main/config.json b/arkui/ace_ets_component_three/entry/src/main/config.json deleted file mode 100644 index 04eddf6e9dcedc0ade37748ecc9bafbd736cd194..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_three/entry/src/main/config.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.acetestthree", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 8 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.acetestthree", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.acetestthree.MainAbility", - "deviceType": [ - "tablet", - "default", - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/toggle", - "pages/gridPage", - "pages/span", - "pages/text", - "pages/badge", - "pages/canvas", - "pages/longPressGesture", - "pages/button", - "pages/ResponseRegion", - "pages/PanGesture", - "pages/background", - "pages/QrCode", - "pages/tabs", - "pages/tapGesture", - "pages/progress", - "pages/animate", - "pages/rating", - "pages/canvas2", - "pages/shape", - "pages/motionPath", - "pages/scrollCode", - "pages/transition", - "pages/priorityGesture", - "pages/parallelGesture", - "pages/blank", - "pages/sharedTransition", - "pages/sharedTransition2", - "pages/line", - "pages/circle", - "pages/aboutToDisappear", - "pages/timeStamp" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/Application/AbilityStage.ts b/arkui/ace_ets_component_three/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0e0206ea9fb5ce94ef140d69510b6280969dd8e --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.app.ability.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/MainAbility.ts b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d66065e88c907379883364a43ec02989cfd626b --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,37 @@ +import Ability from '@ohos.app.ability.UIAbility' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/images/test.png b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/images/test.png new file mode 100644 index 0000000000000000000000000000000000000000..78488bb00baa01614c87a503998fa4129ab110ac Binary files /dev/null and b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/images/test.png differ diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets index 52091cfda4495dc0b86da3b2b3cd9fddd8863b2e..5c08540fbdae11b3364c48d3edf14211b3e64f26 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,10 +13,12 @@ * limitations under the License. */ import events_emitter from '@ohos.events.emitter' +import {MessageManager,Callback} from '../utils/MessageManager'; @Entry @Component struct AnimationExample { + @State show:string = "btShow" @State btn1: boolean = false @State duration: number = 100 @State curve: string = 'Ease' @@ -25,99 +26,38 @@ struct AnimationExample { @State tempo: number= 1000 @State playmode: PlayMode = PlayMode.Normal + messageManager:MessageManager = new MessageManager() onPageShow() { - console.info('animate page show called'); - var stateChangeEvent = { - eventId: 50, - priority: events_emitter.EventPriority.LOW + globalThis.value = { + name:'messageManager',message:this.messageManager } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - - var stateChangeEventa = { - eventId: 1011, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventa, this.stateChangCallBack) - - var stateChangeEventb = { - eventId: 1012, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventb, this.stateChangCallBack) - - var stateChangeEventc = { - eventId: 1013, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventc, this.stateChangCallBack) - - var stateChangeEventd = { - eventId: 1014, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventd, this.stateChangCallBack) - - var stateChangeEvente = { - eventId: 1015, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvente, this.stateChangCallBack) - - var stateChangeEventf = { - eventId: 1016, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventf, this.stateChangCallBack) - - var stateChangeEventg = { - eventId: 1017, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventg, this.stateChangCallBack) - - var stateChangeEventh = { - eventId: 1018, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventh, this.stateChangCallBack) - - var stateChangeEventi = { - eventId: 1019, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventi, this.stateChangCallBack) - - var stateChangeEventj = { - eventId: 1020, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventj, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("animate page state change called:" + JSON.stringify(eventData)); - if (eventData.data.duration != null) { - this.duration = parseInt(eventData.data.duration); + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value) + if (message.name == 'duration') { + this.duration = message.value } - if (eventData.data.curve != null) { - this.curve = eventData.data.curve; + if (message.name == 'curve') { + this.curve = message.value } - if (eventData.data.tempo != null) { - this.tempo = parseInt(eventData.data.tempo); + if (message.name == 'iteration') { + this.iteration = message.value } - if (eventData.data.iteration != null) { - this.iteration = parseInt(eventData.data.iteration); + if (message.name == 'tempo') { + this.tempo = message.value } - if (eventData.data.playmode != null) { - this.playmode = eventData.data.playmode; + if (message.name == 'playmode') { + this.playmode = message.value } } + this.messageManager.registerCallback(callback) } + + build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, }) { + Column(){ Button(this.show) + .backgroundColor(0x317aff) .width(80) .height(30) .backgroundColor(0x317aff) @@ -145,6 +85,64 @@ struct AnimationExample { console.info("button1 duration test animateTo START") }) }) + Button(this.show) + .backgroundColor(0x317aff) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button11') + .onClick(() => { + try { + var backData = { + data: { + "duration": this.duration, + } + } + var backEvent = { + eventId: 151, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button1 animateTo START") + console.info("button1 duration value is : " + this.duration) + animateTo({ duration: this.duration }, () => { + console.info("button1 duration test animateTo START") + }) + }) + Button(this.show) + .backgroundColor(0x317aff) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button12') + .onClick(() => { + try { + var backData = { + data: { + "curve": this.curve, + } + } + var backEvent = { + eventId: 152, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button1 animateTo START") + console.info("button1 duration value is : " + this.duration) + animateTo({ duration: this.duration }, () => { + console.info("button1 duration test animateTo START") + }) + }) Button(this.show) .width(80) .height(30) @@ -201,6 +199,34 @@ struct AnimationExample { console.info("button3 iterations test animateTo START") }) }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button13') + .onClick(() => { + try { + var backDataTwo = { + data: { + "iterations": this.iteration, + } + } + var backEventTwo = { + eventId: 153, + priority: events_emitter.EventPriority.LOW + } + console.info("button3 start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("button3 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button3 animateTo START") + console.info("button3 iteration value is : " + this.iteration) + animateTo({ iterations: this.iteration }, () => { + console.info("button3 iterations test animateTo START") + }) + }) Button(this.show) .width(80) .height(30) @@ -229,6 +255,34 @@ struct AnimationExample { console.info("button4 tempo test animateTo START") }) }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button14') + .onClick(() => { + try { + var backDataThree = { + data: { + "tempo": this.tempo + } + } + var backEventThree = { + eventId: 154, + priority: events_emitter.EventPriority.LOW + } + console.info("button4 start to emit action state") + events_emitter.emit(backEventThree, backDataThree) + } catch (err) { + console.info("button4 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button4 animateTo START") + console.info("button4 tempo value is : " + this.duration) + animateTo({ tempo: this.tempo }, () => { + console.info("button4 tempo test animateTo START") + }) + }) Button(this.show) .width(80) .height(30) @@ -253,7 +307,35 @@ struct AnimationExample { } console.info("button5 animateTo START") console.info("button5 playmode value is : " + this.playmode) - animateTo({ PlayMode: this.playmode }, () => { + animateTo({playMode:PlayMode.Normal}, () => { + console.info("button5 playMode test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button15') + .onClick(() => { + try { + var backDataFour = { + data: { + "playmode": this.playmode, + } + } + var backEventFour = { + eventId: 155, + priority: events_emitter.EventPriority.LOW + } + console.info("button5 start to emit action state") + events_emitter.emit(backEventFour, backDataFour) + } catch (err) { + console.info("button5 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button5 animateTo START") + console.info("button5 playmode value is : " + this.playmode) + animateTo({playMode:PlayMode.Normal}, () => { console.info("button5 playMode test animateTo START") }) }) @@ -323,7 +405,7 @@ struct AnimationExample { try { var backData = { data: { - "duration": this.duration, + "curve": this.curve, } } var backEvent = { @@ -351,7 +433,7 @@ struct AnimationExample { try { var backData = { data: { - "duration": this.duration, + "curve": this.curve, } } var backEvent = { @@ -379,7 +461,7 @@ struct AnimationExample { try { var backData = { data: { - "duration": this.duration, + "iteration": this.iteration, } } var backEvent = { @@ -402,12 +484,12 @@ struct AnimationExample { .height(30) .backgroundColor(0x317aff) .margin({ bottom: 20 }) - .key('button11') + .key('button111') .onClick(() => { try { var backData = { data: { - "duration": this.duration, + "iteration": this.iteration, } } var backEvent = { @@ -430,12 +512,12 @@ struct AnimationExample { .height(30) .backgroundColor(0x317aff) .margin({ bottom: 20 }) - .key('button12') + .key('button121') .onClick(() => { try { var backData = { data: { - "duration": this.duration, + "tempo": this.tempo, } } var backEvent = { @@ -458,12 +540,12 @@ struct AnimationExample { .height(30) .backgroundColor(0x317aff) .margin({ bottom: 20 }) - .key('button13') + .key('button131') .onClick(() => { try { var backData = { data: { - "duration": this.duration, + "tempo": this.tempo, } } var backEvent = { @@ -486,12 +568,12 @@ struct AnimationExample { .height(30) .backgroundColor(0x317aff) .margin({ bottom: 20 }) - .key('button14') + .key('button141') .onClick(() => { try { var backData = { data: { - "duration": this.duration, + "playmode": this.playmode, } } var backEvent = { @@ -514,12 +596,12 @@ struct AnimationExample { .height(30) .backgroundColor(0x317aff) .margin({ bottom: 20 }) - .key('button15') + .key('button151') .onClick(() => { try { var backData = { data: { - "duration": this.duration, + "playmode": this.playmode, } } var backEvent = { @@ -537,6 +619,6 @@ struct AnimationExample { console.info("button15 duration test animateTo START") }) }) - }.height(400).width("100%").padding({ top: 100 }) + }.height("%100").width("100%") } } \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets index c7ccef703ed63314e64f8cf172a5d179e6a109ce..5439c535d3151ef4b51c698199cb9164f0cd65db 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index/index.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..97504e2440a9a6110fd5c9c02985914ef8d9e655 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/second/second.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets index c06c9aaff04090399346a9fa3d56c83a4b9baec0..aeefdd16ae8cf504ff891656f87d53b314d42fee 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Common.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Common.ets new file mode 100644 index 0000000000000000000000000000000000000000..16d5ad46f0dad844df185b479830df5ae52618e3 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Common.ets @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2022 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. + */ + +export default class CommonFunc { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } +} + + + + diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/MessageManager.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/MessageManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..70d716b6d61af8e8ba54a5a0affe80413221b168 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/MessageManager.ets @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2022 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. + */ +export interface Callback { + (message:any):void +} + +export class MessageManager { + callback:Callback + callbacks:Map = new Map() + + constructor() { + + } + + registerCallback(callback:Callback , type?:string) { + if (type == undefined) { + console.error('registerCallback callback set') + this.callback = callback + return + } + this.callbacks.set(type,callback) + } + + notify(message:any, type?:string) { + if (type == undefined) { + this.callback(message) + return + } + + let tmpCallback:Callback = this.callbacks.get(type) + if (tmpCallback === undefined) { + console.error('callbacks has no callback for type ' + type) + return + } + tmpCallback(message) + } + + clear() { + this.callbacks.clear() + this.callback = null + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/TestAbility.ts b/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8028a70f8af44690b95a08bd177bca6b09f24687 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 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 Ability from '@ohos.app.ability.UIAbility' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_three/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_three/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts index dfbf1f268a45e4a2f30b8c836f42d76f3a9f5ad3..5d14ac8283d9c935f0624e45860ec9c4454f958c 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/arkui/ace_ets_component_three/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -1,6 +1,5 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 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 @@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined function translateParamsToString(parameters) { const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', + '-s class', '-s notClass', '-s suite', '-s it', '-s level', '-s testType', '-s size', '-s timeout', - '-s package' + '-s dryRun' ]) let targetParams = ''; for (const key in parameters) { if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] + targetParams = `${targetParams} ${key} ${parameters[key]}` } } return targetParams.trim() } async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); + console.log("onAbilityCreateCallback"); } async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) } export default class OpenHarmonyTestRunner implements TestRunner { @@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { } onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') + console.info("OpenHarmonyTestRunner OnPrepare ") } - onRun() { + async onRun() { console.log('OpenHarmonyTestRunner onRun run') abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' let lMonitor = { abilityName: testAbilityName, onAbilityCreate: onAbilityCreateCallback, }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + var cmd = 'aa start -d 0 -a com.open.harmony.acetestthree.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } console.info('cmd : '+cmd) abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { @@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.exitCode); }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) console.info('OpenHarmonyTestRunner onRun end') } }; \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/AboutToDisappearJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/AboutToDisappearJsunit.test.ets index 6830a97111141e9e10dc2c1a572fefee2551f815..6ae7ed43212af214b33f7e09c3e469edded9a1e7 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/AboutToDisappearJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/AboutToDisappearJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function aboutToDisappearJsunit() { beforeEach(async function (done) { console.info("aboutToDisappear beforeEach start"); let options = { - uri: 'pages/aboutToDisappear', + uri: 'MainAbility/pages/aboutToDisappear', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/AnimateJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/AnimateJsunit.test.ets index f0ec6854e15c4c524463ba18a6450079f6db543b..ee8dc1d30ffff7957a252f672648be1ac7857e96 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/AnimateJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/AnimateJsunit.test.ets @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,17 +12,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; +import CommonFunc from '../MainAbility/utils/Common'; +import {MessageManager,Callback} from '../MainAbility/utils/MessageManager'; +const waitUiReadyMs = 1000; export default function animateJsunit() { describe('animateTest', function () { beforeEach(async function (done) { console.info("animate beforeEach start"); let options = { - uri: 'pages/animate', + uri: 'MainAbility/pages/animate', } try { router.clear(); @@ -55,7 +57,11 @@ export default function animateJsunit() { } let callback = (indexEvent) => { console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.duration).assertEqual('100') + try { + expect(indexEvent.data.duration == 100).assertTrue(); + } catch (err) { + console.info("animateTest_0100 get state result is errr: " + JSON.stringify(err)); + } } try { events_emitter.on(indexEvent, callback); @@ -99,7 +105,12 @@ export default function animateJsunit() { } let callback = (indexEvent) => { console.info("animateTest_0300 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.iteration).assertEqual('1') + try { + expect(indexEvent.data.iterations == 1).assertTrue(); + } catch (err) { + console.info("animateTest_0300 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); @@ -157,108 +168,82 @@ export default function animateJsunit() { }); it('animateTest_0600', 0, async function (done) { - console.info('animateTest_0500 START'); - try { - let eventData = { - data: { - "duration": '2000' - } - } - let indexEventOne = { - eventId: 50, + await CommonFunc.sleep(1000); + globalThis.value.message.notify({name:'duration', value:2000}); + await CommonFunc.sleep(200); + let indexEvent = { + eventId: 151, priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_0600 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_0600 change component data error: " + err.message); - } - let indexEvent = { - eventId: 51, - priority: events_emitter.EventPriority.LOW - } + } let callback = (indexEvent) => { console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.duration).assertEqual(2000) + try { + expect(indexEvent.data.duration == 2000).assertTrue(); + } catch (err) { + console.info("animateTest_0600 get state result err is: " + JSON.stringify(err)); + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1', 10, ""))); + console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button11', 10, ""))); await Utils.sleep(2000); console.info('animateTest_0600 END'); done(); }); it('animateTest_0700', 0, async function (done) { - console.info('animateTest_0700 START'); - try { - let eventData = { - data: { - "curve": "Linear" - } - } - let indexEventOne = { - eventId: 50, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_0700 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_0700 change component data error: " + err.message); - } + console.info('animateTest_0700 START'); + globalThis.value.message.notify({name:'curve', value:'Linear'}); + await CommonFunc.sleep(200); let indexEvent = { - eventId: 52, + eventId: 152, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_0700 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.curve).assertEqual('Linear') + try { + expect(indexEvent.data.curve).assertEqual('Linear'); + } catch (err) { + console.info("animateTest_0700 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_0700 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_0700 click result is: " + JSON.stringify(sendEventByKey('button2', 10, ""))); + console.info("animateTest_0700 click result is: " + JSON.stringify(sendEventByKey('button12', 10, ""))); await Utils.sleep(2000); console.info('animateTest_0700 END'); done(); }); it('animateTest_0800', 0, async function (done) { - console.info('animateTest_0800 START'); - try { - let eventData = { - data: { - "iteration": "2" - } - } - let indexEventOne = { - eventId: 50, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_0800 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_0800 change component data error: " + err.message); - } - let indexEvent = { - eventId: 53, + console.info('animateTest_0800 START'); + globalThis.value.message.notify({name:'iteration', value:2}); + await CommonFunc.sleep(200); + let indexEvent = { + eventId: 153, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_0800 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.iteration).assertEqual('2') + try { + expect(indexEvent.data.iterations).assertEqual(2) + } catch (err) { + console.info("animateTest_0800 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_0800 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_0800 click result is: " + JSON.stringify(sendEventByKey('button3', 10, ""))); + console.info("animateTest_0800 click result is: " + JSON.stringify(sendEventByKey('button13', 10, ""))); await Utils.sleep(2000); console.info('animateTest_0800 END'); done(); @@ -266,35 +251,27 @@ export default function animateJsunit() { it('animateTest_0900', 0, async function (done) { console.info('animateTest_0900 START'); - try { - let eventData = { - data: { - "tempo": "20000" - } - } - let indexEventOne = { - eventId: 50, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_0900 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_0900 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'tempo', value:"20000"}); + await CommonFunc.sleep(200); let indexEvent = { - eventId: 54, + eventId: 154, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_0900 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.tempo).assertEqual('20000') + try { + expect(indexEvent.data.tempo).assertEqual('20000'); + } catch (err) { + console.info("animateTest_0900 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_0900 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_0900 click result is: " + JSON.stringify(sendEventByKey('button4', 10, ""))); + console.info("animateTest_0900 click result is: " + JSON.stringify(sendEventByKey('button14', 10, ""))); await Utils.sleep(2000); console.info('animateTest_0900 END'); done(); @@ -302,35 +279,26 @@ export default function animateJsunit() { it('animateTest_1000', 0, async function (done) { console.info('animateTest_1000 START'); - try { - let eventData = { - data: { - "playmode": "PlayMode.Alternate" - } - } - let indexEventOne = { - eventId: 50, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1000 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1000 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'playmode', value:PlayMode.Alternate}); + await CommonFunc.sleep(200); let indexEvent = { - eventId: 55, + eventId: 155, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1000 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.playmode).assertEqual('alternate') + try { + expect(indexEvent.data.playmode).assertEqual('alternate'); + } catch (err) { + console.info("animateTest_1000 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_1000 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_1000 click result is: " + JSON.stringify(sendEventByKey('button5', 10, ""))); + console.info("animateTest_1000 click result is: " + JSON.stringify(sendEventByKey('button15', 10, ""))); await Utils.sleep(2000); console.info('animateTest_1000 END'); done(); @@ -338,28 +306,20 @@ export default function animateJsunit() { it('animateTest_1100', 0, async function (done) { console.info('animateTest_1100 START'); - try { - let eventData = { - data: { - "duration": -1000 - } - } - let indexEventOne = { - eventId: 1011, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1100 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1100 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'duration', value:-1000}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1001, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1100 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.duration).assertEqual('-1000') + try { + expect(indexEvent.data.duration).assertEqual(-1000); + } catch (err) { + console.info("animateTest_1100 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); @@ -374,28 +334,19 @@ export default function animateJsunit() { it('animateTest_1200', 0, async function (done) { console.info('animateTest_1200 START'); - try { - let eventData = { - data: { - "duration": 100000000 - } - } - let indexEventOne = { - eventId: 1012, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1200 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1200 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'duration', value:100000000}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1002, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1200 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.duration).assertEqual('100000000') + try { + expect(indexEvent.data.duration).assertEqual(100000000); + } catch (err) { + console.info("animateTest_1200 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); @@ -410,28 +361,20 @@ export default function animateJsunit() { it('animateTest_1300', 0, async function (done) { console.info('animateTest_1300 START'); - try { - let eventData = { - data: { - "curve": 123 - } - } - let indexEventOne = { - eventId: 1013, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1300 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1300 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'curve', value:'123'}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1003, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1300 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.curve).assertEqual('123') + try { + expect(indexEvent.data.curve).assertEqual('123'); + } catch (err) { + console.info("animateTest_1300 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); @@ -446,28 +389,19 @@ export default function animateJsunit() { it('animateTest_1400', 0, async function (done) { console.info('animateTest_1400 START'); - try { - let eventData = { - data: { - "curve": 'abc' - } - } - let indexEventOne = { - eventId: 1014, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1400 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1400 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'curve', value:'abc'}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1004, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1400 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.curve).assertEqual('abc') + try { + expect(indexEvent.data.curve).assertEqual('abc') + } catch (err) { + console.info("animateTest_1400 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); @@ -482,28 +416,19 @@ export default function animateJsunit() { it('animateTest_1500', 0, async function (done) { console.info('animateTest_1500 START'); - try { - let eventData = { - data: { - "iteration": "121212121212" - } - } - let indexEventOne = { - eventId: 1015, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1500 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1500 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'iteration', value:121}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1005, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1500 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.iteration).assertEqual('121212121212') + try { + expect(indexEvent.data.iteration).assertEqual(121); + } catch (err) { + console.info("animateTest_1500 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); @@ -518,35 +443,26 @@ export default function animateJsunit() { it('animateTest_1600', 0, async function (done) { console.info('animateTest_1600 START'); - try { - let eventData = { - data: { - "iteration": "-5" - } - } - let indexEventOne = { - eventId: 1016, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1600 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1600 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'iteration', value:-5}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1006, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1600 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.iteration).assertEqual('-5') + try { + expect(indexEvent.data.iteration).assertEqual(-5); + } catch (err) { + console.info("animateTest_1600 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_1600 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_1600 click result is: " + JSON.stringify(sendEventByKey('button11', 10, ""))); + console.info("animateTest_1600 click result is: " + JSON.stringify(sendEventByKey('button111', 10, ""))); await Utils.sleep(2000); console.info('animateTest_1600 END'); done(); @@ -554,35 +470,27 @@ export default function animateJsunit() { it('animateTest_1700', 0, async function (done) { console.info('animateTest_1700 START'); - try { - let eventData = { - data: { - "tempo": "12121212121212" - } - } - let indexEventOne = { - eventId: 1017, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1700 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1700 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'tempo', value:"12121212121212"}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1007, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1700 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.tempo).assertEqual('12121212121212') + try { + expect(indexEvent.data.tempo).assertEqual('12121212121212'); + } catch (err) { + console.info("animateTest_1700 get state result err is: " + JSON.stringify(err)) + } + } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_1700 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_1700 click result is: " + JSON.stringify(sendEventByKey('button12', 10, ""))); + console.info("animateTest_1700 click result is: " + JSON.stringify(sendEventByKey('button121', 10, ""))); await Utils.sleep(2000); console.info('animateTest_1700 END'); done(); @@ -590,35 +498,26 @@ export default function animateJsunit() { it('animateTest_1800', 0, async function (done) { console.info('animateTest_1800 START'); - try { - let eventData = { - data: { - "tempo": "-5" - } - } - let indexEventOne = { - eventId: 1018, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1800 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1800 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'tempo', value:"-5"}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1008, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1800 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.tempo).assertEqual('-5') + try { + expect(indexEvent.data.tempo).assertEqual('-5') + } catch (err) { + console.info("animateTest_1800 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_1800 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_1800 click result is: " + JSON.stringify(sendEventByKey('button13', 10, ""))); + console.info("animateTest_1800 click result is: " + JSON.stringify(sendEventByKey('button131', 10, ""))); await Utils.sleep(2000); console.info('animateTest_1800 END'); done(); @@ -626,35 +525,26 @@ export default function animateJsunit() { it('animateTest_1900', 0, async function (done) { console.info('animateTest_1900 START'); - try { - let eventData = { - data: { - "playmode": "aaa" - } - } - let indexEventOne = { - eventId: 1019, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_1900 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_1900 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'playmode', value:-6}); + await CommonFunc.sleep(200); let indexEvent = { eventId: 1009, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_1900 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.playmode).assertEqual('aaa') + try { + expect(indexEvent.data.playmode).assertEqual(-6); + } catch (err) { + console.info("animateTest_1900 get state result err is: " + JSON.stringify(err)) + } } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_1900 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_1900 click result is: " + JSON.stringify(sendEventByKey('button14', 10, ""))); + console.info("animateTest_1900 click result is: " + JSON.stringify(sendEventByKey('button141', 10, ""))); await Utils.sleep(2000); console.info('animateTest_1900 END'); done(); @@ -662,35 +552,28 @@ export default function animateJsunit() { it('animateTest_2000', 0, async function (done) { console.info('animateTest_2000 START'); - try { - let eventData = { - data: { - "playmode": "123456" - } - } - let indexEventOne = { - eventId: 1020, - priority: events_emitter.EventPriority.LOW - } - console.info("animateTest_2000 start to publish emit"); - events_emitter.emit(indexEventOne, eventData); - } catch (err) { - console.log("animateTest_2000 change component data error: " + err.message); - } + globalThis.value.message.notify({name:'playmode', value:123456}); + await CommonFunc.sleep(200); + let indexEvent = { eventId: 1010, priority: events_emitter.EventPriority.LOW } let callback = (indexEvent) => { console.info("animateTest_2000 get state result is: " + JSON.stringify(indexEvent)) - expect(indexEvent.data.playmode).assertEqual('123456') + try { + expect(indexEvent.data.playmode).assertEqual(123456); + } catch (err) { + console.info("animateTest_2000 get state result err is: " + JSON.stringify(err)); + } + } try { events_emitter.on(indexEvent, callback); } catch (err) { console.info("animateTest_2000 on events_emitter err : " + JSON.stringify(err)); } - console.info("animateTest_2000 click result is: " + JSON.stringify(sendEventByKey('button15', 10, ""))); + console.info("animateTest_2000 click result is: " + JSON.stringify(sendEventByKey('button151', 10, ""))); await Utils.sleep(2000); console.info('animateTest_2000 END'); done(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/BackgroundJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/BackgroundJsunit.test.ets index f373c86f974f53b923d314c4e80e4b2514dca039..e11a85eaff1446211d4d89e8d57272c417624fad 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/BackgroundJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/BackgroundJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils.ets'; @@ -23,7 +23,7 @@ export default function backgroundJsunit() { beforeEach(async function (done) { console.info("background beforeEach start"); let options = { - uri: 'pages/general-properties/background', + uri: 'MainAbility/pages/general-properties/background', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/BadgeJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/BadgeJsunit.test.ets index 63110c65170e78fe947b7844912a083bdba6e0fd..248908b4e0353af350c5eae4b5e3b9ee2e2600d9 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/BadgeJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/BadgeJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function badgeJsunit() { beforeEach(async function (done) { console.info("badge beforeEach start"); let options = { - uri: 'pages/badge', + uri: 'MainAbility/pages/badge', } let result; try { @@ -52,67 +52,68 @@ export default function badgeJsunit() { await Utils.sleep(1000); let strJson = getInspectorByKey('badge'); let obj = JSON.parse(strJson); - console.info("[testBadge01] component obj is: " + JSON.stringify(obj)); + console.info("[testBadge01] component obj is: " + JSON.stringify(obj.$attrs.style) + "---" + obj.$attrs.style); let style = JSON.parse(obj.$attrs.style); expect(obj.$type).assertEqual('Badge'); expect(style.fontSize).assertEqual('20.00fp'); done(); }); - it('testBadge02', 0, async function (done) { - console.info('[testBadge02] START'); + it('testBadge03', 0, async function (done) { + console.info('[testBadge03] START'); await Utils.sleep(1000); try { var eventData = { data: { - "fontSizeValue": "30", + "fontSizeValue": -1, } } var innerEvent = { eventId: 63, priority: events_emitter.EventPriority.LOW } - console.info("[testBadge02] start to publish emit"); + console.info("[testBadge03] start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testBadge02] change component data error: " + err.message); + console.log("[testBadge03] change component data error: " + err.message); } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('badge'); let objNew = JSON.parse(strJsonNew); - console.info("[testBadge02] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); - expect(style.fontSize).assertEqual('30.00fp'); + console.info("[testBadge03] component objNew is: " + style + "--" + objNew.$attrs.style); + expect(style.fontSize).assertEqual('10.00vp'); done(); }); - it('testBadge03', 0, async function (done) { - console.info('[testBadge03] START'); + it('testBadge02', 0, async function (done) { + console.info('[testBadge02] START'); await Utils.sleep(1000); try { var eventData = { data: { - "fontSizeValue": "-1", + "fontSizeValue": "30", } } var innerEvent = { eventId: 63, priority: events_emitter.EventPriority.LOW } - console.info("[testBadge03] start to publish emit"); + console.info("[testBadge02] start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testBadge03] change component data error: " + err.message); + console.log("[testBadge02] change component data error: " + err.message); } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('badge'); let objNew = JSON.parse(strJsonNew); - console.info("[testBadge03] component objNew is: " + JSON.stringify(objNew)); + console.info("[testBadge02] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); - expect(style.fontSize).assertEqual('-1.00fp'); + expect(style.fontSize).assertEqual('30.00fp'); done(); }); + it('testBadge04', 0, async function (done) { console.info('[testBadge04] START'); await Utils.sleep(1000); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/BlankJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/BlankJsunit.test.ets index b5270f7f38e47d841260e8eaf1551c427868dcf6..27d68f77d580ccfa9abb4a78c282a9d10482c443 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/BlankJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/BlankJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function blankJsunit() { beforeEach(async function (done) { console.info("blank beforeEach start"); let options = { - uri: 'pages/blank', + uri: 'MainAbility/pages/blank', } let result; try { 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 1b65225b86707f735845754c9032bcedbbd47c36..f6cb59abe821e5fe51175b4a0a17c3d01198b247 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 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function buttonJsunit() { beforeEach(async function (done) { console.info("button beforeEach start"); let options = { - uri: 'pages/button', + uri: 'MainAbility/pages/button', } let result; try { @@ -306,10 +306,15 @@ export default function buttonJsunit() { let event = JSON.parse(eventData.data.event); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY)); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX)); - expect(event.screenX).assertEqual(185) - expect(event.screenY).assertEqual(485) - expect(event.x).assertEqual(100) - expect(event.y).assertEqual(50) + try { + expect(event.screenX).assertEqual(185) + expect(event.screenY).assertEqual(533) + expect(event.x).assertEqual(100) + expect(event.y).assertEqual(50) + } catch (err) { + console.info("[testButton12_] expection err : " + JSON.stringify(err)); + expect().assertFail(); + } done(); } var innerEvent = { diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/Canvas2Jsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/Canvas2Jsunit.test.ets index 79bae445fbe690e02918e7f213253775a5d6a380..ddcd1f286e275823d5ee6ed4b5f14777d5500c2d 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/Canvas2Jsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/Canvas2Jsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function canvas2Jsunit() { beforeEach(async function (done) { console.info("canvas beforeEach start"); let options = { - uri: 'pages/canvas2', + uri: 'MainAbility/pages/canvas2', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/CanvasJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/CanvasJsunit.test.ets index a01f82d3a5cc70e84d665604f951750067f52934..33b600c22c5a94ba0c726ebd39b1dd00ebc4d055 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/CanvasJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/CanvasJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function canvasJsunit() { beforeEach(async function (done) { console.info("canvas beforeEach start"); let options = { - uri: 'pages/canvas', + uri: 'MainAbility/pages/canvas', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/CircleJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/CircleJsunit.test.ets index f75cc247c6a69e961ab3de2ba917104d582fa5bd..693b15378d3c0d7c8a5184bf0be98b535952e3ce 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/CircleJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/CircleJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function circleJsunit() { beforeEach(async function (done) { console.info("circle beforeEach start"); let options = { - uri: 'pages/circle', + uri: 'MainAbility/pages/circle', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/CommonJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/CommonJsunit.test.ets index 7459e4b047d7d12b3697ed774495f901d096cfc9..3dbc1a34ef529459c60c597910d7aba36b6ff061 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/CommonJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/CommonJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import display from '@ohos.display'; import Utils from './Utils'; diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/GridJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/GridJsunit.test.ets index a486a745b48e3f8da2cdfa7bb49023906b0f65a5..20d5fb501234f8ce1ae7f0ba3a1d916766b92adb 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/GridJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/GridJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function gridJsunit() { beforeEach(async function (done) { console.info('beforeEach ===================grid test beforeEach called==================='); let options = { - uri: 'pages/gridPage', + uri: 'MainAbility/pages/gridPage', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/LineJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/LineJsunit.test.ets index 911a4c9217dead3b994c04bfaaff0da0f6e8c1ef..92ad04ee64a588c33edc7de14d12b0441cf512dc 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/LineJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/LineJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function LineJsunit() { describe('LineTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/line', + uri: 'MainAbility/pages/line', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/List.test.ets index ef83463975232e833f45ff8bb544d04463a4a419..8398813adb527eed27ef14a81b4f6759154b1de0 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/List.test.ets @@ -54,7 +54,7 @@ export default function testsuite() { circleJsunit(); gridJsunit(); tapGesture(); - panGestureJsunit(); + panGestureJsunit(); canvasJsunit(); canvas2Jsunit(); longPressGestureJsUnit(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/LongPressGesture.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/LongPressGesture.test.ets index 5cfe47efbdba72dd8e0154c8ce057d6f83280469..5b001fc88930f6ed1eb997e0ed4aee55dc9d0678 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/LongPressGesture.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/LongPressGesture.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function longPressGestureJsunit() { beforeEach(async function (done) { console.info("longPressGesture beforeEach start"); let options = { - uri: 'pages/longPressGesture', + uri: 'MainAbility/pages/longPressGesture', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/MotionPathJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/MotionPathJsunit.test.ets index d1f927b867cbff507b72fe54200a1a138480db8a..a94be7c355f51415a4aa8a4e1b5d179bcc3b2908 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/MotionPathJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/MotionPathJsunit.test.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -23,7 +23,7 @@ export default function motionPathJsunit() { describe('motionPathTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/motionPath', + uri: 'MainAbility/pages/motionPath', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/PanGestureJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/PanGestureJsunit.test.ets index 0852b7823ea0e3de6335c308f3423cb19c616d9b..7ec059b2d7f5c5557b33371ab370bce3a6197bd7 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/PanGestureJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/PanGestureJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -26,7 +26,7 @@ export default function PanGestureJsunit() { beforeEach(async function (done) { console.info("PanGesture beforeEach start"); let options = { - uri: 'pages/PanGesture', + uri: 'MainAbility/pages/PanGesture', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ParallelGestureJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ParallelGestureJsunit.test.ets index b06c5196526e55d05a27e040ca248dda3f4e3090..7ef0549227b15a01fe2a947280ca386e50a8cffe 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ParallelGestureJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ParallelGestureJsunit.test.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -23,7 +23,7 @@ export default function parallelGestureJsunit() { describe('parallelGestureTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/parallelGesture', + uri: 'MainAbility/pages/parallelGesture', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/PriorityGestureJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/PriorityGestureJsunit.test.ets index a123f3eb94b66077c4ff330c97c38247d3396a05..95979eb4feb593e4e65a70920aeab9563da5362b 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/PriorityGestureJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/PriorityGestureJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function priorityGestureJsunit() { describe('priorityGestureTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/priorityGesture', + uri: 'MainAbility/pages/priorityGesture', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ProgressJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ProgressJsunit.test.ets index f9189894c3cbb1b03fc9bc9ac5c34629de1d4a81..66bd445952cc9ed28d2be244e463cd91541e2fde 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ProgressJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ProgressJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function progressJsunit() { describe('progressTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/progress', + uri: 'MainAbility/pages/progress', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets index 3fbcdadad17386e5a2af0f5409091bbd95226477..99e18960bd21df3b10f6f9ca68b269ef1f480c22 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function qrCodeJsunit() { describe('qrCodeTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/QrCode', + uri: 'MainAbility/pages/QrCode', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/RatingJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/RatingJsunit.test.ets index 9c94b83157da6f5b34a60fe8bd4246775da59584..fcb7a7a7a06228ef6a0189079e42c6951a3b36aa 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/RatingJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/RatingJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function ratingJsunit() { describe('ratingTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/rating', + uri: 'MainAbility/pages/rating', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ResponseRegionJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ResponseRegionJsunit.test.ets index eaf9e26b6dc778b2a8549f3f83ffcbb12ce0a835..d841ed45fa366705381934f90728b121ff5d73e4 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ResponseRegionJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ResponseRegionJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -26,7 +26,7 @@ export default function ResponseRegionJsunit() { beforeEach(async function (done) { console.info("ResponseRegion beforeEach start"); let options = { - uri: 'pages/ResponseRegion', + uri: 'MainAbility/pages/ResponseRegion', } try { router.clear(); 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 113a4f402b383bba70757ed7e560945013186025..4cb1da1a4d14e5688fbcb3f695e980762ac5f285 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 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function scrollCodeJsunit() { describe('scrollCodeTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/scrollCode', + uri: 'MainAbility/pages/scrollCode', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ShapeJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ShapeJsunit.test.ets index ffb9c44085449af24a5fae5635614fcce0b4ddf7..5ec49faff5f8b9005c28a35d9d260320c5e94f86 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ShapeJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ShapeJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function shapeJsunit() { describe('shapeTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/shape', + uri: 'MainAbility/pages/shape', } try { router.clear(); @@ -377,111 +377,112 @@ export default function shapeJsunit() { expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter'); done(); }); - - it('shapeTest_1900', 0, async function (done) { - console.info('shapeTest_1900 START'); + + it('shapeTest_2100', 0, async function (done) { + console.info('shapeTest_2100 START'); await Utils.sleep(1000); try { var eventData = { data: { - "strokeMiterLimit": "5", + "strokeMiterLimit": "-0.11111", } } var innerEvent = { eventId: 192, priority: events_emitter.EventPriority.LOW } - console.info("shapeTest_1900 start to publish emit"); + console.info("shapeTest_2100 start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("shapeTest_1900 change component color error: " + err.message); + console.log("shapeTest_2100 change component color error: " + err.message); } await Utils.sleep(2000); var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); - console.info("shapeTest_1900 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); - expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000'); + console.info("shapeTest_2100 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); done(); }); - it('shapeTest_2000', 0, async function (done) { - console.info('shapeTest_2000 START'); + it('shapeTest_2200', 0, async function (done) { + console.info('shapeTest_1300 START'); await Utils.sleep(1000); try { var eventData = { data: { - "strokeMiterLimit": "string", + "strokeMiterLimit": 'aaa11111', } } var innerEvent = { eventId: 192, priority: events_emitter.EventPriority.LOW } - console.info("shapeTest_2000 start to publish emit"); + console.info("shapeTest_2200 start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("shapeTest_2000 change component color error: " + err.message); + console.log("shapeTest_2200 change component color error: " + err.message); } await Utils.sleep(2000); var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); - console.info("shapeTest_2000 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + console.info("shapeTest_2200 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); done(); }); - it('shapeTest_2100', 0, async function (done) { - console.info('shapeTest_2100 START'); + it('shapeTest_1900', 0, async function (done) { + console.info('shapeTest_1900 START'); await Utils.sleep(1000); try { var eventData = { data: { - "strokeMiterLimit": '-0.11111', + "strokeMiterLimit": "5", } } var innerEvent = { eventId: 192, priority: events_emitter.EventPriority.LOW } - console.info("shapeTest_2100 start to publish emit"); + console.info("shapeTest_1900 start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("shapeTest_2100 change component color error: " + err.message); + console.log("shapeTest_1900 change component color error: " + err.message); } await Utils.sleep(2000); var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); - console.info("shapeTest_2100 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); - expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + console.info("shapeTest_1900 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000'); done(); }); - it('shapeTest_2200', 0, async function (done) { - console.info('shapeTest_1300 START'); + it('shapeTest_2000', 0, async function (done) { + console.info('shapeTest_2000 START'); await Utils.sleep(1000); try { var eventData = { data: { - "strokeMiterLimit": 'aaa11111', + "strokeMiterLimit": "string", } } var innerEvent = { eventId: 192, priority: events_emitter.EventPriority.LOW } - console.info("shapeTest_2200 start to publish emit"); + console.info("shapeTest_2000 start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("shapeTest_2200 change component color error: " + err.message); + console.log("shapeTest_2000 change component color error: " + err.message); } await Utils.sleep(2000); var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); - console.info("shapeTest_2200 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); - expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + console.info("shapeTest_2000 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000'); done(); }); + it('shapeTest_2300', 0, async function (done) { console.info('shapeTest_2300 START'); await Utils.sleep(1000); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/SharedTransitionJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/SharedTransitionJsunit.test.ets index 49974dcc303d733453f1c7eec701b3768eaae69d..19e50cdaacf6d22ad5d667e8322067589d75d2ea 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/SharedTransitionJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/SharedTransitionJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function sharedTransitionJsunit() { beforeEach(async function (done) { console.info("sharedTransition beforeEach start"); let options = { - uri: 'pages/sharedTransition', + uri: 'MainAbility/pages/sharedTransition', } try { router.clear(); @@ -92,16 +92,21 @@ export default function sharedTransitionJsunit() { eventId: 194, priority: events_emitter.EventPriority.LOW } - console.info("sharedTransitionTest_0400 start to publish emit"); events_emitter.emit(indexEvent, eventData); + await Utils.sleep(2500); } catch (err) { console.log("sharedTransitionTest_0400 change component data error: " + err.message); } let callback = (indexEventOne) => { console.info("sharedTransitionTest_0400 get state result is: " + JSON.stringify(indexEventOne)); - expect(indexEventOne.data.duration).assertEqual(2000); - expect(indexEventOne.data.delay).assertEqual(5); - expect(indexEventOne.data.type).assertEqual(SharedTransitionEffectType.Exchange); + try { + expect(indexEventOne.data.duration).assertEqual(2000); + expect(indexEventOne.data.delay).assertEqual(5); + expect(indexEventOne.data.type).assertEqual(SharedTransitionEffectType.Exchange); + } catch(err) { + console.info("sharedTransitionTest_0400 error: " + err.message); + } + } let indexEventOne = { eventId: 193, diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets index 0447b70f2cf15dcb0c8997e16036f922ebea6bfd..5adb3ff166a159b15a9d52e82181c4c46ea9ca86 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/SpanJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -22,7 +22,7 @@ export default function spanJsunit() { describe('spanTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/span', + uri: 'MainAbility/pages/span', } try { router.clear(); @@ -179,7 +179,7 @@ export default function spanJsunit() { console.info("[testSpan007] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSpan007] textCase:" + obj); - expect(obj.$attrs.textCase).assertEqual('TextCase.Normal'); + expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase'); done(); }); @@ -205,7 +205,7 @@ export default function spanJsunit() { console.info("[testSpan008] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSpan008] fontColor:" + obj); - expect(obj.$attrs.fontColor).assertEqual('#FF000000'); + expect(obj.$attrs.fontColor).assertEqual('#FF000990'); done(); }); @@ -231,7 +231,7 @@ export default function spanJsunit() { console.info("[testSpan009] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSpan009] fontColor:" + obj); - expect(obj.$attrs.fontColor).assertEqual('#FF000000'); + expect(obj.$attrs.fontColor).assertEqual('#FF000990'); done(); }); }) diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets index 955edad286c4e6075dda244f0caa7fc16ef68c47..4245164fb32c7b5082157d516837934be158dc56 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -23,7 +23,7 @@ export default function tabsJsunit() { beforeEach(async function (done) { console.info("tabs beforeEach start"); let options = { - uri: 'pages/tabs', + uri: 'MainAbility/pages/tabs', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TapGesture.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TapGesture.test.ets index b7bbab37d0ddf8e98784eae502d1d422ca9ac68a..2358bf7ee6dbdf35e86cc3aaede5a235bf6eae92 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TapGesture.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TapGesture.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function longPressGestureJsunit() { beforeEach(async function (done) { console.info("tapGesture beforeEach start"); let options = { - uri: 'pages/tapGesture', + uri: 'MainAbility/pages/tapGesture', } try { router.clear(); 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 62e630cd25989b667db09ae4ee5d3fa5c6626d9d..c517427e9f2d83607e96272e93005e3ac69bb9a7 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 @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +22,7 @@ export default function textJsunit() { beforeEach(async function (done) { console.info("text beforeEach start"); let options = { - uri: 'pages/text', + uri: 'MainAbility/pages/text', } try { router.clear(); @@ -63,13 +62,8 @@ export default function textJsunit() { let strJson = getInspectorByKey('image'); console.info("testText_0200 component strJson:" + strJson); let obj = JSON.parse(strJson); - console.info("testText_0200 component obj is: " + JSON.stringify(obj)); - var res = obj.$attrs.src.indexOf('RAWFILE/test.png'); - console.info("testText_0200 result is: " + res); - var sres = obj.$attrs.src.slice(res, res + 16); - console.info("testText_0200 slice result is: " + sres); - expect(obj.$type).assertEqual('Image'); - expect(obj.$attrs.src.slice(res, res + 16)).assertEqual('RAWFILE/test.png'); + console.info("testText_0200 component strJson:" + obj.$attrs.src); + expect(obj.$attrs.src).assertEqual('resource://rawfile/test.png'); console.info('testText_0200 END'); done(); }); @@ -244,7 +238,7 @@ export default function textJsunit() { let strJsonNew = getInspectorByKey('text'); let objNew = JSON.parse(strJsonNew); console.info("testText_1100 component objNew is: " + JSON.stringify(objNew.$attrs.fontColor)); - expect(objNew.$attrs.fontColor).assertEqual('#FF000000'); + expect(objNew.$attrs.fontColor).assertEqual('#330A59F7'); console.info('testText_1100 END'); 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 0459ef47a7057cfb90de8ddd9412acf5f7de1b2d..13bedcf58da147c0e040d14b87e1ea727f39131c 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 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; @@ -22,7 +22,7 @@ export default function timeStampJsunit() { describe('timeStampTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/timeStamp', + uri: 'MainAbility/pages/timeStamp', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ToggleJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ToggleJsunit.test.ets index 75a6e87cec8e2c4d818fa3a1c05dd6baf9824ac3..5d2adc696e4896ac1991f41d76b0d93a23e3b58e 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ToggleJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ToggleJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function ToggleJsunit() { beforeEach(async function (done) { console.info("toggle beforeEach start"); let options = { - uri: 'pages/toggle', + uri: 'MainAbility/pages/toggle', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TransitionJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TransitionJsunit.test.ets index 1d55211a5c2448620c968065e9cdf4c6f38f3335..d363c843449b65ee12fb6603bf998f8dd71a80d0 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TransitionJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TransitionJsunit.test.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; @@ -23,7 +23,7 @@ export default function transitionJsunit() { beforeEach(async function (done) { console.info("text beforeEach start"); let options = { - uri: 'pages/transition', + uri: 'MainAbility/pages/transition', } try { router.clear(); diff --git a/arkui/ace_ets_component_three/entry/src/main/module.json b/arkui/ace_ets_component_three/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..32320cccd658cce4d66e78ec8fb2aa5c504c96e6 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/module.json @@ -0,0 +1,35 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.open.harmony.acetestthree.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }] + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_component_three/entry/src/main/resources/base/element/string.json index f6488bb9ccc6588f4a68440a5a320c1d2d952a99..1f98380da627350f3a12e9002365acf88e0f1ace 100644 --- a/arkui/ace_ets_component_three/entry/src/main/resources/base/element/string.json +++ b/arkui/ace_ets_component_three/entry/src/main/resources/base/element/string.json @@ -27,6 +27,34 @@ { "name":"message_arrive", "value":"We will arrive at %s." - } + }, + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } ] } \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_component_three/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..74102b0b509fb729cb19dd64010cea46141118b7 --- /dev/null +++ b/arkui/ace_ets_component_three/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,38 @@ +{ + "src": [ + "MainAbility/pages/index", + "MainAbility/pages/index/index", + "MainAbility/pages/second/second", + "MainAbility/pages/toggle", + "MainAbility/pages/gridPage", + "MainAbility/pages/span", + "MainAbility/pages/text", + "MainAbility/pages/badge", + "MainAbility/pages/canvas", + "MainAbility/pages/longPressGesture", + "MainAbility/pages/button", + "MainAbility/pages/ResponseRegion", + "MainAbility/pages/PanGesture", + "MainAbility/pages/background", + "MainAbility/pages/QrCode", + "MainAbility/pages/tabs", + "MainAbility/pages/tapGesture", + "MainAbility/pages/progress", + "MainAbility/pages/animate", + "MainAbility/pages/rating", + "MainAbility/pages/canvas2", + "MainAbility/pages/shape", + "MainAbility/pages/motionPath", + "MainAbility/pages/scrollCode", + "MainAbility/pages/transition", + "MainAbility/pages/priorityGesture", + "MainAbility/pages/parallelGesture", + "MainAbility/pages/blank", + "MainAbility/pages/sharedTransition", + "MainAbility/pages/sharedTransition2", + "MainAbility/pages/line", + "MainAbility/pages/circle", + "MainAbility/pages/aboutToDisappear", + "MainAbility/pages/timeStamp" + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/AppScope/app.json b/arkui/ace_ets_dev/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7cd6479a5fb10d86f9087a5fc7d72c708d6922dc --- /dev/null +++ b/arkui/ace_ets_dev/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.open.harmony.acedevtest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/AppScope/resources/base/element/string.json b/arkui/ace_ets_dev/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/arkui/ace_ets_dev/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_dev/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/arkui/ace_ets_dev/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_dev/BUILD.gn b/arkui/ace_ets_dev/BUILD.gn index 7e5b20c16b5444f234cb411df70eb4d74d507b36..2b15461ea02d5761b8c64f0244f39008b3f5fffe 100644 --- a/arkui/ace_ets_dev/BUILD.gn +++ b/arkui/ace_ets_dev/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# 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 @@ -14,23 +14,30 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAceDevTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" deps = [ ":ace_ets_dev_assets", - ":ace_ets_dev_resources", - ":ace_ets_dev_test_assets", + ":ace_ets_dev_resources" ] ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" + certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsAceDevTest" + subsystem_name = "arkui" + part_name = "ace_engine" } -ohos_js_assets("ace_ets_dev_assets") { - source_dir = "./entry/src/main/ets/MainAbility" + +ohos_app_scope("ace_ets_component_dev_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] } -ohos_js_assets("ace_ets_dev_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" + +ohos_js_assets("ace_ets_dev_assets") { + source_dir = "entry/src/main/ets" } + ohos_resources("ace_ets_dev_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "entry/src/main/resources" ] + deps = [ ":ace_ets_component_dev_app_profile" ] + hap_profile = "entry/src/main/module.json" } diff --git a/arkui/ace_ets_dev/Test.json b/arkui/ace_ets_dev/Test.json index 40b6e1ecc1e45ac47f55e729117c645a453c14cd..79192d517705a99a50f94f0098db87639f28bb52 100644 --- a/arkui/ace_ets_dev/Test.json +++ b/arkui/ace_ets_dev/Test.json @@ -1,10 +1,10 @@ { - "description": "Configuration for dev Tests", + "description": "Configuration for hjunit demo Tests", "driver": { "type": "OHJSUnitTest", "test-timeout": "600000", "bundle-name": "com.open.harmony.acedevtest", - "package-name": "com.open.harmony.acedevtest", + "module-name": "phone", "shell-timeout": "600000" }, "kits": [ diff --git a/arkui/ace_ets_dev/entry/src/main/config.json b/arkui/ace_ets_dev/entry/src/main/config.json deleted file mode 100644 index 61b99d1831f641fa9351c497e7e1bdb0c5a5c131..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_dev/entry/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.acedevtest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 8 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.acedevtest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.acedevtest.MainAbility", - "deviceType": [ - "tablet", - "default", - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/curve" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/arkui/ace_ets_dev/entry/src/main/ets/Application/AbilityStage.ts b/arkui/ace_ets_dev/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0e0206ea9fb5ce94ef140d69510b6280969dd8e --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.app.ability.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/MainAbility.ts b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d66065e88c907379883364a43ec02989cfd626b --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,37 @@ +import Ability from '@ohos.app.ability.UIAbility' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/index/index.ets b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..97504e2440a9a6110fd5c9c02985914ef8d9e655 --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/second/second.ets b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/Common.ets b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/Common.ets new file mode 100644 index 0000000000000000000000000000000000000000..a67880c93d98eb600808e0b1bb4d2052e3f9f35f --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/Common.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. + */ + +export default class CommonFunc { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } +} + + + + diff --git a/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/MessageManager.ets b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/MessageManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ed176cc91fc16252ccf70be4fcd2775501b576b --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/MainAbility/utils/MessageManager.ets @@ -0,0 +1,54 @@ +/** + * 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. + */ +export interface Callback { + (message:any):void +} + +export class MessageManager { + callback:Callback + callbacks:Map = new Map() + + constructor() { + + } + + registerCallback(callback:Callback , type?:string) { + if (type == undefined) { + console.error('registerCallback callback set') + this.callback = callback + return + } + this.callbacks.set(type,callback) + } + + notify(message:any, type?:string) { + if (type == undefined) { + this.callback(message) + return + } + + let tmpCallback:Callback = this.callbacks.get(type) + if (tmpCallback === undefined) { + console.error('callbacks has no callback for type ' + type) + return + } + tmpCallback(message) + } + + clear() { + this.callbacks.clear() + this.callback = null + } +} \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/TestAbility.ts b/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8028a70f8af44690b95a08bd177bca6b09f24687 --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 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 Ability from '@ohos.app.ability.UIAbility' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_dev/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_dev/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts index dfbf1f268a45e4a2f30b8c836f42d76f3a9f5ad3..34c7ad81ef674b0fafe9260794945520cff4b502 100644 --- a/arkui/ace_ets_dev/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/arkui/ace_ets_dev/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -1,6 +1,5 @@ -// @ts-nocheck -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 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 @@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined function translateParamsToString(parameters) { const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', + '-s class', '-s notClass', '-s suite', '-s it', '-s level', '-s testType', '-s size', '-s timeout', - '-s package' + '-s dryRun' ]) let targetParams = ''; for (const key in parameters) { if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] + targetParams = `${targetParams} ${key} ${parameters[key]}` } } return targetParams.trim() } async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); + console.log("onAbilityCreateCallback"); } async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) } export default class OpenHarmonyTestRunner implements TestRunner { @@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { } onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') + console.info("OpenHarmonyTestRunner OnPrepare ") } - onRun() { + async onRun() { console.log('OpenHarmonyTestRunner onRun run') abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' let lMonitor = { abilityName: testAbilityName, onAbilityCreate: onAbilityCreateCallback, }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + var cmd = 'aa start -d 0 -a com.open.harmony.acedevtest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } console.info('cmd : '+cmd) abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { @@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.exitCode); }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) console.info('OpenHarmonyTestRunner onRun end') } -}; \ No newline at end of file +}; diff --git a/arkui/ace_ets_dev/entry/src/main/ets/test/CurveJsunit.test.ets b/arkui/ace_ets_dev/entry/src/main/ets/test/CurveJsunit.test.ets index 1c92525e6fcc4affee5121b68ac6875804dc8309..7714d300a962d8486c4784c6a6dc2221f0112123 100644 --- a/arkui/ace_ets_dev/entry/src/main/ets/test/CurveJsunit.test.ets +++ b/arkui/ace_ets_dev/entry/src/main/ets/test/CurveJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -15,7 +15,7 @@ */ import router from '@system.router'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import Utils from './Utils.ets' export default function CurveJsunit() { @@ -23,7 +23,7 @@ export default function CurveJsunit() { beforeEach(async function (done) { console.info("flex beforeEach start"); let options = { - uri: 'pages/curve', + uri: 'MainAbility/pages/curve', } try { router.clear(); diff --git a/arkui/ace_ets_dev/entry/src/main/module.json b/arkui/ace_ets_dev/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..015bbe329339e37283699e3a7f7c0fc6a13b070a --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/module.json @@ -0,0 +1,35 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.open.harmony.acedevtest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }] + } +} diff --git a/arkui/ace_ets_dev/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_dev/entry/src/main/resources/base/element/string.json index f6488bb9ccc6588f4a68440a5a320c1d2d952a99..fdffb6bf9a805bc99035795a250498bec26ac231 100644 --- a/arkui/ace_ets_dev/entry/src/main/resources/base/element/string.json +++ b/arkui/ace_ets_dev/entry/src/main/resources/base/element/string.json @@ -27,6 +27,34 @@ { "name":"message_arrive", "value":"We will arrive at %s." + }, + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" } ] } \ No newline at end of file diff --git a/arkui/ace_ets_dev/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_dev/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e502410ef3af762166fc7d615c3dd2de13be29c6 --- /dev/null +++ b/arkui/ace_ets_dev/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,8 @@ +{ + "src": [ + "MainAbility/pages/index/index", + "MainAbility/pages/second/second", + "MainAbility/pages/index", + "MainAbility/pages/curve" + ] +} \ No newline at end of file