未验证 提交 5e65592b 编写于 作者: O openharmony_ci 提交者: Gitee

!2382 add test

Merge pull request !2382 from jiyong/master
......@@ -19,10 +19,12 @@ group("fa") {
deps = [
"fa_applicationinfo_test:FaApplicationinfoTest",
"fa_clear_test:FaClearTest",
"fa_configurationconstant_test:FaConfigurationconstantTest",
"fa_coverapi_test:FaCoverapiTest",
"fa_equeryabilitybywant_test:FaEqueryabilitybywantTest",
"fa_lock_test:FaLockTest",
"fa_missionmanager_test:FaMissionmanagerTest",
"fa_movemissiontofront_test:FaMissionmanagerTest",
"fa_statelistener_test:FaStatelistenerTest",
"fa_taskmanager_test:FaTaskmanagerTest",
"fa_taskswiting_test:FaTaskswitingTest",
......
......@@ -20,8 +20,6 @@ export default {
onCreate() {
console.info("Application onCreate");
var uriList = [];
featureAbility.getWant((err,data) =>{
console.log("---data: " +JSON.stringify(data) )
console.log("---uri: " + data.uri)
......
......@@ -17,7 +17,7 @@
import {describe, expect, it} from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
import featureAbility from '@ohos.ability.featureability'
import formBindingData from '@ohos.application.formBindingData'
var getCallingBundleUri = {
events: ["uri"]
......@@ -30,6 +30,29 @@ var getCallingBundleType = {
describe("ApplicationInfoTest", function () {
var TAG = "";
/*
* @tc.number SUB_AA_OpenHarmony_FormBase_1000
* @tc.name Validate formbindingdata creation data
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_FormBase_1000', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_FormBase_1000-------------");
TAG = "SUB_AA_OpenHarmony_FormBase_1000";
var dataObj = {
temperature:"11c",
"time":"11:00",
"test":11,
"test3":true
}
var result = formBindingData.createFormBindingData(dataObj)
console.log(TAG + " result is : " + JSON.stringify(result))
expect(JSON.stringify(result)).
assertEqual(JSON.stringify({"data":"{\"temperature\":\"11c\",\"time\":\"11:00\",\"test\":11,\"test3\":true}"}));
done();
console.log("------------end SUB_AA_OpenHarmony_FormBase_1000-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_Want_0200
* @tc.name Switching the mission in the launcherlist to the foreground is not supported
......
# Copyright (c) 2020-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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("FaConfigurationconstantTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":fa_configurationconstant_test_assets",
":fa_configurationconstant_test_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FaConfigurationconstantTest"
}
ohos_js_assets("fa_configurationconstant_test_assets") {
source_dir = "./entry/src/main/js/MainAbility"
}
ohos_resources("fa_configurationconstant_test_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description" : "Configuration for hjunit demo Test",
"driver": {
"type" : "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.actsabilitydistributetest",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsAbilityDistributeTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
apply plugin: 'com.huawei.ohos.hap'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 8
defaultConfig {
compatibleSdkVersion 7
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
testImplementation 'junit:junit:4.13.1'
}
# config module specific ProGuard rules here.
\ No newline at end of file
{
"app": {
"bundleName": "com.example.jsmyapplication",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.jsmyapplication",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"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": "js",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.UPDATE_CONFIGURATION",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
}
]
}
}
\ 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.
*/
export default {
onCreate() {
console.info("Application onCreate 1");
},
onDestroy() {
console.info("Application onDestroy 1");
}
};
{
"strings": {
"hello": "您好 1 js",
"world": "世界 1 js",
"page": "第二页 1",
"next": "下一页 1",
"back": "返回 1"
},
"Files": {
}
}
\ 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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
// @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 router from '@system.router'
import {Core} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow(){
const core = Core.getInstance()
core.init();
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test');
core.execute();
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
}
}
<!--
* 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.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
// @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 router from '@system.router'
export default {
data: {
title: 'World'
},
onclick: function () {
router.replace({
uri: "pages/index/index"
})
}
}
// @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 {describe, expect, it} from 'deccjsunit/index'
import ConfigurationConstant from '@ohos.application.ConfigurationConstant'
describe("ConfigurationTest", function () {
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT).assertEqual(1);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_DARK"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_DARK).assertEqual(0);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET).assertEqual(-1);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_VERTICAL"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------");
expect(ConfigurationConstant.Direction.DIRECTION_VERTICAL).assertEqual(0);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_HORIZONTAL"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------");
expect(ConfigurationConstant.Direction.DIRECTION_HORIZONTAL).assertEqual(1);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_NOT_SET"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------");
expect(ConfigurationConstant.Direction.DIRECTION_NOT_SET).assertEqual(-1);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI).assertEqual(120);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI).assertEqual(160);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI).assertEqual(240);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI).assertEqual(320);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI).assertEqual(480);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI).assertEqual(640);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------");
});
/*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET"
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET).assertEqual(0);
done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------");
});
})
\ 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.
*/
require('./JSMyapplicationJsunit.test.js');
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "JS_Empty Ability"
},
{
"name": "description_mainability2",
"value": "JS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
}
]
}
\ No newline at end of file
apply plugin: 'com.huawei.ohos.hap'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 8
defaultConfig {
compatibleSdkVersion 8
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
testImplementation 'junit:junit:4.13.1'
}
# config module specific ProGuard rules here.
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"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": "js",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
{
"app": {
"bundleName": "com.example.lock",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.lock",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"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": "js",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"srcPath": "Ability2",
"name": ".Ability2",
"srcLanguage": "js",
"icon": "$media:icon",
"description": "$string:description_ability2",
"formsEnabled": false,
"label": "$string:entry_Ability2",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"srcPath": "Ability1",
"name": ".Ability1",
"srcLanguage": "js",
"icon": "$media:icon",
"description": "$string:description_ability1",
"formsEnabled": false,
"label": "$string:entry_Ability1",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"srcPath": "Ability3",
"name": ".Ability3",
"srcLanguage": "js",
"icon": "$media:icon",
"description": "$string:description_ability3",
"formsEnabled": false,
"label": "$string:entry_Ability3",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"srcPath": "Ability4",
"name": ".Ability4",
"srcLanguage": "js",
"icon": "$media:icon",
"description": "$string:description_ability4",
"formsEnabled": false,
"label": "$string:entry_Ability4",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".Ability2",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".Ability1",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".Ability3",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".Ability4",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.MANAGE_MISSIONS"
},
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.REMOVE_CACHE_FILES",
"reason": "need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE"
}
]
}
}
\ 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 commonEvent from '@ohos.commonEvent';
export default {
onCreate() {
console.info("Application onCreate");
commonEvent.publish("Ability1_onCreate", () => {
console.log("Ability1_onCreate Publish success");
});
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}{{"Ability1"}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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 commonEvent from '@ohos.commonEvent';
import router from '@system.router'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
},
onShow(){
console.info('Ability1 onShow');
commonEvent.publish("Ability1_onShow", () => {
console.log("Ability1_onShow Publish success");
});
},
onHide(){
console.info('Ability1 onHide');
commonEvent.publish("Ability1_onHide", () => {
console.log("Ability1_onHide Publish success");
});
}
}
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
/*
* 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 router from '@system.router'
export default {
data: {
title: 'World'
},
onclick: function () {
router.replace({
uri: "pages/index/index"
})
}
}
/*
* 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 commonEvent from '@ohos.commonEvent';
export default {
onCreate() {
console.info("Application2 onCreate");
commonEvent.publish("Ability2_onCreate", () => {
console.log("Ability2_onCreate Publish success");
});
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}{{"Ability2"}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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 commonEvent from '@ohos.commonEvent';
import router from '@system.router'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
},
onShow(){
console.info('Ability2 onShow');
commonEvent.publish("Ability2_onShow", () => {
console.log("Ability2_onShow Publish success");
});
},
onHide(){
console.info('Ability2 onHide');
commonEvent.publish("Ability2_onHide", () => {
console.log("Ability2_onHide Publish success");
});
}
}
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
/*
* 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 router from '@system.router'
export default {
data: {
title: 'World'
},
onclick: function () {
router.replace({
uri: "pages/index/index"
})
}
}
/*
* 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 commonEvent from '@ohos.commonEvent';
export default {
onCreate() {
console.info("Application3 onCreate");
commonEvent.publish("Ability3_onCreate", () => {
console.log("Ability3_onCreate Publish success");
});
},
onDestroy() {
console.info("Application3 onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }} {{"Ability3"}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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 commonEvent from '@ohos.commonEvent';
import router from '@system.router'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
},
onShow(){
console.info('Ability3 onShow');
commonEvent.publish("Ability3_onShow", () => {
console.log("Ability3_onShow Publish success");
});
},
onHide(){
console.info('Ability3 onHide');
commonEvent.publish("Ability3_onHide", () => {
console.log("Ability3_onHide Publish success");
});
}
}
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
/*
* 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 router from '@system.router'
export default {
data: {
title: 'World'
},
onclick: function () {
router.replace({
uri: "pages/index/index"
})
}
}
/*
* 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 commonEvent from '@ohos.commonEvent';
export default {
onCreate() {
console.info("Application onCreate");
commonEvent.publish("Ability4_onCreate", () => {
console.log("Ability4_onCreate Publish success");
});
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }} {{"Ability4"}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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 commonEvent from '@ohos.commonEvent';
import router from '@system.router'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
},
onShow(){
console.info('Ability4 onShow');
commonEvent.publish("Ability4_onShow", () => {
console.log("Ability4_onShow Publish success");
});
}
}
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
/*
* 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 router from '@system.router'
export default {
data: {
title: 'World'
},
onclick: function () {
router.replace({
uri: "pages/index/index"
})
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
console.info("Application MainAbility onDestroy");
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
......
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
......@@ -12,6 +12,7 @@ http://www.apache.org/licenses/LICENSE-2.0
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
......
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -13,29 +13,31 @@
* limitations under the License.
*/
import app from '@system.app'
import file from '@system.file'
import {Core} from 'deccjsunit/index'
import router from '@system.router';
import {Core} from 'deccjsunit/index';
export default {
data: {title: ""},
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world1111');
this.title = this.$t('strings.world');
},
onclick: function () {
router.replace({
uri: "pages/second/second"
})
},
onShow() {
console.info('onShow finish1')
console.info('onShow start')
const core = Core.getInstance()
console.info('onShow finish2')
core.init()
console.info('onShow finish3')
const configService = core.getDefaultService('config')
console.info('onShow finish4')
configService.setConfig(this)
console.info('onShow finish5')
require('../../../test/List.test')
core.execute()
}
}
\ 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
......
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
......@@ -12,6 +12,7 @@ http://www.apache.org/licenses/LICENSE-2.0
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ $t('strings.page') }}
......
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
export default {
......
......@@ -12,4 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./LockMission.test.js');
//require('./Lock0200Test.js');
require('./LockNew.js');
require('./LockMission.test.js');
\ 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -14,11 +14,10 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import featureAbility from '@ohos.ability.featureAbility';
import missionManager from "@ohos.application.missionManager";
describe('missionManager', function () {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1500-------------------");
console.info("----------------logMessage SUB_AA_OpenHarmony_Lock-------------------");
/*
* @tc.number SUB_AA_OpenHarmony_Lock_1500
......@@ -27,10 +26,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_1500', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1500-------------------")
console.info("-------------logMessage SUB_AA_OpenHarmony_Lock_1500---------")
missionManager.lockMission(-1, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_1500 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_1500 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -47,9 +46,11 @@ describe('missionManager', function () {
var missionId = 0.2;
setTimeout(() => {
missionManager.lockMission(missionId).then((data) => {
console.log("SUB_AA_OpenHarmony_Lock_1800 lockMission data: " + JSON.stringify(data));
console.log("SUB_AA_OpenHarmony_Lock_1800 lockMission data: " +
JSON.stringify(data));
}).catch((error) => {
console.log("SUB_AA_OpenHarmony_Lock_1800 lockMission error: " + JSON.stringify(error));
console.log("SUB_AA_OpenHarmony_Lock_1800 lockMission error: " +
JSON.stringify(error));
expect(error.code != 0).assertTrue();
done();
})
......@@ -66,8 +67,8 @@ describe('missionManager', function () {
it('SUB_AA_OpenHarmony_Lock_1900', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1900-------------------")
missionManager.lockMission(1.2, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_1900 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_1900 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data == undefined).assertTrue();
done();
})
......@@ -80,10 +81,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_1700', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1700-------------------")
console.info("------------logMessage SUB_AA_OpenHarmony_Lock_1700-----------")
missionManager.lockMission("A", (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_1700 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_1700 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -96,10 +97,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_1600', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1600-------------------")
console.info("---------------logMessage SUB_AA_OpenHarmony_Lock_1600------------")
missionManager.lockMission("12", (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_1600 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_1600 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -112,10 +113,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_1400', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_1400-------------------")
console.info("---------------logMessage SUB_AA_OpenHarmony_Lock_1400-------------")
missionManager.lockMission(undefined, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_1400 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_1400 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -128,10 +129,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2200', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2200-------------------")
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2200-------------")
missionManager.unlockMission(-1, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_2200 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_2200 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -144,10 +145,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2500', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2500-------------------")
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2500--------------")
missionManager.unlockMission(0.2, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_2500 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_2500 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -160,10 +161,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2400', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2400-------------------")
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2400-----------")
missionManager.unlockMission("a", (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_2400 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_2400 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -176,10 +177,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2300', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2300-------------------")
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2300--------------")
missionManager.unlockMission("123", (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_2300 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_2300 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -192,10 +193,10 @@ describe('missionManager', function () {
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2100', 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2100-------------------")
console.info("------------------logMessage SUB_AA_OpenHarmony_Lock_2100--------------")
missionManager.unlockMission(undefined, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_2100 AsyncCallback errCode : '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_Lock_2100 AsyncCallback errCode : ' +
JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
})
......@@ -212,14 +213,57 @@ describe('missionManager', function () {
var missionId = 1.2;
setTimeout(() => {
missionManager.unlockMission(missionId).then((data) => {
console.log("SUB_AA_OpenHarmony_Lock_2600 unlockMission data: " + JSON.stringify(data));
console.log("SUB_AA_OpenHarmony_Lock_2600 unlockMission data: " +
JSON.stringify(data));
}).catch((error) => {
console.log("SUB_AA_OpenHarmony_Lock_2600 unlockMission error: " + JSON.stringify(error));
console.log("SUB_AA_OpenHarmony_Lock_2600 unlockMission error: " +
JSON.stringify(error));
expect(error.code != 0).assertTrue();
done();
})
}, 1000)
console.log("------------end SUB_AA_OpenHarmony_Lock_2600-------------");
})
/*
* @tc.number SUB_AA_OpenHarmony_Lock_2000
* @tc.name Repeat lock
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2000',0,async function (done){
console.log("------------start SUB_AA_OpenHarmony_Lock_2000-------------");
for(var i=0;i<2;i++){
missionManager.lockMission(1.2, (error, data) => {
console.log("SUB_AA_OpenHarmony_Lock_0900, twosgetMissionInfos:" +
JSON.stringify(error) + ", " + JSON.stringify(data));
expect(data == undefined).assertTrue();
})
}
done();
})
/*
* @tc.number SUB_AA_OpenHarmony_Lock_2700
* @tc.name Repeat unlock
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_AA_OpenHarmony_Lock_2700',0,async function (done){
var missionId = 1.2
console.log("------------start SUB_AA_OpenHarmony_Lock_2700-------------");
missionManager.lockMission(missionId, (error, data) => {
console.log("lockMission info" + JSON.stringify(data));
})
missionManager.unlockMission(missionId,(error, data) => {
for(var i=0;i<2;i++){
missionManager.unlockMission(missionId,(error, data1) => {
console.log("unlockMission info" + JSON.stringify(data1));
expect(data1 == undefined);
})
}
})
done();
})
})
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index";
import missionManager from '@ohos.application.missionManager';
import abilityFeatureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var START_ABILITY_TIMEOUT = 5000;
describe('LockTest', function () {
console.log("LockTest --- start");
var missionArray = [];
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
/**
* @tc.number: SUB_AA_OpenHarmony_Lock_0400
* @tc.name: wantConstant : Check specific enum
* @tc.desc: Check the return type of the interface (by Promise)
*/
it('SUB_AA_OpenHarmony_Lock_0700', 0, async function (done) {
console.info('=======SUB_AA_OpenHarmony_Lock_0700 step1 start=====startActivity=====');
abilityFeatureAbility.startAbility({ want: {
bundleName: "com.example.lock",
abilityName: "com.example.lock.Ability1"
} })
.then((data) => {
console.info('SUB_AA_OpenHarmony_Lock_0300 startAbility1: ' +
JSON.stringify(data));
console.info('SUB_AA_OpenHarmony_Lock_0300 - startAbility2 start: ')
abilityFeatureAbility.startAbility({ "want": {
bundleName: "com.example.lock",
abilityName: "com.example.lock.Ability2"
} }, (error, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0300 - startAbility2: ' +
JSON.stringify(error) + ", " + JSON.stringify(data))
console.info('SUB_AA_OpenHarmony_Lock_0300 - startAbility3 start');
abilityFeatureAbility.startAbility({ "want": {
bundleName: "com.example.lock",
abilityName: "com.example.lock.Ability3"
} }, (error, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0300 - startAbility3: ' +
JSON.stringify(error) + ", " + JSON.stringify(data))
console.info('SUB_AA_OpenHarmony_Lock_0300 - startAbility4 start');
abilityFeatureAbility.startAbility({ "want": {
bundleName: "com.example.lock",
abilityName: "com.example.lock.Ability4"
} }, (error, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0300 - startAbility4: ' +
JSON.stringify(error) + ", " + JSON.stringify(data))
getMissionInfosOne();
});
});
});
}).catch((error) => {
console.error('SUB_AA_OpenHarmony_Lock_0700 startAbility1 error ' +
JSON.stringify(error));
})
setTimeout(() => {
done();
}, 5000);
})
function getMissionInfosOne() {
console.log('=======SUB_AA_OpenHarmony_Lock_0700 step2 start==========getMissionInfos=====');
missionArray = [];
missionManager.getMissionInfos('', 500, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0700 getMissionInfo err: '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
var i;
for (i = 0; i < data.length; i++) {
console.log("getMissionInfos return1 " + JSON.stringify(data[i]));
if (data[i].want.abilityName == 'com.example.lock.Ability1' &&
data[i].runningState == 0) {
missionArray[0] = new Object();
missionArray[0].id = data[i].missionId;
missionArray[0].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability2' &&
data[i].runningState == 0) {
missionArray[1] = new Object();
missionArray[1].id = data[i].missionId;
missionArray[1].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability3' &&
data[i].runningState == 0) {
missionArray[2] = new Object();
missionArray[2].id = data[i].missionId;
missionArray[2].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability4' &&
data[i].runningState == 0) {
missionArray[3] = new Object();
missionArray[3].id = data[i].missionId;
missionArray[3].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.MainAbility' &&
data[i].runningState == 0) {
missionArray[4] = new Object();
missionArray[4].id = data[i].missionId;
missionArray[4].name = data[i].want.abilityName;
}
}
console.log("###" + JSON.stringify(missionArray));
expect(missionArray.length == 5).assertTrue();
lockMissionMy();
})
}
function lockMissionMy() {
console.log('===============SUB_AA_OpenHarmony_Lock_0700 step3 start=====lockMission======');
console.log('SUB_AA_OpenHarmony_Lock_0700 missionArray' + JSON.stringify(missionArray));
var i;
var j = 0;
for (i = 0; i < missionArray.length; i++) {
if (missionArray[i].name == 'com.example.lock.Ability1' || missionArray[i].name ==
'com.example.lock.Ability4'|| missionArray[i].name == 'com.example.lock.MainAbility') {
console.log('SUB_AA_OpenHarmony_Lock_0700 j===' + j);
console.log('SUB_AA_OpenHarmony_Lock_0700 ' + JSON.stringify(missionArray[i].id));
missionManager.lockMission(missionArray[i].id, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0700 lockMission err:'
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data == undefined).assertTrue();
j++;
if (j == 3) {
getMissionInfosTest();
//clearAllMission();
}
})
}
}
}
function unlockMissionTest() {
console.log('===============SUB_AA_OpenHarmony_Lock_0700 step6 start=====unLockMission======');
console.log("unlockMissionMy start " + JSON.stringify(missionArray));
missionManager.unlockMission(missionArray[1].id, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0700 unlockMission err:'
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data == undefined).assertTrue();
});
}
function getMissionInfosTest(){
console.log('==========SUB_AA_OpenHarmony_Lock_0700 step5 start=====getMissionInfosTest======');
missionArray = []
missionManager.getMissionInfos('', 500, (err, data) => {
console.log('getMissionInfosTwo getMissionInfos4 err: '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
var i;
for (i = 0; i < data.length; i++) {
console.log("getMissionInfos return1 " + JSON.stringify(data[i]));
if (data[i].want.abilityName == 'com.example.lock.Ability1' &&
data[i].runningState == 0) {
expect(data[i].lockedState == true).assertTrue();
expect(data[i].timestamp != 0).assertTrue();
expect(data[i].label).assertEquals("$string:entry_MainAbility");
missionArray[0] = new Object();
missionArray[0].id = data[i].missionId;
missionArray[0].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability4' &&
data[i].runningState == 0) {
expect(data[i].lockedState == true).assertTrue();
expect(data[i].timestamp != 0).assertTrue();
expect(data[i].label).assertEquals("$string:entry_MainAbility");
missionArray[1] = new Object();
missionArray[1].id = data[i].missionId;
missionArray[1].name = data[i].want.abilityName;
}
}
console.log("###" + JSON.stringify(missionArray));
console.log("###" + JSON.stringify(missionArray.length));
expect(missionArray.length == 2).assertTrue();
unlockMissionTest();
})
}
function clearAllMission(done) {
console.log('==========SUB_AA_OpenHarmony_Lock_0700 step4 start=====clearAllMissions======');
missionManager.clearAllMissions((err, data) => {
console.log('getMissionInfosTwo clearAllMission err: '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
getMissionInfosTwo();
});
}
function getMissionInfosTwo(done) {
console.log('==========SUB_AA_OpenHarmony_Lock_0700 step5 start=====getMissionInfos======');
missionArray = []
missionManager.getMissionInfos('', 500, (err, data) => {
console.log('getMissionInfosTwo getMissionInfo err: '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
var i;
for (i = 0; i < data.length; i++) {
console.log("getMissionInfos return1 " + JSON.stringify(data[i]));
if (data[i].want.abilityName == 'com.example.lock.Ability1' &&
data[i].runningState == 0) {
expect(data[i].lockedState == true).assertTrue();
missionArray[0] = new Object();
missionArray[0].id = data[i].missionId;
missionArray[0].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability2') {
expect().assertFail();
}
if (data[i].want.abilityName == 'com.example.lock.Ability3' &&
data[i].runningState == 0) {
expect().assertFail();
}
if (data[i].want.abilityName == 'com.example.lock.Ability4' &&
data[i].runningState == 0) {
expect(data[i].lockedState == true).assertTrue();
missionArray[1] = new Object();
missionArray[1].id = data[i].missionId;
missionArray[1].name = data[i].want.abilityName;
}
}
console.log("###" + JSON.stringify(missionArray));
console.log("###" + JSON.stringify(missionArray.length));
done();
expect(missionArray.length == 2).assertTrue();
//unlockMissionMy();
})
}
function unlockMissionMy() {
console.log('===========SUB_AA_OpenHarmony_Lock_0700 step6 start=====unLockMission======');
console.log("unlockMissionMy start " + JSON.stringify(missionArray));
missionManager.unlockMission(missionArray[1].id, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0700 unlockMission err:'
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data == undefined).assertTrue();
clearAllMission2();
});
}
function clearAllMission2(done) {
console.log('===========SUB_AA_OpenHarmony_Lock_0700 step7 start=====clearAllMissions======');
var myEvents = {
events:
[
"Ability1_onShow",
"Ability4_onDestroy"
]
};
var Subscriber;
let id;
var data = [];
function SubscribeCallBack(err, data) {
console.debug("beforeAll====>Subscribe CallBack data:====>" + JSON.stringify(data));
switch (data.event) {
case "Ability1_onShow":
console.log("Ability1_onShow");
data[0] = "Ability1_onCreate";
break;
case "Ability4_onDestroy":
console.log("Ability4_onDestroy");
data[1] = "Ability2_onCreate";
break;
default:
}
if (data.length == 2) {
clearTimeout(id);
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
};
commonEvent.createSubscriber(myEvents).then(async (data) => {
console.debug("SUB_AA_OpenHarmony_Lock_0400====>Create Subscriber====>");
Subscriber = data;
console.log("SUB_AA_OpenHarmony_Lock_0700 Subscriber " + JSON.stringify(Subscriber));
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
done();
});
function UnSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('SUB_AA_OpenHarmony_Lock_0700=====timeout======');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
missionManager.clearAllMissions();
sleep(500);
getMissionInfosThree();
}
function getMissionInfosThree(done) {
console.log('===========SUB_AA_OpenHarmony_Lock_0700 step8 start=====getMissonInfos======');
missionArray = [];
missionManager.getMissionInfos('', 500, (err, data) => {
console.log('getMissionInfosThree getMissionInfo err: '
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
var i;
for (i = 0; i < data.length; i++) {
console.log("getMissionInfos return1 " + JSON.stringify(data[i]));
if (data[i].want.abilityName == 'com.example.lock.Ability1' &&
data[i].runningState == 0) {
expect(data[i].lockedState == true).assertTrue();
missionArray[0] = new Object();
missionArray[0].id = data[i].missionId;
missionArray[0].name = data[i].want.abilityName;
}
if (data[i].want.abilityName == 'com.example.lock.Ability2') {
expect().assertFail();
done();
}
if (data[i].want.abilityName == 'com.example.lock.Ability3' &&
data[i].runningState == 0) {
expect().assertFail();
done();
}
if (data[i].want.abilityName == 'com.example.lock.Ability4' &&
data[i].runningState == 0) {
expect().assertFail();
done();
}
}
console.log("###" + JSON.stringify(missionArray));
expect(missionArray.length == 1).assertTrue();
console.log('===============SUB_AA_OpenHarmony_Lock_0700 step9 start===========');
console.info('LockTest TearDown: ' + JSON.stringify(missionArray));
var i;
for (i = 0; i < missionArray.length; i++) {
missionManager.unlockMission(missionArray[i].id, (err, data) => {
console.log('SUB_AA_OpenHarmony_Lock_0700 unlockMission err:'
+ JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data == undefined).assertTrue();
missionManager.clearAllMissions();
if (i == missionArray.length) {
console.info('LockTest - myTearDown: done');
missionManager.clearAllMissions();
done();
}
console.info('LockTest - myTearDown%%: i' + i);
console.info('LockTest - myTearDown%%: length' + missionArray.length);
});
}
})
}
}
)
......@@ -9,36 +9,36 @@
"value": "JS_Empty Ability"
},
{
"name": "description_ability1",
"value": "hap sample empty service"
"name": "description_ability2",
"value": "JS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
"name": "entry_Ability2",
"value": "entry_Ability2"
},
{
"name": "description_mainability2",
"name": "description_ability1",
"value": "JS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
"name": "entry_Ability1",
"value": "entry_Ability1"
},
{
"name": "description_mainability3",
"name": "description_ability3",
"value": "JS_Empty Ability"
},
{
"name": "entry_MainAbility3",
"value": "entry_MainAbility3"
"name": "entry_Ability3",
"value": "entry_Ability3"
},
{
"name": "description_mainability1",
"name": "description_ability4",
"value": "JS_Empty Ability"
},
{
"name": "entry_MainAbility1",
"value": "entry_MainAbility1"
"name": "entry_Ability4",
"value": "entry_Ability4"
}
]
}
\ No newline at end of file
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册