Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4fc944af
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4fc944af
编写于
9月 01, 2023
作者:
Y
yuwenze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
Signed-off-by:
N
yuwenze
<
yuwenze1@huawei.com
>
Change-Id: I08e5f94e9bd21f539d888df23710f5c25774d8d7
上级
895b7d60
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
52 deletion
+50
-52
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
...clemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
+20
-22
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/TestAbility/TestAbility.ts
...nglehaptest/entry/src/main/ets/TestAbility/TestAbility.ts
+0
-2
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
...lesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
+30
-28
未找到文件。
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
浏览文件 @
4fc944af
...
@@ -331,8 +331,6 @@ export default function abilityTest() {
...
@@ -331,8 +331,6 @@ export default function abilityTest() {
it("Multihap_LifecycleTest_005", 0, async function (done) {
it("Multihap_LifecycleTest_005", 0, async function (done) {
console.log("------------Multihap_LifecycleTest_005 start-------------");
console.log("------------Multihap_LifecycleTest_005 start-------------");
TAG = "Multihap_LifecycleTest_005";
TAG = "Multihap_LifecycleTest_005";
listKeyTemp = [];
listKeyTemp1 = [];
globalThis.abilityContext.startAbility({
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
bundleName: "com.example.lifecycletest",
...
@@ -361,31 +359,31 @@ export default function abilityTest() {
...
@@ -361,31 +359,31 @@ export default function abilityTest() {
setTimeout(() => {
setTimeout(() => {
console.log(TAG + ": second Hap2MainAbility7 startAbility success, err: " + JSON.stringify(error) +
console.log(TAG + ": second Hap2MainAbility7 startAbility success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
",data: " + JSON.stringify(data));
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
let setTemp = new Set();
let setTemp1 = new Set();
for (var i = 0; i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
setTemp.add(globalThis.mainAbility4ListKey[i]);
console.log(TAG + " setTemp entry is :" + JSON.stringify(globalThis.mainAbility4ListKey[i]));
} else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility7") {
} else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility7") {
listKeyTemp1.push(globalThis.mainAbility4ListKey[i]);
setTemp1.add(globalThis.mainAbility4ListKey[i]);
console.log(TAG + " setTemp1 entry is :" + JSON.stringify(globalThis.mainAbility4ListKey[i]));
}
}
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "listKeyTemp1 is :" + listKeyTemp1);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onAbilityCreate");
expect(setTemp.has("Hap2MainAbility6 onAbilityCreate")).assertTrue();
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageCreate");
expect(setTemp.has("Hap2MainAbility6 onWindowStageCreate")).assertTrue();
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onAbilityForeground");
expect(setTemp.has("Hap2MainAbility6 onAbilityForeground")).assertTrue();
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onAbilityBackground");
expect(setTemp.has("Hap2MainAbility6 onAbilityBackground")).assertTrue();
var transferStr0 = listKeyTemp[4] + listKeyTemp[5];
expect(setTemp.has("Hap2MainAbility6 onWindowStageDestroy")).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onAbilityDestroy")).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onAbilityDestroy")!=-1).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onAbilityCreate")).assertTrue();
expect(listKeyTemp1[0]).assertEqual("Hap2MainAbility7 onAbilityCreate");
expect(setTemp1.has("Hap2MainAbility7 onWindowStageCreate")).assertTrue();
expect(listKeyTemp1[1]).assertEqual("Hap2MainAbility7 onWindowStageCreate");
expect(setTemp1.has("Hap2MainAbility7 onAbilityForeground")).assertTrue();
expect(listKeyTemp1[2]).assertEqual("Hap2MainAbility7 onAbilityForeground");
expect(setTemp1.has("Hap2MainAbility7 onAbilityBackground")).assertTrue();
expect(listKeyTemp1[3]).assertEqual("Hap2MainAbility7 onAbilityBackground");
expect(setTemp1.has("Hap2MainAbility7 onWindowStageDestroy")).assertTrue();
var transferStr0 = listKeyTemp1[4] + listKeyTemp1[5];
expect(setTemp1.has("Hap2MainAbility7 onAbilityDestroy")).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility7 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility7 onAbilityDestroy")!=-1).assertTrue();
globalThis.ApplicationContext4
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/TestAbility/TestAbility.ts
浏览文件 @
4fc944af
...
@@ -32,8 +32,6 @@ export default class TestAbility extends Ability {
...
@@ -32,8 +32,6 @@ export default class TestAbility extends Ability {
}
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
});
globalThis
.
abilityContext
=
this
.
context
;
}
}
onWindowStageDestroy
()
{
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
4fc944af
...
@@ -94,15 +94,14 @@ export default function lifecycleTest() {
...
@@ -94,15 +94,14 @@ export default function lifecycleTest() {
tempCallbackId = globalThis.callbackid;
tempCallbackId = globalThis.callbackid;
console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId));
console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId));
var strtemp = "";
var strtemp = "";
var listtemp = []
;
let settemp = new Set()
;
for (var i = 0; i < globalThis.list.length; i++) {
for (var i = 0; i < globalThis.list.length; i++) {
strtemp = globalThis.list[i].substring(0, 12);
strtemp = globalThis.list[i].substring(0, 12);
if (strtemp === "MainAbility2") {
if (strtemp === "MainAbility2") {
listtemp.push(globalThis.list[i]);
settemp.add(globalThis.list[i]);
console.log(TAG + " entry is :" + JSON.stringify(globalThis.list[i]));
}
}
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.applicationContext
globalThis.applicationContext
.unregisterAbilityLifecycleCallback(tempCallbackId, (error, data) => {
.unregisterAbilityLifecycleCallback(tempCallbackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
@@ -110,12 +109,12 @@ export default function lifecycleTest() {
...
@@ -110,12 +109,12 @@ export default function lifecycleTest() {
code = error.code;
code = error.code;
});
});
setTimeout(function () {
setTimeout(function () {
expect(
exlist[0]).assertEqual("MainAbility2 onAbilityCreate"
);
expect(
settemp.has("MainAbility2 onAbilityCreate")).assertTrue(
);
expect(
exlist[1]).assertEqual("MainAbility2 onWindowStageCreate"
);
expect(
settemp.has("MainAbility2 onWindowStageCreate")).assertTrue(
);
expect(
exlist[2]).assertEqual("MainAbility2 onAbilityForeground"
);
expect(
settemp.has("MainAbility2 onAbilityForeground")).assertTrue(
);
expect(
exlist[3]).assertEqual("MainAbility2 onAbilityBackground"
);
expect(
settemp.has("MainAbility2 onAbilityBackground")).assertTrue(
);
expect(
exlist[4]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
settemp.has("MainAbility2 onWindowStageDestroy")).assertTrue(
);
expect(
exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"
);
expect(
settemp.has("MainAbility2 onAbilityDestroy")).assertTrue(
);
expect(code).assertEqual(0);
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0100 END-------------");
console.log("------------Singlehap_LifeCycleTest_0100 END-------------");
done();
done();
...
@@ -159,20 +158,23 @@ export default function lifecycleTest() {
...
@@ -159,20 +158,23 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1));
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var strtemp = "";
var listtemp = []
;
let maptemp = new Map()
;
var listtemp1 = []
;
let settemp = new Set()
;
for (var i = 0; i < globalThis.list1.length; i++) {
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1") {
if (strtemp === "MainAbility1") {
listtemp.push(globalThis.list1[i]);
if (maptemp.has(globalThis.list1[i])) {
let value = maptemp.get(globalThis.list1[i]);
maptemp.set(globalThis.list1[i], value + 1);
} else {
maptemp.set(globalThis.list1[i], 1);
}
console.log(TAG + " maptemp entry is :" + JSON.stringify(globalThis.list1[i]));
} else if (strtemp === "MainAbility2") {
} else if (strtemp === "MainAbility2") {
listtemp1.push(globalThis.list1[i]);
settemp.add(globalThis.list1[i]);
console.log(TAG + " settemp entry is :" + JSON.stringify(globalThis.list1[i]));
}
}
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1));
let exlist = listtemp;
let exlist1 = listtemp1;
globalThis.applicationContext1
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
@@ -180,16 +182,16 @@ export default function lifecycleTest() {
...
@@ -180,16 +182,16 @@ export default function lifecycleTest() {
code = error.code;
code = error.code;
})
})
setTimeout(function () {
setTimeout(function () {
expect(
exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"
);
expect(
maptemp.has("MainAbility1 onWindowStageCreate")).assertTrue(
);
expect(
exlist[1]).assertEqual("MainAbility1 onAbilityForeground"
);
expect(
maptemp.get("MainAbility1 onAbilityForeground")).assertEqual(2
);
expect(
exlist[2]).assertEqual("MainAbility1 onAbilityBackground"
);
expect(
maptemp.has("MainAbility1 onAbilityBackground")).assertTrue(
);
expect(exlist[3]).assertEqual("MainAbility1 onAbilityForeground");
expect(
exlist1[0]).assertEqual("MainAbility2 onAbilityCreate"
);
expect(
settemp.has("MainAbility2 onAbilityCreate")).assertTrue(
);
expect(
exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate"
);
expect(
settemp.has("MainAbility2 onWindowStageCreate")).assertTrue(
);
expect(
exlist1[2]).assertEqual("MainAbility2 onAbilityForeground"
);
expect(
settemp.has("MainAbility2 onAbilityForeground")).assertTrue(
);
expect(
exlist1[3]).assertEqual("MainAbility2 onAbilityBackground"
);
expect(
settemp.has("MainAbility2 onAbilityBackground")).assertTrue(
);
expect(
exlist1[4]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
settemp.has("MainAbility2 onWindowStageDestroy")).assertTrue(
);
expect(
exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy"
);
expect(
settemp.has("MainAbility2 onAbilityDestroy")).assertTrue(
);
expect(code).assertEqual(0);
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0200 END-------------");
console.log("------------Singlehap_LifeCycleTest_0200 END-------------");
done();
done();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录