Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
37337840
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看板
未验证
提交
37337840
编写于
11月 10, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6447 【monthly_20221018】【主题】锁屏XTS优化
Merge pull request !6447 from 何海涛/cherry-pick-1667993589
上级
a55ad423
e84648a4
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
139 addition
and
361 deletion
+139
-361
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
...ock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
+23
-93
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
...screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
+116
-268
未找到文件。
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
浏览文件 @
37337840
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import screenLock from '@ohos.screenLock';
import {
describe, expect, it} from 'deccjsunit/index'
import {
describe, expect, it, beforeEach} from "hypium/index";
const SLEEP_TIME = 1000;
...
...
@@ -22,15 +22,11 @@ export default function ScreenLockPromiseTest(){
describe('ScreenLockServicePromiseTest', function () {
console.info("-----------------------ScreenlockPromiseTest is starting-----------------------");
function sleep(numberMillis) {
let now = new Date();
let exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
let result = false
beforeEach(async function (done) {
result = await screenLock.isScreenLocked();
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_001
...
...
@@ -45,14 +41,16 @@ export default function ScreenLockPromiseTest(){
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_001 isScreenLocked result is " + data);
expect(data == true).assertTrue()
expect(data == result).assertTrue()
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done();
})
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_001 test_setScreenLocked : error = " + error);
expect(true).assertTrue();
expect().assertFail();
done();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done();
});
/*
...
...
@@ -68,14 +66,16 @@ export default function ScreenLockPromiseTest(){
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_002 isScreenLocked result is " + data);
expect(data == false).assertTrue();
expect(data == result).assertTrue();
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_002 test_setScreenLocked : error = " + error);
expect(true).assertTrue();
expect().assertFail();
done();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done();
});
/*
...
...
@@ -92,84 +92,14 @@ export default function ScreenLockPromiseTest(){
screenLock.isSecureMode().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked TRUE: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_004
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_Promise_004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
try {
screenLock.unlockScreen().then(() => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("Screenlock_Test_1400: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_005
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_Promise_005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
try {
screenLock.unlockScreen().then(() => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: isScreenLocked result is " + data);
expect(data == true).assertTrue();
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_Promise_005: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
done();
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked TRUE: error = " + error);
expect().assertFail();
done();
}
});
})
}
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
浏览文件 @
37337840
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录