提交 5371fdba 编写于 作者: H hekun

change to stage model

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 7aea3c5e
{
"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
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
...@@ -14,25 +14,33 @@ ...@@ -14,25 +14,33 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceEtsComponentFiveTest") { ohos_js_hap_suite("ActsAceEtsComponentFiveTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [ deps = [
":ace_ets_component_assets",
":ace_ets_component_resources", ":ace_ets_component_resources",
":ace_ets_component_test_assets", ":ace_ets_component_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceEtsComponentFiveTest" hap_name = "ActsAceEtsComponentFiveTest"
subsystem_name = "arkui" subsystem_name = "arkui"
part_name = "ace_engine" 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") { ohos_js_assets("ace_ets_component_assets") {
source_dir = "./entry/src/main/ets/MainAbility" source_dir = "./entry/src/main/ets/MainAbility"
} }
ohos_js_assets("ace_ets_component_test_assets") { 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") { ohos_resources("ace_ets_component_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_app_profile" ]
hap_profile = "entry/src/main/module.json"
} }
{ {
"description": "Configuration for aceceshi Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "700000", "test-timeout": "700000",
"bundle-name": "com.open.harmony.acetestfive", "bundle-name": "com.open.harmony.acetestfive",
"package-name": "com.open.harmony.acetestfive", "module-name": "phone",
"shell-timeout": "700000" "shell-timeout": "700000",
"testcase-timeout": "180000"
}, },
"kits": [ "kits": [
{ {
......
{
"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
}
}
]
}
}
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;
}
}
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
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -44,6 +44,7 @@ struct CheckboxExample { ...@@ -44,6 +44,7 @@ struct CheckboxExample {
Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) Checkbox({name: 'checkbox1', group: 'checkboxGroup'})
.select(true) .select(true)
.key('Checkbox1') .key('Checkbox1')
.selectedColor(0xed6f21) .selectedColor(0xed6f21)
.onChange((value: boolean) => { .onChange((value: boolean) => {
console.info('Checkbox1 change is'+ value) console.info('Checkbox1 change is'+ value)
......
/*
* 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
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -18,20 +18,20 @@ import events_emitter from '@ohos.events.emitter'; ...@@ -18,20 +18,20 @@ import events_emitter from '@ohos.events.emitter';
@Entry @Entry
@Component @Component
struct PositionSetting { struct PositionSetting {
@State align: Alignment = Alignment.TopStart; @State alignT: Alignment = Alignment.TopStart;
@State direction: Direction = Direction.Rtl; @State directionT: Direction = Direction.Rtl;
@State position1: {x: string, y: string} = {x: 25, y: 15}; @State position1: {x: number, y: number} = {x: 25, y: 15};
@State position2: {x: string, y: string} = {x: '50%', y: '70%'}; @State position2: {x: string, y: string} = {x: '50%', y: '70%'};
@State anchor: {x: string, y: string} = {x: 25, y: 25}; @State anchor: {x: number, y: number} = {x: 25, y: 25};
@State offset: {x: string, y: string} = {x: 10, y: 15}; @State offsetT: {x: number, y: number} = {x: 10, y: 15};
@State opacityValue: string = 1; @State opacityValue: number = 1;
build() { build() {
Column() { Column() {
Column({space: 10}) { 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') Text('top start')
.align(this.align) .align(this.alignT)
.height(50) .height(50)
.width('90%') .width('90%')
.fontSize(20) .fontSize(20)
...@@ -46,7 +46,7 @@ struct PositionSetting { ...@@ -46,7 +46,7 @@ struct PositionSetting {
Text('4').height(50).width('25%').fontSize(20).backgroundColor(0xD2B48C) Text('4').height(50).width('25%').fontSize(20).backgroundColor(0xD2B48C)
} }
.width('90%') .width('90%')
.direction(this.direction) .direction(this.directionT)
.key('rowDirection') .key('rowDirection')
Text('position').fontSize(20).fontColor(Color.Black).width('90%') Text('position').fontSize(20).fontColor(Color.Black).width('90%')
...@@ -92,10 +92,10 @@ struct PositionSetting { ...@@ -92,10 +92,10 @@ struct PositionSetting {
Text('offset').fontSize(20).fontColor(Color.Black).width('90%') Text('offset').fontSize(20).fontColor(Color.Black).width('90%')
Row() { Row() {
Text('1').size({ width: '15%', height: '100' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(20) 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 }) .size({ width: 170, height: '50' }).backgroundColor(0xbbb2cb).border({ width: 1 })
.fontSize(20).align(Alignment.Start) .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') .key('offset')
Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(20) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(20)
Text('4\noffset(-10%, 20%)') Text('4\noffset(-10%, 20%)')
...@@ -141,16 +141,16 @@ struct PositionSetting { ...@@ -141,16 +141,16 @@ struct PositionSetting {
console.info("position page stateChangCallBack" + JSON.stringify(eventData)); console.info("position page stateChangCallBack" + JSON.stringify(eventData));
if (eventData) { if (eventData) {
if (eventData.data.textAlign) { if (eventData.data.textAlign) {
this.align = Alignment.BottomEnd; this.alignT = Alignment.BottomEnd;
} else if (eventData.data.direction) { } else if (eventData.data.direction) {
this.direction = eventData.data.direction; this.directionT = eventData.data.direction;
} else if (eventData.data.position1) { } else if (eventData.data.position1) {
this.position1 = JSON.parse(eventData.data.position1); this.position1 = JSON.parse(eventData.data.position1);
this.position2 = JSON.parse(eventData.data.position2); this.position2 = JSON.parse(eventData.data.position2);
} else if (eventData.data.markAnchor) { } else if (eventData.data.markAnchor) {
this.anchor = JSON.parse(eventData.data.markAnchor); this.anchor = JSON.parse(eventData.data.markAnchor);
} else if (eventData.data.offset) { } else if (eventData.data.offset) {
this.offset = JSON.parse(eventData.data.offset); this.offsetT = JSON.parse(eventData.data.offset);
} else if (eventData.data.opacityValue) { } else if (eventData.data.opacityValue) {
this.opacityValue = eventData.data.opacityValue; this.opacityValue = eventData.data.opacityValue;
} }
......
// @ts-nocheck /*
/** * Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at
* You may obtain a copy of the License at *
* * http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0 *
* * Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and * limitations under the License.
* limitations under the License. */
*/ import router from '@system.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' @Entry
import testsuite from '../test/List.test' @Component
struct Second {
export default { private content: string = "Second Page"
onCreate() {
console.info('Application onCreate') build() {
var abilityDelegator: any Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() Text(`${this.content}`)
var abilityDelegatorArguments: any .fontSize(50)
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() .fontWeight(FontWeight.Bold)
console.info('start run testcase!!!') Button() {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Text('back to index')
}, .fontSize(20)
onDestroy() { .fontWeight(FontWeight.Bold)
console.info('Application onDestroy') }.type(ButtonType.Capsule)
}, .margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
} }
\ No newline at end of file
/*
* 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
// @ts-nocheck /*
/** * Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,7 +12,7 @@ ...@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router'; import router from '@ohos.router';
@Entry @Entry
@Component @Component
...@@ -21,7 +20,6 @@ struct Index { ...@@ -21,7 +20,6 @@ struct Index {
aboutToAppear() { aboutToAppear() {
console.info('TestAbility index aboutToAppear') console.info('TestAbility index aboutToAppear')
} }
@State message: string = 'Hello World' @State message: string = 'Hello World'
build() { build() {
Row() { Row() {
......
// @ts-nocheck /*
/** * Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined ...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) { function translateParamsToString(parameters) {
const keySet = new Set([ 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 level', '-s testType', '-s size', '-s timeout',
'-s package' '-s dryRun'
]) ])
let targetParams = ''; let targetParams = '';
for (const key in parameters) { for (const key in parameters) {
if (keySet.has(key)) { if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key] targetParams = `${targetParams} ${key} ${parameters[key]}`
} }
} }
return targetParams.trim() return targetParams.trim()
} }
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); console.log("onAbilityCreateCallback");
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') console.info("OpenHarmonyTestRunner OnPrepare ")
} }
onRun() { async onRun() {
console.log('OpenHarmonyTestRunner onRun run') console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) 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) cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd) console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode); 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') console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function backgroundAndSizeSettingJsunit() { ...@@ -23,7 +23,7 @@ export default function backgroundAndSizeSettingJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("backgroundAndSizeSetting beforeEach start"); console.info("backgroundAndSizeSetting beforeEach start");
let options = { let options = {
uri: 'pages/backgroundAndSizeSetting', uri: 'MainAbility/pages/backgroundAndSizeSetting',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function borderJsunit() { ...@@ -23,7 +23,7 @@ export default function borderJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("border beforeEach start"); console.info("border beforeEach start");
let options = { let options = {
uri: 'pages/border', uri: 'MainAbility/pages/border',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -21,7 +21,7 @@ export default function checkboxGroupJsunit() { ...@@ -21,7 +21,7 @@ export default function checkboxGroupJsunit() {
describe('checkboxGroupTest', function () { describe('checkboxGroupTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/checkboxGroup', uri: 'MainAbility/pages/checkboxGroup',
} }
try { try {
router.clear(); router.clear();
...@@ -83,7 +83,8 @@ export default function checkboxGroupJsunit() { ...@@ -83,7 +83,8 @@ export default function checkboxGroupJsunit() {
let strJson = getInspectorByKey('CheckboxGroup'); let strJson = getInspectorByKey('CheckboxGroup');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("testCheckboxGroup_400 component obj is: " + JSON.stringify(obj)); 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'); console.info('testCheckboxGroup_400 END');
done(); done();
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -21,7 +21,7 @@ export default function checkboxJsunit() { ...@@ -21,7 +21,7 @@ export default function checkboxJsunit() {
describe('checkboxTest', function () { describe('checkboxTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/checkbox', uri: 'MainAbility/pages/checkbox',
} }
try { try {
router.clear(); router.clear();
...@@ -71,8 +71,9 @@ export default function checkboxJsunit() { ...@@ -71,8 +71,9 @@ export default function checkboxJsunit() {
await Utils.sleep(1000); await Utils.sleep(1000);
let strJson = getInspectorByKey('Checkbox1'); let strJson = getInspectorByKey('Checkbox1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("testCheckbox_300 component obj is: " + JSON.stringify(obj)); console.info("testCheckbox_300 component obj is: " + JSON.stringify(obj.$attrs.borderRadius));
expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); let assertObjet = obj.$attrs.borderRadius;
expect(assertObjet instanceof Object).assertTrue();
console.info('testCheckbox_300 END'); console.info('testCheckbox_300 END');
done(); done();
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function colorGradientJsunit() { ...@@ -23,7 +23,7 @@ export default function colorGradientJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("colorGradient beforeEach start"); console.info("colorGradient beforeEach start");
let options = { let options = {
uri: 'pages/colorGradient', uri: 'MainAbility/pages/colorGradient',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function edgeEffectJsunit(){ ...@@ -22,7 +22,7 @@ export default function edgeEffectJsunit(){
describe('edgeEffectTest', function (){ describe('edgeEffectTest', function (){
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/edgeEffect', uri: 'MainAbility/pages/edgeEffect',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function enumsFlexItemJsunit() { ...@@ -22,7 +22,7 @@ export default function enumsFlexItemJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach ===================enumsFlexItem test beforeEach called==================='); console.info('beforeEach ===================enumsFlexItem test beforeEach called===================');
let options = { let options = {
uri: 'pages/enumsFlexAlign', uri: 'MainAbility/pages/enumsFlexAlign',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() { ...@@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach ===================enumsHorizontalAlign test beforeEach called==================='); console.info('beforeEach ===================enumsHorizontalAlign test beforeEach called===================');
let options = { let options = {
uri: 'pages/enumsHorizontalAlign', uri: 'MainAbility/pages/enumsHorizontalAlign',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function enumsImageJsunit() { ...@@ -22,7 +22,7 @@ export default function enumsImageJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach ===================enumsImage test beforeEach called==================='); console.info('beforeEach ===================enumsImage test beforeEach called===================');
let options = { let options = {
uri: 'pages/enumsImage', uri: 'MainAbility/pages/enumsImage',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() { ...@@ -22,7 +22,7 @@ export default function enumsVerticalAlignJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach ===================enumsFlexItem test beforeEach called==================='); console.info('beforeEach ===================enumsFlexItem test beforeEach called===================');
let options = { let options = {
uri: 'pages/enumsVerticalAlign', uri: 'MainAbility/pages/enumsVerticalAlign',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function fillModeJsunit(){ ...@@ -23,7 +23,7 @@ export default function fillModeJsunit(){
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('fillModeTest beforeEach called'); console.info('fillModeTest beforeEach called');
let options = { let options = {
uri: 'pages/fillMode', uri: 'MainAbility/pages/fillMode',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function ohosMatrix4Jsunit() { ...@@ -23,7 +23,7 @@ export default function ohosMatrix4Jsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("ohosMatrix4 beforeEach start"); console.info("ohosMatrix4 beforeEach start");
let options = { let options = {
uri: 'pages/ohosMatrix4', uri: 'MainAbility/pages/ohosMatrix4',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function positionSettingJsunit() { ...@@ -23,7 +23,7 @@ export default function positionSettingJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("positionSetting beforeEach start"); console.info("positionSetting beforeEach start");
let options = { let options = {
uri: 'pages/positionSetting', uri: 'MainAbility/pages/positionSetting',
} }
try { try {
router.clear(); router.clear();
...@@ -52,8 +52,8 @@ export default function positionSettingJsunit() { ...@@ -52,8 +52,8 @@ export default function positionSettingJsunit() {
let strJson = getInspectorByKey('textAlign'); let strJson = getInspectorByKey('textAlign');
console.info("[testPositionSetting001] component strJson:" + strJson); console.info("[testPositionSetting001] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign); console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign + "_" + obj.$attrs.align);
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Left'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
console.info('[testPositionSetting001] END'); console.info('[testPositionSetting001] END');
done(); done();
}); });
...@@ -92,7 +92,7 @@ export default function positionSettingJsunit() { ...@@ -92,7 +92,7 @@ export default function positionSettingJsunit() {
console.info("[testPositionSetting003] component strJson:" + strJson); console.info("[testPositionSetting003] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testPositionSetting003] textAlign: " + obj.$attrs.textAlign); 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'); console.info('[testPositionSetting003] END');
done(); done();
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function selectJsunit() { ...@@ -22,7 +22,7 @@ export default function selectJsunit() {
describe('appInfoTest_five_2', function () { describe('appInfoTest_five_2', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/select', uri: 'MainAbility/pages/select',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function shapeClippingJsunit() { ...@@ -23,7 +23,7 @@ export default function shapeClippingJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("shapeClipping beforeEach start"); console.info("shapeClipping beforeEach start");
let options = { let options = {
uri: 'pages/shapeClipping', uri: 'MainAbility/pages/shapeClipping',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function sliderJsunit() { ...@@ -22,7 +22,7 @@ export default function sliderJsunit() {
describe('appInfoTest_five_3', function () { describe('appInfoTest_five_3', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/slider', uri: 'MainAbility/pages/slider',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function transFormJsunit() { ...@@ -22,7 +22,7 @@ export default function transFormJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("transForm beforeEach start"); console.info("transForm beforeEach start");
let options = { let options = {
uri: 'pages/transForm', uri: 'MainAbility/pages/transForm',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function visibilityJsunit() { ...@@ -22,7 +22,7 @@ export default function visibilityJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("visibility beforeEach start"); console.info("visibility beforeEach start");
let options = { let options = {
uri: 'pages/visibility', uri: 'MainAbility/pages/visibility',
} }
try { try {
router.clear(); router.clear();
......
{
"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
...@@ -28,5 +28,34 @@ ...@@ -28,5 +28,34 @@
"name":"message_arrive", "name":"message_arrive",
"value":"We will arrive at %s." "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
{
"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
{
"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
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -14,25 +14,29 @@ ...@@ -14,25 +14,29 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceEtsComponentThreeTest") { ohos_js_hap_suite("ActsAceEtsComponentThreeTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [ deps = [
":ace_ets_component_assets", ":ace_ets_component_assets",
":ace_ets_component_resources", ":ace_ets_component_resources",
":ace_ets_component_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceEtsComponentThreeTest" hap_name = "ActsAceEtsComponentThreeTest"
subsystem_name = "arkui" subsystem_name = "arkui"
part_name = "ace_engine" 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") { ohos_resources("ace_ets_component_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_app_profile" ]
hap_profile = "entry/src/main/module.json"
} }
{ {
"description": "Configuration for aceceshi Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1200000", "test-timeout": "1200000",
"bundle-name": "com.open.harmony.acetestthree", "bundle-name": "com.open.harmony.acetestthree",
"package-name": "com.open.harmony.acetestthree",
"module-name": "phone",
"shell-timeout": "1200000" "shell-timeout": "1200000"
}, },
"kits": [ "kits": [
......
{
"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
}
}
]
}
}
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;
}
}
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
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -14,10 +13,12 @@ ...@@ -14,10 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import {MessageManager,Callback} from '../utils/MessageManager';
@Entry @Entry
@Component @Component
struct AnimationExample { struct AnimationExample {
@State show:string = "btShow"
@State btn1: boolean = false @State btn1: boolean = false
@State duration: number = 100 @State duration: number = 100
@State curve: string = 'Ease' @State curve: string = 'Ease'
...@@ -25,99 +26,38 @@ struct AnimationExample { ...@@ -25,99 +26,38 @@ struct AnimationExample {
@State tempo: number= 1000 @State tempo: number= 1000
@State playmode: PlayMode = PlayMode.Normal @State playmode: PlayMode = PlayMode.Normal
messageManager:MessageManager = new MessageManager()
onPageShow() { onPageShow() {
console.info('animate page show called'); globalThis.value = {
var stateChangeEvent = { name:'messageManager',message:this.messageManager
eventId: 50,
priority: events_emitter.EventPriority.LOW
} }
events_emitter.on(stateChangeEvent, this.stateChangCallBack) let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
var stateChangeEventa = { if (message.name == 'duration') {
eventId: 1011, this.duration = message.value
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);
} }
if (eventData.data.curve != null) { if (message.name == 'curve') {
this.curve = eventData.data.curve; this.curve = message.value
} }
if (eventData.data.tempo != null) { if (message.name == 'iteration') {
this.tempo = parseInt(eventData.data.tempo); this.iteration = message.value
} }
if (eventData.data.iteration != null) { if (message.name == 'tempo') {
this.iteration = parseInt(eventData.data.iteration); this.tempo = message.value
} }
if (eventData.data.playmode != null) { if (message.name == 'playmode') {
this.playmode = eventData.data.playmode; this.playmode = message.value
} }
} }
this.messageManager.registerCallback(callback)
} }
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, }) { Column(){
Button(this.show) Button(this.show)
.backgroundColor(0x317aff)
.width(80) .width(80)
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
...@@ -145,6 +85,64 @@ struct AnimationExample { ...@@ -145,6 +85,64 @@ struct AnimationExample {
console.info("button1 duration test animateTo START") 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) Button(this.show)
.width(80) .width(80)
.height(30) .height(30)
...@@ -201,6 +199,34 @@ struct AnimationExample { ...@@ -201,6 +199,34 @@ struct AnimationExample {
console.info("button3 iterations test animateTo START") 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) Button(this.show)
.width(80) .width(80)
.height(30) .height(30)
...@@ -229,6 +255,34 @@ struct AnimationExample { ...@@ -229,6 +255,34 @@ struct AnimationExample {
console.info("button4 tempo test animateTo START") 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) Button(this.show)
.width(80) .width(80)
.height(30) .height(30)
...@@ -253,7 +307,35 @@ struct AnimationExample { ...@@ -253,7 +307,35 @@ struct AnimationExample {
} }
console.info("button5 animateTo START") console.info("button5 animateTo START")
console.info("button5 playmode value is : " + this.playmode) 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") console.info("button5 playMode test animateTo START")
}) })
}) })
...@@ -323,7 +405,7 @@ struct AnimationExample { ...@@ -323,7 +405,7 @@ struct AnimationExample {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "curve": this.curve,
} }
} }
var backEvent = { var backEvent = {
...@@ -351,7 +433,7 @@ struct AnimationExample { ...@@ -351,7 +433,7 @@ struct AnimationExample {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "curve": this.curve,
} }
} }
var backEvent = { var backEvent = {
...@@ -379,7 +461,7 @@ struct AnimationExample { ...@@ -379,7 +461,7 @@ struct AnimationExample {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "iteration": this.iteration,
} }
} }
var backEvent = { var backEvent = {
...@@ -402,12 +484,12 @@ struct AnimationExample { ...@@ -402,12 +484,12 @@ struct AnimationExample {
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.margin({ bottom: 20 }) .margin({ bottom: 20 })
.key('button11') .key('button111')
.onClick(() => { .onClick(() => {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "iteration": this.iteration,
} }
} }
var backEvent = { var backEvent = {
...@@ -430,12 +512,12 @@ struct AnimationExample { ...@@ -430,12 +512,12 @@ struct AnimationExample {
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.margin({ bottom: 20 }) .margin({ bottom: 20 })
.key('button12') .key('button121')
.onClick(() => { .onClick(() => {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "tempo": this.tempo,
} }
} }
var backEvent = { var backEvent = {
...@@ -458,12 +540,12 @@ struct AnimationExample { ...@@ -458,12 +540,12 @@ struct AnimationExample {
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.margin({ bottom: 20 }) .margin({ bottom: 20 })
.key('button13') .key('button131')
.onClick(() => { .onClick(() => {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "tempo": this.tempo,
} }
} }
var backEvent = { var backEvent = {
...@@ -486,12 +568,12 @@ struct AnimationExample { ...@@ -486,12 +568,12 @@ struct AnimationExample {
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.margin({ bottom: 20 }) .margin({ bottom: 20 })
.key('button14') .key('button141')
.onClick(() => { .onClick(() => {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "playmode": this.playmode,
} }
} }
var backEvent = { var backEvent = {
...@@ -514,12 +596,12 @@ struct AnimationExample { ...@@ -514,12 +596,12 @@ struct AnimationExample {
.height(30) .height(30)
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
.margin({ bottom: 20 }) .margin({ bottom: 20 })
.key('button15') .key('button151')
.onClick(() => { .onClick(() => {
try { try {
var backData = { var backData = {
data: { data: {
"duration": this.duration, "playmode": this.playmode,
} }
} }
var backEvent = { var backEvent = {
...@@ -537,6 +619,6 @@ struct AnimationExample { ...@@ -537,6 +619,6 @@ struct AnimationExample {
console.info("button15 duration test animateTo START") console.info("button15 duration test animateTo START")
}) })
}) })
}.height(400).width("100%").padding({ top: 100 }) }.height("%100").width("100%")
} }
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
......
/*
* 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
// @ts-nocheck /*
/** * Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at
* You may obtain a copy of the License at *
* * http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0 *
* * Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and * limitations under the License.
* limitations under the License. */
*/ import router from '@system.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' @Entry
import testsuite from '../test/List.test' @Component
struct Second {
export default { private content: string = "Second Page"
onCreate() {
console.info('Application onCreate') build() {
var abilityDelegator: any Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() Text(`${this.content}`)
var abilityDelegatorArguments: any .fontSize(50)
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() .fontWeight(FontWeight.Bold)
console.info('start run testcase!!!') Button() {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Text('back to index')
}, .fontSize(20)
onDestroy() { .fontWeight(FontWeight.Bold)
console.info('Application onDestroy') }.type(ButtonType.Capsule)
}, .margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
......
/**
* 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
}
}
}
// @ts-nocheck /**
/** * Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at
* You may obtain a copy of the License at *
* * http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0 *
* * Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and * limitations under the License.
* limitations under the License. */
*/ export interface Callback {
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' (message:any):void
import { Hypium } from 'hypium/index' }
import testsuite from '../test/List.test'
export class MessageManager {
export default { callback:Callback
onCreate() { callbacks:Map<string,Callback> = new Map()
console.info('Application onCreate')
var abilityDelegator: any constructor() {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any }
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!') registerCallback(callback:Callback , type?:string) {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) if (type == undefined) {
}, console.error('registerCallback callback set')
onDestroy() { this.callback = callback
console.info('Application onDestroy') 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
/*
* 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
// @ts-nocheck /*
/** * Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined ...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) { function translateParamsToString(parameters) {
const keySet = new Set([ 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 level', '-s testType', '-s size', '-s timeout',
'-s package' '-s dryRun'
]) ])
let targetParams = ''; let targetParams = '';
for (const key in parameters) { for (const key in parameters) {
if (keySet.has(key)) { if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key] targetParams = `${targetParams} ${key} ${parameters[key]}`
} }
} }
return targetParams.trim() return targetParams.trim()
} }
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); console.log("onAbilityCreateCallback");
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') console.info("OpenHarmonyTestRunner OnPrepare ")
} }
onRun() { async onRun() {
console.log('OpenHarmonyTestRunner onRun run') console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) 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) cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd) console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode); 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') console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function aboutToDisappearJsunit() { ...@@ -23,7 +23,7 @@ export default function aboutToDisappearJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("aboutToDisappear beforeEach start"); console.info("aboutToDisappear beforeEach start");
let options = { let options = {
uri: 'pages/aboutToDisappear', uri: 'MainAbility/pages/aboutToDisappear',
} }
try { try {
router.clear(); router.clear();
......
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -13,17 +12,20 @@ ...@@ -13,17 +12,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
import CommonFunc from '../MainAbility/utils/Common';
import {MessageManager,Callback} from '../MainAbility/utils/MessageManager';
const waitUiReadyMs = 1000;
export default function animateJsunit() { export default function animateJsunit() {
describe('animateTest', function () { describe('animateTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("animate beforeEach start"); console.info("animate beforeEach start");
let options = { let options = {
uri: 'pages/animate', uri: 'MainAbility/pages/animate',
} }
try { try {
router.clear(); router.clear();
...@@ -55,7 +57,11 @@ export default function animateJsunit() { ...@@ -55,7 +57,11 @@ export default function animateJsunit() {
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_0100 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -99,7 +105,12 @@ export default function animateJsunit() { ...@@ -99,7 +105,12 @@ export default function animateJsunit() {
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_0300 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -157,108 +168,82 @@ export default function animateJsunit() { ...@@ -157,108 +168,82 @@ export default function animateJsunit() {
}); });
it('animateTest_0600', 0, async function (done) { it('animateTest_0600', 0, async function (done) {
console.info('animateTest_0500 START'); await CommonFunc.sleep(1000);
try { globalThis.value.message.notify({name:'duration', value:2000});
let eventData = { await CommonFunc.sleep(200);
data: { let indexEvent = {
"duration": '2000' eventId: 151,
}
}
let indexEventOne = {
eventId: 50,
priority: events_emitter.EventPriority.LOW 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) => { let callback = (indexEvent) => {
console.info("animateTest_0600 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_0600 END'); console.info('animateTest_0600 END');
done(); done();
}); });
it('animateTest_0700', 0, async function (done) { it('animateTest_0700', 0, async function (done) {
console.info('animateTest_0700 START'); console.info('animateTest_0700 START');
try { globalThis.value.message.notify({name:'curve', value:'Linear'});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 52, eventId: 152,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_0700 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_0700 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_0700 END'); console.info('animateTest_0700 END');
done(); done();
}); });
it('animateTest_0800', 0, async function (done) { it('animateTest_0800', 0, async function (done) {
console.info('animateTest_0800 START'); console.info('animateTest_0800 START');
try { globalThis.value.message.notify({name:'iteration', value:2});
let eventData = { await CommonFunc.sleep(200);
data: { let indexEvent = {
"iteration": "2" eventId: 153,
}
}
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,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_0800 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_0800 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_0800 END'); console.info('animateTest_0800 END');
done(); done();
...@@ -266,35 +251,27 @@ export default function animateJsunit() { ...@@ -266,35 +251,27 @@ export default function animateJsunit() {
it('animateTest_0900', 0, async function (done) { it('animateTest_0900', 0, async function (done) {
console.info('animateTest_0900 START'); console.info('animateTest_0900 START');
try { globalThis.value.message.notify({name:'tempo', value:"20000"});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 54, eventId: 154,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_0900 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_0900 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_0900 END'); console.info('animateTest_0900 END');
done(); done();
...@@ -302,35 +279,26 @@ export default function animateJsunit() { ...@@ -302,35 +279,26 @@ export default function animateJsunit() {
it('animateTest_1000', 0, async function (done) { it('animateTest_1000', 0, async function (done) {
console.info('animateTest_1000 START'); console.info('animateTest_1000 START');
try { globalThis.value.message.notify({name:'playmode', value:PlayMode.Alternate});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 55, eventId: 155,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1000 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_1000 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_1000 END'); console.info('animateTest_1000 END');
done(); done();
...@@ -338,28 +306,20 @@ export default function animateJsunit() { ...@@ -338,28 +306,20 @@ export default function animateJsunit() {
it('animateTest_1100', 0, async function (done) { it('animateTest_1100', 0, async function (done) {
console.info('animateTest_1100 START'); console.info('animateTest_1100 START');
try { globalThis.value.message.notify({name:'duration', value:-1000});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1001, eventId: 1001,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1100 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -374,28 +334,19 @@ export default function animateJsunit() { ...@@ -374,28 +334,19 @@ export default function animateJsunit() {
it('animateTest_1200', 0, async function (done) { it('animateTest_1200', 0, async function (done) {
console.info('animateTest_1200 START'); console.info('animateTest_1200 START');
try { globalThis.value.message.notify({name:'duration', value:100000000});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1002, eventId: 1002,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1200 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -410,28 +361,20 @@ export default function animateJsunit() { ...@@ -410,28 +361,20 @@ export default function animateJsunit() {
it('animateTest_1300', 0, async function (done) { it('animateTest_1300', 0, async function (done) {
console.info('animateTest_1300 START'); console.info('animateTest_1300 START');
try { globalThis.value.message.notify({name:'curve', value:'123'});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1003, eventId: 1003,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1300 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -446,28 +389,19 @@ export default function animateJsunit() { ...@@ -446,28 +389,19 @@ export default function animateJsunit() {
it('animateTest_1400', 0, async function (done) { it('animateTest_1400', 0, async function (done) {
console.info('animateTest_1400 START'); console.info('animateTest_1400 START');
try { globalThis.value.message.notify({name:'curve', value:'abc'});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1004, eventId: 1004,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1400 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -482,28 +416,19 @@ export default function animateJsunit() { ...@@ -482,28 +416,19 @@ export default function animateJsunit() {
it('animateTest_1500', 0, async function (done) { it('animateTest_1500', 0, async function (done) {
console.info('animateTest_1500 START'); console.info('animateTest_1500 START');
try { globalThis.value.message.notify({name:'iteration', value:121});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1005, eventId: 1005,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1500 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
...@@ -518,35 +443,26 @@ export default function animateJsunit() { ...@@ -518,35 +443,26 @@ export default function animateJsunit() {
it('animateTest_1600', 0, async function (done) { it('animateTest_1600', 0, async function (done) {
console.info('animateTest_1600 START'); console.info('animateTest_1600 START');
try { globalThis.value.message.notify({name:'iteration', value:-5});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1006, eventId: 1006,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1600 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_1600 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_1600 END'); console.info('animateTest_1600 END');
done(); done();
...@@ -554,35 +470,27 @@ export default function animateJsunit() { ...@@ -554,35 +470,27 @@ export default function animateJsunit() {
it('animateTest_1700', 0, async function (done) { it('animateTest_1700', 0, async function (done) {
console.info('animateTest_1700 START'); console.info('animateTest_1700 START');
try { globalThis.value.message.notify({name:'tempo', value:"12121212121212"});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1007, eventId: 1007,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1700 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_1700 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_1700 END'); console.info('animateTest_1700 END');
done(); done();
...@@ -590,35 +498,26 @@ export default function animateJsunit() { ...@@ -590,35 +498,26 @@ export default function animateJsunit() {
it('animateTest_1800', 0, async function (done) { it('animateTest_1800', 0, async function (done) {
console.info('animateTest_1800 START'); console.info('animateTest_1800 START');
try { globalThis.value.message.notify({name:'tempo', value:"-5"});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1008, eventId: 1008,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1800 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_1800 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_1800 END'); console.info('animateTest_1800 END');
done(); done();
...@@ -626,35 +525,26 @@ export default function animateJsunit() { ...@@ -626,35 +525,26 @@ export default function animateJsunit() {
it('animateTest_1900', 0, async function (done) { it('animateTest_1900', 0, async function (done) {
console.info('animateTest_1900 START'); console.info('animateTest_1900 START');
try { globalThis.value.message.notify({name:'playmode', value:-6});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1009, eventId: 1009,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_1900 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_1900 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_1900 END'); console.info('animateTest_1900 END');
done(); done();
...@@ -662,35 +552,28 @@ export default function animateJsunit() { ...@@ -662,35 +552,28 @@ export default function animateJsunit() {
it('animateTest_2000', 0, async function (done) { it('animateTest_2000', 0, async function (done) {
console.info('animateTest_2000 START'); console.info('animateTest_2000 START');
try { globalThis.value.message.notify({name:'playmode', value:123456});
let eventData = { await CommonFunc.sleep(200);
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);
}
let indexEvent = { let indexEvent = {
eventId: 1010, eventId: 1010,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
let callback = (indexEvent) => { let callback = (indexEvent) => {
console.info("animateTest_2000 get state result is: " + JSON.stringify(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 { try {
events_emitter.on(indexEvent, callback); events_emitter.on(indexEvent, callback);
} catch (err) { } catch (err) {
console.info("animateTest_2000 on events_emitter err : " + JSON.stringify(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); await Utils.sleep(2000);
console.info('animateTest_2000 END'); console.info('animateTest_2000 END');
done(); done();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils.ets'; import Utils from './Utils.ets';
...@@ -23,7 +23,7 @@ export default function backgroundJsunit() { ...@@ -23,7 +23,7 @@ export default function backgroundJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("background beforeEach start"); console.info("background beforeEach start");
let options = { let options = {
uri: 'pages/general-properties/background', uri: 'MainAbility/pages/general-properties/background',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function badgeJsunit() { ...@@ -23,7 +23,7 @@ export default function badgeJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("badge beforeEach start"); console.info("badge beforeEach start");
let options = { let options = {
uri: 'pages/badge', uri: 'MainAbility/pages/badge',
} }
let result; let result;
try { try {
...@@ -52,67 +52,68 @@ export default function badgeJsunit() { ...@@ -52,67 +52,68 @@ export default function badgeJsunit() {
await Utils.sleep(1000); await Utils.sleep(1000);
let strJson = getInspectorByKey('badge'); let strJson = getInspectorByKey('badge');
let obj = JSON.parse(strJson); 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); let style = JSON.parse(obj.$attrs.style);
expect(obj.$type).assertEqual('Badge'); expect(obj.$type).assertEqual('Badge');
expect(style.fontSize).assertEqual('20.00fp'); expect(style.fontSize).assertEqual('20.00fp');
done(); done();
}); });
it('testBadge02', 0, async function (done) { it('testBadge03', 0, async function (done) {
console.info('[testBadge02] START'); console.info('[testBadge03] START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"fontSizeValue": "30", "fontSizeValue": -1,
} }
} }
var innerEvent = { var innerEvent = {
eventId: 63, eventId: 63,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
console.info("[testBadge02] start to publish emit"); console.info("[testBadge03] start to publish emit");
events_emitter.emit(innerEvent, eventData); events_emitter.emit(innerEvent, eventData);
} catch (err) { } catch (err) {
console.log("[testBadge02] change component data error: " + err.message); console.log("[testBadge03] change component data error: " + err.message);
} }
await Utils.sleep(2000); await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge'); let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew); let objNew = JSON.parse(strJsonNew);
console.info("[testBadge02] component objNew is: " + JSON.stringify(objNew));
let style = JSON.parse(objNew.$attrs.style); 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(); done();
}); });
it('testBadge03', 0, async function (done) { it('testBadge02', 0, async function (done) {
console.info('[testBadge03] START'); console.info('[testBadge02] START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"fontSizeValue": "-1", "fontSizeValue": "30",
} }
} }
var innerEvent = { var innerEvent = {
eventId: 63, eventId: 63,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
console.info("[testBadge03] start to publish emit"); console.info("[testBadge02] start to publish emit");
events_emitter.emit(innerEvent, eventData); events_emitter.emit(innerEvent, eventData);
} catch (err) { } catch (err) {
console.log("[testBadge03] change component data error: " + err.message); console.log("[testBadge02] change component data error: " + err.message);
} }
await Utils.sleep(2000); await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge'); let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew); 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); let style = JSON.parse(objNew.$attrs.style);
expect(style.fontSize).assertEqual('-1.00fp'); expect(style.fontSize).assertEqual('30.00fp');
done(); done();
}); });
it('testBadge04', 0, async function (done) { it('testBadge04', 0, async function (done) {
console.info('[testBadge04] START'); console.info('[testBadge04] START');
await Utils.sleep(1000); await Utils.sleep(1000);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function blankJsunit() { ...@@ -23,7 +23,7 @@ export default function blankJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("blank beforeEach start"); console.info("blank beforeEach start");
let options = { let options = {
uri: 'pages/blank', uri: 'MainAbility/pages/blank',
} }
let result; let result;
try { try {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function buttonJsunit() { ...@@ -23,7 +23,7 @@ export default function buttonJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("button beforeEach start"); console.info("button beforeEach start");
let options = { let options = {
uri: 'pages/button', uri: 'MainAbility/pages/button',
} }
let result; let result;
try { try {
...@@ -306,10 +306,15 @@ export default function buttonJsunit() { ...@@ -306,10 +306,15 @@ export default function buttonJsunit() {
let event = JSON.parse(eventData.data.event); 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.screenY));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX)); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX));
expect(event.screenX).assertEqual(185) try {
expect(event.screenY).assertEqual(485) expect(event.screenX).assertEqual(185)
expect(event.x).assertEqual(100) expect(event.screenY).assertEqual(533)
expect(event.y).assertEqual(50) expect(event.x).assertEqual(100)
expect(event.y).assertEqual(50)
} catch (err) {
console.info("[testButton12_] expection err : " + JSON.stringify(err));
expect().assertFail();
}
done(); done();
} }
var innerEvent = { var innerEvent = {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function canvas2Jsunit() { ...@@ -22,7 +22,7 @@ export default function canvas2Jsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("canvas beforeEach start"); console.info("canvas beforeEach start");
let options = { let options = {
uri: 'pages/canvas2', uri: 'MainAbility/pages/canvas2',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function canvasJsunit() { ...@@ -22,7 +22,7 @@ export default function canvasJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("canvas beforeEach start"); console.info("canvas beforeEach start");
let options = { let options = {
uri: 'pages/canvas', uri: 'MainAbility/pages/canvas',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function circleJsunit() { ...@@ -23,7 +23,7 @@ export default function circleJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("circle beforeEach start"); console.info("circle beforeEach start");
let options = { let options = {
uri: 'pages/circle', uri: 'MainAbility/pages/circle',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 display from '@ohos.display';
import Utils from './Utils'; import Utils from './Utils';
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function gridJsunit() { ...@@ -23,7 +23,7 @@ export default function gridJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach ===================grid test beforeEach called==================='); console.info('beforeEach ===================grid test beforeEach called===================');
let options = { let options = {
uri: 'pages/gridPage', uri: 'MainAbility/pages/gridPage',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function LineJsunit() { ...@@ -22,7 +22,7 @@ export default function LineJsunit() {
describe('LineTest', function () { describe('LineTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/line', uri: 'MainAbility/pages/line',
} }
try { try {
router.clear(); router.clear();
......
...@@ -54,7 +54,7 @@ export default function testsuite() { ...@@ -54,7 +54,7 @@ export default function testsuite() {
circleJsunit(); circleJsunit();
gridJsunit(); gridJsunit();
tapGesture(); tapGesture();
panGestureJsunit(); panGestureJsunit();
canvasJsunit(); canvasJsunit();
canvas2Jsunit(); canvas2Jsunit();
longPressGestureJsUnit(); longPressGestureJsUnit();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function longPressGestureJsunit() { ...@@ -23,7 +23,7 @@ export default function longPressGestureJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("longPressGesture beforeEach start"); console.info("longPressGesture beforeEach start");
let options = { let options = {
uri: 'pages/longPressGesture', uri: 'MainAbility/pages/longPressGesture',
} }
try { try {
router.clear(); router.clear();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -23,7 +23,7 @@ export default function motionPathJsunit() { ...@@ -23,7 +23,7 @@ export default function motionPathJsunit() {
describe('motionPathTest', function () { describe('motionPathTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/motionPath', uri: 'MainAbility/pages/motionPath',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -26,7 +26,7 @@ export default function PanGestureJsunit() { ...@@ -26,7 +26,7 @@ export default function PanGestureJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("PanGesture beforeEach start"); console.info("PanGesture beforeEach start");
let options = { let options = {
uri: 'pages/PanGesture', uri: 'MainAbility/pages/PanGesture',
} }
try { try {
router.clear(); router.clear();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -23,7 +23,7 @@ export default function parallelGestureJsunit() { ...@@ -23,7 +23,7 @@ export default function parallelGestureJsunit() {
describe('parallelGestureTest', function () { describe('parallelGestureTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/parallelGesture', uri: 'MainAbility/pages/parallelGesture',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function priorityGestureJsunit() { ...@@ -22,7 +22,7 @@ export default function priorityGestureJsunit() {
describe('priorityGestureTest', function () { describe('priorityGestureTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/priorityGesture', uri: 'MainAbility/pages/priorityGesture',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function progressJsunit() { ...@@ -22,7 +22,7 @@ export default function progressJsunit() {
describe('progressTest', function () { describe('progressTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/progress', uri: 'MainAbility/pages/progress',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function qrCodeJsunit() { ...@@ -22,7 +22,7 @@ export default function qrCodeJsunit() {
describe('qrCodeTest', function () { describe('qrCodeTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/QrCode', uri: 'MainAbility/pages/QrCode',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function ratingJsunit() { ...@@ -22,7 +22,7 @@ export default function ratingJsunit() {
describe('ratingTest', function () { describe('ratingTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/rating', uri: 'MainAbility/pages/rating',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -26,7 +26,7 @@ export default function ResponseRegionJsunit() { ...@@ -26,7 +26,7 @@ export default function ResponseRegionJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("ResponseRegion beforeEach start"); console.info("ResponseRegion beforeEach start");
let options = { let options = {
uri: 'pages/ResponseRegion', uri: 'MainAbility/pages/ResponseRegion',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function scrollCodeJsunit() { ...@@ -22,7 +22,7 @@ export default function scrollCodeJsunit() {
describe('scrollCodeTest', function () { describe('scrollCodeTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/scrollCode', uri: 'MainAbility/pages/scrollCode',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function shapeJsunit() { ...@@ -22,7 +22,7 @@ export default function shapeJsunit() {
describe('shapeTest', function () { describe('shapeTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/shape', uri: 'MainAbility/pages/shape',
} }
try { try {
router.clear(); router.clear();
...@@ -377,111 +377,112 @@ export default function shapeJsunit() { ...@@ -377,111 +377,112 @@ export default function shapeJsunit() {
expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter'); expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter');
done(); done();
}); });
it('shapeTest_1900', 0, async function (done) { it('shapeTest_2100', 0, async function (done) {
console.info('shapeTest_1900 START'); console.info('shapeTest_2100 START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"strokeMiterLimit": "5", "strokeMiterLimit": "-0.11111",
} }
} }
var innerEvent = { var innerEvent = {
eventId: 192, eventId: 192,
priority: events_emitter.EventPriority.LOW 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); events_emitter.emit(innerEvent, eventData);
} catch (err) { } 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); await Utils.sleep(2000);
var strJson = getInspectorByKey('shape'); var strJson = getInspectorByKey('shape');
var obj = JSON.parse(strJson); var obj = JSON.parse(strJson);
console.info("shapeTest_1900 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); console.info("shapeTest_2100 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit));
expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000'); expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000');
done(); done();
}); });
it('shapeTest_2000', 0, async function (done) { it('shapeTest_2200', 0, async function (done) {
console.info('shapeTest_2000 START'); console.info('shapeTest_1300 START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"strokeMiterLimit": "string", "strokeMiterLimit": 'aaa11111',
} }
} }
var innerEvent = { var innerEvent = {
eventId: 192, eventId: 192,
priority: events_emitter.EventPriority.LOW 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); events_emitter.emit(innerEvent, eventData);
} catch (err) { } 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); await Utils.sleep(2000);
var strJson = getInspectorByKey('shape'); var strJson = getInspectorByKey('shape');
var obj = JSON.parse(strJson); 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'); expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000');
done(); done();
}); });
it('shapeTest_2100', 0, async function (done) { it('shapeTest_1900', 0, async function (done) {
console.info('shapeTest_2100 START'); console.info('shapeTest_1900 START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"strokeMiterLimit": '-0.11111', "strokeMiterLimit": "5",
} }
} }
var innerEvent = { var innerEvent = {
eventId: 192, eventId: 192,
priority: events_emitter.EventPriority.LOW 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); events_emitter.emit(innerEvent, eventData);
} catch (err) { } 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); await Utils.sleep(2000);
var strJson = getInspectorByKey('shape'); var strJson = getInspectorByKey('shape');
var obj = JSON.parse(strJson); var obj = JSON.parse(strJson);
console.info("shapeTest_2100 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); console.info("shapeTest_1900 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit));
expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000');
done(); done();
}); });
it('shapeTest_2200', 0, async function (done) { it('shapeTest_2000', 0, async function (done) {
console.info('shapeTest_1300 START'); console.info('shapeTest_2000 START');
await Utils.sleep(1000); await Utils.sleep(1000);
try { try {
var eventData = { var eventData = {
data: { data: {
"strokeMiterLimit": 'aaa11111', "strokeMiterLimit": "string",
} }
} }
var innerEvent = { var innerEvent = {
eventId: 192, eventId: 192,
priority: events_emitter.EventPriority.LOW 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); events_emitter.emit(innerEvent, eventData);
} catch (err) { } 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); await Utils.sleep(2000);
var strJson = getInspectorByKey('shape'); var strJson = getInspectorByKey('shape');
var obj = JSON.parse(strJson); var obj = JSON.parse(strJson);
console.info("shapeTest_2200 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); console.info("shapeTest_2000 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit));
expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000');
done(); done();
}); });
it('shapeTest_2300', 0, async function (done) { it('shapeTest_2300', 0, async function (done) {
console.info('shapeTest_2300 START'); console.info('shapeTest_2300 START');
await Utils.sleep(1000); await Utils.sleep(1000);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function sharedTransitionJsunit() { ...@@ -23,7 +23,7 @@ export default function sharedTransitionJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("sharedTransition beforeEach start"); console.info("sharedTransition beforeEach start");
let options = { let options = {
uri: 'pages/sharedTransition', uri: 'MainAbility/pages/sharedTransition',
} }
try { try {
router.clear(); router.clear();
...@@ -92,16 +92,21 @@ export default function sharedTransitionJsunit() { ...@@ -92,16 +92,21 @@ export default function sharedTransitionJsunit() {
eventId: 194, eventId: 194,
priority: events_emitter.EventPriority.LOW priority: events_emitter.EventPriority.LOW
} }
console.info("sharedTransitionTest_0400 start to publish emit");
events_emitter.emit(indexEvent, eventData); events_emitter.emit(indexEvent, eventData);
await Utils.sleep(2500);
} catch (err) { } catch (err) {
console.log("sharedTransitionTest_0400 change component data error: " + err.message); console.log("sharedTransitionTest_0400 change component data error: " + err.message);
} }
let callback = (indexEventOne) => { let callback = (indexEventOne) => {
console.info("sharedTransitionTest_0400 get state result is: " + JSON.stringify(indexEventOne)); console.info("sharedTransitionTest_0400 get state result is: " + JSON.stringify(indexEventOne));
expect(indexEventOne.data.duration).assertEqual(2000); try {
expect(indexEventOne.data.delay).assertEqual(5); expect(indexEventOne.data.duration).assertEqual(2000);
expect(indexEventOne.data.type).assertEqual(SharedTransitionEffectType.Exchange); expect(indexEventOne.data.delay).assertEqual(5);
expect(indexEventOne.data.type).assertEqual(SharedTransitionEffectType.Exchange);
} catch(err) {
console.info("sharedTransitionTest_0400 error: " + err.message);
}
} }
let indexEventOne = { let indexEventOne = {
eventId: 193, eventId: 193,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -22,7 +22,7 @@ export default function spanJsunit() { ...@@ -22,7 +22,7 @@ export default function spanJsunit() {
describe('spanTest', function () { describe('spanTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/span', uri: 'MainAbility/pages/span',
} }
try { try {
router.clear(); router.clear();
...@@ -179,7 +179,7 @@ export default function spanJsunit() { ...@@ -179,7 +179,7 @@ export default function spanJsunit() {
console.info("[testSpan007] component strJson:" + strJson); console.info("[testSpan007] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testSpan007] textCase:" + obj); console.info("[testSpan007] textCase:" + obj);
expect(obj.$attrs.textCase).assertEqual('TextCase.Normal'); expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase');
done(); done();
}); });
...@@ -205,7 +205,7 @@ export default function spanJsunit() { ...@@ -205,7 +205,7 @@ export default function spanJsunit() {
console.info("[testSpan008] component strJson:" + strJson); console.info("[testSpan008] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testSpan008] fontColor:" + obj); console.info("[testSpan008] fontColor:" + obj);
expect(obj.$attrs.fontColor).assertEqual('#FF000000'); expect(obj.$attrs.fontColor).assertEqual('#FF000990');
done(); done();
}); });
...@@ -231,7 +231,7 @@ export default function spanJsunit() { ...@@ -231,7 +231,7 @@ export default function spanJsunit() {
console.info("[testSpan009] component strJson:" + strJson); console.info("[testSpan009] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testSpan009] fontColor:" + obj); console.info("[testSpan009] fontColor:" + obj);
expect(obj.$attrs.fontColor).assertEqual('#FF000000'); expect(obj.$attrs.fontColor).assertEqual('#FF000990');
done(); done();
}); });
}) })
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -23,7 +23,7 @@ export default function tabsJsunit() { ...@@ -23,7 +23,7 @@ export default function tabsJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("tabs beforeEach start"); console.info("tabs beforeEach start");
let options = { let options = {
uri: 'pages/tabs', uri: 'MainAbility/pages/tabs',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function longPressGestureJsunit() { ...@@ -23,7 +23,7 @@ export default function longPressGestureJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("tapGesture beforeEach start"); console.info("tapGesture beforeEach start");
let options = { let options = {
uri: 'pages/tapGesture', uri: 'MainAbility/pages/tapGesture',
} }
try { try {
router.clear(); router.clear();
......
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -13,7 +12,7 @@ ...@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +22,7 @@ export default function textJsunit() { ...@@ -23,7 +22,7 @@ export default function textJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("text beforeEach start"); console.info("text beforeEach start");
let options = { let options = {
uri: 'pages/text', uri: 'MainAbility/pages/text',
} }
try { try {
router.clear(); router.clear();
...@@ -63,13 +62,8 @@ export default function textJsunit() { ...@@ -63,13 +62,8 @@ export default function textJsunit() {
let strJson = getInspectorByKey('image'); let strJson = getInspectorByKey('image');
console.info("testText_0200 component strJson:" + strJson); console.info("testText_0200 component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("testText_0200 component obj is: " + JSON.stringify(obj)); console.info("testText_0200 component strJson:" + obj.$attrs.src);
var res = obj.$attrs.src.indexOf('RAWFILE/test.png'); expect(obj.$attrs.src).assertEqual('resource://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 END'); console.info('testText_0200 END');
done(); done();
}); });
...@@ -244,7 +238,7 @@ export default function textJsunit() { ...@@ -244,7 +238,7 @@ export default function textJsunit() {
let strJsonNew = getInspectorByKey('text'); let strJsonNew = getInspectorByKey('text');
let objNew = JSON.parse(strJsonNew); let objNew = JSON.parse(strJsonNew);
console.info("testText_1100 component objNew is: " + JSON.stringify(objNew.$attrs.fontColor)); 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'); console.info('testText_1100 END');
done(); done();
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import Utils from './Utils'; import Utils from './Utils';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
...@@ -22,7 +22,7 @@ export default function timeStampJsunit() { ...@@ -22,7 +22,7 @@ export default function timeStampJsunit() {
describe('timeStampTest', function () { describe('timeStampTest', function () {
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/timeStamp', uri: 'MainAbility/pages/timeStamp',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function ToggleJsunit() { ...@@ -23,7 +23,7 @@ export default function ToggleJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("toggle beforeEach start"); console.info("toggle beforeEach start");
let options = { let options = {
uri: 'pages/toggle', uri: 'MainAbility/pages/toggle',
} }
try { try {
router.clear(); router.clear();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import Utils from './Utils'; import Utils from './Utils';
...@@ -23,7 +23,7 @@ export default function transitionJsunit() { ...@@ -23,7 +23,7 @@ export default function transitionJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("text beforeEach start"); console.info("text beforeEach start");
let options = { let options = {
uri: 'pages/transition', uri: 'MainAbility/pages/transition',
} }
try { try {
router.clear(); router.clear();
......
{
"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
...@@ -27,6 +27,34 @@ ...@@ -27,6 +27,34 @@
{ {
"name":"message_arrive", "name":"message_arrive",
"value":"We will arrive at %s." "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
{
"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
{
"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
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -14,23 +14,30 @@ ...@@ -14,23 +14,30 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceDevTest") { ohos_js_hap_suite("ActsAceDevTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [ deps = [
":ace_ets_dev_assets", ":ace_ets_dev_assets",
":ace_ets_dev_resources", ":ace_ets_dev_resources"
":ace_ets_dev_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceDevTest" 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") { ohos_resources("ace_ets_dev_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_dev_app_profile" ]
hap_profile = "entry/src/main/module.json"
} }
{ {
"description": "Configuration for dev Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.open.harmony.acedevtest", "bundle-name": "com.open.harmony.acedevtest",
"package-name": "com.open.harmony.acedevtest", "module-name": "phone",
"shell-timeout": "600000" "shell-timeout": "600000"
}, },
"kits": [ "kits": [
......
{
"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
}
}
]
}
}
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;
}
}
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
// @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
/*
* 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
// @ts-nocheck /*
/** * Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at
* You may obtain a copy of the License at *
* * http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0 *
* * Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and * limitations under the License.
* limitations under the License. */
*/ import router from '@system.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' @Entry
import testsuite from '../test/List.test' @Component
struct Second {
export default { private content: string = "Second Page"
onCreate() {
console.info('Application onCreate') build() {
var abilityDelegator: any Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() Text(`${this.content}`)
var abilityDelegatorArguments: any .fontSize(50)
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() .fontWeight(FontWeight.Bold)
console.info('start run testcase!!!') Button() {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Text('back to index')
}, .fontSize(20)
onDestroy() { .fontWeight(FontWeight.Bold)
console.info('Application onDestroy') }.type(ButtonType.Capsule)
}, .margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
} }
\ No newline at end of file
/**
* 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
}
}
}
/**
* 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<string,Callback> = 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
/*
* 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
// @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
// @ts-nocheck /*
/** * Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined ...@@ -21,25 +20,25 @@ var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) { function translateParamsToString(parameters) {
const keySet = new Set([ 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 level', '-s testType', '-s size', '-s timeout',
'-s package' '-s dryRun'
]) ])
let targetParams = ''; let targetParams = '';
for (const key in parameters) { for (const key in parameters) {
if (keySet.has(key)) { if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key] targetParams = `${targetParams} ${key} ${parameters[key]}`
} }
} }
return targetParams.trim() return targetParams.trim()
} }
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); console.log("onAbilityCreateCallback");
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -47,22 +46,26 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') console.info("OpenHarmonyTestRunner OnPrepare ")
} }
onRun() { async onRun() {
console.log('OpenHarmonyTestRunner onRun run') console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) 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) cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd) console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -70,9 +73,6 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console.info('executeShellCommand : data : ' + d.stdResult); console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode); 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') console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
// @ts-nocheck // @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
import router from '@system.router'; 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' import Utils from './Utils.ets'
export default function CurveJsunit() { export default function CurveJsunit() {
...@@ -23,7 +23,7 @@ export default function CurveJsunit() { ...@@ -23,7 +23,7 @@ export default function CurveJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("flex beforeEach start"); console.info("flex beforeEach start");
let options = { let options = {
uri: 'pages/curve', uri: 'MainAbility/pages/curve',
} }
try { try {
router.clear(); router.clear();
......
{
"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"
]
}]
}]
}
}
...@@ -27,6 +27,34 @@ ...@@ -27,6 +27,34 @@
{ {
"name":"message_arrive", "name":"message_arrive",
"value":"We will arrive at %s." "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
{
"src": [
"MainAbility/pages/index/index",
"MainAbility/pages/second/second",
"MainAbility/pages/index",
"MainAbility/pages/curve"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册