Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c2a583ab
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看板
未验证
提交
c2a583ab
编写于
10月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6225 【Openharmony3.2.8.2】【master分支】【sensor子系统】【ToC】【RK3568】【必现】api覆盖
Merge pull request !6225 from ldy/master
上级
c0aa69d2
d2dea34b
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
4168 addition
and
74 deletion
+4168
-74
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
..._standard/src/main/js/test/Vibrator_newSupplement.test.js
+943
-1
sensors/sensor_standard/src/main/js/test/List.test.js
sensors/sensor_standard/src/main/js/test/List.test.js
+2
-0
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newAmbient_Light.js
...src/main/js/test/SensorOnOffTest.test_newAmbient_Light.js
+20
-20
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newRotatingVector.js
...rc/main/js/test/SensorOnOffTest.test_newRotatingVector.js
+34
-24
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
...main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
+3140
-0
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSignificant_Motion.js
...ain/js/test/SensorOnOffTest.test_newSignificant_Motion.js
+26
-26
sensors/sensor_standard/src/main/js/test/Subscribe_subscribeDeviceOrientation.js
.../src/main/js/test/Subscribe_subscribeDeviceOrientation.js
+2
-2
sensors/sensor_standard/src/main/js/test/Subscribe_subscribeLight.js
...sor_standard/src/main/js/test/Subscribe_subscribeLight.js
+1
-1
未找到文件。
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
浏览文件 @
c2a583ab
此差异已折叠。
点击以展开。
sensors/sensor_standard/src/main/js/test/List.test.js
浏览文件 @
c2a583ab
...
...
@@ -15,6 +15,7 @@
import
SystemParameterTest
from
'
./SensorOnOffTest.test.js
'
import
SensorJsTest_sensor_2
from
'
./SensorGeomagneticTest.test.js
'
import
SensorJsTest_sensor_1
from
'
./SensorGeneralalgorithm.test.js
'
import
SensorJsTest_sensor_60
from
'
./SensorOnOffTest.test_newSensorGeomagnetic.js
'
import
SensorJsTest_sensor_3
from
'
./SensorOnOffTest.test_oldAccelerometer.js
'
import
SensorJsTest_sensor_25
from
'
./Subscribe_subscribeAccelerometer.js
'
import
SensorJsTest_sensor_39
from
'
./SensorOnOffTest.test_newAccelerometer.js
'
...
...
@@ -22,6 +23,7 @@ import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js'
export
default
function
testsuite
()
{
SensorJsTest_sensor_1
()
SensorJsTest_sensor_2
()
SensorJsTest_sensor_60
()
SystemParameterTest
()
SensorJsTest_sensor_3
()
SensorJsTest_sensor_25
()
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newAmbient_Light.js
浏览文件 @
c2a583ab
...
...
@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_41", function () {
/*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0140
* @tc.name: newAmbient_Light_SensorJsTest0
27
* @tc.name: newAmbient_Light_SensorJsTest0
14
* @tc.desc: Functional Use Cases
*/
it
(
"
newAmbient_Light_SensorJsTest0
27
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
27
--------------
'
);
it
(
"
newAmbient_Light_SensorJsTest0
14
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
14
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
AMBIENT_LIGHT
,
callback
);
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorId
.
AMBIENT_LIGHT
);
...
...
@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_41", function () {
/*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0150
* @tc.name: newAmbient_Light_SensorJsTest0
28
* @tc.name: newAmbient_Light_SensorJsTest0
15
* @tc.desc: Illegal ID passed in
*/
it
(
"
newAmbient_Light_SensorJsTest0
28
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
28
--------------
'
);
it
(
"
newAmbient_Light_SensorJsTest0
15
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
15
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newAmbient_Light_SensorJsTest0
28
callback in
'
);
console
.
info
(
'
newAmbient_Light_SensorJsTest0
15
callback in
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
on
(
invalid
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
newAmbient_Light_SensorJsTest0
28
error:
"
+
error
);
console
.
info
(
"
newAmbient_Light_SensorJsTest0
15
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -104,29 +104,29 @@ describe("SensorJsTest_sensor_41", function () {
/*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0160
* @tc.name: newAmbient_Light_SensorJsTest0
29
* @tc.name: newAmbient_Light_SensorJsTest0
16
* @tc.desc: For normal scenarios
*/
it
(
"
newAmbient_Light_SensorJsTest0
29
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------
SensorJsTest003
--------------
'
);
it
(
"
newAmbient_Light_SensorJsTest0
16
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------
newAmbient_Light_SensorJsTest016
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
AMBIENT_LIGHT
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
29
off in--------------
'
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
16
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
AMBIENT_LIGHT
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
29
off end--------------
'
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
16
off end--------------
'
);
done
();
},
500
);
})
/*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0170
* @tc.name: newAmbient_Light_SensorJsTest0
30
* @tc.name: newAmbient_Light_SensorJsTest0
17
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it
(
"
newAmbient_Light_SensorJsTest0
30
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
30
--------------
'
);
it
(
"
newAmbient_Light_SensorJsTest0
17
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
17
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newAmbient_Light_SensorJsTest0
30
callback in
'
);
console
.
info
(
'
newAmbient_Light_SensorJsTest0
17
callback in
'
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
done
();
...
...
@@ -134,14 +134,14 @@ describe("SensorJsTest_sensor_41", function () {
try
{
sensor
.
on
(
sensor
.
SensorId
.
AMBIENT_LIGHT
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
"
newAmbient_Light_SensorJsTest0
30
error:
"
+
error
);
console
.
info
(
"
newAmbient_Light_SensorJsTest0
17
error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
setTimeout
(()
=>
{
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
30
off in--------------
'
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
17
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
AMBIENT_LIGHT
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
30
off end--------------
'
);
console
.
info
(
'
---------newAmbient_Light_SensorJsTest0
17
off end--------------
'
);
done
();
},
500
);
})
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newRotatingVector.js
浏览文件 @
c2a583ab
...
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
...
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
...
...
@@ -73,11 +75,11 @@ describe("SensorJsTest_sensor_49", function () {
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0140
* @tc.name:newRotatingVector_SensorJsTest0
27
* @tc.name:newRotatingVector_SensorJsTest0
14
* @tc.desc: Functional Use Cases
*/
it
(
"
newRotatingVector_SensorJsTest0
27
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
27
--------------
'
);
it
(
"
newRotatingVector_SensorJsTest0
14
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
14
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
callback
);
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorId
.
ROTATION_VECTOR
);
...
...
@@ -87,19 +89,19 @@ describe("SensorJsTest_sensor_49", function () {
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0150
* @tc.name:newRotatingVector_SensorJsTest0
28
* @tc.name:newRotatingVector_SensorJsTest0
15
* @tc.desc: Illegal ID passed in
*/
it
(
"
newRotatingVector_SensorJsTest0
28
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
28
--------------
'
);
it
(
"
newRotatingVector_SensorJsTest0
15
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
15
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newRotatingVector_SensorJsTest0
28
callback in
'
);
console
.
info
(
'
newRotatingVector_SensorJsTest0
15
callback in
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
on
(
invalid
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
newRotatingVector_SensorJsTest0
28
error:
"
+
error
);
console
.
info
(
"
newRotatingVector_SensorJsTest0
15
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -108,45 +110,46 @@ describe("SensorJsTest_sensor_49", function () {
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0160
* @tc.name:newRotatingVector_SensorJsTest0
29
* @tc.name:newRotatingVector_SensorJsTest0
16
* @tc.desc: For normal scenarios
*/
it
(
"
newRotatingVector_SensorJsTest0
29
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
29
--------------
'
);
it
(
"
newRotatingVector_SensorJsTest0
16
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
16
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
29
off in--------------
'
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
16
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
ROTATION_VECTOR
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
29
off end--------------
'
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
16
off end--------------
'
);
done
();
},
500
);
})
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0170
* @tc.name:newRotatingVector_SensorJsTest0
30
* @tc.name:newRotatingVector_SensorJsTest0
17
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it
(
"
newRotatingVector_SensorJsTest0
30
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
30
--------------
'
);
it
(
"
newRotatingVector_SensorJsTest0
17
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
17
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newRotatingVector_SensorJsTest0
30
callback in
'
);
console
.
info
(
'
newRotatingVector_SensorJsTest0
17
callback in
'
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
try
{
sensor
.
on
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
"
newRotatingVector_SensorJsTest0
30
error:
"
+
error
);
console
.
info
(
"
newRotatingVector_SensorJsTest0
17
error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
setTimeout
(()
=>
{
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
30
off in--------------
'
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
17
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
ROTATION_VECTOR
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
30
off end--------------
'
);
console
.
info
(
'
---------newRotatingVector_SensorJsTest0
17
off end--------------
'
);
done
();
},
500
);
})
...
...
@@ -196,6 +199,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
done
();
}
...
...
@@ -245,18 +249,18 @@ describe("SensorJsTest_sensor_49", function () {
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0230
* @tc.name: new
new
RotatingVector_SensorJsTest023
* @tc.name: newRotatingVector_SensorJsTest023
* @tc.desc:SensorId1000000 of incoming exception
*/
it
(
"
new
new
RotatingVector_SensorJsTest023
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
newRotatingVector_SensorJsTest023
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
new
new
RotatingVector_SensorJsTest023 on error
'
);
console
.
info
(
'
newRotatingVector_SensorJsTest023 on error
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
new
new
RotatingVector_SensorJsTest023 error:
"
+
error
);
console
.
info
(
"
newRotatingVector_SensorJsTest023 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
)
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
)
done
();
...
...
@@ -274,6 +278,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
});
sensor
.
on
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
(
data
)
=>
{
...
...
@@ -281,6 +286,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
});
setTimeout
(()
=>
{
...
...
@@ -319,6 +325,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
},
{
'
interval
'
:
100000000
});
sensor
.
once
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
(
data
)
=>
{
...
...
@@ -326,6 +333,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
});
setTimeout
(()
=>
{
...
...
@@ -348,6 +356,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
},
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorId
.
ROTATION_VECTOR
,
(
data
)
=>
{
...
...
@@ -355,6 +364,7 @@ describe("SensorJsTest_sensor_49", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
},
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
0 → 100644
浏览文件 @
c2a583ab
此差异已折叠。
点击以展开。
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSignificant_Motion.js
浏览文件 @
c2a583ab
...
...
@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_50", function () {
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0120
* @tc.name: newSignificant_Motion_SensorJsTest0
23
* @tc.name: newSignificant_Motion_SensorJsTest0
12
* @tc.desc: Functional Use Cases
*/
it
(
"
newSignificant_Motion_SensorJsTest0
23
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
23
--------------
'
);
it
(
"
newSignificant_Motion_SensorJsTest0
12
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
12
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
,
callback
);
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
);
...
...
@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_50", function () {
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0130
* @tc.name: newSignificant_Motion_SensorJsTest0
24
* @tc.name: newSignificant_Motion_SensorJsTest0
13
* @tc.desc: Illegal ID passed in
*/
it
(
"
newSignificant_Motion_SensorJsTest0
24
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
24
--------------
'
);
it
(
"
newSignificant_Motion_SensorJsTest0
13
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
13
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newSignificant_Motion_SensorJsTest0
24
callback in
'
);
console
.
info
(
'
newSignificant_Motion_SensorJsTest0
13
callback in
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
on
(
invalid
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
newSignificant_Motion_SensorJsTest0
24
error:
"
+
error
);
console
.
info
(
"
newSignificant_Motion_SensorJsTest0
13
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -104,53 +104,53 @@ describe("SensorJsTest_sensor_50", function () {
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0140
* @tc.name: newSignificant_Motion_SensorJsTest0
25
* @tc.name: newSignificant_Motion_SensorJsTest0
14
* @tc.desc: For normal scenarios
*/
it
(
"
newSignificant_Motion_SensorJsTest0
25
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
25
--------------
'
);
it
(
"
newSignificant_Motion_SensorJsTest0
14
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
14
--------------
'
);
sensor
.
on
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
25
off in--------------
'
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
14
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
25
off end--------------
'
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
14
off end--------------
'
);
done
();
},
500
);
})
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0150
* @tc.name: newSignificant_Motion_SensorJsTest0
26
* @tc.name: newSignificant_Motion_SensorJsTest0
15
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it
(
"
newSignificant_Motion_SensorJsTest0
26
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
26
--------------
'
);
it
(
"
newSignificant_Motion_SensorJsTest0
15
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
15
--------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
newSignificant_Motion_SensorJsTest0
26
callback in
'
);
console
.
info
(
'
newSignificant_Motion_SensorJsTest0
15
callback in
'
);
expect
(
typeof
(
data
.
scalar
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
try
{
sensor
.
on
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
"
newSignificant_Motion_SensorJsTest0
26
error:
"
+
error
);
console
.
info
(
"
newSignificant_Motion_SensorJsTest0
15
error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
setTimeout
(()
=>
{
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
26
off in--------------
'
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
15
off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
26
off end--------------
'
);
console
.
info
(
'
---------newSignificant_Motion_SensorJsTest0
15
off end--------------
'
);
done
();
},
500
);
})
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0160
* @tc.name: newSignificant_Motion_SensorJsTest0
27
* @tc.name: newSignificant_Motion_SensorJsTest0
16
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it
(
"
newSignificant_Motion_SensorJsTest0
27
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
newSignificant_Motion_SensorJsTest0
16
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
sensor
.
once
(
sensor
.
SensorId
.
SIGNIFICANT_MOTION
,
callback
);
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
...
...
@@ -216,18 +216,18 @@ describe("SensorJsTest_sensor_50", function () {
/*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0200
* @tc.name: new
new
Significant_Motion_SensorJsTest020
* @tc.name: newSignificant_Motion_SensorJsTest020
* @tc.desc:SensorId1000000 of incoming exception
*/
it
(
"
new
new
Significant_Motion_SensorJsTest020
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
newSignificant_Motion_SensorJsTest020
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
new
new
Significant_Motion_SensorJsTest020 on error
'
);
console
.
info
(
'
newSignificant_Motion_SensorJsTest020 on error
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
new
new
Significant_Motion_SensorJsTest020 error:
"
+
error
);
console
.
info
(
"
newSignificant_Motion_SensorJsTest020 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
)
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
)
done
();
...
...
sensors/sensor_standard/src/main/js/test/Subscribe_subscribeDeviceOrientation.js
浏览文件 @
c2a583ab
...
...
@@ -16,8 +16,8 @@ import sensor from '@system.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
export
default
function
SensorJsTest_sensor_2
6
()
{
describe
(
"
SensorJsTest_sensor_2
6
"
,
function
()
{
export
default
function
SensorJsTest_sensor_2
7
()
{
describe
(
"
SensorJsTest_sensor_2
7
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/test/Subscribe_subscribeLight.js
浏览文件 @
c2a583ab
...
...
@@ -106,7 +106,6 @@ describe("SensorJsTest_sensor_31", function () {
it
(
"
subscribeLight_SensorJsTest003
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest003---------------------------
'
);
sensor
.
subscribeLight
({
interval
:
'
normal
'
,
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest003 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
...
...
@@ -170,6 +169,7 @@ describe("SensorJsTest_sensor_31", function () {
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest005 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
"
subscribeLight_SensorJsTest005 is failed, data:
"
+
data
+
"
, code:
"
+
code
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录