Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2e8a82a8
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看板
提交
2e8a82a8
编写于
7月 12, 2023
作者:
H
hu0475
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'测试abilityconstant'
Signed-off-by:
N
hu0475
<
huyanqiang5@huawei.com
>
上级
25107fb1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
0 deletion
+39
-0
ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/MainAbility1/MainAbility1.ts
...iAbilityEtsTest/src/main/ets/MainAbility1/MainAbility1.ts
+1
-0
ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets
...bilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets
+38
-0
未找到文件。
ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/MainAbility1/MainAbility1.ts
浏览文件 @
2e8a82a8
...
@@ -28,6 +28,7 @@ export default class MainAbility1 extends Ability {
...
@@ -28,6 +28,7 @@ export default class MainAbility1 extends Ability {
onCreate
(
want
,
launchParam
)
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] MainAbility1 onCreate
"
)
console
.
log
(
"
[Demo] MainAbility1 onCreate
"
)
globalThis
.
launchParam1
=
launchParam
;
abilityName
=
want
.
abilityName
abilityName
=
want
.
abilityName
globalThis
.
list1
=
[];
globalThis
.
list1
=
[];
recordLife
(
globalThis
.
list1
,
abilityName
,
'
onCreate
'
);
recordLife
(
globalThis
.
list1
,
abilityName
,
'
onCreate
'
);
...
...
ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets
浏览文件 @
2e8a82a8
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import aConstant from '@ohos.app.ability.AbilityConstant'
function sleep(time) {
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
return new Promise((resolve) => setTimeout(resolve, time));
...
@@ -481,5 +482,42 @@ export default function abilityTest() {
...
@@ -481,5 +482,42 @@ export default function abilityTest() {
// await sleep(500);
// await sleep(500);
// done();
// done();
// })
// })
/**
*@tc.number : UIAbilityConstantTest0100
*@tc.name : UIAbilityConstantTest0100
*@tc.desc : start mainability1, check ability constant.
*@tc.size : MediumTest
*@tc.type : Function
*@tc.level : Level 1
*/
it("UIAbilityConstantTest0100", 0, async (done) => {
console.log("------------UIAbilityConstantTest0100 START-------------");
TAG = "UIAbilityConstantTest0100";
var want = {
bundleName: "com.example.uiabilitylifecycle",
abilityName: "MainAbility1",
moduleName: moduleName,
};
globalThis.abilityContext
.startAbility(want)
.then((data) => {
console.info(TAG + " start successful. Data: " + data);
})
.catch((error) => {
console.error(TAG + " start failed. Cause: " + JSON.stringify(error));
});
await sleep(1000);
console.log('UIAbilityConstantTest0100:' + globalThis.launchParam1.lastExitReason)
expect(globalThis.launchParam1.launchReason == 1).assertTrue();
expect(globalThis.launchParam1.lastExitReason == 2).assertTrue();
expect(aConstant.LaunchReason.UNKNOWN == 0).assertTrue();
expect(aConstant.LastExitReason.UNKNOWN == 0).assertTrue();
done();
});
});
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录