Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a4a4debf
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看板
提交
a4a4debf
编写于
9月 22, 2022
作者:
Z
zwx1016320
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add screenLock API and moddifed time API and utitest
Signed-off-by:
N
zwx1016320
<
zhangyushuai1@huawei-partners.com
>
上级
2586d121
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
367 addition
and
931 deletion
+367
-931
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
...ock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
+0
-3
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
...screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
+284
-805
time/timeTest/entry/src/main/ets/test/systemTimeTest.ets
time/timeTest/entry/src/main/ets/test/systemTimeTest.ets
+1
-1
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
+82
-122
未找到文件。
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
浏览文件 @
a4a4debf
...
...
@@ -42,7 +42,6 @@ export default function ScreenLockPromiseTest(){
*/
it("SUB_MISC_THEME_screenLock_API_Promise_001", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
let isScreenLocked = true;
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_001 isScreenLocked result is " + data);
...
...
@@ -66,7 +65,6 @@ export default function ScreenLockPromiseTest(){
*/
it("SUB_MISC_THEME_screenLock_API_Promise_002", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
let isScreenLocked = false;
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_002 isScreenLocked result is " + data);
...
...
@@ -173,6 +171,5 @@ export default function ScreenLockPromiseTest(){
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
done();
});
})
}
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
浏览文件 @
a4a4debf
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import screenLock from '@ohos.screenLock';
import {
describe, expect, it
} from "hypium/index";
import {
describe, expect, it
} from "hypium/index";
export default function screenLockJSUnit() {
const INTERACTIVE_STATE_END_SLEEP = 0;
...
...
@@ -35,808 +35,287 @@ export default function screenLockJSUnit() {
}
}
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0001
* @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_0001", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0001-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0001 screen's status is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0001: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0001-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0002
* @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_0002", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0002-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0002 screen's status is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0002: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0002-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0003
* @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_0003", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0003-------------------");
try {
screenLock.isSecureMode((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0003: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0004
* @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_0004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0004-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0005
* @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_0005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0005-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0005: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0005: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0005-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0006
* @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_0006", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0006-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0006: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0006: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0006-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0007
* @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_0007", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0007-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0007: isScreenLocked is successful, result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0007: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0007-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0008
* @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_0008", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0008-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.log("SUB_MISC_THEME_screenLock_API_0008: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0008: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0008-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0009
* @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_0009", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0009-------------------");
try {
let eventType = 'beginWakeUp';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0009: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0009: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0009-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0010
* @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_0010", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0010-------------------");
try {
let eventType = 'endWakeUp';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0010: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0010: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0010-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0011
* @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_0011", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0011-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0011: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0011: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0011-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0012
* @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_0012", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0012-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0012: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0012: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0012-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0013
* @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_0013", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0013-------------------");
try {
let eventType = 'beginScreenOff';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0013: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0013: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0013-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0014
* @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_0014", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0014-------------------");
try {
let eventType = 'endScreenOff';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0014: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0014: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0014-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0015
* @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_0015", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0015-------------------");
try {
let eventType = 'unlockScreen';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0015: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0015: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0015-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0016
* @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_0016", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0016-------------------");
try {
let eventType = 'beginExitAnimation';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0016: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0016: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0016-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0017
* @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_0017", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0017-------------------");
try {
let eventType = 'screenLockEnabled';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0017: test_getRuntimeState screenLockEnabled is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0017: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0017-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0018
* @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_0018", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0018-------------------");
try {
let eventType = 'beginSleep';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0018: test_getRuntimeState beginSleep is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0018: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0018-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0019
* @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_0019", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0019-------------------");
try {
let eventType = 'endSleep';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0019: test_getRuntimeState endSleep is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0019: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0019-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0020
* @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_0020", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0020-------------------");
try {
let eventType = 'changeUser';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0020: test_getRuntimeState changeUser is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0020: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0020-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0021
* @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_0021", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0021-------------------");
try {
let eventType = 'beginWakeUp';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0021: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0021: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0021-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0022
* @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_0022", 0, async function (done) {
console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0022-------------------");
try {
let eventType = 'endWakeUp';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0022: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0022: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0022-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0023
* @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_0023", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0023-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0023: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0023: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0023-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0024
* @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_0024", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0024-------------------");
try {
let eventType = 'endScreenOn';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0024: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0024: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0024-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0025
* @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_0025", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0025-------------------");
try {
let eventType = 'beginScreenOff';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0025: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0025: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0025-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0026
* @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_0026", 0, async function (done) {
console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0026-------------------");
try {
let eventType = 'endScreenOff';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0026: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0026: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0026-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0027
* @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_0027", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0027-------------------");
try {
let eventType = 'unlockScreen';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0027: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0027: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0027-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0028
* @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_0028", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0028-------------------");
try {
let eventType = 'beginExitAnimation';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0028: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0028: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0028-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0029
* @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_0029", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0029-------------------");
try {
let eventType = 'changeUser';
screenLock.on(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0029: test_getRuntimeState beginSleep is successful");
expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0029: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0029-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0030
* @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_0030", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0030-------------------");
try {
let eventType = 'endSleep';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0030: test_getRuntimeState endSleep is successful");
expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0030: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0030-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0031
* @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_0031", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0031-------------------");
try {
let eventType = 'changeUser';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0031: test_getRuntimeState changeUser is successful");
expect(data == INTERACTIVE_STATE_USERID).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0031: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0031-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0032
* @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_0032", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0032-------------------");
try {
let eventType = 'screenLockEnabled';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0032: test_getRuntimeState screenLockEnabled is successfuls");
expect(data == true).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0032: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0032-------------------");
done();
});
})
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0001
* @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_0001", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0001-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0001 screen's status is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0001: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0001-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0002
* @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_0002", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0002-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0002 screen's status is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0002: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0002-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0003
* @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_0003", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0003-------------------");
try {
screenLock.isSecureMode((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0003: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0004
* @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_0004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0004-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0005
* @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_0005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0005-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0005: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0005: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0005-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0006
* @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_0006", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0006-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0006: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0006: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0006-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0007
* @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_0007", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0007-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0007: isScreenLocked is successful, result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0007: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0007-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0008
* @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_0008", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0008-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.log("SUB_MISC_THEME_screenLock_API_0008: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0008: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0008-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0009
* @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_0009", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0009-------------------");
let flag = null;
try{
flag = await screenLock.onSystemEvent((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent start");
if (err){
console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent err: " + JSON.stringify(err));
expect().assertFalse();
done();
};
expect( data != null ).assertTrue();
console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent end" + data)
done();
});
}catch(err){
console.info("SUB_MISC_THEME_screenLock_API_0009 failed: " + JSON.stringify(err));
expect().assertFalse();
done();
}
console.info("SUB_MISC_THEME_screenLock_API_0009 data: " + flag);
//这里的业务暂时为false,后续获取权限后为true
expect( flag == false).assertTrue();
console.info("-----------------end SUB_MISC_THEME_screenLock_API_0009--------------------");
done()
});
});
}
time/timeTest/entry/src/main/ets/test/systemTimeTest.ets
浏览文件 @
a4a4debf
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {
describe, it, expect} from "hypium/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import systemTime from "@ohos.systemTime";
export default function systemTimeJsunit() {
...
...
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
浏览文件 @
a4a4debf
...
...
@@ -109,13 +109,13 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0000 has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_0001
* @tc.name SUB_time_systemTimer_createTimer_0001
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIM
E, repeat = true (callback)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
IDL
E, repeat = true (callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -123,16 +123,16 @@ export default function systemTimerTest() {
it('SUB_time_systemTimer_createTimer_0001', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0001 start.');
let options = {
type: systemTimer.TIMER_TYPE_
REALTIM
E,
type: systemTimer.TIMER_TYPE_
IDL
E,
repeat: false
}
}
;
try {
systemTimer.createTimer(options, function (err, timerID) {
if (err) {
console.info('SUB_time_systemTimer_createTimer_0001 wrong since ' + err.code);
expect().assertTrue();
done();
}
}
;
console.info('SUB_time_systemTimer_createTimer_0001 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
done();
...
...
@@ -141,7 +141,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0001 arv wrong since ' + e.code);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -153,7 +153,7 @@ export default function systemTimerTest() {
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0002', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0002 start")
console.info("SUB_time_systemTimer_createTimer_0002 start")
;
WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info('SUB_time_systemTimer_createTimer_0002 BundleName: ' + data);
})
...
...
@@ -162,7 +162,7 @@ export default function systemTimerTest() {
repeat: true,
wantAgent: wantAgent,
interval: interval_time
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0002 create timer")
systemTimer.createTimer(options, function (err, timerID) {
...
...
@@ -179,7 +179,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -191,11 +191,11 @@ export default function systemTimerTest() {
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0003', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0003 start")
console.info("SUB_time_systemTimer_createTimer_0003 start")
;
let options = {
type: systemTimer.TIMER_TYPE_EXACT,
repeat: false
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0003 create timer")
systemTimer.createTimer(options, function (err, timerID) {
...
...
@@ -211,35 +211,35 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_0004
* @tc.name SUB_time_systemTimer_createTimer_0004
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
IDL
E, repeat = false, wantAgent(callback)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIM
E, repeat = false, wantAgent(callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0004', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0004 start")
console.info("SUB_time_systemTimer_createTimer_0004 start")
;
WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info("SUB_time_systemTimer_createTimer_0004 BundleName: " + data);
})
})
;
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: true,
wantAgent: wantAgent,
interval: interval_time
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0004 create timer")
systemTimer.createTimer(options, function (err, timerID) {
if (err) {
expect().assertTrue();
done();
}
}
;
expect(Number.isInteger(timerID)).assertTrue();
done();
});
...
...
@@ -247,18 +247,18 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0004 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_0005
* @tc.name SUB_time_systemTimer_createTimer_0005
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
* @tc.number SUB_time_systemTimer_createTimer_0005
* @tc.name SUB_time_systemTimer_createTimer_0005
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_time_systemTimer_createTimer_0005', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0005 start.');
let options = {
...
...
@@ -269,7 +269,6 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0005 create timer.');
systemTimer.createTimer(options).then((timerID) =>{
console.info('SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID);
// globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
...
...
@@ -281,13 +280,13 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0005 has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_0006
* @tc.name SUB_time_systemTimer_createTimer_0006
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIM
E, repeat = true (callback)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
IDL
E, repeat = true (callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -295,9 +294,9 @@ export default function systemTimerTest() {
it('SUB_time_systemTimer_createTimer_0006', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0006 start.');
let options = {
type: systemTimer.TIMER_TYPE_
REALTIM
E,
type: systemTimer.TIMER_TYPE_
IDL
E,
repeat: false
}
}
;
try {
systemTimer.createTimer(options).then((timerID) => {
console.info('SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID);
...
...
@@ -312,7 +311,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0006 arv wrong since ' + e.code);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -324,7 +323,7 @@ export default function systemTimerTest() {
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0007', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0007 start")
console.info("SUB_time_systemTimer_createTimer_0007 start")
;
WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info('SUB_time_systemTimer_createTimer_0007 BundleName: ' + data);
})
...
...
@@ -333,9 +332,9 @@ export default function systemTimerTest() {
repeat: true,
wantAgent: wantAgent,
interval: interval_time
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0007 create timer")
console.info("SUB_time_systemTimer_createTimer_0007 create timer")
;
systemTimer.createTimer(options).then((timerID) => {
console.info('SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
...
...
@@ -349,7 +348,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0007 arv wrong since ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -361,11 +360,11 @@ export default function systemTimerTest() {
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0008', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0008 start")
console.info("SUB_time_systemTimer_createTimer_0008 start")
;
let options = {
type: systemTimer.TIMER_TYPE_EXACT,
repeat: false
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0008 create timer")
systemTimer.createTimer(options).then((timerID) => {
...
...
@@ -380,28 +379,28 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0008 arv wrong since ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_0009
* @tc.name SUB_time_systemTimer_createTimer_0009
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
IDL
E, repeat = false, wantAgent(callback)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIM
E, repeat = false, wantAgent(callback)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_time_systemTimer_createTimer_0009', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0009 start")
console.info("SUB_time_systemTimer_createTimer_0009 start")
;
WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info("SUB_time_systemTimer_createTimer_0009 BundleName: " + data);
})
})
;
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: true,
wantAgent: wantAgent,
interval: interval_time
}
}
;
try {
console.info("SUB_time_systemTimer_createTimer_0009 create timer")
systemTimer.createTimer(options).then((timerID) => {
...
...
@@ -416,15 +415,9 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0009 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_startTimer_0001
* @tc.name SUB_time_systemTimer_startTimer_0001
...
...
@@ -434,11 +427,7 @@ export default function systemTimerTest() {
* @tc.level Level 0
*/
it('SUB_time_systemTimer_startTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_startTimer_0001 start")
let options = {
type: systemTimer.TIMER_TYPE_IDLE,
repeat: false,
}
console.info("SUB_time_systemTimer_startTimer_0001 start");
try {
console.info("SUB_time_systemTimer_startTimer_0001 start timer, timerID: " + globalTimerID)
let triggerTime = new Date().getTime() + interval_time * 1.2;
...
...
@@ -455,7 +444,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_startTimer_0001 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -467,27 +456,22 @@ export default function systemTimerTest() {
* @tc.level Level 0
*/
it('SUB_time_systemTimer_stopTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_stopTimer_0001 start")
let options = {
type: systemTimer.TIMER_TYPE_IDLE,
repeat: false,
}
console.info("SUB_time_systemTimer_stopTimer_0001 start");
try {
console.info("SUB_time_systemTimer_stopTimer_0001 stop timer, timerID: " + globalTimerID)
systemTimer.stopTimer(globalTimerID, function (err, data) {
if (err) {
expect().assertTrue();
done();
}
}
;
console.info("SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + globalTimerID);
done();
});
} catch (e) {
console.info('SUB_time_systemTimer_stopTimer_0001 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -499,62 +483,57 @@ export default function systemTimerTest() {
* @tc.level Level 0
*/
it('SUB_time_systemTimer_destroyTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_destroyTimer_0001 start")
let options = {
type: systemTimer.TIMER_TYPE_IDLE,
repeat: false,
}
console.info("SUB_time_systemTimer_destroyTimer_0001 start");
try {
console.info("SUB_time_systemTimer_destroyTimer_0001 destroy timer, timerID: " + globalTimerID)
systemTimer.destroyTimer(globalTimerID, function (err, data) {
if (err) {
expect().assertTrue();
done();
}
}
;
console.info("SUB_time_systemTimer_destroyTimer_0001 success to destroy timerID: " + globalTimerID);
done();
});
} catch (e) {
console.info('SUB_time_systemTimer_destroyTimer_0001 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_createTimer_000
6
* @tc.name SUB_time_systemTimer_createTimer_000
6
* @tc.number SUB_time_systemTimer_createTimer_000
2
* @tc.name SUB_time_systemTimer_createTimer_000
2
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Promise)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_time_systemTimer_createTimer_000
6
', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_000
6
start.');
it('SUB_time_systemTimer_createTimer_000
2
', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_000
2
start.');
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
console.info('SUB_time_systemTimer_createTimer_000
6
create timer.');
console.info('SUB_time_systemTimer_createTimer_000
2
create timer.');
systemTimer.createTimer(options).then((timerID)=>{
console.info('SUB_time_systemTimer_createTimer_000
6
timerID:' + timerID);
console.info('SUB_time_systemTimer_createTimer_000
2
timerID:' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
globalTimerID = timerID;
done();
}
,
error => {
}
).catch(
error => {
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_createTimer_000
6
failed to create timer.');
console.info('SUB_time_systemTimer_createTimer_000
2
failed to create timer.');
expect().assertTrue();
done();
});
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_createTimer_000
6
has failed for ' + err);
console.info('SUB_time_systemTimer_createTimer_000
2
has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -567,10 +546,6 @@ export default function systemTimerTest() {
*/
it('SUB_time_systemTimer_startTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_startTimer_0002 start.');
let options = {
type: systemTimer.TIMER_TYPE_WAKEUP,
repeat: false
};
try {
console.info('SUB_time_systemTimer_startTimer_0002 start timer, timerID: ' + globalTimerID);
let triggerTime = new Date().getTime() + interval_time * 2;
...
...
@@ -578,13 +553,12 @@ export default function systemTimerTest() {
.then(()=>{
console.info('SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID);
done();
})
.catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_startTimer_0002 failed to start timer.');
expect().assertTrue();
done();
});
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_startTimer_0002 failed to start timer.');
expect().assertTrue();
done();
});
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_startTimer_0002 has failed for ' + err);
...
...
@@ -603,29 +577,24 @@ export default function systemTimerTest() {
*/
it('SUB_time_systemTimer_stopTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_stopTimer_0002 start.');
let options = {
type: systemTimer.TIMER_TYPE_WAKEUP,
repeat: false
};
try {
console.info('SUB_time_systemTimer_stopTimer_0002 stop timer, timerID: ' + globalTimerID);
systemTimer.stopTimer(globalTimerID)
.then(()=>{
console.info('SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID);
done();
})
.catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_stopTimer_0002 failed to stop timer.');
expect().assertTrue();
done();
});
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_stopTimer_0002 failed to stop timer.');
expect().assertTrue();
done();
});
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -638,35 +607,30 @@ export default function systemTimerTest() {
*/
it('SUB_time_systemTimer_destroyTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_destroyTimer_0002 start.');
let options = {
type: systemTimer.TIMER_TYPE_WAKEUP,
repeat: false
};
try {
console.info('SUB_time_systemTimer_destroyTimer_0002 destroy timer, timerID: ' + globalTimerID);
systemTimer.destroyTimer(globalTimerID)
.then(()=>{
console.info('SUB_time_systemTimer_destroyTimer_0002 timerID:' + globalTimerID);
done();
})
.catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.');
expect().assertTrue();
done();
});
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.');
expect().assertTrue();
done();
});
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
* @tc.number SUB_time_systemTimer_ALL_Promise_0008
* @tc.name SUB_time_systemTimer_ALL_Promise_0008
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIME
, repeat = false (Promise)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
WAKEUP
, repeat = false (Promise)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -739,7 +703,7 @@ export default function systemTimerTest() {
/**
* @tc.number SUB_time_systemTimer_ALL_Callback_0009
* @tc.name SUB_time_systemTimer_ALL_Callback_0009
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
REALTIME
, repeat = false (Promise)
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_
WAKEUP
, repeat = false (Promise)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -768,26 +732,22 @@ export default function systemTimerTest() {
});
})
} catch (err) {
// 捕获stopTimer参数错误
console.info('SUB_time_systemTimer_ALL_Callback_0009 stopTimer with wrong arg: ' + err);
expect().assertTrue();
done();
}
})
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_ALL_Callback_0009 startTimer with wrong arg: ' + err);
expect().assertTrue();
done();
}
})
} catch (err) {
// 捕获参数错误
console.info('SUB_time_systemTimer_ALL_Callback_0009 createTimer with wrong arg: ' + err);
expect().assertTrue();
done();
}
});
});
}
\ No newline at end of file
鸿蒙社区
@harmonycommunity
mentioned in commit
310b027e
·
9月 27, 2022
mentioned in commit
310b027e
mentioned in commit 310b027e9a04126f3ac8be2cff19bb5e7fff3feb
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录