Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
630f5f2b
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看板
未验证
提交
630f5f2b
编写于
9月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!10009 修复ActsLifecycleMultiHapTest用例
Merge pull request !10009 from 于文泽/master
上级
4681ccfb
4fc944af
变更
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
浏览文件 @
630f5f2b
...
...
@@ -331,8 +331,6 @@ export default function abilityTest() {
it("Multihap_LifecycleTest_005", 0, async function (done) {
console.log("------------Multihap_LifecycleTest_005 start-------------");
TAG = "Multihap_LifecycleTest_005";
listKeyTemp = [];
listKeyTemp1 = [];
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -361,31 +359,31 @@ export default function abilityTest() {
setTimeout(() => {
console.log(TAG + ": second Hap2MainAbility7 startAbility success, err: " + JSON.stringify(error) +
",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") {
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") {
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);
expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onAbilityCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageCreate");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onAbilityForeground");
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onAbilityBackground");
var transferStr0 = listKeyTemp[4] + listKeyTemp[5];
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onAbilityDestroy")!=-1).assertTrue();
expect(listKeyTemp1[0]).assertEqual("Hap2MainAbility7 onAbilityCreate");
expect(listKeyTemp1[1]).assertEqual("Hap2MainAbility7 onWindowStageCreate");
expect(listKeyTemp1[2]).assertEqual("Hap2MainAbility7 onAbilityForeground");
expect(listKeyTemp1[3]).assertEqual("Hap2MainAbility7 onAbilityBackground");
var transferStr0 = listKeyTemp1[4] + listKeyTemp1[5];
expect(transferStr0.indexOf("Hap2MainAbility7 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility7 onAbilityDestroy")!=-1).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onAbilityCreate")).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onWindowStageCreate")).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onAbilityForeground")).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onAbilityBackground")).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onWindowStageDestroy")).assertTrue();
expect(setTemp.has("Hap2MainAbility6 onAbilityDestroy")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onAbilityCreate")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onWindowStageCreate")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onAbilityForeground")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onAbilityBackground")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onWindowStageDestroy")).assertTrue();
expect(setTemp1.has("Hap2MainAbility7 onAbilityDestroy")).assertTrue();
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/TestAbility/TestAbility.ts
浏览文件 @
630f5f2b
...
...
@@ -32,8 +32,6 @@ export default class TestAbility extends Ability {
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
630f5f2b
...
...
@@ -94,15 +94,14 @@ export default function lifecycleTest() {
tempCallbackId = globalThis.callbackid;
console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId));
var strtemp = "";
var listtemp = []
;
let settemp = new Set()
;
for (var i = 0; i < globalThis.list.length; i++) {
strtemp = globalThis.list[i].substring(0, 12);
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
.unregisterAbilityLifecycleCallback(tempCallbackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -110,12 +109,12 @@ export default function lifecycleTest() {
code = error.code;
});
setTimeout(function () {
expect(
exlist[0]).assertEqual("MainAbility2 onAbilityCreate"
);
expect(
exlist[1]).assertEqual("MainAbility2 onWindowStageCreate"
);
expect(
exlist[2]).assertEqual("MainAbility2 onAbilityForeground"
);
expect(
exlist[3]).assertEqual("MainAbility2 onAbilityBackground"
);
expect(
exlist[4]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"
);
expect(
settemp.has("MainAbility2 onAbilityCreate")).assertTrue(
);
expect(
settemp.has("MainAbility2 onWindowStageCreate")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityForeground")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityBackground")).assertTrue(
);
expect(
settemp.has("MainAbility2 onWindowStageDestroy")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityDestroy")).assertTrue(
);
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0100 END-------------");
done();
...
...
@@ -159,20 +158,23 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = []
;
var listtemp1 = []
;
let maptemp = new Map()
;
let settemp = new Set()
;
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
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") {
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
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -180,16 +182,16 @@ export default function lifecycleTest() {
code = error.code;
})
setTimeout(function () {
expect(
exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"
);
expect(
exlist[1]).assertEqual("MainAbility1 onAbilityForeground"
);
expect(
exlist[2]).assertEqual("MainAbility1 onAbilityBackground"
);
expect(exlist[3]).assertEqual("MainAbility1 onAbilityForeground");
expect(
exlist1[0]).assertEqual("MainAbility2 onAbilityCreate"
);
expect(
exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate"
);
expect(
exlist1[2]).assertEqual("MainAbility2 onAbilityForeground"
);
expect(
exlist1[3]).assertEqual("MainAbility2 onAbilityBackground"
);
expect(
exlist1[4]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy"
);
expect(
maptemp.has("MainAbility1 onWindowStageCreate")).assertTrue(
);
expect(
maptemp.get("MainAbility1 onAbilityForeground")).assertEqual(2
);
expect(
maptemp.has("MainAbility1 onAbilityBackground")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityCreate")).assertTrue(
);
expect(
settemp.has("MainAbility2 onWindowStageCreate")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityForeground")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityBackground")).assertTrue(
);
expect(
settemp.has("MainAbility2 onWindowStageDestroy")).assertTrue(
);
expect(
settemp.has("MainAbility2 onAbilityDestroy")).assertTrue(
);
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0200 END-------------");
done();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录