From 9ba56df732f8da4e018cc9cb433450cca4f62d92 Mon Sep 17 00:00:00 2001 From: jy Date: Mon, 14 Mar 2022 19:37:04 +0800 Subject: [PATCH] add configuration test Signed-off-by: jy --- .../entry/src/main/config.json | 87 +++- .../entry/src/main/js/MainAbility/app.js | 25 +- .../src/main/js/MainAbility/i18n/zh-CN.json | 10 +- .../main/js/MainAbility/pages/index/index.hml | 26 +- .../main/js/MainAbility/pages/index/index.js | 46 ++- .../js/MainAbility/pages/second/second.hml | 26 +- .../js/MainAbility/pages/second/second.js | 1 - .../entry/src/main/js/MainAbility2/app.js | 47 +++ .../src/main/js/MainAbility2/i18n/en-US.json | 11 + .../src/main/js/MainAbility2/i18n/zh-CN.json | 11 + .../js/MainAbility2/pages/index/index.css | 38 ++ .../js/MainAbility2/pages/index/index.hml | 20 + .../main/js/MainAbility2/pages/index/index.js | 59 +++ .../js/MainAbility2/pages/second/second.css | 38 ++ .../js/MainAbility2/pages/second/second.hml | 20 + .../js/MainAbility2/pages/second/second.js | 26 ++ .../entry/src/main/js/MainAbility3/app.js | 40 ++ .../src/main/js/MainAbility3/i18n/en-US.json | 11 + .../src/main/js/MainAbility3/i18n/zh-CN.json | 11 + .../js/MainAbility3/pages/index/index.css | 38 ++ .../js/MainAbility3/pages/index/index.hml | 20 + .../main/js/MainAbility3/pages/index/index.js | 55 +++ .../js/MainAbility3/pages/second/second.css | 38 ++ .../js/MainAbility3/pages/second/second.hml | 20 + .../js/MainAbility3/pages/second/second.js | 26 ++ .../entry/src/main/js/MainAbility4/app.js | 29 ++ .../src/main/js/MainAbility4/i18n/en-US.json | 11 + .../src/main/js/MainAbility4/i18n/zh-CN.json | 11 + .../js/MainAbility4/pages/index/index.css | 38 ++ .../js/MainAbility4/pages/index/index.hml | 20 + .../main/js/MainAbility4/pages/index/index.js | 56 +++ .../js/MainAbility4/pages/second/second.css | 38 ++ .../js/MainAbility4/pages/second/second.hml | 20 + .../js/MainAbility4/pages/second/second.js | 26 ++ .../src/main/js/test/AbilityDisableTest.js | 386 ++++++++++++++++++ .../entry/src/main/js/test/ClearTest.js | 112 +++++ .../js/test/JSMyapplicationJsunit.test.js | 191 --------- .../entry/src/main/js/test/List.test.js | 6 +- .../main/resources/base/element/string.json | 20 + 39 files changed, 1470 insertions(+), 244 deletions(-) create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/en-US.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/zh-CN.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/en-US.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/zh-CN.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/app.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/en-US.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/zh-CN.json create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.css create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.hml create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js create mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js delete mode 100644 aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/JSMyapplicationJsunit.test.js diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/config.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/config.json index d2f4b1957..28902fb2a 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/config.json +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.jsmyapplication", + "bundleName": "com.example.abilitydisable", "vendor": "example", "version": { "code": 1000000, @@ -9,7 +9,7 @@ }, "deviceConfig": {}, "module": { - "package": "com.example.jsmyapplication", + "package": "com.example.abilitydisable", "name": ".MyApplication", "mainAbility": ".MainAbility", "srcPath": "", @@ -45,6 +45,42 @@ "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" + }, + { + "orientation": "unspecified", + "srcPath": "MainAbility2", + "name": ".MainAbility2", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:description_mainability2", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "srcPath": "MainAbility3", + "name": ".MainAbility3", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:description_mainability3", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "srcPath": "MainAbility4", + "name": ".MainAbility4", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:description_mainability4", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" } ], "js": [ @@ -58,15 +94,56 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index", + "pages/second/second" + ], + "name": ".MainAbility2", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index", + "pages/second/second" + ], + "name": ".MainAbility3", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index", + "pages/second/second" + ], + "name": ".MainAbility4", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } ], "reqPermissions": [ { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "need use ohos.permission.INSTALL_BUNDLE" + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.MANAGE_MISSIONS" }, { - "name": "ohos.permission.UPDATE_CONFIGURATION", + "name": "ohos.permission.GET_BUNDLE_INFO", "reason": "need use ohos.permission.INSTALL_BUNDLE" } ] diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js index a8f63230f..4b5e8faf1 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/app.js @@ -1,4 +1,3 @@ -// @ts-nocheck /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,12 +12,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import commonEvent from '@ohos.commonEvent'; +import ability_featureAbility from '@ohos.ability.featureAbility'; export default { onCreate() { - console.info("Application onCreate 1"); + commonEvent.publish("ApplicationMainAbility1_onCreate",()=>{ + console.log("ApplicationMainAbility1_onCreate publish callBack ApplicationMainAbility1_onCreate"); + }); + setTimeout(()=>{ + ability_featureAbility.terminateSelf().then((data)=>{ + console.log("ApplicationMainAbility2 terminateSelf data:" + JSON.stringify(data) ) + }).catch((error)=>{ + console.log("ApplicationMainAbility2 terminateSelf error:" + JSON.stringify(error) ) + }) + },3000) + + console.info("Application onCreate"); }, onDestroy() { - console.info("Application onDestroy 1"); - + console.info("Application onDestroy"); +// commonEvent.publish("ApplicationMainAbility1_onDestroy",()=>{ +// console.log("ApplicationMainAbility1_onDestroy publish callBack ApplicationMainAbility1_onDestroy"); +// }); + }, + onForgeGround(){ + console.info("Application onForgeGround"); } }; diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/i18n/zh-CN.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/i18n/zh-CN.json index 195f303be..3dd53b3a8 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/i18n/zh-CN.json +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -1,10 +1,10 @@ { "strings": { - "hello": "您好 1 js", - "world": "世界 1 js", - "page": "第二页 1", - "next": "下一页 1", - "back": "返回 1" + "hello": "您好", + "world": "世界", + "page": "第二页", + "next": "下一页", + "back": "返回" }, "Files": { } diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.hml index 534abd5a9..9c27d02f6 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.hml +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.hml @@ -1,17 +1,17 @@ + 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. +-->
{{ $t('strings.hello') }} {{ title }} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.js index 7d7c4a74c..56e613e12 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.js +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/index/index.js @@ -1,4 +1,3 @@ -// @ts-nocheck /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,27 +12,54 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import commonEvent from '@ohos.commonEvent'; 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(); + this.title = 'yingyong1'; }, onclick: function () { router.replace({ uri: "pages/second/second" }) + }, + onShow() { + console.log("singletonEntryAbulity1_onShow") + commonEvent.publish("singletonEntryAbulity1_onShow",()=>{ + console.log("singletonEntryAbulity1_onHide publish callBack singletonEntryAbulity1_onHide"); + }); + const core = Core.getInstance() + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + console.info('onShow ') + require('../../../test/List.test') + console.info('onShow start5') + core.execute() + }, + onHide(){ + console.log("singletonEntryAbulity_onHide") + commonEvent.publish("singletonEntryAbulity1_onHide",()=>{ + console.log("singletonEntryAbulity1_onHide publish callBack singletonEntryAbulity1_onHide"); + }); + }, + onActive(){ + console.log("singletonEntryAbulity_onActive") + commonEvent.publish("singletonEntryAbulity1_onActive",()=>{ + console.log("singletonEntryAbulity1_onActive publish callBack singletonEntryAbulity1_onActive"); + }); + }, + onInactive(){ + console.log("singletonEntryAbulity_onInactive") + commonEvent.publish("singletonEntryAbulity1_onInactive",()=>{ + console.log("singletonEntryAbulity1_onInactive publish callBack singletonEntryAbulity1_onInactive"); + }); } } diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.hml index 7ef73cefb..232a295e9 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.hml +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.hml @@ -1,17 +1,17 @@ + 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. +-->
{{ $t('strings.page') }} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.js index 1d7012a63..55c229adf 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.js +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility/pages/second/second.js @@ -1,4 +1,3 @@ -// @ts-nocheck /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js new file mode 100644 index 000000000..61bd64de9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/app.js @@ -0,0 +1,47 @@ +/* + * 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 ability_featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; + +export default { + onCreate() { + commonEvent.publish("ApplicationMainAbility2_onCreate",()=>{ + console.log("ApplicationMainAbility2_onCreate publish callBack ApplicationMainAbility2_onCreate"); + }); + console.info("ApplicationMainAbility2 onCreate"); +// setTimeout(()=>{ +// console.info("ApplicationMainAbility2 terminateSelf"); +// ability_featureAbility.terminateSelf().then((data)=>{ +// console.log("ApplicationMainAbility2 terminateSelf data:" + JSON.stringify(data) ) +// }).catch((error)=>{ +// console.log("ApplicationMainAbility2 terminateSelf error:" + JSON.stringify(error) ) +// }) +// },1000); + }, + onDestroy() { + console.log("singletonEntryAbulity_onDestroy222"); + commonEvent.publish("ApplicationMainAbility2_onDestroy",()=>{ + console.log("singletonEntryAbulity2_onDestroy publish callBack singletonEntryAbulity2onDestroy"); + }); + }, +// onForgeGround(){ +// console.log("singletonEntryAbulity_onForgeGround"); +// commonEvent.publish("ApplicationMainAbility2_onForgeGround",()=>{ +// console.log("ApplicationMainAbility2_onHide publish callBack ApplicationMainAbility2_onForgeGround"); +// }); +// } +}; + diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/en-US.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/en-US.json new file mode 100644 index 000000000..08e34eac9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/en-US.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "page": "Second Page", + "next": "Next Page", + "back": "Back" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/zh-CN.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/zh-CN.json new file mode 100644 index 000000000..3dd53b3a8 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/i18n/zh-CN.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "page": "第二页", + "next": "下一页", + "back": "返回" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.hml new file mode 100644 index 000000000..83ae6b784 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.hello') }} {{ title }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.js new file mode 100644 index 000000000..caadb951d --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/index/index.js @@ -0,0 +1,59 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent'; + +export default { + data: { + title: "" + }, + onInit() { + this.title = 'yingyong2'; + }, + onclick: function () { + router.replace({ + uri: "pages/second/second" + }) + }, + onShow() { + console.log("singletonEntryAbulity_onShow") + commonEvent.publish("singletonEntryAbulity2_onShow",()=>{ + console.log("singletonEntryAbulity2_onShow publish callBack singletonEntryAbulity2_onShow"); + }); + }, + onHide(){ + console.log("singletonEntryAbulity_onHide") + commonEvent.publish("singletonEntryAbulity2_onHide",()=>{ + console.log("singletonEntryAbulity2_onHide publish callBack singletonEntryAbulity2onHide"); + }); + }, + onActive(){ + console.log("singletonEntryAbulity_onActive") + commonEvent.publish("singletonEntryAbulity2_onActive",()=>{ + console.log("singletonEntryAbulity2_onActive publish callBack singletonEntryAbulity2_onActive"); + }); + }, + onInactive(){ + console.log("singletonEntryAbulity_onInactive"); + commonEvent.publish("singletonEntryAbulity2_onInactive",()=>{ + console.log("singletonEntryAbulity2_onInactive publish callBack singletonEntryAbulity2_onInactive"); + }); + } + +} + + + diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.hml new file mode 100644 index 000000000..4503365d5 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.page') }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.js new file mode 100644 index 000000000..55c229adf --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility2/pages/second/second.js @@ -0,0 +1,26 @@ +/* + * 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" + }) + } +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js new file mode 100644 index 000000000..695d23b4c --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/app.js @@ -0,0 +1,40 @@ +/* + * 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 ability_featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; +export default { + onCreate() { + console.info("Application onCreate MainAbility3"); + setTimeout(()=>{ + ability_featureAbility.terminateSelf().then((data)=>{ + console.log("Application terminateSelf data:" + JSON.stringify(data) ) + }).catch((error)=>{ + console.log("Application terminateSelf data:" + JSON.stringify(error) ) + }) + },2500) + }, + onDestroy() { + console.log("singletonEntryAbulity_onDestroy222"); + commonEvent.publish("ApplicationMainAbility3_onDestroy",()=>{ + console.log("ApplicationMainAbility3_onDestroy publish callBack ApplicationMainAbility2_onDestroy"); + }); + }, + onForgeGround(){ + console.log("singletonEntryAbulity_onForgeGround"); + commonEvent.publish("ApplicationMainAbility3_onForgeGround",()=>{ + console.log("ApplicationMainAbility3_onHide publish callBack ApplicationMainAbility2_onForgeGround"); + }); + } +}; diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/en-US.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/en-US.json new file mode 100644 index 000000000..08e34eac9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/en-US.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "page": "Second Page", + "next": "Next Page", + "back": "Back" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/zh-CN.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/zh-CN.json new file mode 100644 index 000000000..3dd53b3a8 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/i18n/zh-CN.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "page": "第二页", + "next": "下一页", + "back": "返回" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.hml new file mode 100644 index 000000000..9c27d02f6 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.hello') }} {{ title }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.js new file mode 100644 index 000000000..4749e8252 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/index/index.js @@ -0,0 +1,55 @@ +/* + * 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' +import commonEvent from '@ohos.commonEvent'; + +export default { + data: { + title: "" + }, + onInit() { + this.title = 'yingyong3'; + }, + onclick: function () { + router.replace({ + uri: "pages/second/second" + }) + }, + onShow() { + console.info('onShow start') + }, + onHide(){ + console.log("singletonEntryAbulity_onHide") + commonEvent.publish("singletonEntryAbulity3_onHide",()=>{ + console.log("singletonEntryAbulity3_onHide publish callBack singletonEntryAbulity3_onHide"); + }); + }, + onActive(){ + console.log("singletonEntryAbulity_onActive") + commonEvent.publish("singletonEntryAbulity3_onActive",()=>{ + console.log("singletonEntryAbulity3_onActive publish callBack singletonEntryAbulity3_onActive"); + }); + }, + onInactive(){ + console.log("singletonEntryAbulity_onInactive") + commonEvent.publish("singletonEntryAbulity3_onHide",()=>{ + console.log("singletonEntryAbulity3_onInactive publish callBack singletonEntryAbulity3_onInactive"); + }); + } +} + + + diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.hml new file mode 100644 index 000000000..232a295e9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.page') }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.js new file mode 100644 index 000000000..55c229adf --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility3/pages/second/second.js @@ -0,0 +1,26 @@ +/* + * 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" + }) + } +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/app.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/app.js new file mode 100644 index 000000000..7cb7248bd --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/app.js @@ -0,0 +1,29 @@ +/* + * 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"); +// setTimeout(()=>{ +// this.content.terminateSelf().then((data)=>{ +// console.log("Application terminateSelf data:" + JSON.stringify(data) ) +// }).catch((error)=>{ +// console.log("Application terminateSelf data:" + JSON.stringify(error) ) +// }) +// },8000) + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/en-US.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/en-US.json new file mode 100644 index 000000000..08e34eac9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/en-US.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "page": "Second Page", + "next": "Next Page", + "back": "Back" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/zh-CN.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/zh-CN.json new file mode 100644 index 000000000..3dd53b3a8 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/i18n/zh-CN.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "page": "第二页", + "next": "下一页", + "back": "返回" + }, + "Files": { + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.hml new file mode 100644 index 000000000..9c27d02f6 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.hello') }} {{ title }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.js new file mode 100644 index 000000000..e73299287 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/index/index.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router' +import {Core} from 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent'; + +export default { + data: { + title: "" + }, + onInit() { + this.title = 'yingyong4'; + }, + onclick: function () { + router.replace({ + uri: "pages/second/second" + }) + }, + onShow() { + console.info('onShow start') + + }, + onHide(){ + console.log("singletonEntryAbulity_onHide") + commonEvent.publish("singletonEntryAbulity1_onHide",()=>{ + console.log("singletonEntryAbulity1_onHide publish callBack singletonEntryAbulity1_onHide"); + }); + }, + onActive(){ + console.log("singletonEntryAbulity_onActive") + commonEvent.publish("singletonEntryAbulity1_onActive",()=>{ + console.log("singletonEntryAbulity1_onActive publish callBack singletonEntryAbulity1_onActive"); + }); + }, + onInactive(){ + console.log("singletonEntryAbulity_onInactive") + commonEvent.publish("singletonEntryAbulity1_onHide",()=>{ + console.log("singletonEntryAbulity1_onInactive publish callBack singletonEntryAbulity1_onInactive"); + }); + } +} + + + diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.css b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.css new file mode 100644 index 000000000..737096ca1 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.css @@ -0,0 +1,38 @@ +/* + * 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. + */ +.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; +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.hml b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.hml new file mode 100644 index 000000000..232a295e9 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.hml @@ -0,0 +1,20 @@ + +
+ + {{ $t('strings.page') }} + + +
diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.js new file mode 100644 index 000000000..55c229adf --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/MainAbility4/pages/second/second.js @@ -0,0 +1,26 @@ +/* + * 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" + }) + } +} diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js new file mode 100644 index 000000000..cf949c222 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/AbilityDisableTest.js @@ -0,0 +1,386 @@ + +/* + * 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. + */ +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import missionManager from '@ohos.application.missionManager'; +import featureAbility from '@ohos.ability.featureAbility'; +import bundleManager from '@ohos.bundle'; +import app_manager from "@ohos.application.appManager" +import commonEvent from '@ohos.commonEvent'; +import {onDestroys} from "../MainAbility2/app.js" +import abilityManager from '@ohos.application.abilityManager' +import ConfigurationConstant from "@ohos.application.ConfigurationConstant"; + +function startAility(){ + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility2" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0400 - startMainAbility2: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + }); + },100) + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility3" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0400 - startMainAbility3: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)); + }); + },400) +} +function lockMissions(titles,missionId,times){ + setTimeout(()=>{ + for(var i=0;i{ + console.log(titles+'lockMission1 errCode:' + JSON.stringify(err) + " data: " + JSON.stringify(data)); + }); + }; + },times); +} +function clearAllMissions(){ + missionManager.clearAllMissions((err,data)=>{ + console.log('clearAllMissions errCode: ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + }) +} + +function fns(){ + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility2" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 - startMainAbility2: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + expect(err.code == 0).assertTrue(); + }); + },100) + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility4" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 - startMainAbility4: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + expect(err.code == 0).assertTrue(); + }); + },300) + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility3" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 - startMainAbility3: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)) + expect(err.code == 0).assertTrue(); + }); + },500) + setTimeout(()=>{ + missionManager.getMissionInfos("", 20, (err, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 getMissionInfos errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + console.log("bundleName:"+data[i].want["abilityName"]) + if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility3" + || data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility4" + ||data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility" + ||data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility2"){ + console.log("data[i]['lockedState']::::"+data[i]['lockedState']); + console.log("data[i].missionId" + data[i].missionId); + console.log("SUB_AA_OpenHarmony_Clear_0100, missionId:" + data[i].missionId); + missionIds.push(data[i].missionId); + } + } + console.log('SUB_AA_OpenHarmony_Clear_0100 missionId:'+ missionIds + + typeof missionIds +missionIds[1] + typeof missionIds[1]); + }) + console.log("SUB_AA_OpenHarmony_Clear_0100" + JSON.stringify(missionIds)); + },800) + setTimeout(()=>{ + missionManager.lockMission(parseInt(missionIds[1]),(err,data)=>{ + console.log('SUB_AA_OpenHarmony_Clear_0100 lockMission1 missionIds[1] : ' + + JSON.stringify(missionIds[1]), + parseInt(missionIds[1])); + console.log('SUB_AA_OpenHarmony_Clear_0100 lockMission1 errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + }) + },1200) + setTimeout(()=>{ + missionManager.lockMission(parseInt(missionIds[2]),(err,data)=>{ + console.log('SUB_AA_OpenHarmony_Clear_0100 lockMission2 errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + }) + },1500) + setTimeout(()=>{ + missionManager.getMissionInfos("", 20, (err, data) => { + console.log("SUB_AA_OpenHarmony_Clear_0100, twosgetMissionInfos:" + + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + console.log("data[i].missionId:missionIds[2] news missionIds[1]" + + data[i].missionId + missionIds[2] + missionIds[1]) + if(data[i].missionId == missionIds[1] || data[i].missionId == missionIds[2]){ + console.log("data[i]['lockedState']222:::::::"+data[i]['lockedState']); + expect(data[i]['lockedState'] == true).assertTrue(); + } + } + }) + console.log("SUB_AA_OpenHarmony_Clear_0100" + JSON.stringify(missionIds)); + },3500) + setTimeout(()=>{ + missionManager.getMissionInfos("", 20, (err, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 getMissionInfos errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + console.log("bundleName:"+data[i].want["abilityName"]) + if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility3" + || data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility4" + ||data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility" + ||data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility2"){ + console.log("data[i]['lockedState']::::"+data[i]['lockedState']); + expect(data[i].lockedState == false).assertTrue(); + } + } + }) + console.log("SUB_AA_OpenHarmony_Clear_0100" + JSON.stringify(missionIds)); + },4000) + setTimeout(()=>{ + missionManager.moveMissionToFront(parseInt(missionIds[2]),(err,data)=>{ + console.log('SUB_AA_OpenHarmony_Clear_0100 moveMissionToFront errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + }) + },4500) + setTimeout(()=>{ + missionManager.clearAllMissions((err,data)=>{ + console.log('SUB_AA_OpenHarmony_Clear_0100 clearAllMissions errCode: ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + + }) + },5000) + setTimeout(()=>{ + missionManager.getMissionInfos("", 20, (err, data) => { + console.log('SUB_AA_OpenHarmony_Clear_0100 getMissionInfos errCode : ' + + JSON.stringify(err) + " data: " + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + console.log("bundleName:"+data[i].want["abilityName"]) + if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility3" || + data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility4" || + data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility"|| + data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility2"){ + console.log("data[i]['lockedState']end::::"+data[i]['lockedState']); + expect(data[i]['lockedState'] == true).assertTrue(); + } + } + }) + console.log("SUB_AA_OpenHarmony_Clear_0100" + + JSON.stringify(missionIds)); + },8000) + expect(lists.indexOf(JSON.stringify("singletonEntryAbulity2_onShow"))!=-1).assertTrue(); + +} +describe('AbilityDisableTests', function () { + let mainAbility1ListS = new Array() + let lists = new Array() + function subscriberCallBack_mainAbility2_Destory(err,data){ + console.log("Subscribe2 CallBack data:" + JSON.stringify(data)); + lists.push(data["event"]); + console.log("subscriberCallBack_mainAbility2_Destory lists:"+lists); + }; + function subscriberCallBack_mainAbility1_Destory(err,data){ + console.log("Subscribe3 CallBack data:" + JSON.stringify(data)); + mainAbility1ListS.push(data["event"]) + console.log("subscriberCallBack_mainAbility3_Destory mainAbility1ListS:"+mainAbility1ListS); + } + console.log("AbilityDisableTests --- start"); + var ability2LifeEvents = { + events:["ApplicationMainAbility2_onDestroy", + "singletonEntryAbulity2_onHide", + "singletonEntryAbulity2_onActive", + "singletonEntryAbulity2_onInactive", + "singletonEntryAbility2_onDestroy", + "singletonEntryAbulity2_onShow", + "ApplicationMainAbility2_onCreate",] + }; + var ability1LifeEvents = { + events:["singletonEntryAbulity3_onHide", + "singletonEntryAbulity3_onActive", + "singletonEntryAbulity3_onInactive", + "singletonEntryAbility3_onDestroy", + "singletonEntryAbulity3_onShow", + "ApplicationMainAbility3_onCreate", + "ApplicationMainAbility3_onDestroy", + ] + }; + + /* + * @tc.number SUB_AA_OpenHarmony_MoveMissionToFront_2900 + * @tc.name Verify the full-screen switching application + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_MoveMissionToFront_2900', 0, async function (done) { + + var Subscriber2 = []; + var Subscriber1 = []; + var mainAbility1missinds = [] + console.log("SUB_AA_OpenHarmony_MoveMissionToFront_2900 --- start") + commonEvent.createSubscriber(ability2LifeEvents).then(async (data)=>{ + console.log("Create Subscriber2=======>:"+JSON.stringify(data)); + Subscriber2 = data; + console.log("data2 is:" + JSON.stringify(Subscriber2)); + await commonEvent.subscribe(Subscriber2,subscriberCallBack_mainAbility2_Destory) + }); + commonEvent.createSubscriber(ability1LifeEvents).then(async (data)=>{ + console.log("Create Subscriber1=======>:"+JSON.stringify(data)); + Subscriber1 = data; + console.log("data2 is:" + JSON.stringify(Subscriber1)); + await commonEvent.subscribe(Subscriber1,subscriberCallBack_mainAbility1_Destory) + }); + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility2" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 - startMainAbility2: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)); + }); + },500) + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility3" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 - startMainAbility3: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)); + }); + },1000); + setTimeout(()=>{ + console.log("1111subscriberCallBack_mainAbility2_Destory lists:"+lists); + expect(lists.indexOf(JSON.stringify("singletonEntryAbulity2_onShow"))!=-1).assertTrue(); + expect(lists.indexOf(JSON.stringify("ApplicationMainAbility2_onCreate"))!=-1).assertTrue(); + },2500) + setTimeout(()=>{ + missionManager.getMissionInfos("", 100, (err, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 getMissionInfos errCode: '+ JSON.stringify(err) + " data: " + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility2"){ + mainAbility1missinds.push(data[i]["missionId"]) + } + + } + console.log("mainAbility1missinds:"+mainAbility1missinds); + }); + },3000) + setTimeout(()=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 moveMissionToFront dataCode:++++++'); + missionManager.moveMissionToFront(parseInt(mainAbility1missinds[0]),{ + parameters:{ "windowMode":1 }}).then((data)=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 moveMissionToFront dataCode:'+ " data:" + + JSON.stringify(data)); + expect().assertFail(); + }).catch((err)=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 moveMissionToFront errCode:'+ " err:" + + JSON.stringify(err)); + }); + },3888); + setTimeout(()=>{ + console.log("1111subscriberCallBack_mainAbility1_Destory lists:"+ mainAbility1ListS); + expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntrymainAb" + + "ility1ListSAbulity1_onInactive"))!=-1).assertTrue(); + expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntryA" + + "bulity1_onHide"))!=-1).assertTrue(); + },3999); + done() + }); + + /* + * @tc.number SUB_AA_OpenHarmony_MoveMissionToFront_3000 + * @tc.name Verify the left split screen switching application + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_MoveMissionToFront_3000', 0, async function (done) { + var Subscriber2 = ""; + var Subscriber1 = ""; + var mainAbility1missinds = [] + console.log("SUB_AA_OpenHarmony_MoveMissionToFront_3000 --- start") + commonEvent.createSubscriber(ability2LifeEvents).then(async (data)=>{ + console.log("Create Subscriber2=======>:"+JSON.stringify(data)); + Subscriber2 = data; + console.log("data2 is:" + JSON.stringify(Subscriber2)); + await commonEvent.subscribe(Subscriber2,subscriberCallBack_mainAbility2_Destory) + }); + commonEvent.createSubscriber(ability1LifeEvents).then(async (data)=>{ + console.log("Create Subscriber1=======>:"+JSON.stringify(data)); + Subscriber1 = data; + console.log("data2 is:" + JSON.stringify(Subscriber1)); + await commonEvent.subscribe(Subscriber1,subscriberCallBack_mainAbility1_Destory) + }); + + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility2" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 - startMainAbility2: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)); + }); + },500); + setTimeout(()=>{ + featureAbility.startAbility({ want: { + bundleName: "com.example.abilitydisable", + abilityName: "com.example.abilitydisable.MainAbility3" + } }, (error, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 - startMainAbility3: ' + + JSON.stringify(error) + ", " + JSON.stringify(data)); + }); + },1000); + setTimeout(()=>{ + console.log("1111subscriberCallBack_mainAbility2_lists:singletonEntryAbulity2_onShow:"+lists); + console.log("+++++++++++++++++"+lists.indexOf("singletonEntryAbulity2_onShow")+"+++++++"+lists.indexOf("ApplicationMainAbility2_onCreate")+lists) + expect(lists.indexOf(JSON.stringify("singletonEntryAbulity2_onShow"))!=-1).assertTrue(); + expect(lists.indexOf(JSON.stringify("ApplicationMainAbility2_onCreate"))!=-1).assertTrue(); + },2500); + setTimeout(()=>{ + missionManager.getMissionInfos("", 100, (err, data) => { + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 getMissionInfos errCode: '+ JSON.stringify(err) + " data: " + JSON.stringify(data)); + for (var i = 0;i < data.length; i++) { + console.log("bundleName222222:"+data[i].want["abilityName"]+"data[i]['lockedState']::::"+data[i]['lockedState']); + if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility3"){ + console.log('data[i]["missionId"]'+data[i]["missionId"] + "::::"+data[i].want["abilityName"]); + mainAbility1missinds.push(data[i]["missionId"]) + } + } + console.log("mainAbility1missinds:"+mainAbility1missinds); + }); + },3000); + setTimeout(()=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:++++++'); + missionManager.moveMissionToFront(parseInt(mainAbility1missinds[0]),{ + parameters:{ "windowMode":100 }}).then((data)=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:'+ " data:" + JSON.stringify(data)); + }).catch((err)=>{ + console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront errCode:'+ " err:" + JSON.stringify(err)); + }); + },3888); + setTimeout(()=>{ + expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntryAbulity1_onInactive"))==-1).assertTrue(); + expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntryAbulity1_onHide"))==-1).assertTrue(); + },3999); + done(); + }); +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js new file mode 100644 index 000000000..61ebf2086 --- /dev/null +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/ClearTest.js @@ -0,0 +1,112 @@ + +/* + * 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. + */ +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import missionManager from '@ohos.application.missionManager'; +import ability_featureAbility from '@ohos.ability.featureAbility'; +import bundleManager from '@ohos.bundle'; +import app_manager from "@ohos.application.appManager" +import commonEvent from '@ohos.commonEvent'; +import {onDestroys} from "../MainAbility2/app.js" +import abilityManager from '@ohos.application.abilityManager' +import ConfigurationConstant from "@ohos.application.ConfigurationConstant"; +import AbilityConstant from '@ohos.application.AbilityConstant' +describe('AbilityDisableTests', function () { + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6200 + * @tc.name Verify the enumeration values LaunchReason. CONTINUATION + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6200", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6300-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6200 LaunchReason.CONTINUATION: " + AbilityConstant.LaunchReason.CONTINUATION); + expect(AbilityConstant.LaunchReason.CONTINUATION==3).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6300 + * @tc.name Verify the enumeration value launchreason.start UNKNOWN + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6300", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6300-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6300 LaunchReason.UNKNOWN: " + AbilityConstant.LaunchReason.UNKNOWN); + expect(AbilityConstant.LaunchReason.UNKNOWN==0).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6400 + * @tc.name Verify the enumeration value launchreason.START_ABILITY + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6400", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6400-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6400 LaunchReason.START_ABILITY: " + AbilityConstant.LaunchReason.START_ABILITY); + expect(AbilityConstant.LaunchReason.START_ABILITY==1).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6500 + * @tc.name Verify the enumeration values LaunchReason. CALL + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6500", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6500-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6500 LaunchReason.CALL: " + AbilityConstant.LaunchReason.CALL); + expect(AbilityConstant.LaunchReason.CALL==2).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6600 + * @tc.name Verify the enumeration values LastExitReason.UNKNOWN + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6600", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6600-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6600 LastExitReason.UNKNOWN: " + AbilityConstant.LastExitReason.UNKNOWN); + expect(AbilityConstant.LastExitReason.UNKNOWN==0).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6700 + * @tc.name Verify the enumeration values LastExitReason.ABILITY_NOT_RESPONDING + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6700", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6700-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6700 LastExitReason.ABILITY_NOT_RESPONDING: " + AbilityConstant.LastExitReason.ABILITY_NOT_RESPONDING); + expect(AbilityConstant.LastExitReason.ABILITY_NOT_RESPONDING==1).assertTrue(); + done(); + }); + /* + * @tc.number SUB_AA_OpenHarmony_AbilityStart_6700 + * @tc.name Verify the enumeration values LastExitReason.NORMAL + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_AA_OpenHarmony_AbilityStart_6800", 0, async function (done) { + console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6800-------------------"); + console.info("SUB_AA_OpenHarmony_AbilityStart_6800 LastExitReason.NORMAL: " + AbilityConstant.LastExitReason.NORMAL); + expect(AbilityConstant.LastExitReason.NORMAL==2).assertTrue(); + done(); + }); +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/JSMyapplicationJsunit.test.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/JSMyapplicationJsunit.test.js deleted file mode 100644 index 82b045010..000000000 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/JSMyapplicationJsunit.test.js +++ /dev/null @@ -1,191 +0,0 @@ -// @ts-nocheck -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {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 diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/List.test.js index ebef389ae..41ed56e04 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/List.test.js +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/js/test/List.test.js @@ -1,4 +1,3 @@ -// @ts-nocheck /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,4 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./JSMyapplicationJsunit.test.js'); +require('./ClearTest.js'); +require('./AbilityDisableTest.js'); + + diff --git a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/resources/base/element/string.json index 92f5ff8a4..2e8b3cf8a 100644 --- a/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/resources/base/element/string.json +++ b/aafwk/aafwk_standard/fa/fa_configurationconstant_test/entry/src/main/resources/base/element/string.json @@ -15,6 +15,26 @@ { "name": "entry_MainAbility2", "value": "entry_MainAbility2" + }, + { + "name": "description_mainability3", + "value": "JS_Empty Ability" + }, + { + "name": "entry_MainAbility3", + "value": "entry_MainAbility3" + }, + { + "name": "description_mainability4", + "value": "JS_Empty Ability" + }, + { + "name": "entry_MainAbility4", + "value": "entry_MainAbility4" + }, + { + "name": "description_serviceability", + "value": "hap sample empty service" } ] } \ No newline at end of file -- GitLab