Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
26d50831
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26d50831
编写于
7月 21, 2022
作者:
L
logic42
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add multimodalinput and powermgr and sensors testcase for 3.1release
Signed-off-by:
N
logic42
<
wanglong108@huawei.com
>
上级
37372617
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
135 addition
and
27 deletion
+135
-27
multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js
..._js_standard/src/main/js/default/test/InputDevice.test.js
+95
-27
powermgr/powermgrthermal/src/main/js/default/test/thermal_unittest.test.js
...thermal/src/main/js/default/test/thermal_unittest.test.js
+21
-0
sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js
...d/src/main/js/default/test/SensorGeneralalgorithm.test.js
+19
-0
未找到文件。
multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js
浏览文件 @
26d50831
...
@@ -28,87 +28,155 @@ describe('MultimodalInput_test', function () {
...
@@ -28,87 +28,155 @@ describe('MultimodalInput_test', function () {
// 参数正确,返回一个数组
// 参数正确,返回一个数组
it
(
'
inputDevice::getDeviceIds_test-01
'
,
0
,
function
()
{
it
(
'
inputDevice::getDeviceIds_test-01
'
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDeviceIds_test-01 enter`
);
console
.
info
(
`inputDevice::getDeviceIds_test-01 enter`
);
inputDevice
.
getDeviceIds
((
data
,
err
)
=>
{
inputDevice
.
getDeviceIds
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
expect
(
data
).
assertInstanceOf
(
'
Array
'
);
expect
(
data
).
assertInstanceOf
(
'
Array
'
);
}
}
console
.
log
(
`inputDevice::getDeviceIds_test-01 exit`
);
console
.
info
(
`inputDevice::getDeviceIds_test-01 exit`
);
})
})
})
})
// 参数正确,判断一种或多种设备
// 参数正确,判断一种或多种设备
it
(
"
inputDevice::getDeviceIds_test-02
"
,
0
,
function
()
{
it
(
"
inputDevice::getDeviceIds_test-02
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDeviceIds_test-02 enter`
);
console
.
info
(
`inputDevice::getDeviceIds_test-02 enter`
);
inputDevice
.
getDeviceIds
((
data
,
err
)
=>
{
inputDevice
.
getDeviceIds
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
expect
(
data
.
length
>
0
).
assertTure
();
expect
(
data
.
length
>
0
).
assertTure
();
}
}
console
.
log
(
`inputDevice::getDeviceIds_test-02 exit`
);
console
.
info
(
`inputDevice::getDeviceIds_test-02 exit`
);
})
})
})
})
it
(
"
inputDevice::getDevice_test-01
"
,
0
,
function
()
{
it
(
"
inputDevice::getDevice_test-01
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDevice_test-03 enter`
);
console
.
info
(
`inputDevice::getDevice_test-03 enter`
);
inputDevice
.
getDevice
(
-
1
,
(
data
,
err
)
=>
{
inputDevice
.
getDevice
(
-
1
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
console
.
log
(
`inputDevice::getDevice_test-03
${
JSON
.
stringify
(
err
)}
`
);
console
.
info
(
`inputDevice::getDevice_test-03
${
JSON
.
stringify
(
err
)}
`
);
}
else
{
}
else
{
expect
(
JSON
.
stringify
(
data
)
!==
"
{}
"
).
assertTrue
();
expect
(
JSON
.
stringify
(
data
)
!==
"
{}
"
).
assertTrue
();
}
}
console
.
log
(
`inputDevice::getDevice_test-03 exit`
);
console
.
info
(
`inputDevice::getDevice_test-03 exit`
);
})
})
})
})
// 参数正常,返回值正常
// 参数正常,返回值正常
it
(
"
inputDevice::getDevice_test-02
"
,
0
,
function
()
{
it
(
"
inputDevice::getDevice_test-02
"
,
0
,
function
()
{
console
.
log
(
`inputDevice::getDevice_test-04 enter`
);
console
.
info
(
`inputDevice::getDevice_test-04 enter`
);
inputDevice
.
getDeviceIds
((
data
,
err
)
=>
{
inputDevice
.
getDeviceIds
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
let
arr
=
[];
let
arr
=
[];
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
inputDevice
.
getDevice
(
data
[
i
],
(
res
,
err
)
=>
{
inputDevice
.
getDevice
(
data
[
i
],
(
res
,
err
)
=>
{
console
.
log
(
`getDevice:data_i
${
JSON
.
stringify
(
data
[
i
])}
`
)
console
.
info
(
`getDevice:data_i
${
JSON
.
stringify
(
data
[
i
])}
`
)
console
.
log
(
`getDevice:data
${
JSON
.
stringify
(
data
)}
`
)
console
.
info
(
`getDevice:data
${
JSON
.
stringify
(
data
)}
`
)
console
.
log
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
console
.
info
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
arr
=
Object
.
keys
(
res
);
arr
=
Object
.
keys
(
res
);
})
})
expect
(
arr
.
length
>
0
).
assertTrue
();
expect
(
arr
.
length
>
0
).
assertTrue
();
}
}
}
}
console
.
log
(
`inputDevice::getDevice_test-04 exit`
);
console
.
info
(
`inputDevice::getDevice_test-04 exit`
);
});
});
})
})
it
(
"
inputDevice::getDevice_test03
"
,
0
,
function
()
{
it
(
"
inputDevice::getDevice_test03
"
,
0
,
async
function
()
{
console
.
log
(
`inputDevice::getDevice_test-04 enter`
);
console
.
info
(
`inputDevice::getDevice_test-04 enter`
);
inputDevice
.
getDeviceIds
((
data
,
err
)
=>
{
await
inputDevice
.
getDeviceIds
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
}
else
{
}
else
{
let
arr
=
[];
let
arr
=
[];
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
inputDevice
.
getDevice
(
data
[
i
],
(
res
,
err
)
=>
{
inputDevice
.
getDevice
(
data
[
i
],
(
res
,
err
)
=>
{
console
.
log
(
`getDevice:data_i
${
JSON
.
stringify
(
data
[
i
])}
`
)
console
.
info
(
`getDevice:data_i
${
JSON
.
stringify
(
data
[
i
])}
`
)
console
.
log
(
`getDevice:data
${
JSON
.
stringify
(
data
)}
`
)
console
.
info
(
`getDevice:data
${
JSON
.
stringify
(
data
)}
`
)
console
.
log
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
console
.
info
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
arr
=
Object
.
keys
(
res
);
arr
=
Object
.
keys
(
res
);
expect
(
data
[
i
].
id
).
assertInstanceOf
(
'
number
'
);
expect
(
res
).
assertInstanceOf
(
'
InputDeviceData
'
);
expect
(
data
[
i
].
sources
).
assertInstanceOf
(
'
string
'
);
expect
(
res
.
id
).
assertInstanceOf
(
'
number
'
);
expect
(
data
[
i
].
name
).
assertInstanceOf
(
'
Array
'
);
expect
(
res
.
sources
).
assertInstanceOf
(
'
string
'
);
expect
(
data
[
i
].
axisRanges
).
assertInstanceOf
(
'
Array
'
);
expect
(
res
.
name
).
assertInstanceOf
(
'
Array
'
);
expect
(
res
.
axisRanges
).
assertInstanceOf
(
'
Array
'
);
for
(
let
j
=
0
;
j
<
res
.
sources
.
length
;
j
++
)
{
expect
(
res
.
sources
[
j
]).
assertInstanceOf
(
'
SourceType
'
);
expect
(
res
.
sources
[
j
]
==
'
keyboard
'
||
res
.
sources
[
j
]
==
'
mouse
'
||
res
.
sources
[
j
]
==
'
touchpad
'
||
res
.
sources
[
j
]
==
'
touchscreen
'
||
res
.
sources
[
j
]
==
'
joystick
'
||
res
.
sources
[
j
]
==
'
trackball
'
).
assertTrue
();
}
for
(
let
k
=
0
;
k
<
res
.
axisRanges
.
length
;
k
++
)
{
expect
(
res
.
axisRanges
[
i
]).
assertInstanceOf
(
'
AxisRange
'
);
expect
(
res
.
axisRanges
[
i
].
source
).
assertInstanceOf
(
'
SourceType
'
);
expect
(
res
.
axisRanges
[
i
].
axis
).
assertInstanceOf
(
'
AxisType
'
);
expect
(
res
.
axisRanges
[
i
].
axis
==
'
NULL
'
).
assertTrue
();
expect
(
res
.
axisRanges
[
i
].
max
).
assertInstanceOf
(
'
number
'
);
expect
(
res
.
axisRanges
[
i
].
min
).
assertInstanceOf
(
'
number
'
);
}
})
})
expect
(
arr
.
length
>
0
).
assertTrue
();
expect
(
arr
.
length
>
0
).
assertTrue
();
}
}
}
}
console
.
log
(
`inputDevice::getDevice_test-04 exit`
);
console
.
info
(
`inputDevice::getDevice_test-04 exit`
);
});
})
/**
* @tc.number MultimodalInputDevice_js_0070
* @tc.name MultimodalInputDevice_getDeviceIds_Promise_test
* @tc.desc inputdevice interface getDeviceIds & supportKeys test
*/
it
(
"
MultimodalInputDevice_getDeviceIds_Promise_test
"
,
0
,
async
function
()
{
console
.
info
(
`inputDevice::supportKeys_test-01 enter`
);
await
inputDevice
.
getDeviceIds
().
then
((
data
)
=>
{
console
.
info
(
`getDevice:data
${
JSON
.
stringify
(
data
)}
`
)
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
inputDevice
.
getDevice
(
data
[
i
]).
then
((
res
)
=>
{
console
.
info
(
`getDevice:data_i
${
JSON
.
stringify
(
data
[
i
])}
`
)
console
.
info
(
`getDevice:res
${
JSON
.
stringify
(
res
)}
`
)
arr
=
Object
.
keys
(
res
);
expect
(
res
.
id
).
assertInstanceOf
(
'
number
'
);
expect
(
res
.
sources
).
assertInstanceOf
(
'
string
'
);
expect
(
res
.
name
).
assertInstanceOf
(
'
Array
'
);
expect
(
res
.
axisRanges
).
assertInstanceOf
(
'
Array
'
);
for
(
let
j
=
0
;
j
<
res
.
sources
.
length
;
j
++
)
{
expect
(
res
.
sources
[
j
]).
assertInstanceOf
(
'
SourceType
'
);
expect
(
res
.
sources
[
j
]
==
'
keyboard
'
||
res
.
sources
[
j
]
==
'
mouse
'
||
res
.
sources
[
j
]
==
'
touchpad
'
||
res
.
sources
[
j
]
==
'
touchscreen
'
||
res
.
sources
[
j
]
==
'
joystick
'
||
res
.
sources
[
j
]
==
'
trackball
'
).
assertTrue
();
}
for
(
let
k
=
0
;
k
<
res
.
axisRanges
.
length
;
k
++
)
{
expect
(
res
.
axisRanges
[
i
]).
assertInstanceOf
(
'
AxisRange
'
);
expect
(
res
.
axisRanges
[
i
].
source
).
assertInstanceOf
(
'
SourceType
'
);
expect
(
res
.
axisRanges
[
i
].
axis
).
assertInstanceOf
(
'
AxisType
'
);
expect
(
res
.
axisRanges
[
i
].
axis
==
'
NULL
'
).
assertTrue
();
expect
(
res
.
axisRanges
[
i
].
max
).
assertInstanceOf
(
'
number
'
);
expect
(
res
.
axisRanges
[
i
].
min
).
assertInstanceOf
(
'
number
'
);
}
done
();
},
(
err
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
done
();
}
})
}
done
();
console
.
info
(
`inputDevice::supportKeys_test-01 exit`
);
},
(
err
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
`getDevice:err
${
JSON
.
stringify
(
err
)}
`
)
done
();
}
});
});
})
})
})
})
powermgr/powermgrthermal/src/main/js/default/test/thermal_unittest.test.js
浏览文件 @
26d50831
...
@@ -23,6 +23,7 @@ describe('appInfoTest_thermal4', function () {
...
@@ -23,6 +23,7 @@ describe('appInfoTest_thermal4', function () {
console
.
log
(
"
*************Thermal API Test Begin*************
"
);
console
.
log
(
"
*************Thermal API Test Begin*************
"
);
test14
();
test14
();
test15
();
test15
();
test16
();
})
})
function
test14
()
{
function
test14
()
{
...
@@ -67,3 +68,23 @@ function test15() {
...
@@ -67,3 +68,23 @@ function test15() {
})
})
})
})
}
}
function
test16
()
{
/* @tc.number thermal_manager_js_013
* @tc.name Thermal_013
* @tc.desc Thermal acquisition kit
*/
it
(
'
Thermal_016
'
,
0
,
function
()
{
console
.
info
(
"
Thermal level is:
"
+
thermal
.
ThermalLevel
.
COOL
+
thermal
.
ThermalLevel
.
NORMAL
+
thermal
.
ThermalLevel
.
WARM
+
thermal
.
ThermalLevel
.
HOT
+
thermal
.
ThermalLevel
.
OVERHEATED
+
thermal
.
ThermalLevel
.
WARNING
+
thermal
.
ThermalLevel
.
EMERGENCY
);
expect
(
thermal
.
ThermalLevel
.
COOL
==
0
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
NORMAL
==
1
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
WARM
==
2
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
HOT
==
3
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
OVERHEATED
==
4
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
WARNING
==
5
).
assertTrue
();
expect
(
thermal
.
ThermalLevel
.
EMERGENCY
==
6
).
assertTrue
();
})
}
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js
浏览文件 @
26d50831
...
@@ -866,6 +866,25 @@ describe("SensorJsTest_sensor5", function () {
...
@@ -866,6 +866,25 @@ describe("SensorJsTest_sensor5", function () {
console
.
info
(
"
SensorJsTest_101 end
"
)
console
.
info
(
"
SensorJsTest_101 end
"
)
})
})
/*
* @tc.name: SensorJsTest_101
* @tc.desc: Verfication results of the incorrect parameters of test interface.
*/
it
(
'
SensorJsTest_1011
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SensorJsTest_1011 start
'
)
await
sensor
.
getGeomagneticDip
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]).
then
((
data
)
=>
{
console
.
info
(
"
SensorJsTest_1011
"
+
data
)
expect
(
data
).
assertEqual
(
getGeomagneticDipResult
[
0
])
done
()
console
.
info
(
'
SensorJsTest_1011
'
+
'
length:
'
+
data
.
length
);
},
(
error
)
=>
{
console
.
info
(
'
SensorJsTest_1011 failed
'
);
expect
(
false
).
assertTrue
();
done
()
})
console
.
info
(
"
SensorJsTest_1011 end
"
)
})
/*
/*
* @tc.name: SensorJsTest_102
* @tc.name: SensorJsTest_102
* @tc.desc: Verfication results of the incorrect parameters of test interface.
* @tc.desc: Verfication results of the incorrect parameters of test interface.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录