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
此差异已折叠。
点击以展开。
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,7 +247,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_createTimer_0004 has failed for ' + e);
expect().assertTrue();
done();
}
}
;
});
...
...
@@ -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,8 +553,7 @@ export default function systemTimerTest() {
.then(()=>{
console.info('SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID);
done();
})
.catch(()=>{
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_startTimer_0002 failed to start timer.');
expect().assertTrue();
...
...
@@ -603,18 +577,13 @@ 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(()=>{
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_stopTimer_0002 failed to stop timer.');
expect().assertTrue();
...
...
@@ -625,7 +594,7 @@ export default function systemTimerTest() {
console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err);
expect().assertTrue();
done();
}
}
;
});
/**
...
...
@@ -638,18 +607,13 @@ 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(()=>{
}).catch(()=>{
// 捕获业务逻辑错误
console.info('SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.');
expect().assertTrue();
...
...
@@ -660,13 +624,13 @@ export default function systemTimerTest() {
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录