Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ffbdf0cc
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看板
提交
ffbdf0cc
编写于
8月 31, 2023
作者:
Y
yuwenze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
Signed-off-by:
N
yuwenze
<
yuwenze1@huawei.com
>
Change-Id: I802fb5125f5494aba56df1ccf6f025f7a8ed5891
上级
c09d1cab
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
28 deletion
+29
-28
ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
...ntest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
+10
-8
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
...lesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
+19
-20
未找到文件。
ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets
浏览文件 @
ffbdf0cc
...
...
@@ -441,7 +441,7 @@ export default function OnAndOffScreenTest() {
let
flag
=
false
;
let
status1
=
undefined
;
let
life
List
=
[]
;
let
life
Set
=
new
Set
()
;
let
listCheck
=
[
"onCreate"
,
"onWindowStageCreate"
,
"onForeground"
,
"onBackground"
];
let
onCreate
=
"StageOnAndOffScreen_MainAbility2_onCreate"
;
let
onWindowStageCreate
=
"StageOnAndOffScreen_MainAbility2_onWindowStageCreate"
;
...
...
@@ -465,27 +465,27 @@ export default function OnAndOffScreenTest() {
console
.
log
(
TAG
+
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
onCreate
)
{
life
List
.
push
(
"onCreate"
);
life
Set
.
add
(
"onCreate"
);
}
if
(
data
.
event
==
onWindowStageCreate
)
{
life
List
.
push
(
"onWindowStageCreate"
);
life
Set
.
add
(
"onWindowStageCreate"
);
}
if
(
data
.
event
==
onForeground
)
{
life
List
.
push
(
"onForeground"
);
life
Set
.
add
(
"onForeground"
);
}
if
(
data
.
event
==
onBackground
)
{
life
List
.
push
(
"onBackground"
);
life
Set
.
add
(
"onBackground"
);
}
if
(
data
.
event
==
onWindowStageDestroy
)
{
life
List
.
push
(
"onWindowStageDestroy"
);
life
Set
.
add
(
"onWindowStageDestroy"
);
}
if
(
data
.
event
==
onDestroy
)
{
life
List
.
push
(
"onDestroy"
);
life
Set
.
add
(
"onDestroy"
);
}
if
(
data
.
event
==
onForeground2
&&
!
flag
)
{
...
...
@@ -497,7 +497,9 @@ export default function OnAndOffScreenTest() {
setTimeout
(
async
()
=>
{
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
console
.
log
(
TAG
+
"UnSubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
expect
(
JSON
.
stringify
(
lifeList
))
.
assertEqual
(
JSON
.
stringify
(
listCheck
));
for
(
let
i
in
listCheck
)
{
expect
(
lifeSet
.
has
(
listCheck
[
i
]))
.
assertTrue
();
}
expect
(
status1
)
.
assertTrue
();
done
();
});
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
ffbdf0cc
...
...
@@ -496,32 +496,31 @@ export default function lifecycleTest() {
console.log(TAG + " listKey1 : " + JSON.stringify(globalThis.list1));
console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = []
;
var listtemp2 = []
;
let settemp = new Set()
;
let settemp2 = new Set()
;
for (var i = 0; i < globalThis.list1.length; i++) {
strtemp = globalThis.list1[i].substring(0, 12);
if (strtemp == "MainAbility2") {
listtemp.push(globalThis.list1[i]);
settemp.add(globalThis.list1[i]);
console.log(TAG + " set1 is :" + JSON.stringify(globalThis.list1[i]));
} else if (strtemp == "MainAbility5") {
listtemp2.push(globalThis.list1[i]);
settemp2.add(globalThis.list1[i]);
console.log(TAG + " set2 is :" + JSON.stringify(globalThis.list1[i]));
}
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
console.log(TAG + " listtemp2 is :" + JSON.stringify(listtemp2));
let exlist = listtemp;
let exlist2 = listtemp2;
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(exlist2[0]).assertEqual("MainAbility5 onAbilityCreate");
expect(exlist2[1]).assertEqual("MainAbility5 onWindowStageCreate");
expect(exlist2[2]).assertEqual("MainAbility5 onAbilityForeground");
expect(exlist2[3]).assertEqual("MainAbility5 onAbilityBackground");
expect(exlist2[4]).assertEqual("MainAbility5 onWindowStageDestroy");
expect(exlist2[5]).assertEqual("MainAbility5 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(settemp2.has("MainAbility5 onAbilityCreate")).assertTrue();
expect(settemp2.has("MainAbility5 onWindowStageCreate")).assertTrue();
expect(settemp2.has("MainAbility5 onAbilityForeground")).assertTrue();
expect(settemp2.has("MainAbility5 onAbilityBackground")).assertTrue();
expect(settemp2.has("MainAbility5 onWindowStageDestroy")).assertTrue();
expect(settemp2.has("MainAbility5 onAbilityDestroy")).assertTrue();
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录