Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6fa96fe2
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看板
提交
6fa96fe2
编写于
9月 24, 2021
作者:
G
guduhanyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20200924
Signed-off-by:
N
guduhanyan
<
xuyanjun27@163.com
>
上级
7dc0adb0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
978 addition
and
3 deletion
+978
-3
miscservices/BUILD.gn
miscservices/BUILD.gn
+4
-3
miscservices/TimeTest_js/src/main/js/default/test/SystemTimerJsunit.test.js
...est_js/src/main/js/default/test/SystemTimerJsunit.test.js
+974
-0
未找到文件。
miscservices/BUILD.gn
浏览文件 @
6fa96fe2
...
...
@@ -14,7 +14,8 @@
import("//build/ohos_var.gni")
group("miscservices") {
testonly = true
deps = [ "TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test", ]
deps = [
"TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test",
]
}
miscservices/TimeTest_js/src/main/js/default/test/SystemTimerJsunit.test.js
0 → 100644
浏览文件 @
6fa96fe2
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
systemTimer
from
'
@ohos.systemtimer
'
describe
(
'
TimerTest
'
,
function
()
{
console
.
log
(
'
start################################start
'
);
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0100
* @tc.name Test systemTimer.Timer type = TIMER_TYPE_REALTIME
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test1
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0100 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0100 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0200
* @tc.name Test systemTimer.Timer type = TIMER_TYPE_REALTIME_WAKEUP
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test2
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0200 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME_WAKEUP
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0200 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0300
* @tc.name Test systemTimer.Timer type = TIMER_TYPE_EXACT
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test3
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0300 start
"
)
var
options
=
{
type
:
TIMER_TYPE_EXACT
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0300 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0400
* @tc.name Test systemTimer.Timer type = TIMER_TYPE_REALTIME
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test4
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0400 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0400 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0500
* @tc.name Test systemTimer.Timer triggerTime = 0
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test5
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0500 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
0
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0500 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0600
* @tc.name Test systemTimer.Timer triggerTime = 5000
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test6
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0600 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
5000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0600 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0700
* @tc.name Test systemTimer.Timer triggerTime = Number.MAX_VALUE/2
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test7
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0700 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
Number
.
MAX_VALUE
/
2
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0700 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0800
* @tc.name Test systemTimer.Timer triggerTime = Number.MAX_VALUE-1
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test8
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0800 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
Number
.
MAX_VALUE
-
1
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0800 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0900
* @tc.name Test systemTimer.Timer triggerTime = Number.MAX_VALUE
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test9
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_0900 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
Number
.
MAX_VALUE
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_0900 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1000
* @tc.name Test systemTimer.Timer repeat = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test10
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1000 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
true
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1000 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1100
* @tc.name Test systemTimer.Timer persistent = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test11
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1100 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
true
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1100 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1200
* @tc.name Test systemTimer.Timer repeat,persistent = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test12
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1200 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
true
,
persistent
:
true
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1200 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1300
* @tc.name Test systemTimer.Timer create,start,stop,destroy 1000 timers
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test13
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1300 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
for
(
var
index
=
0
;
index
<
1000
;
index
++
)
{
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1300 end
'
);
}
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1400
* @tc.name Test systemTimer.Timer interval = 0
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test14
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1400 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
0
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1400 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1500
* @tc.name Test systemTimer.Timer interval = 5000
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test15
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1500 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
5000
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1500 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1600
* @tc.name Test systemTimer.Timer interval = Number.MAX_VALUE/2
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test16
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1600 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
Number
.
MAX_VALUE
/
2
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1600 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1700
* @tc.name Test systemTimer.Timer interval = Number.MAX_VALUE-1
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test17
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1700 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
Number
.
MAX_VALUE
-
1
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1700 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1800
* @tc.name Test systemTimer.Timer interval = Number.MAX_VALUE
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test18
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1800 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
Number
.
MAX_VALUE
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1800 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1900
* @tc.name Test systemTimer.Timer WantAgent
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test19
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_1900 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
100000
,
persistent
:
false
//wantAgent:WantAgent
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_1900 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2000
* @tc.name Test systemTimer.Timer Called back when the timer goes off.
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test20
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2000 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
interval
:
100000
,
persistent
:
false
,
callback
:
callbackFunction
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2000 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2100
* @tc.name Test systemTimer.Timer start a not exist timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test21
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2100 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start a not exist timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
+
1
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
false
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2100 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2200
* @tc.name Test systemTimer.Timer stop a not exist timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test22
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2200 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop a not exist timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
+
1
)
expect
(
stopTimerRes
).
assertEqual
(
false
)
console
.
log
(
"
stop the current timer
"
)
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2200 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2300
* @tc.name Test systemTimer.Timer destroy a not exist timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test23
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2300 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy a not exist timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
+
1
)
expect
(
destroyTimerRes
).
assertEqual
(
false
)
console
.
log
(
"
destroy timer
"
)
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2300 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2400
* @tc.name Test systemTimer.Timer stop a not started timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test24
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2400 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
stop a not started timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
false
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2400 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2500
* @tc.name Test systemTimer.Timer destroy a started timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test25
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2500 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy a started timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2500 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2600
* @tc.name Test systemTimer.Timer repeat to start a timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test26
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2600 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
start timer again
"
)
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2600 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2700
* @tc.name Test systemTimer.Timer repeat to stop a timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test27
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2700 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer again
"
)
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2700 end
'
);
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2800
* @tc.name Test systemTimer.Timer repeat to destroy a timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTimer_Timer_test28
'
,
0
,
async
()
=>
{
console
.
log
(
"
SUB_systemTimer_Timer_JS_API_2800 start
"
)
var
options
=
{
type
:
TIMER_TYPE_REALTIME
,
repeat
:
false
,
persistent
:
false
}
console
.
log
(
"
create timer
"
)
let
timer
=
systemTimer
.
Timer
(
options
)
expect
(
parseInt
(
timer
)
==
parseFloat
(
timer
)).
assertEqual
(
true
)
console
.
log
(
"
start timer
"
)
let
startTimerRes
=
systemTimer
.
startTimer
(
timer
,
100000
)
expect
(
startTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
stop timer
"
)
let
stopTimerRes
=
systemTimer
.
stopTimer
(
timer
)
expect
(
stopTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer
"
)
let
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
true
)
console
.
log
(
"
destroy timer again
"
)
destroyTimerRes
=
systemTimer
.
destroyTimer
(
timer
)
expect
(
destroyTimerRes
).
assertEqual
(
false
)
console
.
log
(
'
SUB_systemTimer_Timer_JS_API_2800 end
'
);
});
/**
* @function Used for callback functions
* @tc.name callbackFunction
*/
function
callbackFunction
()
{
console
.
log
(
"
Start to call the callback function
"
)
}
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录