Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
914f5906
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看板
提交
914f5906
编写于
1月 18, 2022
作者:
L
liuzixuan10
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify the use case number and modify the use case name
Signed-off-by:
N
liuzixuan10
<
liuzixuan10@huawei.com
>
上级
f71d7c17
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
671 addition
and
737 deletion
+671
-737
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer.js
...ain/js/default/test/SensorOnOffTest.test_Accelerometer.js
+108
-116
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer_Uncalibrated.js
...t/test/SensorOnOffTest.test_Accelerometer_Uncalibrated.js
+18
-18
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Ambient_Light.js
...ain/js/default/test/SensorOnOffTest.test_Ambient_Light.js
+99
-115
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Barometer.js
...rc/main/js/default/test/SensorOnOffTest.test_Barometer.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gravity.js
.../src/main/js/default/test/SensorOnOffTest.test_Gravity.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope.js
...rc/main/js/default/test/SensorOnOffTest.test_Gyroscope.js
+105
-116
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope_Uncalibrated.js
...fault/test/SensorOnOffTest.test_Gyroscope_Uncalibrated.js
+15
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Hall.js
...ard/src/main/js/default/test/SensorOnOffTest.test_Hall.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Heart_Rate.js
...c/main/js/default/test/SensorOnOffTest.test_Heart_Rate.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Humidity.js
...src/main/js/default/test/SensorOnOffTest.test_Humidity.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Linear_Acceleration.js
.../default/test/SensorOnOffTest.test_Linear_Acceleration.js
+16
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Magnetic_Field.js
...in/js/default/test/SensorOnOffTest.test_Magnetic_Field.js
+108
-116
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Magnetic_Field_Uncalibrated.js
.../test/SensorOnOffTest.test_Magnetic_Field_Uncalibrated.js
+16
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Orientation.js
.../main/js/default/test/SensorOnOffTest.test_Orientation.js
+16
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer.js
...rc/main/js/default/test/SensorOnOffTest.test_Pedometer.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer_Detection.js
.../default/test/SensorOnOffTest.test_Pedometer_Detection.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Proxinity.js
...rc/main/js/default/test/SensorOnOffTest.test_Proxinity.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Rotation_Vector.js
...n/js/default/test/SensorOnOffTest.test_Rotation_Vector.js
+16
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Significant_Motion.js
...s/default/test/SensorOnOffTest.test_Significant_Motion.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Temperature.js
.../main/js/default/test/SensorOnOffTest.test_Temperature.js
+14
-16
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Wear_Detection.js
...in/js/default/test/SensorOnOffTest.test_Wear_Detection.js
+14
-16
未找到文件。
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
acc
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Accelerometer
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0010
* @tc.name: SensorAccelerometerJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,25 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
AccelerometerJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest002
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0020
* @tc.name: SensorAccelerometerJSTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest002
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0020
---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test002 on success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test002 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -130,25 +129,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest003
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0030
* @tc.name: SensorAccelerometerJSTest003
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest003
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0030
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test003 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -162,13 +160,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -182,37 +181,36 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test003 reject
"
);
console
.
info
(
"
Sensor
AccelerometerJS
Test003 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest004
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0040
* @tc.name: SensorAccelerometerJSTest004
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest004
"
,
0
,
function
()
{
console
.
info
(
'
----------------------S
ensorJsTest004
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0040
---------------------------
'
);
sensor
.
on
(
1
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------Sensor
Js
Test004--------------------------- end
'
);
console
.
info
(
'
----------------------Sensor
AccelerometerJS
Test004--------------------------- end
'
);
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0050
* @tc.name: SensorAccelerometerJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -225,18 +223,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest006
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0060
* @tc.name: SensorAccelerometerJSTest006
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest006
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test006 on success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test006 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -247,29 +244,27 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest007
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0070
* @tc.name: SensorAccelerometerJSTest007
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest007
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0070
"
,
0
,
function
()
{
sensor
.
once
(
1
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest008
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0080
* @tc.name: SensorAccelerometerJSTest008
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest008
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test008 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test008 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -280,18 +275,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest009
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0090
* @tc.name: SensorAccelerometerJSTest009
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest009
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test009 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test009 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -302,18 +296,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest010
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0100
* @tc.name: SensorAccelerometerJSTest010
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest01
0
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_010
0
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test010 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test010 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -324,18 +317,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest011
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0110
* @tc.name: SensorAccelerometerJSTest011
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest011
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test011 once success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test011 once error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -346,18 +338,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest012
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0120
* @tc.name: SensorAccelerometerJSTest012
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest012
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test012 on success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test012 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -368,37 +359,35 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest013
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0130
* @tc.name: SensorAccelerometerJSTest013
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest013
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
1
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest014
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0140
* @tc.name: SensorAccelerometerJSTest014
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest014
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest014
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0140
---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off2 success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
(
err
);
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off2 error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -413,13 +402,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off1 error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off1 success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -432,13 +421,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 on error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -458,25 +448,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest015
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0150
* @tc.name: SensorAccelerometerJSTest015
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest015
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest015
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0150
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -490,13 +479,14 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on2 error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -511,13 +501,14 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on1 error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -538,25 +529,24 @@ describe("SensorJsTest", function () {
/*
* @tc.name:SensorJsTest016
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0160
* @tc.name: SensorAccelerometerJSTest016
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest016
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest016
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Accelerometer_JSTest_0160
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 off error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 off success
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -570,13 +560,14 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 once error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -591,13 +582,14 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 on1 error
'
);
console
.
info
(
'
Sensor
AccelerometerJS
Test016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorAccelerometerJSTest016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
acc_uncal
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Accelerometer_Uncalibrated
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Accelerometer_Uncalibrated_JSTest_0010
* @tc.name: SensorAccelerometerUncalibratedJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------
----------SensorJsTest001----------
-----------------
'
);
it
(
"
S
UB_SensorsSystem_Accelerometer_Uncalibrated_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------
SUB_SensorsSystem_Accelerometer_Uncalibrated_JSTest_0010
-----------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
AccelerometerUncalibratedJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
AccelerometerUncalibratedJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,14 +80,15 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
AccelerometerUncalibratedJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -105,25 +105,25 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
AccelerometerUncalibratedJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Accelerometer_Uncalibrated_JSTest_0020
* @tc.name: SensorAccelerometerUncalibratedJSTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Accelerometer_Uncalibrated_JSTest_0020
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
JsTest005
once error
'
);
console
.
info
(
'
Sensor
AccelerometerUncalibratedJSTest002
once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest002 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
l
ight.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Ambient_L
ight.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0010
* @tc.name: SensorAmbientLightJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success, success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test001 on success, success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,25 +98,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
AmbientLightJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest002
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0020
* @tc.name: SensorAmbientLightJSTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest002
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0020
---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test002 on success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test002 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -128,25 +126,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest003
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0030
* @tc.name: SensorAmbientLightJSTest003
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest003
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0030
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test003 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -160,13 +157,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test003 on success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test003 on success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -178,37 +175,35 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test003 reject
"
);
console
.
info
(
"
Sensor
AmbientLightJS
Test003 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest004
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0040
* @tc.name: SensorAmbientLightJSTest004
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest004
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
Js
Test004---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
AmbientLightJS
Test004---------------------------
'
);
sensor
.
on
(
5
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------Sensor
Js
Test004--------------------------- end
'
);
console
.
info
(
'
----------------------Sensor
AmbientLightJS
Test004--------------------------- end
'
);
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0050
* @tc.name: SensorAmbientLightJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test005 once success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
@@ -219,18 +214,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest006
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0060
* @tc.name: SensorAmbientLightJSTest006
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest006
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test006 on success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test006 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -241,10 +235,9 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest007
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0070
* @tc.name: SensorAmbientLightJSTest007
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
SensorJsTest007
"
,
0
,
function
()
{
sensor
.
once
(
5
,
function
()
{
},
5
);
...
...
@@ -252,18 +245,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest008
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0080
* @tc.name: SensorAmbientLightJSTest008
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest008
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test008 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test008 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -274,18 +266,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest009
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0090
* @tc.name: SensorAmbientLightJSTest009
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest009
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test009 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test009 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -296,18 +287,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest010
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0100
* @tc.name: SensorAmbientLightJSTest010
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest01
0
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_010
0
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test010 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test010 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -318,18 +308,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest011
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0110
* @tc.name: SensorAmbientLightJSTest011
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest011
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test011 once success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test011 once error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -340,18 +329,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest012
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0120
* @tc.name: SensorAmbientLightJSTest012
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest012
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test012 on success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test012 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -362,37 +350,35 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest013
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0130
* @tc.name: SensorAmbientLightJSTest013
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest013
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
5
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest014
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0140
* @tc.name: SensorAmbientLightJSTest014
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest014
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest014
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0140
---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off2 success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off2 error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -407,13 +393,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off1 error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off1 success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -426,13 +412,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 on error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 on success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test014 on success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -450,25 +436,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest015
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0150
* @tc.name: SensorAmbientLightJSTest015
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest015
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest015
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0150
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -482,13 +467,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on2 error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 on2 success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 on2 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -501,13 +486,13 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on1 error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 on1 success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test015 on1 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -526,25 +511,24 @@ describe("SensorJsTest", function () {
/*
* @tc.name:SensorJsTest016
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0160
* @tc.name: SensorAmbientLightJSTest016
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest016
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest016
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Light_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Ambient_Light_JSTest_0160
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 off error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 off success
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -558,13 +542,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 once error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 once success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 once success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -577,13 +561,13 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 on1 error
'
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 on1 success data:
'
+
data
.
intensity
);
console
.
info
(
'
Sensor
AmbientLightJS
Test016 on1 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
ba
r.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Baromete
r.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Barometer_JSTest_0010
* @tc.name: SensorBarometerJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Barometer_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Barometer_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_BAROMETER
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
BarometerJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
BarometerJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_BAROMETER
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
BarometerJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success pressure:
'
+
data
.
pressure
);
console
.
info
(
'
Sensor
BarometerJS
Test001 on success pressure:
'
+
data
.
pressure
);
expect
(
typeof
(
data
.
pressure
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
BarometerJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Barometer_JSTest_0050
* @tc.name: SensorBarometerJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Barometer_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
BarometerJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success pressure:
'
+
data
.
pressure
);
console
.
info
(
'
Sensor
BarometerJS
Test005 once success pressure:
'
+
data
.
pressure
);
expect
(
typeof
(
data
.
pressure
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
grav
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Gravity
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Gravity_JSTest_0010
* @tc.name: SensorGravityJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gravity_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gravity_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
GravityJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
GravityJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
GravityJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
Sensor
GravityJS
Test001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,24 +100,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
GravityJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Gravity_JSTest_0050
* @tc.name: SensorGravityJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gravity_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
GravityJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
JsTest001
on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
Sensor
GravityJSTest005
on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
gyr
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Gyroscope
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0010
* @tc.name: SensorGyroscopeJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorGyroscopeJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,25 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
GyroscopeJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest002
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0020
* @tc.name: SensorGyroscopeJSTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest002
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0020
---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test002 on success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test002 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -130,25 +129,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest003
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0030
* @tc.name: SensorGyroscopeJSTest003
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest003
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0030
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test003 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -162,13 +160,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorGyroscopeJSTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -182,37 +181,35 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test003 reject
"
);
console
.
info
(
"
Sensor
GyroscopeJS
Test003 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest004
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0040
* @tc.name: SensorGyroscopeJSTest004
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest004
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
Js
Test004---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
GyroscopeJS
Test004---------------------------
'
);
sensor
.
on
(
2
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------Sensor
Js
Test004--------------------------- end
'
);
console
.
info
(
'
----------------------Sensor
GyroscopeJS
Test004--------------------------- end
'
);
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0050
* @tc.name: SensorGyroscopeJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
Sensor
GyroscopeJS
Test005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -225,18 +222,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest006
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0060
* @tc.name: SensorGyroscopeJSTest006
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest006
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test006 on success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test006 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -247,29 +243,27 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest007
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0070
* @tc.name: SensorGyroscopeJSTest007
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest007
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0070
"
,
0
,
function
()
{
sensor
.
once
(
2
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest008
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0080
* @tc.name: SensorGyroscopeJSTest008
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest008
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test008 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test008 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -280,18 +274,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest009
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0090
* @tc.name: SensorGyroscopeJSTest009
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest009
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test009 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test009 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -302,18 +295,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest010
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0100
* @tc.name: SensorGyroscopeJSTest010
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest01
0
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_010
0
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test010 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test010 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -324,18 +316,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest011
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0110
* @tc.name: SensorGyroscopeJSTest011
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest011
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test011 once success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test011 once error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -346,18 +337,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest012
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0120
* @tc.name: SensorGyroscopeJSTest012
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest012
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test012 on success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test012 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -368,37 +358,35 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest013
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0130
* @tc.name: SensorGyroscopeJSTest013
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest013
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
2
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest014
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0140
* @tc.name: SensorGyroscopeJSTest014
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest014
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest014
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0140
---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off2 success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off2 error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -413,13 +401,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off1 error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off1 success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -432,13 +420,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 on error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorGyroscopeJSTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -458,25 +447,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest015
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0150
* @tc.name: SensorGyroscopeJSTest015
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest015
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest015
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0150
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -490,13 +478,14 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on2 error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorGyroscopeJSTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -511,13 +500,14 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on1 error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorGyroscopeJSTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -538,25 +528,24 @@ describe("SensorJsTest", function () {
/*
* @tc.name:SensorJsTest016
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0160
* @tc.name: SensorGyroscopeJSTest016
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest016
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest016
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Gyroscope_JSTest_0160
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 off error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 off success
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -570,13 +559,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 once error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -591,13 +580,13 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 on1 error
'
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
Sensor
GyroscopeJS
Test016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
gyr_unca
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Gyroscope_Uncalibrated
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Gyroscope_Uncalibrated_JSTest_0010
* @tc.name: SensorGyroscopeUncalibratedJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
-----------------
-----SensorJsTest001-----
----------------------
'
);
it
(
"
S
UB_SensorsSystem_Gyroscope_Uncalibrated_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
-----------------
SUB_SensorsSystem_Gyroscope_Uncalibrated_JSTest_0010
----------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
GyroscopeUncalibratedJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
GyroscopeUncalibratedJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
GyroscopeUncalibratedJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -105,24 +105,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
GyroscopeUncalibratedJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Gyroscope_Uncalibrated_JSTest_0050
* @tc.name: SensorGyroscopeUncalibratedJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Gyroscope_Uncalibrated_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
GyroscopeUncalibratedJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
JsTest001
on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
Sensor
GyroscopeUncalibratedJSTest005
on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
harr
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Hall
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Hall_JSTest_0010
* @tc.name: SensorHallJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Hall_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Hall_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
HallJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
HallJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
HallJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success status:
'
+
data
.
status
);
console
.
info
(
'
Sensor
HallJS
Test001 on success status:
'
+
data
.
status
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
HallJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Hall_JSTest_0050
* @tc.name: SensorHallJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Hall_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
HallJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success status:
'
+
data
.
status
);
console
.
info
(
'
Sensor
HallJS
Test005 once success status:
'
+
data
.
status
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
r
ate.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Heart_R
ate.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Heart_Rate_JSTest_0010
* @tc.name: SensorHeartRateJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Heart_Rate_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Heart_Rate_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HEART_RATE
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
HeartRateJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
HeartRateJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HEART_RATE
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
HeartRateJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success heartRate:
'
+
data
.
heartRate
);
console
.
info
(
'
Sensor
HeartRateJS
Test001 once success heartRate:
'
+
data
.
heartRate
);
expect
(
typeof
(
data
.
heartRate
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
HeartRateJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Heart_Rate_JSTest_0050
* @tc.name: SensorHeartRateJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Heart_Rate_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
HeartRateJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success heartRate:
'
+
data
.
heartRate
);
console
.
info
(
'
Sensor
HeartRateJS
Test005 once success heartRate:
'
+
data
.
heartRate
);
expect
(
typeof
(
data
.
heartRate
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
humi
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Humidity
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Humidity_JSTest_0010
* @tc.name: SensorHumidityJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Humidity_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Humidity_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HUMIDITY
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
HumidityJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
HumidityJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HUMIDITY
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
HumidityJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success humidity:
'
+
data
.
humidity
);
console
.
info
(
'
Sensor
HumidityJS
Test001 on success humidity:
'
+
data
.
humidity
);
expect
(
typeof
(
data
.
humidity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
HumidityJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Humidity_JSTest_0050
* @tc.name: SensorHumidityJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Humidity_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
HumidityJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success humidity:
'
+
data
.
humidity
);
console
.
info
(
'
Sensor
HumidityJS
Test005 once success humidity:
'
+
data
.
humidity
);
expect
(
typeof
(
data
.
humidity
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
line_acc
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Linear_Acceleration
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Linear_Acceleration_JSTest_0010
* @tc.name: SensorLinearAccelerationJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
---------------
-------SensorJsTest001----------
-----------------
'
);
it
(
"
S
UB_SensorsSystem_Linear_Acceleration_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
---------------
SUB_SensorsSystem_Linear_Acceleration_JSTest_0010
-----------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELERATION
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
LinearAccelerationJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
LinearAccelerationJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELERATION
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
LinearAccelerationJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorLinearAccelerationJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,24 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
LinearAccelerationJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Linear_Acceleration_JSTest_0050
* @tc.name: SensorLinearAccelerationJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Linear_Acceleration_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
LinearAccelerationJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorLinearAccelerationJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
mag
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Magnetic_Field
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0010
* @tc.name: SensorMagneticFieldJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,25 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
MagneticFieldJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest002
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0020
* @tc.name: SensorMagneticFieldJSTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest002
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0020
---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test002 on success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test002 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -130,25 +129,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest003
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0030
* @tc.name: SensorMagneticFieldJSTest003
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest003
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0030
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
6
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test003 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -162,13 +160,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test003 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest003 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -182,37 +181,36 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test003 reject
"
);
console
.
info
(
"
Sensor
MagneticFieldJS
Test003 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest004
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0040
* @tc.name: SensorMagneticFieldJSTest004
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest004
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
Js
Test004---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------Sensor
MagneticFieldJS
Test004---------------------------
'
);
sensor
.
on
(
6
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------Sensor
Js
Test004--------------------------- end
'
);
console
.
info
(
'
----------------------Sensor
MagneticFieldJS
Test004--------------------------- end
'
);
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0050
* @tc.name: SensorMagneticFieldJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest005 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -225,18 +223,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest006
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0060
* @tc.name: SensorMagneticFieldJSTest006
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest006
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test006 on success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test006 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -247,29 +244,27 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest007
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0070
* @tc.name: SensorMagneticFieldJSTest007
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest007
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0070
"
,
0
,
function
()
{
sensor
.
once
(
6
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest008
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0080
* @tc.name: SensorMagneticFieldJSTest008
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest008
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test008 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test008 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -280,18 +275,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest009
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0090
* @tc.name: SensorMagneticFieldJSTest009
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest009
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test009 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test009 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -302,18 +296,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest010
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0100
* @tc.name: SensorMagneticFieldJSTest010
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest01
0
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_010
0
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test010 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test010 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -324,18 +317,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest011
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0110
* @tc.name: SensorMagneticFieldJSTest011
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest011
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test011 once success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test011 once error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -346,18 +338,17 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest012
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0120
* @tc.name: SensorMagneticFieldJSTest012
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest012
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test012 on success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test012 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
...
...
@@ -368,37 +359,35 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest013
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0130
* @tc.name: SensorMagneticFieldJSTest013
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest013
"
,
0
,
function
()
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
6
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.name:SensorJsTest014
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0140
* @tc.name: SensorMagneticFieldJSTest014
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest014
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest014
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0140
---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
6
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off2 success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off2 error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -413,13 +402,13 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
6
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 off1 error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test014 off1 success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -432,13 +421,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test014 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest014 on success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -458,25 +448,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest015
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0150
* @tc.name: SensorMagneticFieldJSTest015
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest015
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest015
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0150
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
6
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test015 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -490,13 +479,14 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on2 error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest015 on2 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -511,13 +501,14 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test015 on1 error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest015 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -538,25 +529,24 @@ describe("SensorJsTest", function () {
/*
* @tc.name:SensorJsTest016
* @tc.number: SUB_SensorsSystem_Magnetic_Field_JSTest_0160
* @tc.name: SensorMagneticFieldJSTest016
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest016
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest016
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Magnetic_Field_JSTest_0160
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
6
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test016 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
...
...
@@ -570,13 +560,14 @@ describe("SensorJsTest", function () {
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 once error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest016 once success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -591,13 +582,14 @@ describe("SensorJsTest", function () {
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
6
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test016 on1 error
'
);
console
.
info
(
'
Sensor
MagneticFieldJS
Test016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorMagneticFieldJSTest016 on1 success x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
field_unca
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Magnetic_Field_Uncalibrated
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Magnetic_Field_Uncalibrated_JSTest_0010
* @tc.name: SensorMagneticFieldUncalibratedJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------
------------SensorJsTest001--------
-------------------
'
);
it
(
"
S
UB_SensorsSystem_Magnetic_Field_Uncalibrated_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------
SUB_SensorsSystem_Magnetic_Field_Uncalibrated_JSTest_0010
-------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
MagneticFieldUncalibratedJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
MagneticFieldUncalibratedJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
MagneticFieldUncalibratedJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -105,24 +105,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
MagneticFieldUncalibratedJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Magnetic_Field_Uncalibrated_JSTest_0050
* @tc.name: SensorMagneticFieldUncalibratedJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Magnetic_Field_Uncalibrated_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
MagneticFieldUncalibratedJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
orie
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Orientation
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Orientation_JSTest_0010
* @tc.name: SensorOrientationJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Orientation_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Orientation_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
OrientationJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
OrientationJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
OrientationJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorOrientationJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,24 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
OrientationJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Orientation_JSTest_0050
* @tc.name: SensorOrientationJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Orientation_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
OrientationJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest001 once success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorOrientationJSTest005 once success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
ped
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Pedometer
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Pedometer_JSTest_0010
* @tc.name: SensorPedometerJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Pedometer_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Pedometer_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
PedometerJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
PedometerJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
PedometerJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success steps:
'
+
data
.
steps
);
console
.
info
(
'
Sensor
PedometerJS
Test001 once success steps:
'
+
data
.
steps
);
expect
(
typeof
(
data
.
steps
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
PedometerJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Pedometer_JSTest_0050
* @tc.name: SensorPedometerJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Pedometer_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
PedometerJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success steps:
'
+
data
.
steps
);
console
.
info
(
'
Sensor
PedometerJS
Test005 once success steps:
'
+
data
.
steps
);
expect
(
typeof
(
data
.
steps
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
ped_det
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Pedometer_Detection
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Pedometer_Detection_JSTest_0010
* @tc.name: SensorPedometerDetectionJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001----
-----------------------
'
);
it
(
"
S
UB_SensorsSystem_Pedometer_Detection_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Pedometer_Detection_JSTest_0010
-----------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER_DETECTION
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PEDOMETER_DETECTION
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success scalar:
'
+
data
.
scalar
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test001 once success scalar:
'
+
data
.
scalar
);
expect
(
typeof
(
data
.
scalar
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
PedometerDetectionJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Pedometer_Detection_JSTest_0050
* @tc.name: SensorPedometerDetectionJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Pedometer_Detection_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success scalar:
'
+
data
.
scalar
);
console
.
info
(
'
Sensor
PedometerDetectionJS
Test005 once success scalar:
'
+
data
.
scalar
);
expect
(
typeof
(
data
.
scalar
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
prox
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Proxinity
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Proxinity_JSTest_0010
* @tc.name: SensorProxinityJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001
---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Proxinity_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Proxinity_JSTest_0010
---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PROXIMITY
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
ProxinityJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
ProxinityJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_PROXIMITY
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
ProxinityJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 on success distance:
'
+
data
.
distance
);
console
.
info
(
'
Sensor
ProxinityJS
Test001 on success distance:
'
+
data
.
distance
);
expect
(
typeof
(
data
.
distance
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
ProxinityJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Proxinity_JSTest_0050
* @tc.name: SensorProxinityJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Proxinity_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
ProxinityJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success distance:
'
+
data
.
distance
);
console
.
info
(
'
Sensor
ProxinityJS
Test005 once success distance:
'
+
data
.
distance
);
expect
(
typeof
(
data
.
distance
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
vec
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Rotation_Vector
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Rotation_Vector_JSTest_0010
* @tc.name: SensorRotationVectorJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001-
--------------------------
'
);
it
(
"
S
UB_SensorsSystem_Rotation_Vector_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Rotation_Vector_JSTest_0010
--------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
RotationVectorJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
RotationVectorJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,14 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
RotationVectorJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorRotationVectorJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
@@ -101,24 +101,24 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
RotationVectorJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Rotation_Vector_JSTest_0050
* @tc.name: SensorRotationVectorJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Rotation_Vector_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
RotationVectorJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorJsTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
console
.
info
(
'
SensorRotationVectorJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
moti
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Significant_Motion
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Significant_Motion_JSTest_0010
* @tc.name: SensorSignificantMotionJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
ensorJsTest001---------
------------------
'
);
it
(
"
S
UB_SensorsSystem_Significant_Motion_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------S
UB_SensorsSystem_Significant_Motion_JSTest_0010
------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_SIGNIFICANT_MOTION
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_SIGNIFICANT_MOTION
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success scalar:
'
+
data
.
scalar
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test001 once success scalar:
'
+
data
.
scalar
);
expect
(
typeof
(
data
.
scalar
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
SignificantMotionJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Significant_Motion_JSTest_0050
* @tc.name: SensorSignificantMotionJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Significant_Motion_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success scalar:
'
+
data
.
scalar
);
console
.
info
(
'
Sensor
SignificantMotionJS
Test005 once success scalar:
'
+
data
.
scalar
);
expect
(
typeof
(
data
.
scalar
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
temp
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Temperature
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Ambient_Temperature_JSTest_0010
* @tc.name: SensorAmbientTemperatureJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
--------------------
--SensorJsTest001--
-------------------------
'
);
it
(
"
S
UB_SensorsSystem_Ambient_Temperature_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
--------------------
SUB_SensorsSystem_Ambient_Temperature_JSTest_0010
-------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_TEMPERATURE
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_TEMPERATURE
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success temperature:
'
+
data
.
temperature
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test001 once success temperature:
'
+
data
.
temperature
);
expect
(
typeof
(
data
.
temperature
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
AmbientTemperatureJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Ambient_Temperature_JSTest_0050
* @tc.name: SensorAmbientTemperatureJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Ambient_Temperature_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success temperature:
'
+
data
.
temperature
);
console
.
info
(
'
Sensor
AmbientTemperatureJS
Test005 once success temperature:
'
+
data
.
temperature
);
expect
(
typeof
(
data
.
temperature
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
dete
.js
→
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_
Wear_Detection
.js
浏览文件 @
914f5906
...
...
@@ -50,25 +50,24 @@ describe("SensorJsTest", function () {
})
/*
* @tc.name:SensorJsTest001
* @tc.number: SUB_SensorsSystem_Wear_Detection_JSTest_0010
* @tc.name: SensorWearDetectionJSTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Sensor
Js
Test001---------------------------
'
);
it
(
"
S
UB_SensorsSystem_Wear_Detection_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Sensor
WearDetectionJS
Test001---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_WEAR_DETECTION
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 off error
'
);
console
.
info
(
'
Sensor
WearDetectionJS
Test001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 off success
'
);
console
.
info
(
'
Sensor
WearDetectionJS
Test001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
...
...
@@ -81,13 +80,13 @@ describe("SensorJsTest", function () {
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_WEAR_DETECTION
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test001 on error
'
);
console
.
info
(
'
Sensor
WearDetectionJS
Test001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
Sensor
Js
Test001 once success value:
'
+
data
.
value
);
console
.
info
(
'
Sensor
WearDetectionJS
Test001 once success value:
'
+
data
.
value
);
expect
(
typeof
(
data
.
value
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
...
...
@@ -99,24 +98,23 @@ describe("SensorJsTest", function () {
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
Sensor
Js
Test001 reject
"
);
console
.
info
(
"
Sensor
WearDetectionJS
Test001 reject
"
);
})
done
();
})
/*
* @tc.name:SensorJsTest005
* @tc.number: SUB_SensorsSystem_Wear_Detection_JSTest_0050
* @tc.name: SensorWearDetectionJSTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
S
ensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
S
UB_SensorsSystem_Wear_Detection_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
Sensor
Js
Test005 once error
'
);
console
.
info
(
'
Sensor
WearDetectionJS
Test005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Sensor
Js
Test005 once success value:
'
+
data
.
value
);
console
.
info
(
'
Sensor
WearDetectionJS
Test005 once success value:
'
+
data
.
value
);
expect
(
typeof
(
data
.
value
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录