Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e8b99155
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看板
未验证
提交
e8b99155
编写于
1月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7226 新增用例SUB_AA_UpdateConfiguration_0200
Merge pull request !7226 from yangliang36/yl0114
上级
591b0a53
4ccedc7f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
84 addition
and
0 deletion
+84
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
...overhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
+24
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
...ptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
+60
-0
未找到文件。
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
e8b99155
...
...
@@ -47,4 +47,28 @@ export default class MainAbility extends Ability {
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility onBackground
"
)
}
onConfigurationUpdate
(
config
)
{
console
.
log
(
'
[Demo] MainAbility onConfigurationUpdate:
'
+
this
.
context
.
config
.
language
)
console
.
log
(
'
[Demo] MainAbility onConfigurationUpdate:
'
+
config
.
language
)
if
(
globalThis
.
UpdateConfiguration_0200_prepare_resolve
)
{
globalThis
.
UpdateConfiguration_0200_prepare_resolve
();
}
if
(
!
globalThis
.
UpdateConfiguration_0200_resolve
)
{
console
.
log
(
"
[Demo] MainAbility invalid resolve
"
)
return
;
}
if
(
!
globalThis
.
UpdateConfiguration_0200_reject
)
{
console
.
log
(
"
[Demo] MainAbility invalid reject
"
)
return
;
}
if
(
this
.
context
.
config
.
language
==
"
English
"
&&
config
.
language
==
"
zh-Hans
"
)
{
globalThis
.
UpdateConfiguration_0200_resolve
();
}
else
{
globalThis
.
UpdateConfiguration_0200_reject
();
}
}
};
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
浏览文件 @
e8b99155
...
...
@@ -131,5 +131,65 @@ export default function ApiCoverTest() {
done();
}
});
/*
* @tc.number SUB_AA_UpdateConfiguration_0200
* @tc.name Test updateConfiguration.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_UpdateConfiguration_0200', 0, async function (done) {
let enLanguage = {
language: 'English'
}
let zhLanguage = {
language: 'zh-Hans'
}
// set language to english
await new Promise((resolve, reject) => {
globalThis.UpdateConfiguration_0200_prepare_resolve = resolve;
console.info("SUB_AA_UpdateConfiguration_0200 ----> before set language to english.");
abilityManager.updateConfiguration(enLanguage).then(() => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> set language to english succeed.");
}).catch(err => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> failed to set language to english: " + err);
globalThis.UpdateConfiguration_0200_prepare_resolve();
});
}).then(() => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> succees to set language.");
}).catch(err => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> failed to set language: " + err);
}).finally(() => {
globalThis.UpdateConfiguration_0200_prepare_resolve = null;
globalThis.UpdateConfiguration_0200_resolve = null;
globalThis.UpdateConfiguration_0200_reject = null;
console.info("SUB_AA_UpdateConfiguration_0200 ----> set promise to null after all");
});
// set language to chinese
await new Promise((resolve, reject) => {
globalThis.UpdateConfiguration_0200_resolve = resolve;
globalThis.UpdateConfiguration_0200_reject = reject;
console.info("SUB_AA_UpdateConfiguration_0200 ----> before set language to chinese.");
abilityManager.updateConfiguration(zhLanguage).then(() => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> set language to chinese succeed.");
}).catch(err => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> failed to set language to chinese: " + err);
});
}).then(() => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> succees to set language.");
expect(true).assertTrue();
}).catch(err => {
console.info("SUB_AA_UpdateConfiguration_0200 ----> failed to set language: " + err);
expect(false).assertTrue();
}).finally(() => {
globalThis.UpdateConfiguration_0200_resolve = null;
globalThis.UpdateConfiguration_0200_reject = null;
console.info("SUB_AA_UpdateConfiguration_0200 ----> set promise to null after all");
done();
});
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录