Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e7793130
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看板
提交
e7793130
编写于
8月 25, 2022
作者:
Z
zhoujun62
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
solve stage life cycle problem
Signed-off-by:
N
zhoujun62
<
zhoujun62@huawei.com
>
上级
8b0ce0a2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
171 addition
and
157 deletion
+171
-157
ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
...clemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
+82
-64
ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
...lesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
+89
-93
未找到文件。
ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
浏览文件 @
e7793130
...
...
@@ -66,6 +66,7 @@ export default function abilityTest() {
console.info("---------------Multihap_WindowStageLifecycleTest_001 is start---------------")
TAG = "Multihap_WindowStageLifecycleTest_001";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -87,14 +88,15 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility3") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(
listKeyTemp[0]).assertEqual("Hap2MainAbility3 onWindowStageCreate"
);
expect(
listKeyTemp[1]).assertEqual("Hap2MainAbility3 onWindowStageActive"
);
expect(
listKeyTemp[2]).assertEqual("Hap2MainAbility3 onWindowStageInactive"
);
expect(
listKeyTemp[3]).assertEqual("Hap2MainAbility3 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("Hap2MainAbility3 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility3 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility3 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility3 onWindowStageDestroy")!=-1).assertTrue(
);
console.info(TAG + "globalThis.ApplicationContext4 is :" + JSON.stringify(globalThis.ApplicationContext4));
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
...
...
@@ -118,6 +120,7 @@ export default function abilityTest() {
console.log("------------Multihap_WindowStageLifecycleTest_002 start-------------");
TAG = "Multihap_WindowStageLifecycleTest_002";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -149,14 +152,15 @@ export default function abilityTest() {
for (var i = 0; i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility4") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(
listKeyTemp[0]).assertEqual("Hap2MainAbility4 onWindowStageCreate"
);
expect(
listKeyTemp[1]).assertEqual("Hap2MainAbility4 onWindowStageActive"
);
expect(
listKeyTemp[2]).assertEqual("Hap2MainAbility4 onWindowStageInactive"
);
expect(
listKeyTemp[3]).assertEqual("Hap2MainAbility4 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("Hap2MainAbility4 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility4 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility4 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility4 onWindowStageDestroy")!=-1).assertTrue(
);
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -179,6 +183,7 @@ export default function abilityTest() {
console.log("------------Multihap_WindowStageLifecycleTest_003 start-------------");
TAG = "Multihap_WindowStageLifecycleTest_003";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -210,19 +215,19 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility5") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(listKeyTemp[0]).assertEqual("Hap2MainAbility5 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility5 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility5 onWindowStageCreate");
var transferStr0 = listKeyTemp[3] + listKeyTemp[4];
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageInactive")!=-1).assertTrue();
expect(listKeyTemp[5]).assertEqual("Hap2MainAbility5 onWindowStageDestroy");
expect(listKeyTemp[6]).assertEqual("Hap2MainAbility5 onWindowStageInactive");
expect(listKeyTemp[7]).assertEqual("Hap2MainAbility5 onWindowStageDestroy");
expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageDestroy")!=-1).assertTrue();
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -246,6 +251,8 @@ export default function abilityTest() {
TAG = "Multihap_WindowStageLifecycleTest_004";
listKeyTemp = [];
listKeyTemp1 = [];
var transferStr0 = "";
var transferStr1 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -277,23 +284,24 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
} else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility2") {
listKeyTemp1.push(globalThis.mainAbility4ListKey[i]);
transferStr1 += 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 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive");
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy");
expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility2 onWindowStageCreate");
expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility2 onWindowStageActive");
expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility2 onWindowStageInactive");
expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -317,6 +325,8 @@ export default function abilityTest() {
TAG = "Multihap_WindowStageLifecycleTest_005";
listKeyTemp = [];
listKeyTemp1 = [];
var transferStr0 = "";
var transferStr1 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -348,22 +358,24 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
} else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility7") {
listKeyTemp1.push(globalThis.mainAbility4ListKey[i]);
transferStr1 += 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 onWindowStageCreate"
);
expect(
listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive"
);
expect(
listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive"
);
expect(
listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue(
);
expect(
listKeyTemp1[0]).assertEqual("Hap2MainAbility7 onWindowStageCreate"
);
expect(
listKeyTemp1[1]).assertEqual("Hap2MainAbility7 onWindowStageActive"
);
expect(
listKeyTemp1[2]).assertEqual("Hap2MainAbility7 onWindowStageInactive"
);
expect(
listKeyTemp1[3]).assertEqual("Hap2MainAbility7 onWindowStageDestroy"
);
expect(
transferStr1.indexOf("Hap2MainAbility7 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr1.indexOf("Hap2MainAbility7 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr1.indexOf("Hap2MainAbility7 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr1.indexOf("Hap2MainAbility7 onWindowStageDestroy")!=-1).assertTrue(
);
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
...
...
@@ -470,6 +482,8 @@ export default function abilityTest() {
TAG = "Multihap_WindowStageLifecycleTest_007";
listKeyTemp = [];
listKeyTemp1 = [];
var transferStr0 = "";
var transferStr1 = "";
var callBackId1;
var callBackId2;
var flag;
...
...
@@ -494,17 +508,17 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility6ListKey.length; i++) {
if (globalThis.mainAbility6ListKey[i].substring(0, 16) == "Hap2MainAbility9") {
listKeyTemp.push(globalThis.mainAbility6ListKey[i]);
transferStr0 += globalThis.mainAbility6ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "first globalThis.mainAbility6CallBackId is :" + globalThis.mainAbility6CallBackId);
callBackId1 = globalThis.mainAbility6CallBackId
console.log(TAG + "callBackId1 is :" + callBackId1);
expect(listKeyTemp[0]).assertEqual("Hap2MainAbility9 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility9 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility9 onWindowStageInactive");
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility9 onWindowStageDestroy");
expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageDestroy")!=-1).assertTrue();
globalThis.ApplicationContext6
.unregisterAbilityLifecycleCallback(globalThis.mainAbility6CallBackId, (error, data) => {
console.log(TAG + ": first unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -542,6 +556,7 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility6ListKey.length; i++) {
if (globalThis.mainAbility6ListKey[i].substring(0, 16) == "Hap2MainAbility9") {
listKeyTemp1.push(globalThis.mainAbility6ListKey[i]);
transferStr1 += globalThis.mainAbility6ListKey[i];
}
}
console.log(TAG + "listKeyTemp1 is :" + listKeyTemp1);
...
...
@@ -549,11 +564,10 @@ export default function abilityTest() {
callBackId2 = globalThis.mainAbility6CallBackId
console.log(TAG + "callBackId2 is :" + callBackId2);
expect(callBackId2).assertEqual(callBackId1 + 1)
expect(listKeyTemp1[0]).assertEqual("Hap2MainAbility9 onWindowStageCreate");
expect(listKeyTemp1[1]).assertEqual("Hap2MainAbility9 onWindowStageActive");
expect(listKeyTemp1[2]).assertEqual("Hap2MainAbility9 onWindowStageInactive");
expect(listKeyTemp1[3]).assertEqual("Hap2MainAbility9 onWindowStageDestroy");
expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageDestroy")!=-1).assertTrue();
globalThis.ApplicationContext6
.unregisterAbilityLifecycleCallback(globalThis.mainAbility6CallBackId, (error, data) => {
console.log(TAG + ": second unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -581,6 +595,7 @@ export default function abilityTest() {
console.log("------------Multihap_WindowStageLifecycleTest_008 start-------------");
TAG = "Multihap_WindowStageLifecycleTest_008";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -603,15 +618,15 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId);
expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive");
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy");
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue();
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
console.log(TAG + ": first unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) +
...
...
@@ -641,6 +656,8 @@ export default function abilityTest() {
TAG = "Multihap_WindowStageLifecycleTest_009";
listKeyTemp = [];
listKeyTemp1 = [];
var transferStr0 = "";
var transferStr1 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.lifecycletest",
...
...
@@ -709,29 +726,30 @@ export default function abilityTest() {
for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) {
if (globalThis.mainAbility4ListKey[i].substring(0, 17) == "Hap2MainAbility10") {
listKeyTemp.push(globalThis.mainAbility4ListKey[i]);
transferStr0 += globalThis.mainAbility4ListKey[i];
} else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility3") {
listKeyTemp1.push(globalThis.mainAbility4ListKey[i]);
transferStr1 += 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("Hap2MainAbility10 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap2MainAbility10 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap2MainAbility10 onWindowStageInactive");
expect(listKeyTemp[3]).assertEqual("Hap2MainAbility10 onWindowStageActive");
expect(listKeyTemp[4]).assertEqual("Hap2MainAbility10 onWindowStageInactive");
expect(listKeyTemp[5]).assertEqual("Hap2MainAbility10 onWindowStageActive");
expect(listKeyTemp[6]).assertEqual("Hap2MainAbility10 onWindowStageInactive");
expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility3 onWindowStageCreate");
expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility3 onWindowStageActive");
expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility3 onWindowStageInactive");
expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility3 onWindowStageActive");
expect(listKeyTemp1[4]).assertEqual("Hap3MainAbility3 onWindowStageInactive");
expect(listKeyTemp1[5]).assertEqual("Hap3MainAbility3 onWindowStageActive");
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue();
globalThis.ApplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
e7793130
...
...
@@ -96,14 +96,15 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list.length; i++) {
strtemp = globalThis.list[i].substring(0, 12);
if (strtemp === "MainAbility2") {
listtemp.push(globalThis.list[i]);
transferStr0 += 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) +
...
...
@@ -111,10 +112,10 @@ export default function lifecycleTest() {
code = error.code;
});
setTimeout(function () {
expect(
exlist[0]).assertEqual("MainAbility2 onWindowStageCreate"
);
expect(
exlist[1]).assertEqual("MainAbility2 onWindowStageActive"
);
expect(
exlist[2]).assertEqual("MainAbility2 onWindowStageInactive"
);
expect(
exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(
);
expect(code).assertEqual(0);
console.log("------------Singlehap_WindowStageLifeCycleTest_0100 END-------------");
done();
...
...
@@ -159,14 +160,15 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1" || strtemp === "MainAbility2") {
listtemp.push(globalThis.list1[i]);
transferStr0 += globalThis.list1[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -174,16 +176,14 @@ export default function lifecycleTest() {
code = error.code;
})
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
var transferStr1 = exlist[5] + exlist[6];
expect(transferStr1.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(code).assertEqual(0);
console.log("------------Singlehap_WindowStageLifeCycleTest_0200 END-------------");
done();
...
...
@@ -228,14 +228,15 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1" || strtemp === "MainAbility2") {
listtemp.push(globalThis.list1[i]);
transferStr0 += globalThis.list1[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1)
.then((data) => {
...
...
@@ -254,16 +255,14 @@ export default function lifecycleTest() {
})
}, 500);
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
var transferStr0 = exlist[5] + exlist[6];
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(
exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(
);
expect(code).assertEqual(1);
console.log("------------Singlehap_WindowStageLifeCycleTest_0300 END-------------");
done();
...
...
@@ -308,10 +307,12 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid3));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list3.length; i++) {
strtemp = globalThis.list3[i].substring(0, 12);
if (strtemp === "MainAbility3" || strtemp === "MainAbility2") {
listtemp.push(globalThis.list3[i]);
transferStr0 += globalThis.list3[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
...
...
@@ -339,16 +340,14 @@ export default function lifecycleTest() {
})
}, 500);
setTimeout(function () {
expect(exlist[0]).assertEqual("MainAbility3 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility3 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility3 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility3 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
var transferStr0 = exlist[5] + exlist[6];
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility3 onWindowStageActive")!=-1).assertTrue();
expect(
exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(
);
expect(code).assertEqual(0);
console.log("------------Singlehap_WindowStageLifeCycleTest_0400 END-------------");
done();
...
...
@@ -404,23 +403,23 @@ export default function lifecycleTest() {
console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp == "MainAbility5" || strtemp == "MainAbility2") {
listtemp.push(globalThis.list1[i]);
transferStr0 += globalThis.list1[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
expect(exlist[0]).assertEqual("MainAbility5 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility5 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility5 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility5 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility5 onWindowStageInactive")!=-1).assertTrue();
expect(
exlist[5]).assertEqual("MainAbility5 onWindowStageDestroy"
);
expect(
exlist[6]).assertEqual("MainAbility2 onWindowStageInactive"
);
expect(
exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("MainAbility5 onWindowStageDestroy")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(
);
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -493,34 +492,30 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1" || strtemp === "MainAbility2") {
listtemp.push(globalThis.list1[i]);
transferStr0 += globalThis.list1[i];
}
}
console.log(TAG + " listtemp is :" + listtemp);
let exlist = listtemp;
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
var transferStr0 = exlist[5] + exlist[6];
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist[8]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[9] + exlist[10];
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
var transferStr0 = exlist[11] + exlist[12];
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist[13]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist[14]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[15] + exlist[16];
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
globalThis.applicationContext1
...
...
@@ -581,32 +576,29 @@ export default function lifecycleTest() {
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp === "MainAbility1" || strtemp === "MainAbility2") {
listtemp.push(globalThis.list1[i]);
transferStr0 += globalThis.list1[i];
}
}
console.log(TAG + " listtemp is :" + listtemp);
let exlist = listtemp;
expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
var transferStr0 = exlist[5] + exlist[6];
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist[8]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[9] + exlist[10];
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue();
var transferStr0 = exlist[11] + exlist[12];
expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(
exlist[13]).assertEqual("MainAbility2 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(
);
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -680,6 +672,7 @@ export default function lifecycleTest() {
console.log("------------Singlehap_WindowStageLifeCycleTest_0900 start-------------");
TAG = "Singlehap_WindowStageLifeCycleTest_0900";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.windowstagelifecycle_xts",
abilityName: "MainAbility9"
...
...
@@ -706,14 +699,15 @@ export default function lifecycleTest() {
for (var i = 0; i < globalThis.mainAbility9ListKey.length; i++) {
if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility1") {
listKeyTemp.push(globalThis.mainAbility9ListKey[i]);
transferStr0 += globalThis.mainAbility9ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId);
expect(
listKeyTemp[0]).assertEqual("Hap1MainAbility1 onWindowStageCreate"
);
expect(
listKeyTemp[1]).assertEqual("Hap1MainAbility1 onWindowStageActive"
);
expect(
listKeyTemp[2]).assertEqual("Hap1MainAbility1 onWindowStageInactive"
);
expect(
listKeyTemp[3]).assertEqual("Hap1MainAbility1 onWindowStageDestroy"
);
expect(
transferStr0.indexOf("Hap1MainAbility1 onWindowStageCreate")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap1MainAbility1 onWindowStageActive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap1MainAbility1 onWindowStageInactive")!=-1).assertTrue(
);
expect(
transferStr0.indexOf("Hap1MainAbility1 onWindowStageDestroy")!=-1).assertTrue(
);
globalThis.applicationContext9
.unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -735,6 +729,7 @@ export default function lifecycleTest() {
console.log("------------Singlehap_WindowStageLifeCycleTest_1000 start-------------");
TAG = "Singlehap_WindowStageLifeCycleTest_1000";
listKeyTemp = [];
var transferStr0 = "";
globalThis.abilityContext.startAbility({
bundleName: "com.example.windowstagelifecycle_xts",
abilityName: "MainAbility9"
...
...
@@ -761,19 +756,19 @@ export default function lifecycleTest() {
for (var i = 0;i < globalThis.mainAbility9ListKey.length; i++) {
if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility2") {
listKeyTemp.push(globalThis.mainAbility9ListKey[i]);
transferStr0 += globalThis.mainAbility9ListKey[i];
}
}
console.log(TAG + "listKeyTemp is :" + listKeyTemp);
console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId);
expect(listKeyTemp[0]).assertEqual("Hap1MainAbility2 onWindowStageCreate");
expect(listKeyTemp[1]).assertEqual("Hap1MainAbility2 onWindowStageActive");
expect(listKeyTemp[2]).assertEqual("Hap1MainAbility2 onWindowStageCreate");
var transferStr0 = listKeyTemp[3] + listKeyTemp[4];
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(listKeyTemp[5]).assertEqual("Hap1MainAbility2 onWindowStageDestroy");
expect(listKeyTemp[6]).assertEqual("Hap1MainAbility2 onWindowStageInactive");
expect(listKeyTemp[7]).assertEqual("Hap1MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
globalThis.applicationContext9
.unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
...
...
@@ -852,18 +847,19 @@ export default function lifecycleTest() {
console.log(TAG + " secondCallback id : " + JSON.stringify(id2));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list11.length; i++) {
strtemp = globalThis.list11[i].substring(0, 12);
if (strtemp == "MainAbility2") {
listtemp.push(globalThis.list11[i]);
transferStr0 += globalThis.list11[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
expect(exlist[0]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility2 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageInactive");
expect(exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(id1 + 1).assertEqual(id2);
globalThis.applicationContext11
.unregisterAbilityLifecycleCallback(globalThis.callbackid11, (error, data) => {
...
...
@@ -959,18 +955,19 @@ export default function lifecycleTest() {
console.log(TAG + " secondCallback id : " + JSON.stringify(id2));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < globalThis.list12.length; i++) {
strtemp = globalThis.list12[i].substring(0, 12);
if (strtemp == "MainAbility2") {
listtemp.push(globalThis.list12[i]);
transferStr0 += globalThis.list12[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
expect(exlist[0]).assertEqual("MainAbility2 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility2 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageInactive");
expect(exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(id1 + 1).assertEqual(id2);
globalThis.applicationContext12
.unregisterAbilityLifecycleCallback(id2, (error, data) => {
...
...
@@ -1121,40 +1118,39 @@ export default function lifecycleTest() {
console.log(TAG + " secondCallback id12 : " + JSON.stringify(id4));
var strtemp = "";
var listtemp = [];
var transferStr0 = "";
for (var i = 0; i < templist1.length; i++) {
strtemp = templist1[i].substring(0, 13);
if (strtemp === "MainAbility2 " || strtemp === "MainAbility12") {
listtemp.push(templist1[i]);
transferStr0 += templist1[i];
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
setTimeout(function () {
var strtemp1 = "";
var listtemp1 = [];
var transferStr1 = "";
for (var j = 0; j < templist2.length; j++) {
strtemp1 = templist2[j].substring(0, 12);
if (strtemp1 === "MainAbility2") {
listtemp1.push(templist2[j]);
transferStr1 += templist2[j];
}
}
console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1));
let exlist = listtemp;
let exlist1 = listtemp1;
expect(exlist[0]).assertEqual("MainAbility12 onWindowStageCreate");
expect(exlist[1]).assertEqual("MainAbility12 onWindowStageActive");
expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist[3] + exlist[4];
expect(transferStr0.indexOf("MainAbility12 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility12 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility12 onWindowStageInactive")!=-1).assertTrue();
var transferStr0 = exlist[5] + exlist[6];
expect(transferStr0.indexOf("MainAbility12 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(exlist1[0]).assertEqual("MainAbility2 onWindowStageCreate");
var transferStr0 = exlist1[1] + exlist1[2];
expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(exlist1[3]).assertEqual("MainAbility2 onWindowStageDestroy");
expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(transferStr1.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();;
expect(transferStr1.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue();
expect(transferStr1.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue();
expect(transferStr1.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue();
expect(id1 + 1).assertEqual(id2);
expect(id3 + 1).assertEqual(id4);
globalThis.applicationContext12
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录