Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8c1adf03
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8c1adf03
编写于
11月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6639 Solve XTS ActsLifecycleSingleHapTest Fail Problem
Merge pull request !6639 from zhoujun62/my_xts_acts1
上级
95129dc9
e2507d8f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
107 addition
and
78 deletion
+107
-78
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
...lesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
+107
-78
未找到文件。
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
8c1adf03
...
...
@@ -161,14 +161,19 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var listtemp1 = [];
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1"
|| strtemp === "MainAbility2"
) {
if (strtemp === "MainAbility1") {
listtemp.push(globalThis.list1[i]);
} else if (strtemp === "MainAbility2") {
listtemp1.push(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) +
...
...
@@ -178,14 +183,14 @@ export default function lifecycleTest() {
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility
2 onAbilityCreate
");
expect(exlist[3]).assertEqual("MainAbility
2 onWindowStageCreate
");
expect(exlist
[4]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[5]).assertEqual("MainAbility1 onAbilityBackground
");
expect(exlist
[6]).assertEqual("MainAbility1
onAbilityForeground");
expect(exlist
[7
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
[8
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
[9
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist[2]).assertEqual("MainAbility
1 onAbilityBackground
");
expect(exlist[3]).assertEqual("MainAbility
1 onAbilityForeground
");
expect(exlist
1[0]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[1]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[2]).assertEqual("MainAbility2
onAbilityForeground");
expect(exlist
1[3
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
1[4
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
1[5
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0200 END-------------");
done();
...
...
@@ -230,14 +235,19 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var listtemp1 = [];
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1"
|| strtemp === "MainAbility2"
) {
if (strtemp === "MainAbility1") {
listtemp.push(globalThis.list1[i]);
} else if (strtemp === "MainAbility2") {
listtemp1.push(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)
.then((data) => {
...
...
@@ -258,14 +268,14 @@ export default function lifecycleTest() {
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility
2 onAbilityCreate
");
expect(exlist[3]).assertEqual("MainAbility
2 onWindowStageCreate
");
expect(exlist
[4]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[5]).assertEqual("MainAbility1 onAbilityBackground
");
expect(exlist
[6]).assertEqual("MainAbility1
onAbilityForeground");
expect(exlist
[7
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
[8
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
[9
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist[2]).assertEqual("MainAbility
1 onAbilityBackground
");
expect(exlist[3]).assertEqual("MainAbility
1 onAbilityForeground
");
expect(exlist
1[0]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[1]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[2]).assertEqual("MainAbility2
onAbilityForeground");
expect(exlist
1[3
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
1[4
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
1[5
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(code).assertEqual(1);
console.log("------------Singlehap_LifeCycleTest_0300 END-------------");
done();
...
...
@@ -310,14 +320,19 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid3));
var strtemp = "";
var listtemp = [];
var listtemp1 = [];
for (var i = 0; i < globalThis.list3.length; i++) {
strtemp = globalThis.list3[i].substring(0, 12);
if (strtemp === "MainAbility3"
|| strtemp === "MainAbility2"
) {
if (strtemp === "MainAbility3") {
listtemp.push(globalThis.list3[i]);
} else if (strtemp === "MainAbility2") {
listtemp1.push(globalThis.list3[i]);
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1));
let exlist = listtemp;
let exlist1 = listtemp1;
var para = {
resultCode: 1,
want: {
...
...
@@ -343,14 +358,14 @@ export default function lifecycleTest() {
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility3 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility3 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility
2 onAbilityCreate
");
expect(exlist[3]).assertEqual("MainAbility
2 onWindowStageCreate
");
expect(exlist
[4]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[5]).assertEqual("MainAbility3 onAbilityBackground
");
expect(exlist
[6]).assertEqual("MainAbility3
onAbilityForeground");
expect(exlist
[7
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
[8
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
[9
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist[2]).assertEqual("MainAbility
3 onAbilityBackground
");
expect(exlist[3]).assertEqual("MainAbility
3 onAbilityForeground
");
expect(exlist
1[0]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[1]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[2]).assertEqual("MainAbility2
onAbilityForeground");
expect(exlist
1[3
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
1[4
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
1[5
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(code).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0400 END-------------");
done();
...
...
@@ -502,7 +517,6 @@ export default function lifecycleTest() {
expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist[4]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist2[0]).assertEqual("MainAbility5 onAbilityCreate");
expect(exlist2[1]).assertEqual("MainAbility5 onWindowStageCreate");
expect(exlist2[2]).assertEqual("MainAbility5 onAbilityForeground");
...
...
@@ -703,36 +717,41 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var listtemp1 = [];
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1"
|| strtemp === "MainAbility2"
) {
if (strtemp === "MainAbility1") {
listtemp.push(globalThis.list1[i]);
} else if (strtemp === "MainAbility2") {
listtemp1.push(globalThis.list1[i]);
}
}
console.log(TAG + " listtemp is :" + listtemp);
console.log(TAG + " listtemp1 is :" + listtemp1);
let exlist = listtemp;
let exlist1 = listtemp1;
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility
2 onAbilityCreate
");
expect(exlist[3]).assertEqual("MainAbility
2 onWindowStageCreate
");
expect(exlist[4]).assertEqual("MainAbility
2 onAbilityFore
ground");
expect(exlist[5]).assertEqual("MainAbility1 onAbility
Back
ground");
expect(exlist[6]).assertEqual("MainAbility1 onAbility
Fore
ground");
expect(exlist
[7]).assertEqual("MainAbility2 onAbilityBackground
");
expect(exlist
[8]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
[9]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
[10]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
[11]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
[12]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[13]).assertEqual("MainAbility1 onAbilityBackground
");
expect(exlist
[14]).assertEqual("MainAbility1 onAbilityForeground
");
expect(exlist
[15]).assertEqual("MainAbility2 onAbilityBack
ground");
expect(exlist
[16]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
[17]).assertEqual("MainAbility2 onAbility
Destroy");
expect(exlist
[18]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
[19]).assertEqual("MainAbility2 onWindowStage
Create");
expect(exlist
[20]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[21]).assertEqual("MainAbility1 onAbilityBack
ground");
expect(exlist[2]).assertEqual("MainAbility
1 onAbilityBackground
");
expect(exlist[3]).assertEqual("MainAbility
1 onAbilityForeground
");
expect(exlist[4]).assertEqual("MainAbility
1 onAbilityBack
ground");
expect(exlist[5]).assertEqual("MainAbility1 onAbility
Fore
ground");
expect(exlist[6]).assertEqual("MainAbility1 onAbility
Back
ground");
expect(exlist
1[0]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[1]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[2]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
1[3]).assertEqual("MainAbility2 onAbilityBackground
");
expect(exlist
1[4]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
1[5]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
1[6]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[7]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[8]).assertEqual("MainAbility2 onAbilityFore
ground");
expect(exlist
1[9]).assertEqual("MainAbility2 onAbilityBackground
");
expect(exlist
1[10]).assertEqual("MainAbility2 onWindowStage
Destroy");
expect(exlist
1[11]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
1[12]).assertEqual("MainAbility2 onAbility
Create");
expect(exlist
1[13]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[14]).assertEqual("MainAbility2 onAbilityFore
ground");
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -791,32 +810,37 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var listtemp1 = [];
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1"
|| strtemp === "MainAbility2"
) {
if (strtemp === "MainAbility1") {
listtemp.push(globalThis.list1[i]);
} else if (strtemp === "MainAbility2") {
listtemp1.push(globalThis.list1[i]);
}
}
console.log(TAG + " listtemp is :" + listtemp);
console.log(TAG + " listtemp1 is :" + listtemp1);
let exlist = listtemp;
let exlist1 = listtemp1;
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onAbilityForeground");
expect(exlist[2]).assertEqual("MainAbility
2 onAbilityCreate
");
expect(exlist[3]).assertEqual("MainAbility
2 onWindowStageCreate
");
expect(exlist[4]).assertEqual("MainAbility
2 onAbilityFore
ground");
expect(exlist[5]).assertEqual("MainAbility1 onAbility
Back
ground");
expect(exlist
[6]).assertEqual("MainAbility1 onAbilityForeground
");
expect(exlist
[7]).assertEqual("MainAbility2 onAbilityBackground
");
expect(exlist
[8]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
[9]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
[10]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
[11]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
[12]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[13]).assertEqual("MainAbility1 onAbilityBackground
");
expect(exlist
[14]).assertEqual("MainAbility1
onAbilityForeground");
expect(exlist
[15
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
[16
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
[17
]).assertEqual("MainAbility2 onAbilityDestroy");
expect(exlist[2]).assertEqual("MainAbility
1 onAbilityBackground
");
expect(exlist[3]).assertEqual("MainAbility
1 onAbilityForeground
");
expect(exlist[4]).assertEqual("MainAbility
1 onAbilityBack
ground");
expect(exlist[5]).assertEqual("MainAbility1 onAbility
Fore
ground");
expect(exlist
1[0]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[1]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[2]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
1[3]).assertEqual("MainAbility2 onAbilityBackground
");
expect(exlist
1[4]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
1[5]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
1[6]).assertEqual("MainAbility2 onAbilityCreate
");
expect(exlist
1[7]).assertEqual("MainAbility2 onWindowStageCreate
");
expect(exlist
1[8]).assertEqual("MainAbility2
onAbilityForeground");
expect(exlist
1[9
]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist
1[10
]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist
1[11
]).assertEqual("MainAbility2 onAbilityDestroy");
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -1556,13 +1580,17 @@ export default function lifecycleTest() {
console.log(TAG + " secondCallback id12 : " + JSON.stringify(id4));
var strtemp = "";
var listtemp = [];
var listtemp12 = [];
for (var i = 0; i < templist1.length; i++) {
strtemp = templist1[i].substring(0, 13);
if (strtemp === "MainAbility2 "
|| strtemp === "MainAbility12"
) {
if (strtemp === "MainAbility2 ") {
listtemp.push(templist1[i]);
} else if (strtemp === "MainAbility12") {
listtemp12.push(templist1[i]);
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
console.log(TAG + " listtemp12 is :" + JSON.stringify(listtemp12));
setTimeout(function () {
var strtemp1 = "";
var listtemp1 = [];
...
...
@@ -1574,18 +1602,19 @@ export default function lifecycleTest() {
}
console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1));
let exlist = listtemp;
let exlist12 = listtemp12;
let exlist1 = listtemp1;
expect(exlist[0]).assertEqual("MainAbility
1
2 onAbilityCreate");
expect(exlist[1]).assertEqual("MainAbility
1
2 onWindowStageCreate");
expect(exlist[2]).assertEqual("MainAbility
1
2 onAbilityForeground");
expect(exlist[3]).assertEqual("MainAbility2 onAbility
Create
");
expect(exlist[4]).assertEqual("MainAbility2 onWindowStage
Create
");
expect(exlist
[5]).assertEqual("MainAbility2 onAbilityForeground
");
expect(exlist
[6]).assertEqual("MainAbility12 onAbilityBackground
");
expect(exlist
[7]).assertEqual("MainAbility12 onAbilityForeground
");
expect(exlist
[8]).assertEqual("MainAbility2 onAbilityBack
ground");
expect(exlist
[9]).assertEqual("MainAbility2 onWindowStageDestroy
");
expect(exlist
[10]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist[1]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist[3]).assertEqual("MainAbility2 onAbility
Background
");
expect(exlist[4]).assertEqual("MainAbility2 onWindowStage
Destroy
");
expect(exlist
12[0]).assertEqual("MainAbility2 onAbilityDestroy
");
expect(exlist
12[1]).assertEqual("MainAbility12 onAbilityCreate
");
expect(exlist
12[2]).assertEqual("MainAbility12 onWindowStageCreate
");
expect(exlist
12[3]).assertEqual("MainAbility12 onAbilityFore
ground");
expect(exlist
12[4]).assertEqual("MainAbility12 onAbilityBackground
");
expect(exlist
12[5]).assertEqual("MainAbility12 onAbilityForeground
");
expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate");
expect(exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录