From 776658276ad41ca877430797636ec8a51798fbd9 Mon Sep 17 00:00:00 2001 From: hu0475 Date: Wed, 12 Jul 2023 00:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90ability=E5=AD=90=E7=B3=BB?= =?UTF-8?q?=E7=BB=9Fcontext=E6=A8=A1=E5=9D=97=E7=9A=84=E8=B7=A8=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=B5=8B=E8=AF=95=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hu0475 --- ability/BUILD.gn | 1 + ability/crossplatform/BUILD.gn | 23 + .../crossplatform/ability_runtime/BUILD.gn | 24 + .../actscontexttest/AppScope/app.json | 16 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes .../ability_runtime/actscontexttest/BUILD.gn | 39 + .../ability_runtime/actscontexttest/Test.json | 21 + .../signature/openharmony_sx.p7b | Bin 0 -> 3464 bytes .../src/main/ets/Application/AbilityStage.ts | 8 + .../src/main/ets/MainAbility1/MainAbility1.ts | 66 + .../src/main/ets/TestAbility/TestAbility.ets | 67 + .../src/main/ets/TestAbility/pages/Index.ets | 49 + .../src/main/ets/TestAbility/pages/Index1.ets | 27 + .../ets/TestRunner/OpenHarmonyTestRunner.ts | 49 + .../src/main/ets/test/List.test.ets | 28 + .../AbilityStageContext.test.ets | 473 ++++++ .../ApplicationContext.test.ets | 501 ++++++ .../ets/test/actsCommonTest/Common.test.ets | 149 ++ .../Configuration.test.ets | 105 ++ .../UIAbilityContext.test.ets | 1513 +++++++++++++++++ .../actscontexttest/src/main/module.json | 47 + .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 24 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 6 + .../actscontexttestentry/AppScope/app.json | 16 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes .../actscontexttestentry/BUILD.gn | 39 + .../signature/openharmony_sx.p7b | Bin 0 -> 3464 bytes .../src/main/ets/Application/AbilityStage.ts | 7 + .../src/main/ets/mainability/MainAbility.ts | 136 ++ .../src/main/ets/pages/Index.ets | 32 + .../actscontexttestentry/src/main/module.json | 36 + .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 16 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 5 + 39 files changed, 3555 insertions(+) create mode 100644 ability/crossplatform/BUILD.gn create mode 100644 ability/crossplatform/ability_runtime/BUILD.gn create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/AppScope/app.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/element/string.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/media/app_icon.png create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/BUILD.gn create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/Test.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/signature/openharmony_sx.p7b create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/Application/AbilityStage.ts create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/MainAbility1/MainAbility1.ts create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/TestAbility.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index1.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/List.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsAbilityStageContextTest/AbilityStageContext.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsApplicationContextTest/ApplicationContext.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsCommonTest/Common.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsConfigurationTest/Configuration.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsUIAbilityContextTest/UIAbilityContext.test.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/module.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/color.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/string.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/media/icon.png create mode 100644 ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/profile/test_pages.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/AppScope/app.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/AppScope/resources/base/element/string.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/AppScope/resources/base/media/app_icon.png create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/BUILD.gn create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/signature/openharmony_sx.p7b create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/Application/AbilityStage.ts create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/mainability/MainAbility.ts create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/pages/Index.ets create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/module.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/color.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/string.json create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/media/icon.png create mode 100644 ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/profile/test_pages.json diff --git a/ability/BUILD.gn b/ability/BUILD.gn index d0cd55395..17d685cd0 100644 --- a/ability/BUILD.gn +++ b/ability/BUILD.gn @@ -17,6 +17,7 @@ group("ability") { testonly = true if (is_standard_system) { deps = [ + "crossplatform:ability_crossplatform", "ability_runtime:ability_runtime", "dmsfwk:dmsfwk", ] diff --git a/ability/crossplatform/BUILD.gn b/ability/crossplatform/BUILD.gn new file mode 100644 index 000000000..91f03387a --- /dev/null +++ b/ability/crossplatform/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") + +group("ability_crossplatform") { + testonly = true + if (is_standard_system) { + deps = [ + "ability_runtime:ability_crossplatform_runtime", + ] + } +} diff --git a/ability/crossplatform/ability_runtime/BUILD.gn b/ability/crossplatform/ability_runtime/BUILD.gn new file mode 100644 index 000000000..bb6c6f078 --- /dev/null +++ b/ability/crossplatform/ability_runtime/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") + +group("ability_crossplatform_runtime") { + testonly = true + if (is_standard_system) { + deps = [ + "actscontexttest:context_ets_normal_test", + "actscontexttestentry:context_entry_ets_normal_test" + ] + } +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/AppScope/app.json b/ability/crossplatform/ability_runtime/actscontexttest/AppScope/app.json new file mode 100644 index 000000000..36066e67a --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/AppScope/app.json @@ -0,0 +1,16 @@ +{ + "app": { + "bundleName": "com.example.contexttest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/element/string.json b/ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..3811bc441 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "xtsDemo1" + } + ] +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/media/app_icon.png b/ability/crossplatform/ability_runtime/actscontexttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7e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CtP=w-_pVOL@de}NVT zWAda52q=I8Qt(ezZJt!AffOZBPY9SFNdkc4ZW2Y$BT*5deL<2auy@-yaDiM&zw|Z; z1wH#A67&-x8RF_Q!hd(P?fU|5JUsNoZzjICTVFO`+LAB$*X~Jwdi&DFt})n-vTsD^ zZXctBlO3<+fAr^8+sdqAe|$%IT0|{9HvGLUc2EKGc{-!ViHCz>^M?FmVY_VDU$Zw& zZ|@vGyW@7|oXv6r7?=VK5(s_}i$%hI^T6m-JWxDLJme&P?ZfQ}%lR{__Aj`R`S9C% zsleX1W};vQ@Cl)eUCZ}mCEd+?jD>@d8^0zx0+M|%ug~H1(;nW~+|vF9vch}O_f6OK zyIsp9rL!LWc0E6(bzwu|@}mLe@QuQmGcw06`9s@0E4Zlpe944P`^b+4+8x&l_is_< z#CJZ5&b|8Op#8jlbi95}^yp_$mwIVmE+FtDOE(cr=q_FU^Gau@Y4#}*K}ty7OGN4L z1u|&@IZwosIr*3344KHCA;wBOn^%UU^Vi*ynvXr2NZ<6p;pwwGl ze`xHP=GNzg5d|^;Aq3%zKUdFxm%a7o@9vie>USP5-Eie_&hZPmSLXO~tXGZB%ZulY z2(+8NK7YM^=(+0`2J>ch>?NApSsvMBZ=WE4@IlS4qpMfv93fxn9F`pQaM2~pvdGot z_!Y**F7tn)-1y38#ZXd!@FJVWUl~B?g_N=9MD2Y$X$^wmk8dYgB8VUR-ulTzt=cg%|7_dwu2uOz_`7t*Bb(dz-u-F` zgBeBHp#S5OTqrgIy>M*C&3I99pmO}dyakc36)oo`-#8|Abj&{)`tsi8)#SKQf9D}5 kO-JJecEg?1^8-^P) { + if (err.code) { + console.log('MainAbility1 loadContent error'); + return; + } + console.log('MainAbility1 loadContent success'); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility1 onWindowStageDestroy") + } + + onForeground() { + console.log("[Demo] MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility1 onBackground") + } +}; diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/TestAbility.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/TestAbility.ets new file mode 100644 index 000000000..d6b95dd15 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/TestAbility.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('TestAbility/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + + globalThis.abilityContext = this.context; + globalThis.colorMode = this.context.config.colorMode; + globalThis.direction = this.context.config.direction; + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index.ets new file mode 100644 index 000000000..40f0a77ae --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index1.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index1.ets new file mode 100644 index 000000000..d48360547 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestAbility/pages/Index1.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index1 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World Mainability1') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..92a16d84e --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,49 @@ +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/List.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..e32127048 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/List.test.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Common from './actsCommonTest/Common.test'; +import Configuration from './actsConfigurationTest/Configuration.test'; +import AbilityStageContext from './actsAbilityStageContextTest/AbilityStageContext.test'; +import ApplicationContext from './actsApplicationContextTest/ApplicationContext.test'; +import UIAbilityContext from './actsUIAbilityContextTest/UIAbilityContext.test'; + +export default function testsuite() { + Common(); + Configuration(); + AbilityStageContext(); + ApplicationContext(); + UIAbilityContext(); +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsAbilityStageContextTest/AbilityStageContext.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsAbilityStageContextTest/AbilityStageContext.test.ets new file mode 100644 index 000000000..f7df7b358 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsAbilityStageContextTest/AbilityStageContext.test.ets @@ -0,0 +1,473 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import common from '@ohos.app.ability.common'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function AbilityStageContext() { + describe("AbilityStageContext", function () { + let bundleName: any; + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(async function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info('afterEach case'); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + /** + * @tc.number : ABILITY_TEST_ABILITYSTAGECONTEXT_CURRENTHAPMODULEINFO_0100 + * @tc.name : testAbilityStageContextCurrentHapModuleInfo001 + * @tc.desc : test filed of currentHapModuleInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testAbilityStageContextCurrentHapModuleInfo001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context != null).assertTrue(); + let hapModuleInfo = context.currentHapModuleInfo; + expect(hapModuleInfo != null).assertTrue(); + + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.name: ` + hapModuleInfo.name); + expect(hapModuleInfo.name == "entryTest").assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.icon: ` + hapModuleInfo.icon); + expect(hapModuleInfo.icon == "$media:icon").assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.iconId: ` + hapModuleInfo.iconId); + expect(typeof (hapModuleInfo.iconId) == 'number').assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.label: ` + hapModuleInfo.label); + expect(hapModuleInfo.label == "$string:TestAbility_label").assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.labelId: ` + hapModuleInfo.labelId); + expect(typeof (hapModuleInfo.labelId) == 'number').assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.description: ` + hapModuleInfo.description); + expect(hapModuleInfo.description == "$string:module_test_desc").assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.descriptionId: ` + hapModuleInfo.descriptionId); + expect(typeof (hapModuleInfo.descriptionId) == 'number').assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.mainElementName: ` + hapModuleInfo.mainElementName); + expect(hapModuleInfo.mainElementName == "TestAbility").assertTrue(); + console.log(`testAbilityStageContextCurrentHapModuleInfo001 hapModuleInfo.metadata: ` + hapModuleInfo.metadata.length); + expect(hapModuleInfo.metadata.length >= 0).assertTrue(); + + console.log(`testAbilityStageContextCurrentHapModuleInfo001 success`); + done(); + } catch (err) { + console.log(`testAbilityStageContextCurrentHapModuleInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_ABILITYSTAGECONTEXT_CONFIG_0100 + * @tc.name : testAbilityStageContextConfig001 + * @tc.desc : test filed of config + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testAbilityStageContextConfig001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context != null).assertTrue(); + let config = context.config; + expect(config != null).assertTrue(); + + console.log(`testAbilityStageContextConfig001 config.colorMode: ` + config.colorMode); + expect(typeof (config.colorMode) == 'number').assertTrue(); + console.log(`testAbilityStageContextConfig001 config.direction: ` + config.direction); + expect(typeof (config.direction) == 'number').assertTrue(); + + console.log(`testAbilityStageContextConfig001 success`); + done(); + } catch (err) { + console.log(`testAbilityStageContextConfig001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STAGEMODE_0100 + * @tc.name : testStageMode001 + * @tc.desc : test filed of stageMode + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testStageMode001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context.stageMode).assertTrue(); + console.log(`testStageMode001 success`); + done(); + } catch (err) { + console.log(`testStageMode001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_RESOURCEMANAGER_0100 + * @tc.name : testResourceManager001 + * @tc.desc : test filed of resourceManager + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testResourceManager001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context.resourceManager != null).assertTrue(); + console.log(`testResourceManager001 success`); + done(); + } catch (err) { + console.log(`testResourceManager001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_APPLICATIONINFO_0100 + * @tc.name : testApplicationInfo001 + * @tc.desc : test filed of applicationInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testApplicationInfo001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context != null).assertTrue(); + let applicationInfo = context.applicationInfo; + expect(applicationInfo != null).assertTrue(); + + console.log(`testApplicationInfo001 applicationInfo.name: ` + applicationInfo.name); + expect(applicationInfo.name == 'com.example.contexttest').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.description: ` + applicationInfo.description.length); + expect(applicationInfo.description.length >= 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.descriptionId: ` + applicationInfo.descriptionId); + expect(applicationInfo.descriptionId == 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.label: ` + applicationInfo.label); + expect(applicationInfo.label == '$string:app_name').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.labelId: ` + applicationInfo.labelId); + expect(applicationInfo.labelId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.icon: ` + applicationInfo.icon); + expect(applicationInfo.icon == '$media:app_icon').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.iconId: ` + applicationInfo.iconId); + expect(applicationInfo.iconId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.codePath: ` + applicationInfo.codePath); + expect(typeof (applicationInfo.codePath) == 'string').assertTrue(); + + console.log(`testApplicationInfo001 success`); + done(); + } catch (err) { + console.log(`testApplicationInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CACHEDIR_0100 + * @tc.name : testCacheDir001 + * @tc.desc : test filed of cacheDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCacheDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testCacheDir001 cacheDir:` + context.cacheDir); + expect(typeof (context.cacheDir) == 'string').assertTrue(); + console.log(`testCacheDir001 success`); + done(); + } catch (err) { + console.log(`testCacheDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_TEMPDIR_0100 + * @tc.name : testTempDir001 + * @tc.desc : test filed of tempDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testTempDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testTempDir001 tempDir:` + context.tempDir); + expect(typeof (context.tempDir) == 'string').assertTrue(); + console.log(`testTempDir001 success`); + done(); + } catch (err) { + console.log(`testTempDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_FILESDIR_0100 + * @tc.name : testFilesDir001 + * @tc.desc : test filed of filesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testFilesDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testFilesDir001 filesDir:` + context.filesDir); + expect(typeof (context.filesDir) == 'string').assertTrue(); + console.log(`testFilesDir001 success`); + done(); + } catch (err) { + console.log(`testFilesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_DATABASEDIR_0100 + * @tc.name : testDatabaseDir001 + * @tc.desc : test filed of databaseDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testDatabaseDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testDatabaseDir001 databaseDir:` + context.databaseDir); + expect(typeof (context.databaseDir) == 'string').assertTrue(); + console.log(`testDatabaseDir001 success`); + done(); + } catch (err) { + console.log(`testDatabaseDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_PREFERENCESDIR_0100 + * @tc.name : testPreferencesDir001 + * @tc.desc : test filed of preferencesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testPreferencesDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testPreferencesDir001 preferencesDir:` + context.preferencesDir); + expect(typeof (context.preferencesDir) == 'string').assertTrue(); + console.log(`testPreferencesDir001 success`); + done(); + } catch (err) { + console.log(`testPreferencesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_BUNDLECODEDIR_0100 + * @tc.name : testBundleCodeDir001 + * @tc.desc : test filed of bundleCodeDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testBundleCodeDir001', 0, async function (done) { + try { + let context: common.AbilityStageContext = globalThis.stageContext; + console.log(`testBundleCodeDir001 bundleCodeDir:` + context.bundleCodeDir); + expect(typeof (context.bundleCodeDir) == 'string').assertTrue(); + console.log(`testBundleCodeDir001 success`); + done(); + } catch (err) { + console.log(`testBundleCodeDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0100 + * @tc.name : testCreateModuleContext001 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext001", 0, async function (done) { + try { + console.info("testCreateModuleContext001 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entry"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext001 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext001 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0200 + * @tc.name : testCreateModuleContext002 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap2 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext002", 0, async function (done) { + try { + console.log("testCreateModuleContext002 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entryTest"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext002 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext002 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0300 + * @tc.name : testCreateModuleContext003 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the cross-application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext003", 0, async function (done) { + try { + console.info("testCreateModuleContext003 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + let moduleContext = context.createModuleContext("entry_assist"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext003 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0400 + * @tc.name : testCreateModuleContext004 + * @tc.desc : Context calls createModuleContext, passing in a non-existing moduleName + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext004", 0, async function (done) { + try { + console.info("testCreateModuleContext004 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + let moduleContext = context.createModuleContext("abc"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext004 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0500 + * @tc.name : testCreateModuleContext005 + * @tc.desc : Context calls createModuleContext, and the incoming moduleName is undefined + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext005", 0, async function (done) { + try { + console.info("testCreateModuleContext005 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + let moduleContext = context.createModuleContext(undefined); + expect(moduleContext != null).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext005 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_GETAPPLICATIONCONTEXT_0100 + * @tc.name : testGetApplicationContext001 + * @tc.desc : test getApplicationContext return not empty + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testGetApplicationContext001", 0, async function (done) { + try { + console.info("testGetApplicationContext001 begin"); + let context: common.AbilityStageContext = globalThis.stageContext; + let applicationContext = context.getApplicationContext(); + expect(applicationContext != null).assertTrue(); + console.info("testGetApplicationContext001 success"); + done(); + } catch (err) { + console.log(`testGetApplicationContext001 fail: ` + err); + expect().assertFail(); + done(); + } + }); + }) +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsApplicationContextTest/ApplicationContext.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsApplicationContextTest/ApplicationContext.test.ets new file mode 100644 index 000000000..4e19e75bf --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsApplicationContextTest/ApplicationContext.test.ets @@ -0,0 +1,501 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import common from '@ohos.app.ability.common'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function ApplicationContext() { + describe("ApplicationContext", function () { + let bundleName: any; + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(async function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info('afterEach case'); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + /** + * @tc.number : ABILITY_TEST_GETRUNNINGPROCESSINFORMATION_PROMISE_0100 + * @tc.name : testGetRunningProcessInformationPromise001 + * @tc.desc : test getRunningProcessInformation(promise) + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testGetRunningProcessInformationPromise001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let appContext: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(appContext != null).assertTrue(); + + appContext.getRunningProcessInformation().then((data) => { + expect(data != undefined).assertTrue(); + console.log(`testGetRunningProcessInformationPromise001 pid:` + data[0].pid); + expect(data[0].pid > 0).assertTrue(); + console.log(`testGetRunningProcessInformationPromise001 processName:` + data[0].processName); + expect(data[0].processName == "com.example.contexttest").assertTrue(); + console.log(`testGetRunningProcessInformationPromise001 bundleNames:` + data[0].bundleNames); + expect(data[0].bundleNames[0] == "com.example.contexttest").assertTrue(); + console.log(`testGetRunningProcessInformationPromise001 success`); + done(); + }).catch((err) => { + console.log(`testGetRunningProcessInformationPromise001 fail ` + err); + expect().assertFail(); + done(); + }) + } catch (err) { + console.log(`testGetRunningProcessInformationPromise001 fail ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_GETRUNNINGPROCESSINFORMATION_CALLBACK_0100 + * @tc.name : testGetRunningProcessInformationCb001 + * @tc.desc : test getRunningProcessInformation(callback) + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testGetRunningProcessInformationCb001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let appContext: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(appContext != null).assertTrue(); + + appContext.getRunningProcessInformation((err, data) => { + expect(data != undefined).assertTrue(); + console.log(`testGetRunningProcessInformationCb001 pid:` + data[0].pid); + expect(data[0].pid > 0).assertTrue(); + console.log(`testGetRunningProcessInformationCb001 processName:` + data[0].processName); + expect(data[0].processName == "com.example.contexttest").assertTrue(); + console.log(`testGetRunningProcessInformationCb001 bundleNames:` + data[0].bundleNames); + expect(data[0].bundleNames[0] == "com.example.contexttest").assertTrue(); + console.log(`testGetRunningProcessInformationCb001 success`); + done(); + }) + } catch (err) { + console.log(`testGetRunningProcessInformationCb001 fail ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STAGEMODE_0100 + * @tc.name : testStageMode001 + * @tc.desc : test filed of stageMode + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testStageMode001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(context.stageMode).assertTrue(); + console.log(`testStageMode001 success`); + done(); + } catch (err) { + console.log(`testStageMode001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_RESOURCEMANAGER_0100 + * @tc.name : testResourceManager001 + * @tc.desc : test filed of resourceManager + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testResourceManager001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(context.resourceManager != null).assertTrue(); + console.log(`testResourceManager001 success`); + done(); + } catch (err) { + console.log(`testResourceManager001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_APPLICATIONINFO_0100 + * @tc.name : testApplicationInfo001 + * @tc.desc : test filed of applicationInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testApplicationInfo001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(context != null).assertTrue(); + let applicationInfo = context.applicationInfo; + expect(applicationInfo != null).assertTrue(); + + console.log(`testApplicationInfo001 applicationInfo.name: ` + applicationInfo.name); + expect(applicationInfo.name == 'com.example.contexttest').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.description: ` + applicationInfo.description.length); + expect(applicationInfo.description.length >= 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.descriptionId: ` + applicationInfo.descriptionId); + expect(applicationInfo.descriptionId == 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.label: ` + applicationInfo.label); + expect(applicationInfo.label == '$string:app_name').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.labelId: ` + applicationInfo.labelId); + expect(applicationInfo.labelId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.icon: ` + applicationInfo.icon); + expect(applicationInfo.icon == '$media:app_icon').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.iconId: ` + applicationInfo.iconId); + expect(applicationInfo.iconId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.codePath: ` + applicationInfo.codePath); + expect(typeof (applicationInfo.codePath) == 'string').assertTrue(); + + console.log(`testApplicationInfo001 success`); + done(); + } catch (err) { + console.log(`testApplicationInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CACHEDIR_0100 + * @tc.name : testCacheDir001 + * @tc.desc : test filed of cacheDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCacheDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testCacheDir001 cacheDir:` + context.cacheDir); + expect(typeof (context.cacheDir) == 'string').assertTrue(); + console.log(`testCacheDir001 success`); + done(); + } catch (err) { + console.log(`testCacheDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_TEMPDIR_0100 + * @tc.name : testTempDir001 + * @tc.desc : test filed of tempDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testTempDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testTempDir001 tempDir:` + context.tempDir); + expect(typeof (context.tempDir) == 'string').assertTrue(); + console.log(`testTempDir001 success`); + done(); + } catch (err) { + console.log(`testTempDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_FILESDIR_0100 + * @tc.name : testFilesDir001 + * @tc.desc : test filed of filesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testFilesDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testFilesDir001 filesDir:` + context.filesDir); + expect(typeof (context.filesDir) == 'string').assertTrue(); + console.log(`testFilesDir001 success`); + done(); + } catch (err) { + console.log(`testFilesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_DATABASEDIR_0100 + * @tc.name : testDatabaseDir001 + * @tc.desc : test filed of databaseDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testDatabaseDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testDatabaseDir001 databaseDir:` + context.databaseDir); + expect(typeof (context.databaseDir) == 'string').assertTrue(); + console.log(`testDatabaseDir001 success`); + done(); + } catch (err) { + console.log(`testDatabaseDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_PREFERENCESDIR_0100 + * @tc.name : testPreferencesDir001 + * @tc.desc : test filed of preferencesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testPreferencesDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testPreferencesDir001 preferencesDir:` + context.preferencesDir); + expect(typeof (context.preferencesDir) == 'string').assertTrue(); + console.log(`testPreferencesDir001 success`); + done(); + } catch (err) { + console.log(`testPreferencesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_BUNDLECODEDIR_0100 + * @tc.name : testBundleCodeDir001 + * @tc.desc : test filed of bundleCodeDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testBundleCodeDir001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + console.log(`testBundleCodeDir001 bundleCodeDir:` + context.bundleCodeDir); + expect(typeof (context.bundleCodeDir) == 'string').assertTrue(); + console.log(`testBundleCodeDir001 success`); + done(); + } catch (err) { + console.log(`testBundleCodeDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0100 + * @tc.name : testCreateModuleContext001 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext001", 0, async function (done) { + try { + console.info("testCreateModuleContext001 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entry"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext001 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext001 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0200 + * @tc.name : testCreateModuleContext002 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap2 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext002", 0, async function (done) { + try { + console.log("testCreateModuleContext002 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entryTest"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext002 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext002 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0300 + * @tc.name : testCreateModuleContext003 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the cross-application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext003", 0, async function (done) { + try { + console.info("testCreateModuleContext003 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + let moduleContext = context.createModuleContext("entry_assist"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext003 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0400 + * @tc.name : testCreateModuleContext004 + * @tc.desc : Context calls createModuleContext, passing in a non-existing moduleName + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext004", 0, async function (done) { + try { + console.info("testCreateModuleContext004 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + let moduleContext = context.createModuleContext("abc"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext004 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0500 + * @tc.name : testCreateModuleContext005 + * @tc.desc : Context calls createModuleContext, and the incoming moduleName is undefined + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext005", 0, async function (done) { + try { + console.info("testCreateModuleContext005 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + let moduleContext = context.createModuleContext(undefined); + expect(moduleContext != null).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext005 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_GETAPPLICATIONCONTEXT_0100 + * @tc.name : testGetApplicationContext001 + * @tc.desc : test getApplicationContext return not empty + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testGetApplicationContext001", 0, async function (done) { + try { + console.info("testGetApplicationContext001 begin"); + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let context: common.ApplicationContext = abilityContext.getApplicationContext(); + let applicationContext = context.getApplicationContext(); + expect(applicationContext != null).assertTrue(); + console.info("testGetApplicationContext001 success"); + done(); + } catch (err) { + console.log(`testGetApplicationContext001 fail: ` + err); + expect().assertFail(); + done(); + } + }); + }) +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsCommonTest/Common.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsCommonTest/Common.test.ets new file mode 100644 index 000000000..f35d4029e --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsCommonTest/Common.test.ets @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import common from '@ohos.app.ability.common'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function Common() { + describe("Common", function () { + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(async function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info('afterEach case'); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + /** + * @tc.number : ABILITY_TEST_COMMON_0100 + * @tc.name : testCommon001 + * @tc.desc : test Common of UIAbilityContext + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCommon001', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + console.log(`testCommon001 success`); + done(); + } catch (err) { + console.log(`testCommon001 fail:` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_COMMON_0200 + * @tc.name : testCommon002 + * @tc.desc : test Common of AbilityStageContext + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCommon002', 0, async function (done) { + try { + let stageContext: common.AbilityStageContext = globalThis.stageContext; + expect(stageContext != null).assertTrue(); + console.log(`testCommon002 success`); + done(); + } catch (err) { + console.log(`testCommon002 fail:` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_COMMON_0300 + * @tc.name : testCommon003 + * @tc.desc : test Common of ApplicationContext + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCommon003', 0, async function (done) { + try { + let abilityContext: common.UIAbilityContext = globalThis.abilityContext; + expect(abilityContext != null).assertTrue(); + let appContext: common.ApplicationContext = abilityContext.getApplicationContext(); + expect(appContext != null).assertTrue(); + console.log(`testCommon003 success`); + done(); + } catch (err) { + console.log(`testCommon003 fail:` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_COMMON_0400 + * @tc.name : testCommon004 + * @tc.desc : test Common of BaseContext + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCommon004', 0, async function (done) { + try { + let stageContext: common.AbilityStageContext = globalThis.stageContext; + expect(stageContext != null).assertTrue(); + let baseContext: common.BaseContext = stageContext; + expect(baseContext != null).assertTrue(); + console.log(`testCommon004 success`); + done(); + } catch (err) { + console.log(`testCommon004 fail:` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_COMMON_0500 + * @tc.name : testCommon005 + * @tc.desc : test Common of Context + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCommon005', 0, async function (done) { + try { + let stageContext: common.AbilityStageContext = globalThis.stageContext; + expect(stageContext != null).assertTrue(); + let context: common.Context = stageContext; + expect(context != null).assertTrue(); + console.log(`testCommon005 success`); + done(); + } catch (err) { + console.log(`testCommon005 fail:` + err); + expect().assertFail(); + done(); + } + }) + }) +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsConfigurationTest/Configuration.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsConfigurationTest/Configuration.test.ets new file mode 100644 index 000000000..61bcf451b --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsConfigurationTest/Configuration.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import common from '@ohos.app.ability.common'; +import configurationConstant from '@ohos.app.ability.ConfigurationConstant'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function Configuration() { + describe("Configuration", function () { + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(async function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info('afterEach case'); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + /** + * @tc.number : ABILITY_TEST_COLORMODE_0100 + * @tc.name : testColorMode001 + * @tc.desc : test filed of colorMode + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testColorMode001', 0, async function (done) { + try { + let colorMode = globalThis.colorMode; + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testColorMode001 colorMode:` + colorMode); + if (colorMode == configurationConstant.ColorMode.COLOR_MODE_NOT_SET) { + expect(context.config.colorMode).assertEqual(configurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } else if (colorMode == configurationConstant.ColorMode.COLOR_MODE_DARK) { + expect(context.config.colorMode).assertEqual(configurationConstant.ColorMode.COLOR_MODE_DARK); + expect(context.config.colorMode != configurationConstant.ColorMode.COLOR_MODE_NOT_SET).assertTrue(); + expect(context.config.colorMode != configurationConstant.ColorMode.COLOR_MODE_LIGHT).assertTrue(); + } else if (colorMode == configurationConstant.ColorMode.COLOR_MODE_LIGHT) { + expect(context.config.colorMode).assertEqual(configurationConstant.ColorMode.COLOR_MODE_LIGHT); + expect(context.config.colorMode != configurationConstant.ColorMode.COLOR_MODE_NOT_SET).assertTrue(); + expect(context.config.colorMode != configurationConstant.ColorMode.COLOR_MODE_DARK).assertTrue(); + } + console.log(`testColorMode001 success`); + done(); + } catch (err) { + console.log(`testColorMode001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_DIRECTION_0100 + * @tc.name : testDirection001 + * @tc.desc : test filed of direction + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testDirection001', 0, async function (done) { + try { + let direction = globalThis.direction; + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testDirection001 direction:` + direction); + if (direction == configurationConstant.Direction.DIRECTION_NOT_SET) { + expect(context.config.direction).assertEqual(configurationConstant.Direction.DIRECTION_NOT_SET); + } else if (direction == configurationConstant.Direction.DIRECTION_VERTICAL) { + expect(context.config.direction).assertEqual(configurationConstant.Direction.DIRECTION_VERTICAL); + expect(context.config.direction != configurationConstant.Direction.DIRECTION_NOT_SET).assertTrue(); + expect(context.config.direction != configurationConstant.Direction.DIRECTION_HORIZONTAL).assertTrue(); + } else if (direction == configurationConstant.Direction.DIRECTION_HORIZONTAL) { + expect(context.config.direction).assertEqual(configurationConstant.Direction.DIRECTION_HORIZONTAL); + expect(context.config.direction != configurationConstant.Direction.DIRECTION_NOT_SET).assertTrue(); + expect(context.config.direction != configurationConstant.Direction.DIRECTION_VERTICAL).assertTrue(); + } + console.log(`testDirection001 success`); + done(); + } catch (err) { + console.log(`testDirection001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + }) +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsUIAbilityContextTest/UIAbilityContext.test.ets b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsUIAbilityContextTest/UIAbilityContext.test.ets new file mode 100644 index 000000000..cf8d016eb --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/ets/test/actsUIAbilityContextTest/UIAbilityContext.test.ets @@ -0,0 +1,1513 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import common from '@ohos.app.ability.common'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function UIAbilityContext() { + describe("UIAbilityContext", function () { + let bundleName: any; + + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(async function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info('afterEach case'); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + /** + * @tc.number : ABILITY_TEST_ABILITYINFO_0100 + * @tc.name : testAbilityInfo001 + * @tc.desc : test AbilityInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testAbilityInfo001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let abilityInfo = context.abilityInfo; + expect(abilityInfo != null).assertTrue(); + + console.log(`testAbilityInfo001 abilityInfo.bundleName: ` + abilityInfo.bundleName); + expect(abilityInfo.bundleName == "com.example.contexttest").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.moduleName: ` + abilityInfo.moduleName); + expect(abilityInfo.moduleName == "entryTest").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.name: ` + abilityInfo.name); + expect(abilityInfo.name == "TestAbility").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.label: ` + abilityInfo.label); + expect(abilityInfo.label == "$string:TestAbility_label").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.labelId: ` + abilityInfo.labelId); + expect(typeof (abilityInfo.labelId) == 'number').assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.description: ` + abilityInfo.description); + expect(abilityInfo.description == "$string:TestAbility_desc").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.descriptionId: ` + abilityInfo.descriptionId); + expect(typeof (abilityInfo.descriptionId) == 'number').assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.icon: ` + abilityInfo.icon); + expect(abilityInfo.icon == "$media:icon").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.iconId: ` + abilityInfo.iconId); + expect(typeof (abilityInfo.iconId) == 'number').assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.applicationInfo: ` + abilityInfo.applicationInfo.name); + expect(abilityInfo.applicationInfo.name == "com.example.contexttest").assertTrue(); + console.log(`testAbilityInfo001 abilityInfo.metadata: ` + abilityInfo.metadata.length); + expect(abilityInfo.metadata.length >= 0).assertTrue(); + + console.log(`testAbilityInfo001 success`); + done(); + } catch (err) { + console.log(`testAbilityInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_UIABILITYCONTEXT_CURRENTHAPMODULEINFO_0100 + * @tc.name : testUIAbilityContextCurrentHapModuleInfo001 + * @tc.desc : test filed of currentHapModuleInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testUIAbilityContextCurrentHapModuleInfo001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let hapModuleInfo = context.currentHapModuleInfo; + expect(hapModuleInfo != null).assertTrue(); + + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.name: ` + hapModuleInfo.name); + expect(hapModuleInfo.name == "entryTest").assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.icon: ` + hapModuleInfo.icon); + expect(hapModuleInfo.icon == "$media:icon").assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.iconId: ` + hapModuleInfo.iconId); + expect(typeof (hapModuleInfo.iconId) == 'number').assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.label: ` + hapModuleInfo.label); + expect(hapModuleInfo.label == "$string:TestAbility_label").assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.labelId: ` + hapModuleInfo.labelId); + expect(typeof (hapModuleInfo.labelId) == 'number').assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.description: ` + hapModuleInfo.description); + expect(hapModuleInfo.description == "$string:module_test_desc").assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.descriptionId: ` + hapModuleInfo.descriptionId); + expect(typeof (hapModuleInfo.descriptionId) == 'number').assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.mainElementName: ` + hapModuleInfo.mainElementName); + expect(hapModuleInfo.mainElementName == "TestAbility").assertTrue(); + console.log(`testUIAbilityContextCurrentHapModuleInfo001 hapModuleInfo.metadata: ` + hapModuleInfo.metadata.length); + expect(hapModuleInfo.metadata.length >= 0).assertTrue(); + + console.log(`testUIAbilityContextCurrentHapModuleInfo001 success`); + done(); + } catch (err) { + console.log(`testUIAbilityContextCurrentHapModuleInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_UIABILITYCONTEXT_CONFIG_0100 + * @tc.name : testUIAbilityContextConfig001 + * @tc.desc : test filed of config + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testUIAbilityContextConfig001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let config = context.config; + expect(config != null).assertTrue(); + + console.log(`testUIAbilityContextConfig001 config.colorMode: ` + config.colorMode); + expect(typeof (config.colorMode) == 'number').assertTrue(); + console.log(`testUIAbilityContextConfig001 config.direction: ` + config.direction); + expect(typeof (config.direction) == 'number').assertTrue(); + + console.log(`testUIAbilityContextConfig001 success`); + done(); + } catch (err) { + console.log(`testUIAbilityContextConfig001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0100 + * @tc.name : testStartAbilityPromise001 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.info('testStartAbilityPromise001 start successful.'); + }).catch((error) => { + console.error('testStartAbilityPromise001 start failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1500); + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityPromise001 success`); + done(); + } catch (err) { + console.log(`testStartAbilityPromise001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0200 + * @tc.name : testStartAbilityPromise002 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise002', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.abc", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise002 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise002 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise002 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0300 + * @tc.name : testStartAbilityPromise003 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise003', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": " ", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise003 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise003 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise003 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0400 + * @tc.name : testStartAbilityPromise004 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise004', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise004 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise004 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise004 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0500 + * @tc.name : testStartAbilityPromise005 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise005', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "abc" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise005 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise005 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise005 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0600 + * @tc.name : testStartAbilityPromise006 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise006', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": " " + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise006 fail `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise006 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise006 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0800 + * @tc.name : testStartAbilityPromise008 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise008', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "abc", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise008 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise008 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise008 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0900 + * @tc.name : testStartAbilityPromise009 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise009', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.contexttest", + "abilityName": " ", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise009 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise009 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise009 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_1000 + * @tc.name : testStartAbilityPromise010 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise010', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = { + "bundleName": "com.example.contexttest", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise010 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise010 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise010 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_1100 + * @tc.name : testStartAbilityPromise011 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise011', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + var want = {} + context.startAbility(want).then(() => { + console.log(`testStartAbilityPromise011 fail: `); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(`testStartAbilityPromise011 error.code: ` + error.code); + expect(true).assertTrue(); + done(); + }) + } catch (err) { + console.log(`testStartAbilityPromise011 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_1200 + * @tc.name : testStartAbilityPromise012 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise012', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest", + "parameters": { + "key1": true, + "key2": 1, + "key3": "this is string" + } + } + context.startAbility(want).then(() => { + console.info('testStartAbilityPromise012 start successful.'); + }).catch((error) => { + console.error('testStartAbilityPromise012 start failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1500); + const result = globalThis.list1; + const parameters = globalThis.parameters; + console.info('result: ' + JSON.stringify(result)); + console.info('parameters: ' + JSON.stringify(parameters)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + expect(parameters.key1).assertEqual(true); + expect(parameters.key2).assertEqual(1); + expect(parameters.key3).assertEqual("this is string"); + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityPromise012 success`); + done(); + } catch (err) { + console.log(`testStartAbilityPromise012 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_1300 + * @tc.name : testStartAbilityPromise013 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityPromise013', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + + context.startAbility(want).then(() => { + console.info('testStartAbilityPromise013 start1 successful.'); + }).catch((error) => { + console.error('testStartAbilityPromise013 start1 failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1000); + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + let context1: common.UIAbilityContext = globalThis.ability1Context; + + context.startAbility(want).then(() => { + console.info('testStartAbilityPromise013 start2 successful.'); + }).catch((error) => { + console.error('testStartAbilityPromise013 start2 failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1000); + const result2 = globalThis.list1; + console.info('result2: ' + JSON.stringify(result2)); + expect(result2[0]).assertEqual('MainAbility1 onCreate'); + let context2: common.UIAbilityContext = globalThis.ability1Context; + + context1.terminateSelf(); + await sleep(1000); + context2.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityPromise013 success`); + done(); + } catch (err) { + console.log(`testStartAbilityPromise013 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0100 + * @tc.name : testStartAbilityCallback001 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback001 fail: ` + err); + expect().assertFail(); + done(); + } + console.info('testStartAbilityCallback001 startAbility succeed'); + }) + await sleep(1500); + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityCallback001 success`); + done(); + } catch (err) { + console.log(`testStartAbilityCallback001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0200 + * @tc.name : testStartAbilityCallback002 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback002', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.abc", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback002 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback002 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0300 + * @tc.name : testStartAbilityCallback003 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback003', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": " ", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback003 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback003 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0400 + * @tc.name : testStartAbilityCallback004 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback004', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback004 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback004 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0500 + * @tc.name : testStartAbilityCallback005 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback005', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "abc" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback005 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback005 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0600 + * @tc.name : testStartAbilityCallback006 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback006', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": " " + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback006 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback006 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0800 + * @tc.name : testStartAbilityCallback008 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback008', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "abc", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback008 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback008 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0900 + * @tc.name : testStartAbilityCallback009 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback009', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": " ", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback009 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback009 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_1000 + * @tc.name : testStartAbilityCallback010 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback010', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "moduleName": "entryTest" + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback010 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback010 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_1100 + * @tc.name : testStartAbilityCallback011 + * @tc.desc : test startAbility wrong want + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback011', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = {} + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback011 err.code: ` + err.code); + expect(true).assertTrue(); + done(); + } else { + expect().assertFail(); + done(); + } + }) + } catch (err) { + console.log(`testStartAbilityCallback011 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_1200 + * @tc.name : testStartAbilityCallback012 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback012', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest", + "parameters": { + "key1": true, + "key2": 1, + "key3": "this is string" + } + } + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback012 fail: ` + err); + expect().assertFail(); + done(); + return; + } + console.info('testStartAbilityCallback012 startAbility succeed'); + }) + await sleep(1500); + const result = globalThis.list1; + const parameters = globalThis.parameters; + console.info('result: ' + JSON.stringify(result)); + console.info('parameters: ' + JSON.stringify(parameters)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + expect(parameters.key1).assertEqual(true); + expect(parameters.key2).assertEqual(1); + expect(parameters.key3).assertEqual("this is string"); + + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityCallback012 success`); + done(); + } catch (err) { + console.log(`testStartAbilityCallback012 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_1300 + * @tc.name : testStartAbilityCallback013 + * @tc.desc : test startAbility right + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('testStartAbilityCallback013', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback013 fail1: ` + err); + expect().assertFail(); + done(); + return; + } + console.info('testStartAbilityCallback013 startAbility1 succeed'); + }) + await sleep(1000); + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[0]).assertEqual('MainAbility1 onCreate'); + let context1: common.UIAbilityContext = globalThis.ability1Context; + + context.startAbility(want, (err) => { + if (err.code) { + console.log(`testStartAbilityCallback013 fail2: ` + err); + expect().assertFail(); + done(); + return; + } + console.info('testStartAbilityCallback013 startAbility2 succeed'); + }) + await sleep(1000); + const result2 = globalThis.list1; + console.info('result: ' + JSON.stringify(result2)); + expect(result2[0]).assertEqual('MainAbility1 onCreate'); + let context2: common.UIAbilityContext = globalThis.ability1Context; + + context1.terminateSelf(); + await sleep(1000); + context2.terminateSelf(); + await sleep(1000); + + console.log(`testStartAbilityCallback013 success`); + done(); + } catch (err) { + console.log(`testStartAbilityCallback013 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_APPLICATIONINFO_PROMISE_0100 + * @tc.name : testApplicationInfoPromise001 + * @tc.desc : test filed of applicationInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testTerminateSelfPromise001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.info('testTerminateSelfPromise001 start successful. '); + }).catch((error) => { + console.error('testTerminateSelfPromise001 start failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1500); + + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf(); + await sleep(1000); + + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[1]).assertEqual('MainAbility1 onDestroy'); + + console.log(`testTerminateSelfPromise001 success`); + done(); + } catch (err) { + console.log(`testTerminateSelfPromise001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_APPLICATIONINFO_CALLBACK_0100 + * @tc.name : testApplicationInfoCallback001 + * @tc.desc : test filed of applicationInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testApplicationInfoCallback001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + + var want = { + "bundleName": "com.example.contexttest", + "abilityName": "MainAbility1", + "moduleName": "entryTest" + } + context.startAbility(want).then(() => { + console.info('testApplicationInfoCallback001 start successful. '); + }).catch((error) => { + console.error('testApplicationInfoCallback001 start failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(1500); + + let context1: common.UIAbilityContext = globalThis.ability1Context; + context1.terminateSelf((err) => { + if (err.code) { + console.log(`testApplicationInfoCallback001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + await sleep(1000); + + const result = globalThis.list1; + console.info('result: ' + JSON.stringify(result)); + expect(result[1]).assertEqual('MainAbility1 onDestroy'); + + console.log(`testApplicationInfoCallback001 success`); + done(); + } catch (err) { + console.log(`testApplicationInfoCallback001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_STAGEMODE_0100 + * @tc.name : testStageMode001 + * @tc.desc : test filed of stageMode + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testStageMode001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context.stageMode).assertTrue(); + console.log(`testStageMode001 success`); + done(); + } catch (err) { + console.log(`testStageMode001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_RESOURCEMANAGER_0100 + * @tc.name : testResourceManager001 + * @tc.desc : test filed of resourceManager + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testResourceManager001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context.resourceManager != null).assertTrue(); + console.log(`testResourceManager001 success`); + done(); + } catch (err) { + console.log(`testResourceManager001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_APPLICATIONINFO_0100 + * @tc.name : testApplicationInfo001 + * @tc.desc : test filed of applicationInfo + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testApplicationInfo001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let applicationInfo = context.applicationInfo; + expect(applicationInfo != null).assertTrue(); + + console.log(`testApplicationInfo001 applicationInfo.name: ` + applicationInfo.name); + expect(applicationInfo.name == 'com.example.contexttest').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.description: ` + applicationInfo.description.length); + expect(applicationInfo.description.length >= 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.descriptionId: ` + applicationInfo.descriptionId); + expect(applicationInfo.descriptionId == 0).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.label: ` + applicationInfo.label); + expect(applicationInfo.label == '$string:app_name').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.labelId: ` + applicationInfo.labelId); + expect(applicationInfo.labelId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.icon: ` + applicationInfo.icon); + expect(applicationInfo.icon == '$media:app_icon').assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.iconId: ` + applicationInfo.iconId); + expect(applicationInfo.iconId != null).assertTrue(); + console.log(`testApplicationInfo001 applicationInfo.codePath: ` + applicationInfo.codePath); + expect(typeof (applicationInfo.codePath) == 'string').assertTrue(); + + console.log(`testApplicationInfo001 success`); + done(); + } catch (err) { + console.log(`testApplicationInfo001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CACHEDIR_0100 + * @tc.name : testCacheDir001 + * @tc.desc : test filed of cacheDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testCacheDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testCacheDir001 cacheDir:` + context.cacheDir); + expect(typeof (context.cacheDir) == 'string').assertTrue(); + console.log(`testCacheDir001 success`); + done(); + } catch (err) { + console.log(`testCacheDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_TEMPDIR_0100 + * @tc.name : testTempDir001 + * @tc.desc : test filed of tempDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testTempDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testTempDir001 tempDir:` + context.tempDir); + expect(typeof (context.tempDir) == 'string').assertTrue(); + console.log(`testTempDir001 success`); + done(); + } catch (err) { + console.log(`testTempDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_FILESDIR_0100 + * @tc.name : testFilesDir001 + * @tc.desc : test filed of filesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testFilesDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testFilesDir001 filesDir:` + context.filesDir); + expect(typeof (context.filesDir) == 'string').assertTrue(); + console.log(`testFilesDir001 success`); + done(); + } catch (err) { + console.log(`testFilesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_DATABASEDIR_0100 + * @tc.name : testDatabaseDir001 + * @tc.desc : test filed of databaseDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testDatabaseDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testDatabaseDir001 databaseDir:` + context.databaseDir); + expect(typeof (context.databaseDir) == 'string').assertTrue(); + console.log(`testDatabaseDir001 success`); + done(); + } catch (err) { + console.log(`testDatabaseDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_PREFERENCESDIR_0100 + * @tc.name : testPreferencesDir001 + * @tc.desc : test filed of preferencesDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testPreferencesDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testPreferencesDir001 preferencesDir:` + context.preferencesDir); + expect(typeof (context.preferencesDir) == 'string').assertTrue(); + console.log(`testPreferencesDir001 success`); + done(); + } catch (err) { + console.log(`testPreferencesDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_BUNDLECODEDIR_0100 + * @tc.name : testBundleCodeDir001 + * @tc.desc : test filed of bundleCodeDir + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testBundleCodeDir001', 0, async function (done) { + try { + let context: common.UIAbilityContext = globalThis.abilityContext; + console.log(`testBundleCodeDir001 bundleCodeDir:` + context.bundleCodeDir); + expect(typeof (context.bundleCodeDir) == 'string').assertTrue(); + console.log(`testBundleCodeDir001 success`); + done(); + } catch (err) { + console.log(`testBundleCodeDir001 fail: ` + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_0100 + * @tc.name : testCreateModuleContext001 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext001", 0, async function (done) { + try { + console.info("testCreateModuleContext001 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entry"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext001 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext001 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_002 + * @tc.name : testCreateModuleContext002 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the current application hap2 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext002", 0, async function (done) { + try { + console.log("testCreateModuleContext002 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + expect(context != null).assertTrue(); + let moduleContext = context.createModuleContext("entryTest"); + expect(moduleContext != null).assertTrue(); + bundleName = moduleContext.applicationInfo.name; + console.info("testCreateModuleContext002 bundleName: " + bundleName); + expect(bundleName).assertEqual("com.example.contexttest"); + done(); + } catch (err) { + console.info("testCreateModuleContext002 err: " + err); + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_003 + * @tc.name : testCreateModuleContext003 + * @tc.desc : Context calls createModuleContext, passing in the moduleName of the cross-application hap1 + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext003", 0, async function (done) { + try { + console.info("testCreateModuleContext003 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + let moduleContext = context.createModuleContext("entry_assist"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext003 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_004 + * @tc.name : testCreateModuleContext004 + * @tc.desc : Context calls createModuleContext, passing in a non-existing moduleName + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext004", 0, async function (done) { + try { + console.info("testCreateModuleContext004 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + let moduleContext = context.createModuleContext("abc"); + expect(!moduleContext).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext004 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_CREATEMODULECONTEXT_005 + * @tc.name : testCreateModuleContext005 + * @tc.desc : Context calls createModuleContext, and the incoming moduleName is undefined + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testCreateModuleContext005", 0, async function (done) { + try { + console.info("testCreateModuleContext005 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + let moduleContext = context.createModuleContext(undefined); + expect(moduleContext != null).assertTrue(); + done(); + } catch (err) { + let e = err.toString(); + let errLog = "Invalid input parameter" + console.debug("testCreateModuleContext005 ====>e====>" + e); + expect(e.indexOf(errLog) >= 0).assertTrue(); + done(); + } + }) + + /** + * @tc.number : ABILITY_TEST_GETAPPLICATIONCONTEXT_0100 + * @tc.name : testGetApplicationContext001 + * @tc.desc : test getApplicationContext return not empty + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it("testGetApplicationContext001", 0, async function (done) { + try { + console.info("testGetApplicationContext001 begin"); + let context: common.UIAbilityContext = globalThis.abilityContext; + let applicationContext = context.getApplicationContext(); + expect(applicationContext != null).assertTrue(); + console.info("testGetApplicationContext001 success"); + done(); + } catch (err) { + console.log(`testGetApplicationContext001 fail: ` + err); + expect().assertFail(); + done(); + } + }); + }) +} diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/module.json b/ability/crossplatform/ability_runtime/actscontexttest/src/main/module.json new file mode 100644 index 000000000..384ab9e13 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/module.json @@ -0,0 +1,47 @@ +{ + "module": { + "name": "entryTest", + "type": "feature", + "description": "$string:module_test_desc", + "srcEntry": "./ets/Application/AbilityStage.ts", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/TestAbility/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "MainAbility1", + "srcEntry": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "launchType": "multiton" + } + ] + } +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/color.json b/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/color.json new file mode 100644 index 000000000..3c712962d --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/string.json b/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..cfe4072fe --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/media/icon.png b/ability/crossplatform/ability_runtime/actscontexttest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_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-Eie_&hZPmSLXO~tXGZB%ZulY z2(+8NK7YM^=(+0`2J>ch>?NApSsvMBZ=WE4@IlS4qpMfv93fxn9F`pQaM2~pvdGot z_!Y**F7tn)-1y38#ZXd!@FJVWUl~B?g_N=9MD2Y$X$^wmk8dYgB8VUR-ulTzt=cg%|7_dwu2uOz_`7t*Bb(dz-u-F` zgBeBHp#S5OTqrgIy>M*C&3I99pmO}dyakc36)oo`-#8|Abj&{)`tsi8)#SKQf9D}5 kO-JJecEg?1^8-^P) { + if (err.code) { + console.log('MainAbility loadContent error'); + return; + } + console.log('MainAbility loadContent success'); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/pages/Index.ets b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/pages/Index.ets new file mode 100644 index 000000000..326276b9d --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/ets/pages/Index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/module.json b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/module.json new file mode 100644 index 000000000..19bc237c6 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "MainAbility", + "srcEntry": "./ets/mainability/MainAbility.ts", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/color.json b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/color.json new file mode 100644 index 000000000..3c712962d --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/string.json b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..65d8fa5a7 --- /dev/null +++ b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/media/icon.png b/ability/crossplatform/ability_runtime/actscontexttestentry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..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