Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1c688540
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看板
未验证
提交
1c688540
编写于
5月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3313 【Sensor】【Master】新增环境光 加速器,陀螺仪,霍尔,接近光,getOnBodyState,subscribeBarometer等用例
Merge pull request !3313 from ldy/master
上级
7fda93b3
ac258bd9
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
809 addition
and
2449 deletion
+809
-2449
sensors/miscdevice_standard/src/main/js/default/test/Subscribe_vibrate.js
...ce_standard/src/main/js/default/test/Subscribe_vibrate.js
+8
-15
sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js
...rd/src/main/js/default/test/SensorGeomagneticTest.test.js
+378
-379
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer.js
...ain/js/default/test/SensorOnOffTest.test_Accelerometer.js
+0
-610
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Ambient_Light.js
...ain/js/default/test/SensorOnOffTest.test_Ambient_Light.js
+0
-586
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope.js
...rc/main/js/default/test/SensorOnOffTest.test_Gyroscope.js
+0
-609
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Hall.js
...ard/src/main/js/default/test/SensorOnOffTest.test_Hall.js
+0
-126
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Accelerometer.js
...src/main/js/default/test/SensorOnOffTest_Accelerometer.js
+2
-9
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Ambient_light.js
...src/main/js/default/test/SensorOnOffTest_Ambient_light.js
+324
-0
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_GyroScope.js
...ard/src/main/js/default/test/SensorOnOffTest_GyroScope.js
+1
-4
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Hall.js
...standard/src/main/js/default/test/SensorOnOffTest_Hall.js
+1
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_getOnBodyState.js
...dard/src/main/js/default/test/Subscribe_getOnBodyState.js
+1
-0
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeAccelerometer.js
.../main/js/default/test/Subscribe_subscribeAccelerometer.js
+11
-12
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeBarometer.js
.../src/main/js/default/test/Subscribe_subscribeBarometer.js
+3
-5
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeCompass.js
...rd/src/main/js/default/test/Subscribe_subscribeCompass.js
+1
-4
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeDeviceOrientation.js
...n/js/default/test/Subscribe_subscribeDeviceOrientation.js
+3
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeGyroscope.js
.../src/main/js/default/test/Subscribe_subscribeGyroscope.js
+10
-13
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeHeartRate.js
.../src/main/js/default/test/Subscribe_subscribeHeartRate.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeLight.js
...dard/src/main/js/default/test/Subscribe_subscribeLight.js
+22
-24
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeOnBodyState.js
...rc/main/js/default/test/Subscribe_subscribeOnBodyState.js
+1
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeProximity.js
.../src/main/js/default/test/Subscribe_subscribeProximity.js
+20
-21
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeStepCounter.js
...rc/main/js/default/test/Subscribe_subscribeStepCounter.js
+22
-22
未找到文件。
sensors/miscdevice_standard/src/main/js/default/test/vibrate.js
→
sensors/miscdevice_standard/src/main/js/default/test/
Subscribe_
vibrate.js
浏览文件 @
1c688540
...
@@ -48,7 +48,10 @@ describe("VibratorJsTest", function () {
...
@@ -48,7 +48,10 @@ describe("VibratorJsTest", function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
var
errMessages
=
[
'
Param number is invalid
'
,
'
Wrong argument type. function expected
'
,
'
Wrong argument type
'
,
'
Wrong argument number
'
]
let
errMessages
=
[
'
Param number is invalid
'
,
'
Wrong argument type. function expected
'
,
'
Wrong argument type
'
,
'
Wrong argument number
'
]
let
errMessage
;
/*
/*
* @tc.name:VibratorJsTest0001
* @tc.name:VibratorJsTest0001
...
@@ -62,7 +65,6 @@ describe("VibratorJsTest", function () {
...
@@ -62,7 +65,6 @@ describe("VibratorJsTest", function () {
mode
:
'
long
'
,
mode
:
'
long
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0001 success
"
);
console
.
info
(
"
VibratorJsTest0001 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
...
@@ -87,7 +89,6 @@ describe("VibratorJsTest", function () {
...
@@ -87,7 +89,6 @@ describe("VibratorJsTest", function () {
mode
:
'
short
'
,
mode
:
'
short
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0002 success
"
);
console
.
info
(
"
VibratorJsTest0002 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
...
@@ -112,7 +113,6 @@ describe("VibratorJsTest", function () {
...
@@ -112,7 +113,6 @@ describe("VibratorJsTest", function () {
mode
:
'
short
'
,
mode
:
'
short
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0003 success
"
);
console
.
info
(
"
VibratorJsTest0003 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
...
@@ -134,7 +134,6 @@ describe("VibratorJsTest", function () {
...
@@ -134,7 +134,6 @@ describe("VibratorJsTest", function () {
mode
:
'
short
'
,
mode
:
'
short
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0004 success
"
);
console
.
info
(
"
VibratorJsTest0004 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
});
});
...
@@ -151,7 +150,6 @@ describe("VibratorJsTest", function () {
...
@@ -151,7 +150,6 @@ describe("VibratorJsTest", function () {
vibrator
.
vibrate
({
vibrator
.
vibrate
({
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0005 success
"
);
console
.
info
(
"
VibratorJsTest0005 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
...
@@ -174,7 +172,6 @@ describe("VibratorJsTest", function () {
...
@@ -174,7 +172,6 @@ describe("VibratorJsTest", function () {
inInvalid
:
2
,
inInvalid
:
2
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0006 success
"
);
console
.
info
(
"
VibratorJsTest0006 success
"
);
expect
(
true
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
...
@@ -202,7 +199,7 @@ describe("VibratorJsTest", function () {
...
@@ -202,7 +199,7 @@ describe("VibratorJsTest", function () {
},
},
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
39
);
errMessage
=
error
.
toString
().
slice
(
39
);
console
.
info
(
'
VibratorJsTest0007 error:
'
+
error
);
console
.
info
(
'
VibratorJsTest0007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -221,26 +218,22 @@ describe("VibratorJsTest", function () {
...
@@ -221,26 +218,22 @@ describe("VibratorJsTest", function () {
mode
:
'
short
'
,
mode
:
'
short
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0008 success
"
);
console
.
info
(
"
VibratorJsTest0008 success
"
);
expect
(
true
).
assertTrue
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
VibratorJsTest0008 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
console
.
error
(
'
VibratorJsTest0008 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
vibrator
.
vibrate
({
vibrator
.
vibrate
({
mode
:
'
short
'
,
mode
:
'
short
'
,
success
:
function
()
{
success
:
function
()
{
console
.
info
(
"
VibratorJsTest0008_1 success
"
);
console
.
info
(
"
VibratorJsTest0008_1 success
"
);
expect
(
true
).
assertTrue
();
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
VibratorJsTest0008_1 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
console
.
error
(
'
VibratorJsTest0008_1 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
},
500
);
},
500
);
...
@@ -258,7 +251,7 @@ describe("VibratorJsTest", function () {
...
@@ -258,7 +251,7 @@ describe("VibratorJsTest", function () {
vibrator
.
vibrate
(
'
xxx
'
,
done
);
vibrator
.
vibrate
(
'
xxx
'
,
done
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
VibratorJsTest0009 error:
'
+
error
);
console
.
info
(
'
VibratorJsTest0009 error:
'
+
error
);
var
errMessage
=
error
.
toString
().
slice
(
68
);
errMessage
=
error
.
toString
().
slice
(
68
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
}
}
...
@@ -275,7 +268,7 @@ describe("VibratorJsTest", function () {
...
@@ -275,7 +268,7 @@ describe("VibratorJsTest", function () {
try
{
try
{
vibrator
.
vibrate
(
done
);
vibrator
.
vibrate
(
done
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
7
);
errMessage
=
error
.
toString
().
slice
(
7
);
console
.
info
(
'
VibratorJsTest0010 error:
'
+
error
);
console
.
info
(
'
VibratorJsTest0010 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
done
();
...
@@ -301,7 +294,7 @@ describe("VibratorJsTest", function () {
...
@@ -301,7 +294,7 @@ describe("VibratorJsTest", function () {
},
function
()
{
},
function
()
{
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
39
);
errMessage
=
error
.
toString
().
slice
(
39
);
console
.
info
(
'
VibratorJsTest0011 error:
'
+
error
);
console
.
info
(
'
VibratorJsTest0011 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
3
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
3
]);
done
();
done
();
...
...
sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js
浏览文件 @
1c688540
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
sensor
from
'
@ohos.sensor
'
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
"
,
function
()
{
...
@@ -51,27 +50,27 @@ describe("SensorJsTest", function () {
...
@@ -51,27 +50,27 @@ describe("SensorJsTest", function () {
let
GEOMAGNETIC_COMPONENT_YEAR_RESULT
=
[
let
GEOMAGNETIC_COMPONENT_YEAR_RESULT
=
[
[
6570.3935546875
,
-
146.3289337158203
,
54606.0078125
,
-
1.2758207321166992
,
83.13726043701172
,
6572.02294921875
,
[
6570.3935546875
,
-
146.3289337158203
,
54606.0078125
,
-
1.2758207321166992
,
83.13726043701172
,
6572.02294921875
,
55000.0703125
],
55000.0703125
],
[
6554.17041015625
,
-
87.19947052001953
,
54649.078125
,
-
0.7622424364089966
,
83.16046905517578
,
6554.75048828125
,
[
6554.17041015625
,
-
87.19947052001953
,
54649.078125
,
-
0.7622424364089966
,
83.16046905517578
,
6554.75048828125
,
55040.7734375
],
55040.7734375
],
[
6537.99169921875
,
-
28.231582641601562
,
54692.02734375
,
-
0.24740631878376007
,
83.18303680419922
,
[
6537.99169921875
,
-
28.231582641601562
,
54692.02734375
,
-
0.24740631878376007
,
83.18303680419922
,
6538.052734375
,
55081.4296875
],
6538.052734375
,
55081.4296875
],
[
6521.81201171875
,
30.73670768737793
,
54734.97265625
,
0.2700277864933014
,
83.20502471923828
,
6521.88427734375
,
[
6521.81201171875
,
30.73670768737793
,
54734.97265625
,
0.2700277864933014
,
83.20502471923828
,
6521.88427734375
,
55122.15625
],
55122.15625
],
[
6505.6328125
,
89.70511627197266
,
54777.90625
,
0.7899921536445618
,
83.22642517089844
,
6506.2509765625
,
[
6505.6328125
,
89.70511627197266
,
54777.90625
,
0.7899921536445618
,
83.22642517089844
,
6506.2509765625
,
55162.9453125
]]
55162.9453125
]]
let
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
=
[
let
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
=
[
[
6570.3935546875
,
-
146.3289337158203
,
54606.0078125
,
-
1.2758207321166992
,
83.13726043701172
,
6572.02294921875
,
[
6570.3935546875
,
-
146.3289337158203
,
54606.0078125
,
-
1.2758207321166992
,
83.13726043701172
,
6572.02294921875
,
55000.0703125
],
55000.0703125
],
[
39624.28125
,
109.8766098022461
,
-
10932.4638671875
,
0.15887857973575592
,
-
15.424291610717773
,
39624.43359375
,
[
39624.28125
,
109.8766098022461
,
-
10932.4638671875
,
0.15887857973575592
,
-
15.424291610717773
,
39624.43359375
,
41104.921875
],
41104.921875
],
[
37636.72265625
,
104.90892791748047
,
-
10474.810546875
,
0.15970633924007416
,
-
15.552550315856934
,
37636.8671875
,
[
37636.72265625
,
104.90892791748047
,
-
10474.810546875
,
0.15970633924007416
,
-
15.552550315856934
,
37636.8671875
,
39067.3203125
],
39067.3203125
],
[
5940.583984375
,
15772.0927734375
,
-
52480.7578125
,
69.36103820800781
,
-
72.19599914550781
,
16853.765625
,
[
5940.583984375
,
15772.0927734375
,
-
52480.7578125
,
69.36103820800781
,
-
72.19599914550781
,
16853.765625
,
55120.58984375
],
55120.58984375
],
[
5744.87255859375
,
14799.48046875
,
-
49969.40234375
,
68.78474426269531
,
-
72.37483215332031
,
15875.3955078125
,
[
5744.87255859375
,
14799.48046875
,
-
49969.40234375
,
68.78474426269531
,
-
72.37483215332031
,
15875.3955078125
,
52430.61328125
]]
52430.61328125
]]
let
GEOMAGNETIC_COORDINATES
=
[[
80
,
0
,
0
],
let
GEOMAGNETIC_COORDINATES
=
[[
80
,
0
,
0
],
[
0
,
120
,
0
],
[
0
,
120
,
0
],
...
@@ -102,9 +101,9 @@ describe("SensorJsTest", function () {
...
@@ -102,9 +101,9 @@ describe("SensorJsTest", function () {
},
500
)
},
500
)
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest001 success x:
'
+
data
.
x
+
'
,y:
'
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest001 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
...
@@ -145,10 +144,10 @@ describe("SensorJsTest", function () {
...
@@ -145,10 +144,10 @@ describe("SensorJsTest", function () {
},
500
)
},
500
)
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest002 success x:
'
+
data
.
x
+
'
,y:
'
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest002 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
0
])
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
0
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
1
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
1
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
])
...
@@ -173,8 +172,8 @@ describe("SensorJsTest", function () {
...
@@ -173,8 +172,8 @@ describe("SensorJsTest", function () {
*/
*/
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030-------------------------
"
);
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
let
geomagneticComponent
=
[
-
1417119616
,
23146989568
,
-
6406359552
,
-
15.442885398864746
,
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
93.50342559814453
,
23190329344
,
24058943488
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MAX_VALUE
,
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MAX_VALUE
,
(
error
,
data
)
=>
{
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -182,9 +181,9 @@ describe("SensorJsTest", function () {
...
@@ -182,9 +181,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest003 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest003 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -207,7 +206,7 @@ describe("SensorJsTest", function () {
...
@@ -207,7 +206,7 @@ describe("SensorJsTest", function () {
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040-------------------------
"
);
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MIN_VALUE
,
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MIN_VALUE
,
(
error
,
data
)
=>
{
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -215,10 +214,10 @@ describe("SensorJsTest", function () {
...
@@ -215,10 +214,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest004 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest004 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -241,7 +240,7 @@ describe("SensorJsTest", function () {
...
@@ -241,7 +240,7 @@ describe("SensorJsTest", function () {
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0050
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0050
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0050-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0050-------------------------
"
);
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
MAX_VALUE
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
MAX_VALUE
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
],
(
error
,
data
)
=>
{
timeMillis
[
0
],
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -249,9 +248,9 @@ describe("SensorJsTest", function () {
...
@@ -249,9 +248,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest005 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest005 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -274,7 +273,7 @@ describe("SensorJsTest", function () {
...
@@ -274,7 +273,7 @@ describe("SensorJsTest", function () {
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0060
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0060
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0060-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0060-------------------------
"
);
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NaN
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
],
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NaN
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
],
(
error
,
data
)
=>
{
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -282,9 +281,9 @@ describe("SensorJsTest", function () {
...
@@ -282,9 +281,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest006 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest006 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -307,7 +306,7 @@ describe("SensorJsTest", function () {
...
@@ -307,7 +306,7 @@ describe("SensorJsTest", function () {
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0070
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0070
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0070-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0070-------------------------
"
);
let
geomagneticComponent
=
[
14425.57421875
,
-
17156.767578125
,
-
52023.21484375
,
-
66.69005584716797
,
let
geomagneticComponent
=
[
14425.57421875
,
-
17156.767578125
,
-
52023.21484375
,
-
66.69005584716797
,
-
49.94255447387695
,
22415.4375
,
56646.859375
]
-
49.94255447387695
,
22415.4375
,
56646.859375
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
],
(
error
,
data
)
=>
{
timeMillis
[
0
],
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -315,10 +314,10 @@ describe("SensorJsTest", function () {
...
@@ -315,10 +314,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest007 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest007 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -347,10 +346,10 @@ describe("SensorJsTest", function () {
...
@@ -347,10 +346,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest008 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest008 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
();
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -373,10 +372,10 @@ describe("SensorJsTest", function () {
...
@@ -373,10 +372,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest009 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest009 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -399,10 +398,10 @@ describe("SensorJsTest", function () {
...
@@ -399,10 +398,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest010 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest010 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -425,10 +424,10 @@ describe("SensorJsTest", function () {
...
@@ -425,10 +424,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest011 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest011 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -445,7 +444,7 @@ describe("SensorJsTest", function () {
...
@@ -445,7 +444,7 @@ describe("SensorJsTest", function () {
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0120
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0120
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0120-------------------------
"
);
console
.
info
(
"
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0120-------------------------
"
);
let
geomagneticComponent
=
[
27536.40234375
,
-
2248.586669921875
,
-
16022.4306640625
,
-
30.110872268676758
,
let
geomagneticComponent
=
[
27536.40234375
,
-
2248.586669921875
,
-
16022.4306640625
,
-
30.110872268676758
,
-
4.66834020614624
,
27628.05859375
,
31937.875
]
-
4.66834020614624
,
27628.05859375
,
31937.875
]
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MIN_VALUE
},
timeMillis
[
0
],
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MIN_VALUE
},
timeMillis
[
0
],
(
error
,
data
)
=>
{
(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -453,10 +452,10 @@ describe("SensorJsTest", function () {
...
@@ -453,10 +452,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest012 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest012 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
...
@@ -485,10 +484,10 @@ describe("SensorJsTest", function () {
...
@@ -485,10 +484,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest013 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest013 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -511,10 +510,10 @@ describe("SensorJsTest", function () {
...
@@ -511,10 +510,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest014 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest014 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -537,10 +536,10 @@ describe("SensorJsTest", function () {
...
@@ -537,10 +536,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest015 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest015 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -563,10 +562,10 @@ describe("SensorJsTest", function () {
...
@@ -563,10 +562,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest016 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest016 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -589,9 +588,9 @@ describe("SensorJsTest", function () {
...
@@ -589,9 +588,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest017 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest017 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -614,10 +613,10 @@ describe("SensorJsTest", function () {
...
@@ -614,10 +613,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest018 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest018 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -640,10 +639,10 @@ describe("SensorJsTest", function () {
...
@@ -640,10 +639,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertfalse
();
expect
(
false
).
assertfalse
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest019 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest019 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -666,9 +665,9 @@ describe("SensorJsTest", function () {
...
@@ -666,9 +665,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest020 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest020 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
();
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -691,10 +690,10 @@ describe("SensorJsTest", function () {
...
@@ -691,10 +690,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest021 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest021 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -717,10 +716,10 @@ describe("SensorJsTest", function () {
...
@@ -717,10 +716,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest022 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest022 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -743,10 +742,10 @@ describe("SensorJsTest", function () {
...
@@ -743,10 +742,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest023 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest023 success x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -769,9 +768,9 @@ describe("SensorJsTest", function () {
...
@@ -769,9 +768,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest024 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest024 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -794,9 +793,9 @@ describe("SensorJsTest", function () {
...
@@ -794,9 +793,9 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest025 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest025 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -815,20 +814,20 @@ describe("SensorJsTest", function () {
...
@@ -815,20 +814,20 @@ describe("SensorJsTest", function () {
for
(
let
i
=
0
;
i
<
timeMillis
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
timeMillis
.
length
;
i
++
)
{
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
i
]).
then
((
data
)
=>
{
timeMillis
[
i
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest026 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest026 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
);
+
'
,totalIntensity:
'
+
data
.
totalIntensity
);
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
})
})
}
}
done
()
done
()
})
})
...
@@ -840,24 +839,24 @@ describe("SensorJsTest", function () {
...
@@ -840,24 +839,24 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270------------------
'
);
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
let
geomagneticComponent
=
[
-
1417119616
,
23146989568
,
-
6406359552
,
-
15.442885398864746
,
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
93.50342559814453
,
23190329344
,
24058943488
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MAX_VALUE
).
then
((
data
)
=>
{
Number
.
MAX_VALUE
).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest027 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest027 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -869,23 +868,23 @@ describe("SensorJsTest", function () {
...
@@ -869,23 +868,23 @@ describe("SensorJsTest", function () {
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280------------------
'
);
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
let
geomagneticComponent
=
[
27779.234375
,
-
6214.9794921875
,
-
14924.6611328125
,
-
27.667943954467773
,
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
-
12.610970497131348
,
28465.9765625
,
32141.2109375
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MIN_VALUE
).
then
((
data
)
=>
{
Number
.
MIN_VALUE
).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest028 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest028 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -897,23 +896,23 @@ describe("SensorJsTest", function () {
...
@@ -897,23 +896,23 @@ describe("SensorJsTest", function () {
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0290
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0290
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0290------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0290------------------
'
);
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
MAX_VALUE
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
MAX_VALUE
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest029 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest029 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -925,23 +924,23 @@ describe("SensorJsTest", function () {
...
@@ -925,23 +924,23 @@ describe("SensorJsTest", function () {
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0300
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0300
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0300------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0300------------------
'
);
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
let
geomagneticComponent
=
[
1824.141845703125
,
116.58167266845703
,
56727.7734375
,
88.15447235107422
,
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
3.6568238735198975
,
1827.8634033203125
,
56757.21484375
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NaN
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NaN
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest030 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest030 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -953,23 +952,23 @@ describe("SensorJsTest", function () {
...
@@ -953,23 +952,23 @@ describe("SensorJsTest", function () {
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0310
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0310
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0310------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0310------------------
'
);
let
geomagneticComponent
=
[
14425.57421875
,
-
17156.767578125
,
-
52023.21484375
,
-
66.69005584716797
,
let
geomagneticComponent
=
[
14425.57421875
,
-
17156.767578125
,
-
52023.21484375
,
-
66.69005584716797
,
-
49.94255447387695
,
22415.4375
,
56646.859375
]
-
49.94255447387695
,
22415.4375
,
56646.859375
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest031 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest031 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -983,14 +982,14 @@ describe("SensorJsTest", function () {
...
@@ -983,14 +982,14 @@ describe("SensorJsTest", function () {
let
geomagneticComponent
=
[
NaN
,
NaN
,
NaN
]
let
geomagneticComponent
=
[
NaN
,
NaN
,
NaN
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
MAX_VALUE
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
MAX_VALUE
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest032 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest032 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1003,14 +1002,14 @@ describe("SensorJsTest", function () {
...
@@ -1003,14 +1002,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0330------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0330------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest033 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest033 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1023,14 +1022,14 @@ describe("SensorJsTest", function () {
...
@@ -1023,14 +1022,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0340------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0340------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest034 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest034 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1043,14 +1042,14 @@ describe("SensorJsTest", function () {
...
@@ -1043,14 +1042,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0350------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0350------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest035 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest035 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1062,23 +1061,23 @@ describe("SensorJsTest", function () {
...
@@ -1062,23 +1061,23 @@ describe("SensorJsTest", function () {
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0360
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0360
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0360------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0360------------------
'
);
let
geomagneticComponent
=
[
27536.40234375
,
-
2248.586669921875
,
-
16022.4306640625
,
-
30.110872268676758
,
let
geomagneticComponent
=
[
27536.40234375
,
-
2248.586669921875
,
-
16022.4306640625
,
-
30.110872268676758
,
-
4.66834020614624
,
27628.05859375
,
31937.875
]
-
4.66834020614624
,
27628.05859375
,
31937.875
]
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MIN_VALUE
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MIN_VALUE
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest036 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest036 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
x
).
assertEqual
(
geomagneticComponent
[
0
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
y
).
assertEqual
(
geomagneticComponent
[
1
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
z
).
assertEqual
(
geomagneticComponent
[
2
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
geomagneticComponent
[
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
geomagneticComponent
[
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
geomagneticComponent
[
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
geomagneticComponent
[
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1091,14 +1090,14 @@ describe("SensorJsTest", function () {
...
@@ -1091,14 +1090,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0370------------------start
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0370------------------start
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest037 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest037 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1113,14 +1112,14 @@ describe("SensorJsTest", function () {
...
@@ -1113,14 +1112,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0380------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0380------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest038 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest038 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
x
)
&&
Number
.
isNaN
(
data
.
y
)
&&
Number
.
isNaN
(
data
.
z
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1134,20 +1133,20 @@ describe("SensorJsTest", function () {
...
@@ -1134,20 +1133,20 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
i
]).
then
((
data
)
=>
{
timeMillis
[
i
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest039 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest039 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
);
+
'
,totalIntensity:
'
+
data
.
totalIntensity
);
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
}
}
done
()
done
()
})
})
...
@@ -1161,14 +1160,14 @@ describe("SensorJsTest", function () {
...
@@ -1161,14 +1160,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0400------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0400------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest040 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest040 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1181,14 +1180,14 @@ describe("SensorJsTest", function () {
...
@@ -1181,14 +1180,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0410------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0410------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest041 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest041 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1201,14 +1200,14 @@ describe("SensorJsTest", function () {
...
@@ -1201,14 +1200,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0420 max ------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0420 max ------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest042 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest042 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1221,14 +1220,14 @@ describe("SensorJsTest", function () {
...
@@ -1221,14 +1220,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0430------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0430------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest043 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest043 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1241,14 +1240,14 @@ describe("SensorJsTest", function () {
...
@@ -1241,14 +1240,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0440------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0440------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest044 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest044 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
console
.
info
(
"
promise::catch
"
,
error
)
});
});
done
()
done
()
})
})
...
@@ -1265,20 +1264,20 @@ describe("SensorJsTest", function () {
...
@@ -1265,20 +1264,20 @@ describe("SensorJsTest", function () {
'
longitude
'
:
GEOMAGNETIC_COORDINATES
[
i
][
1
],
'
altitude
'
:
GEOMAGNETIC_COORDINATES
[
i
][
2
]
'
longitude
'
:
GEOMAGNETIC_COORDINATES
[
i
][
1
],
'
altitude
'
:
GEOMAGNETIC_COORDINATES
[
i
][
2
]
},
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest045 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest045 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
0
])
expect
(
data
.
x
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
0
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
1
])
expect
(
data
.
y
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
1
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
2
])
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
2
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
3
])
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
3
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
4
])
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
4
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
5
])
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
5
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
6
])
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
6
])
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
}
}
done
()
done
()
})
})
...
@@ -1292,14 +1291,14 @@ describe("SensorJsTest", function () {
...
@@ -1292,14 +1291,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0460------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0460------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
MAX_VALUE
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
MAX_VALUE
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest046 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest046 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
();
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -1312,14 +1311,14 @@ describe("SensorJsTest", function () {
...
@@ -1312,14 +1311,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0470------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0470------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NaN
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest047 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest047 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -1332,14 +1331,14 @@ describe("SensorJsTest", function () {
...
@@ -1332,14 +1331,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0480------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0480------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest048 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest048 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
deflectionAngle
)
&&
Number
.
isNaN
(
data
.
geomagneticDip
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -1352,14 +1351,14 @@ describe("SensorJsTest", function () {
...
@@ -1352,14 +1351,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0490------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0490------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MAX_VALUE
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest049 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest049 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -1372,14 +1371,14 @@ describe("SensorJsTest", function () {
...
@@ -1372,14 +1371,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0500------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0500------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NaN
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest050 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest050 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
...
@@ -1392,14 +1391,14 @@ describe("SensorJsTest", function () {
...
@@ -1392,14 +1391,14 @@ describe("SensorJsTest", function () {
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0510------------------
'
);
console
.
info
(
'
------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0510------------------
'
);
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
await
sensor
.
getGeomagneticField
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
NEGATIVE_INFINITY
},
timeMillis
[
0
]).
then
((
data
)
=>
{
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest051 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest051 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
expect
(
Number
.
isNaN
(
data
.
levelIntensity
)
&&
Number
.
isNaN
(
data
.
totalIntensity
)).
assertTrue
()
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
console
.
info
(
"
promise::catch
"
,
error
);
});
});
done
()
done
()
})
})
})
})
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer.js
已删除
100755 → 0
浏览文件 @
7fda93b3
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0010
* @tc.name: SensorAccelerometerJSTest001
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0010---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorAccelerometerJSTest001 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0020
* @tc.name: SensorAccelerometerJSTest002
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0020---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
-
1
,
onSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0030
* @tc.name: SensorAccelerometerJSTest003
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0030---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
{
'
interval
'
:
200000000
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorAccelerometerJSTest003 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0040
* @tc.name: SensorAccelerometerJSTest004
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0040---------------------------
'
);
sensor
.
on
(
1
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------SensorAccelerometerJSTest004--------------------------- end
'
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0050
* @tc.name: SensorAccelerometerJSTest005
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
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
"
);
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0060
* @tc.name: SensorAccelerometerJSTest006
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
-
1
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0070
* @tc.name: SensorAccelerometerJSTest007
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0070
"
,
0
,
function
()
{
sensor
.
once
(
1
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0080
* @tc.name: SensorAccelerometerJSTest008
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
-
1
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0090
* @tc.name: SensorAccelerometerJSTest009
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
1
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0100
* @tc.name: SensorAccelerometerJSTest010
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0100
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
1000000
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0110
* @tc.name: SensorAccelerometerJSTest011
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
1000000
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0120
* @tc.name: SensorAccelerometerJSTest012
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
1000000
,
onCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0130
* @tc.name: SensorAccelerometerJSTest013
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
1
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0140
* @tc.name: SensorAccelerometerJSTest014
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0140---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
(
err
);
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
()
},
500
);
}
});
})
}
function
offPromise1
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise1
();
}).
then
(()
=>
{
return
offPromise2
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0150
* @tc.name: SensorAccelerometerJSTest015
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0150---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
onPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
onPromise2
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Accelerometer_JSTest_0160
* @tc.name: SensorAccelerometerJSTest016
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Accelerometer_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Accelerometer_JSTest_0160---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
1
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerJSTest016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
oncePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
1
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAccelerometerJSTest016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
oncePromise
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
})
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Ambient_Light.js
已删除
100755 → 0
浏览文件 @
7fda93b3
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0010
* @tc.name: SensorAmbientLightJSTest001
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_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
(
'
SensorAmbientLightJSTest001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest001 on success, success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorAmbientLightJSTest001 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0020
* @tc.name: SensorAmbientLightJSTest002
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Ambient_Light_JSTest_0020---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
-
1
,
onSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0030
* @tc.name: SensorAmbientLightJSTest003
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Ambient_Light_JSTest_0030---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest003 on success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
{
'
interval
'
:
200000000
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorAmbientLightJSTest003 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0040
* @tc.name: SensorAmbientLightJSTest004
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------SensorAmbientLightJSTest004---------------------------
'
);
sensor
.
on
(
5
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------SensorAmbientLightJSTest004--------------------------- end
'
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0050
* @tc.name: SensorAmbientLightJSTest005
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest005 once success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0060
* @tc.name: SensorAmbientLightJSTest006
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
-
1
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0070
* @tc.name: SensorAmbientLightJSTest007
* @tc.desc:verify app info is not null
*/
it
(
"
SensorJsTest007
"
,
0
,
function
()
{
sensor
.
once
(
5
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0080
* @tc.name: SensorAmbientLightJSTest008
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
-
1
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0090
* @tc.name: SensorAmbientLightJSTest009
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
5
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0100
* @tc.name: SensorAmbientLightJSTest010
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0100
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
2000000
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0110
* @tc.name: SensorAmbientLightJSTest011
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
2000000
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0120
* @tc.name: SensorAmbientLightJSTest012
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
2000000
,
onCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0130
* @tc.name: SensorAmbientLightJSTest013
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
5
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0140
* @tc.name: SensorAmbientLightJSTest014
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Ambient_Light_JSTest_0140---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
()
},
500
);
}
});
})
}
function
offPromise1
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest014 on success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise1
();
}).
then
(()
=>
{
return
offPromise2
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0150
* @tc.name: SensorAmbientLightJSTest015
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Ambient_Light_JSTest_0150---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
onPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest015 on2 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest015 on1 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
onPromise2
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Ambient_Light_JSTest_0160
* @tc.name: SensorAmbientLightJSTest016
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Ambient_Light_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Ambient_Light_JSTest_0160---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
5
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
oncePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest016 once success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
5
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorAmbientLightJSTest016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAmbientLightJSTest016 on1 success data:
'
+
data
.
intensity
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
oncePromise
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
})
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope.js
已删除
100755 → 0
浏览文件 @
7fda93b3
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0010
* @tc.name: SensorGyroscopeJSTest001
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0010---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorGyroscopeJSTest001 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0020
* @tc.name: SensorGyroscopeJSTest002
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0020
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0020---------------------------
'
);
function
onSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest002 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest002 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
-
1
,
onSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0030
* @tc.name: SensorGyroscopeJSTest003
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0030
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0030---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest003 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest003 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest003 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
{
'
interval
'
:
200000000
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorGyroscopeJSTest003 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0040
* @tc.name: SensorGyroscopeJSTest004
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0040
"
,
0
,
function
()
{
console
.
info
(
'
----------------------SensorGyroscopeJSTest004---------------------------
'
);
sensor
.
on
(
2
,
function
()
{
},
{
'
interval
'
:
100000000
},
5
);
expect
(
true
).
assertTrue
();
console
.
info
(
'
----------------------SensorGyroscopeJSTest004--------------------------- end
'
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0050
* @tc.name: SensorGyroscopeJSTest005
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest005 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
"
);
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0060
* @tc.name: SensorGyroscopeJSTest006
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0060
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest006 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest006 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
-
1
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0070
* @tc.name: SensorGyroscopeJSTest007
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0070
"
,
0
,
function
()
{
sensor
.
once
(
2
,
function
()
{
},
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0080
* @tc.name: SensorGyroscopeJSTest008
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0080
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest008 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest008 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
-
1
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0090
* @tc.name: SensorGyroscopeJSTest009
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0090
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest009 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest009 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
2
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0100
* @tc.name: SensorGyroscopeJSTest010
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0100
"
,
0
,
async
function
(
done
)
{
function
offCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest010 off success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest010 off error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
off
(
1000000
,
offCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0110
* @tc.name: SensorGyroscopeJSTest011
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0110
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest011 once success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest011 once error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
1000000
,
onceSensorCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0120
* @tc.name: SensorGyroscopeJSTest012
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0120
"
,
0
,
async
function
(
done
)
{
function
onCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest012 on success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest012 on error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
on
(
1000000
,
onCallback
);
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0130
* @tc.name: SensorGyroscopeJSTest013
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0130
"
,
0
,
function
()
{
sensor
.
off
(
2
,
5
);
expect
(
true
).
assertTrue
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0140
* @tc.name: SensorGyroscopeJSTest014
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0140
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0140---------------------------
'
);
function
offPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest014 off2 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
)
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest014 off2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
()
},
500
);
}
});
})
}
function
offPromise1
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest014 off1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest014 off1 success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest014 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise1
();
}).
then
(()
=>
{
return
offPromise2
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0150
* @tc.name: SensorGyroscopeJSTest015
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0150
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0150---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest015 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest015 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
onPromise2
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest015 on2 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest015 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
onPromise2
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Gyroscope_JSTest_0160
* @tc.name: SensorGyroscopeJSTest016
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Gyroscope_JSTest_0160
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Gyroscope_JSTest_0160---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
2
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest016 off error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
done
();
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest016 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
resolve
();
},
500
);
}
});
})
}
function
oncePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
once
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest016 once error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest016 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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
onPromise1
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
2
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorGyroscopeJSTest016 on1 error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeJSTest016 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
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
onPromise1
.
then
(()
=>
{
return
oncePromise
();
}).
then
(()
=>
{
return
offPromise
();
});
done
();
})
})
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Hall.js
已删除
100755 → 0
浏览文件 @
7fda93b3
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
/*
* @tc.number: SUB_SensorsSystem_Hall_JSTest_0010
* @tc.name: SensorHallJSTest001
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Hall_JSTest_0010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------SUB_SensorsSystem_Hall_JSTest_0010---------------------------
'
);
function
offPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
SensorHallJSTest001 off error
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
setTimeout ..start
'
)
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorHallJSTest001 off success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
},
1000
)
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
function
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorHallJSTest001 on error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorHallJSTest001 on success status:
'
+
data
.
status
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
offPromise
();
},
()
=>
{
console
.
info
(
"
SensorHallJSTest001 reject
"
);
})
done
();
})
/*
* @tc.number: SUB_SensorsSystem_Hall_JSTest_0050
* @tc.name: SensorHallJSTest005
* @tc.desc:verify app info is not null
*/
it
(
"
SUB_SensorsSystem_Hall_JSTest_0050
"
,
0
,
async
function
(
done
)
{
function
onceSensorCallback
(
error
,
data
)
{
if
(
error
)
{
console
.
info
(
'
SensorHallJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorHallJSTest005 once success status:
'
+
data
.
status
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
}
setTimeout
(()
=>
{
done
();
},
500
);
}
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
onceSensorCallback
);
})
})
sensors/sensor_standard/src/main/js/default/test/Accelerometer.js
→
sensors/sensor_standard/src/main/js/default/test/
SensorOnOffTest_
Accelerometer.js
浏览文件 @
1c688540
...
@@ -31,7 +31,7 @@ describe("SensorJsTest", function () {
...
@@ -31,7 +31,7 @@ describe("SensorJsTest", function () {
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
/*
/*
* @tc.setup: setup invoked before all testcases
* @tc.setup: setup invoked before all testcases
*/
*/
...
@@ -64,6 +64,7 @@ describe("SensorJsTest", function () {
...
@@ -64,6 +64,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -106,13 +107,11 @@ describe("SensorJsTest", function () {
...
@@ -106,13 +107,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
Accelerometer_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
it
(
"
Accelerometer_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Accelerometer_SensorJsTest003 on error
'
);
console
.
info
(
'
Accelerometer_SensorJsTest003 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -146,13 +145,11 @@ describe("SensorJsTest", function () {
...
@@ -146,13 +145,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
Accelerometer_SensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
Accelerometer_SensorJsTest005
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest005---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest005---------------------------
'
);
function
onceSensorCallback
(
data
)
{
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
Accelerometer_SensorJsTest005 on error
'
);
console
.
info
(
'
Accelerometer_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onceSensorCallback
,
5
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -189,13 +186,11 @@ describe("SensorJsTest", function () {
...
@@ -189,13 +186,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
Accelerometer_SensorJsTest007
"
,
0
,
async
function
(
done
)
{
it
(
"
Accelerometer_SensorJsTest007
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest007---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest007---------------------------
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Accelerometer_SensorJsTest007 on error
'
);
console
.
info
(
'
Accelerometer_SensorJsTest007 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
onSensorCallback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -212,13 +207,11 @@ describe("SensorJsTest", function () {
...
@@ -212,13 +207,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
Accelerometer_SensorJsTest008
"
,
0
,
async
function
(
done
)
{
it
(
"
Accelerometer_SensorJsTest008
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest008---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest008---------------------------
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Accelerometer_SensorJsTest008 on error
'
);
console
.
info
(
'
Accelerometer_SensorJsTest008 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Ambient_light.js
0 → 100644
浏览文件 @
1c688540
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
}
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
}
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
let
errMessage
;
/*
* @tc.name:Ambient_Light_SensorJsTest001
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest001---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
);
done
();
},
1500
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest002
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest002---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest002 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest002 off end---------------------------
'
);
done
();
},
1500
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest003
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Ambient_Light_SensorJsTest003 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest003 error:
"
+
error
);
errMessage
=
error
.
toString
().
slice
(
12
,
49
);
console
.
info
(
'
Ambient_Light_SensorJsTest003 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/*
* @tc.name:Ambient_Light_SensorJsTest004
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest004
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest004---------------------------
'
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest005
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest005
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest005---------------------------
'
);
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
Ambient_Light_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest005 error:
"
+
error
);
errMessage
=
error
.
toString
().
slice
(
14
,
51
);
console
.
info
(
'
Ambient_Light_SensorJsTest005 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/*
* @tc.name:Ambient_Light_SensorJsTest006
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest006
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest006---------------------------
'
);
try
{
sensor
.
off
(
string
,
""
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest006 error:
"
+
error
);
errMessage
=
error
.
toString
().
slice
(
16
,
40
);
console
.
info
(
'
Ambient_Light_SensorJsTest006 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
}
})
/*
* @tc.name:Ambient_Light_SensorJsTest007
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest007
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest007---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Ambient_Light_SensorJsTest007 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
onSensorCallback
);
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest008
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest008
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest008---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Ambient_Light_SensorJsTest008 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest008 error:
"
+
error
);
errMessage
=
error
.
toString
().
slice
(
13
,
35
);
console
.
info
(
'
Ambient_Light_SensorJsTest008 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
}
})
/*
* @tc.name:Ambient_Light_SensorJsTest009
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest009
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest009---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest009 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest009 off end---------------------------
'
);
done
();
},
2000
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest010
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest010
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off end---------------------------
'
);
},
1000
);
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off end---------------------------
'
);
done
();
},
2000
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest011
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest011
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest011---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest011 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest011 off end---------------------------
'
);
done
();
},
1000
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest012
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest012
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off end---------------------------
'
);
done
();
},
1000
);
})
/*
* @tc.name:Ambient_Light_SensorJsTest013
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it
(
"
Ambient_Light_SensorJsTest013
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest013---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest013 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest013 off end---------------------------
'
);
done
();
},
1000
);
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/GyroScope.js
→
sensors/sensor_standard/src/main/js/default/test/
SensorOnOffTest_
GyroScope.js
浏览文件 @
1c688540
...
@@ -64,6 +64,7 @@ describe("SensorJsTest", function () {
...
@@ -64,6 +64,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -106,13 +107,11 @@ describe("SensorJsTest", function () {
...
@@ -106,13 +107,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
GYROSCOPE_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
it
(
"
GYROSCOPE_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
GYROSCOPE_SensorJsTest003 on error
'
);
console
.
info
(
'
GYROSCOPE_SensorJsTest003 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -146,13 +145,11 @@ describe("SensorJsTest", function () {
...
@@ -146,13 +145,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
GYROSCOPE_SensorJsTest005
"
,
0
,
async
function
(
done
)
{
it
(
"
GYROSCOPE_SensorJsTest005
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest005---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest005---------------------------
'
);
function
onceSensorCallback
(
data
)
{
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
GYROSCOPE_SensorJsTest005 on error
'
);
console
.
info
(
'
GYROSCOPE_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
onceSensorCallback
,
5
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/Hall.js
→
sensors/sensor_standard/src/main/js/default/test/
SensorOnOffTest_
Hall.js
浏览文件 @
1c688540
...
@@ -60,6 +60,7 @@ describe("SensorJsTest", function () {
...
@@ -60,6 +60,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -102,13 +103,11 @@ describe("SensorJsTest", function () {
...
@@ -102,13 +103,11 @@ describe("SensorJsTest", function () {
*/
*/
it
(
"
Hall_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
it
(
"
Hall_SensorJsTest003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------Hall_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------Hall_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
Hall_SensorJsTest003 on error
'
);
console
.
info
(
'
Hall_SensorJsTest003 on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -204,7 +203,6 @@ describe("SensorJsTest", function () {
...
@@ -204,7 +203,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/getOnBodyState.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
getOnBodyState.js
浏览文件 @
1c688540
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, function expected
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, function expected
'
,
'
Wrong argument type, should be object
'
]
'
Wrong argument type, should be object
'
]
let
errMessage
;
let
errMessage
;
/*
/*
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeAccelerometer.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeAccelerometer.js
浏览文件 @
1c688540
...
@@ -16,7 +16,7 @@ import sensor from '@system.sensor'
...
@@ -16,7 +16,7 @@ import sensor from '@system.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
"
,
function
()
{
beforeAll
(
function
()
{
beforeAll
(
function
()
{
/*
/*
* @tc.setup: setup invoked before all testcases
* @tc.setup: setup invoked before all testcases
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
var
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
let
errMessage
;
/*
/*
* @tc.name:subscribeAccelerometer_SensorJsTest001
* @tc.name:subscribeAccelerometer_SensorJsTest001
...
@@ -71,7 +74,6 @@ describe("SensorJsTest", function () {
...
@@ -71,7 +74,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeAccelerometer
();
sensor
.
unsubscribeAccelerometer
();
...
@@ -107,7 +109,6 @@ describe("SensorJsTest", function () {
...
@@ -107,7 +109,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeAccelerometer
();
sensor
.
unsubscribeAccelerometer
();
...
@@ -181,7 +182,7 @@ describe("SensorJsTest", function () {
...
@@ -181,7 +182,7 @@ describe("SensorJsTest", function () {
},
},
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest004 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest004 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -212,7 +213,7 @@ describe("SensorJsTest", function () {
...
@@ -212,7 +213,7 @@ describe("SensorJsTest", function () {
},
function
()
{
},
function
()
{
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest005 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest005 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -280,7 +281,7 @@ describe("SensorJsTest", function () {
...
@@ -280,7 +281,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeAccelerometer
();
sensor
.
subscribeAccelerometer
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest007 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -298,7 +299,7 @@ describe("SensorJsTest", function () {
...
@@ -298,7 +299,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeAccelerometer
(
'
xxx
'
);
sensor
.
subscribeAccelerometer
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest008 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest008 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -316,7 +317,7 @@ describe("SensorJsTest", function () {
...
@@ -316,7 +317,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeAccelerometer
(
'
xxx
'
);
sensor
.
unsubscribeAccelerometer
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest009 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest009 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -358,7 +359,7 @@ describe("SensorJsTest", function () {
...
@@ -358,7 +359,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeAccelerometer
();
sensor
.
unsubscribeAccelerometer
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest011 error:
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest011 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
done
();
...
@@ -430,12 +431,10 @@ describe("SensorJsTest", function () {
...
@@ -430,12 +431,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
try
{
try
{
sensor
.
unsubscribeAccelerometer
();
sensor
.
unsubscribeAccelerometer
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeAccelerometer_SensorJsTest014_unsubscribeAccelerometer error
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest014_unsubscribeAccelerometer error
'
+
error
);
expect
(
true
).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeBarometer.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeBarometer.js
浏览文件 @
1c688540
...
@@ -49,7 +49,8 @@ describe("SensorJsTest", function () {
...
@@ -49,7 +49,8 @@ describe("SensorJsTest", function () {
})
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -83,7 +84,6 @@ describe("SensorJsTest", function () {
...
@@ -83,7 +84,6 @@ describe("SensorJsTest", function () {
},
1000
);
},
1000
);
})
})
/*
/*
* @tc.name:subscribeBarometer_SensorJsTest002
* @tc.name:subscribeBarometer_SensorJsTest002
* @tc.desc:verify app info is not null
* @tc.desc:verify app info is not null
...
@@ -221,7 +221,6 @@ describe("SensorJsTest", function () {
...
@@ -221,7 +221,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeBarometer
();
sensor
.
unsubscribeBarometer
();
...
@@ -246,7 +245,7 @@ describe("SensorJsTest", function () {
...
@@ -246,7 +245,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeBarometer
();
sensor
.
unsubscribeBarometer
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeBarometer_SensorJsTest008 error:
'
+
error
);
console
.
info
(
'
subscribeBarometer_SensorJsTest008 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -271,7 +270,6 @@ describe("SensorJsTest", function () {
...
@@ -271,7 +270,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
try
{
try
{
sensor
.
unsubscribeBarometer
();
sensor
.
unsubscribeBarometer
();
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeCompass.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeCompass.js
浏览文件 @
1c688540
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -125,7 +126,6 @@ describe("SensorJsTest", function () {
...
@@ -125,7 +126,6 @@ describe("SensorJsTest", function () {
expect
(
typeof
(
data
.
direction
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
direction
)).
assertEqual
(
"
number
"
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeCompass
();
sensor
.
unsubscribeCompass
();
...
@@ -250,7 +250,6 @@ describe("SensorJsTest", function () {
...
@@ -250,7 +250,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeCompass
();
sensor
.
unsubscribeCompass
();
...
@@ -301,12 +300,10 @@ describe("SensorJsTest", function () {
...
@@ -301,12 +300,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
try
{
try
{
sensor
.
unsubscribeCompass
();
sensor
.
unsubscribeCompass
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeLight_SensorJsTest010_unsubscribeLight error
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest010_unsubscribeLight error
'
+
error
);
expect
(
true
).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeDeviceOrientation.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeDeviceOrientation.js
浏览文件 @
1c688540
...
@@ -49,9 +49,10 @@ describe("SensorJsTest", function () {
...
@@ -49,9 +49,10 @@ describe("SensorJsTest", function () {
})
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
'
UnsubscribeSensor failed
'
];
let
errMessage
;
let
errMessage
;
/*
/*
* @tc.name:subscribeDeviceOrientation_SensorJsTest001
* @tc.name:subscribeDeviceOrientation_SensorJsTest001
* @tc.desc:verify app info is not null
* @tc.desc:verify app info is not null
...
@@ -437,7 +438,6 @@ describe("SensorJsTest", function () {
...
@@ -437,7 +438,6 @@ describe("SensorJsTest", function () {
sensor
.
unsubscribeDeviceOrientation
();
sensor
.
unsubscribeDeviceOrientation
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeDeviceOrientation_SensorJsTest014_unsubscribeDeviceOrientation error
'
+
error
);
console
.
info
(
'
subscribeDeviceOrientation_SensorJsTest014_unsubscribeDeviceOrientation error
'
+
error
);
expect
(
true
).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeGyroscope.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeGyroscope.js
浏览文件 @
1c688540
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
var
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
let
errMessage
;
/*
/*
* @tc.name:subscribeGyroscope_SensorJsTest001
* @tc.name:subscribeGyroscope_SensorJsTest001
...
@@ -71,7 +74,6 @@ describe("SensorJsTest", function () {
...
@@ -71,7 +74,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeGyroscope
();
sensor
.
unsubscribeGyroscope
();
...
@@ -107,7 +109,6 @@ describe("SensorJsTest", function () {
...
@@ -107,7 +109,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeGyroscope
();
sensor
.
unsubscribeGyroscope
();
...
@@ -229,7 +230,7 @@ describe("SensorJsTest", function () {
...
@@ -229,7 +230,7 @@ describe("SensorJsTest", function () {
},
},
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest006 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest006 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -260,7 +261,7 @@ describe("SensorJsTest", function () {
...
@@ -260,7 +261,7 @@ describe("SensorJsTest", function () {
},
function
()
{
},
function
()
{
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest007 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -288,7 +289,6 @@ describe("SensorJsTest", function () {
...
@@ -288,7 +289,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
sensor
.
subscribeGyroscope
({
sensor
.
subscribeGyroscope
({
interval
:
'
normal
'
,
interval
:
'
normal
'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -302,7 +302,6 @@ describe("SensorJsTest", function () {
...
@@ -302,7 +302,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeGyroscope
();
sensor
.
unsubscribeGyroscope
();
...
@@ -328,7 +327,7 @@ describe("SensorJsTest", function () {
...
@@ -328,7 +327,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeGyroscope
();
sensor
.
subscribeGyroscope
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest009 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest009 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -346,7 +345,7 @@ describe("SensorJsTest", function () {
...
@@ -346,7 +345,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeGyroscope
(
'
xxx
'
);
sensor
.
subscribeGyroscope
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest010 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest010 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -364,7 +363,7 @@ describe("SensorJsTest", function () {
...
@@ -364,7 +363,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeGyroscope
();
sensor
.
unsubscribeGyroscope
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest011 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest011 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
done
();
...
@@ -382,7 +381,7 @@ describe("SensorJsTest", function () {
...
@@ -382,7 +381,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeGyroscope
(
'
xxx
'
);
sensor
.
unsubscribeGyroscope
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest012 error:
'
+
error
);
console
.
info
(
'
subscribeGyroscope_SensorJsTest012 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -431,12 +430,10 @@ describe("SensorJsTest", function () {
...
@@ -431,12 +430,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
try
{
try
{
sensor
.
unsubscribeGyroscope
();
sensor
.
unsubscribeGyroscope
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeAccelerometer_SensorJsTest014_unsubscribeAccelerometer error
'
+
error
);
console
.
info
(
'
subscribeAccelerometer_SensorJsTest014_unsubscribeAccelerometer error
'
+
error
);
expect
(
false
).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeHeartRate.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeHeartRate.js
浏览文件 @
1c688540
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -220,7 +221,6 @@ describe("SensorJsTest", function () {
...
@@ -220,7 +221,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeHeartRate
();
sensor
.
unsubscribeHeartRate
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeLight.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeLight.js
浏览文件 @
1c688540
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
...
@@ -48,7 +48,10 @@ describe("SensorJsTest", function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
var
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
let
errMessage
;
/*
/*
* @tc.name:subscribeLight_SensorJsTest001
* @tc.name:subscribeLight_SensorJsTest001
...
@@ -57,7 +60,7 @@ describe("SensorJsTest", function () {
...
@@ -57,7 +60,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest001
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest001
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest001---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest001---------------------------
'
);
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest001 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeLight_SensorJsTest001 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -68,7 +71,6 @@ describe("SensorJsTest", function () {
...
@@ -68,7 +71,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeLight
();
sensor
.
unsubscribeLight
();
...
@@ -90,7 +92,7 @@ describe("SensorJsTest", function () {
...
@@ -90,7 +92,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest002
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest002
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest002---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest002---------------------------
'
);
try
{
try
{
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -103,28 +105,27 @@ describe("SensorJsTest", function () {
...
@@ -103,28 +105,27 @@ describe("SensorJsTest", function () {
},
},
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeLight_SensorJsTest002 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest002 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
}
}
})
})
/*
/*
* @tc.name:subscribeLight_SensorJsTest003
* @tc.name:subscribeLight_SensorJsTest003
* @tc.desc:verify app info is not null
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.type: FUNC
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest003
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest003
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest003---------------------------
'
);
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest003 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeLight_SensorJsTest003 success:
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeLight
();
sensor
.
unsubscribeLight
();
...
@@ -146,7 +147,7 @@ describe("SensorJsTest", function () {
...
@@ -146,7 +147,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest004
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest004
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest004---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest004---------------------------
'
);
try
{
try
{
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -160,7 +161,7 @@ describe("SensorJsTest", function () {
...
@@ -160,7 +161,7 @@ describe("SensorJsTest", function () {
},
function
()
{
},
function
()
{
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeLight_SensorJsTest004 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest004 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -178,7 +179,7 @@ describe("SensorJsTest", function () {
...
@@ -178,7 +179,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeLight
(
'
xxx
'
);
sensor
.
unsubscribeLight
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
errMessage
=
error
.
toString
().
slice
(
21
,
58
);
console
.
info
(
'
subscribeLight_SensorJsTest005 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest005 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -196,7 +197,7 @@ describe("SensorJsTest", function () {
...
@@ -196,7 +197,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeLight
();
sensor
.
subscribeLight
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeLight_SensorJsTest006 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest006 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -214,7 +215,7 @@ describe("SensorJsTest", function () {
...
@@ -214,7 +215,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
subscribeLight
(
'
xxx
'
);
sensor
.
subscribeLight
(
'
xxx
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeLight_SensorJsTest007 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
done
();
...
@@ -228,7 +229,7 @@ describe("SensorJsTest", function () {
...
@@ -228,7 +229,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest008
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest008
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest008---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest008---------------------------
'
);
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest008 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeLight_SensorJsTest008 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -249,7 +250,6 @@ describe("SensorJsTest", function () {
...
@@ -249,7 +250,6 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeLight
();
sensor
.
unsubscribeLight
();
...
@@ -275,7 +275,7 @@ describe("SensorJsTest", function () {
...
@@ -275,7 +275,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeLight
();
sensor
.
unsubscribeLight
();
}
catch
(
error
)
{
}
catch
(
error
)
{
var
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeLight_SensorJsTest009 error:
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest009 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -289,7 +289,7 @@ describe("SensorJsTest", function () {
...
@@ -289,7 +289,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeLight_SensorJsTest010
"
,
0
,
function
(
done
)
{
it
(
"
subscribeLight_SensorJsTest010
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeLight_SensorJsTest010---------------------------
'
);
console
.
info
(
'
----------------------subscribeLight_SensorJsTest010---------------------------
'
);
sensor
.
subscribeLight
({
sensor
.
subscribeLight
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeLight_SensorJsTest010 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeLight_SensorJsTest010 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -300,12 +300,10 @@ describe("SensorJsTest", function () {
...
@@ -300,12 +300,10 @@ describe("SensorJsTest", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
},
},
});
});
try
{
try
{
sensor
.
unsubscribeLight
();
sensor
.
unsubscribeLight
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeLight_SensorJsTest008_unsubscribeLight error
'
+
error
);
console
.
info
(
'
subscribeLight_SensorJsTest008_unsubscribeLight error
'
+
error
);
expect
(
true
).
assertTrue
();
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeOnBodyState.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeOnBodyState.js
浏览文件 @
1c688540
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
...
@@ -50,6 +50,7 @@ describe("SensorJsTest", function () {
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
...
@@ -210,7 +211,6 @@ describe("SensorJsTest", function () {
...
@@ -210,7 +211,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
sensor
.
subscribeOnBodyState
({
sensor
.
subscribeOnBodyState
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeOnBodyState_SensorJsTest007_1 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeOnBodyState_SensorJsTest007_1 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -221,7 +221,6 @@ describe("SensorJsTest", function () {
...
@@ -221,7 +221,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeOnBodyState
();
sensor
.
unsubscribeOnBodyState
();
...
@@ -271,7 +270,6 @@ describe("SensorJsTest", function () {
...
@@ -271,7 +270,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
try
{
try
{
sensor
.
unsubscribeOnBodyState
();
sensor
.
unsubscribeOnBodyState
();
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeProximity.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeProximity.js
浏览文件 @
1c688540
...
@@ -49,34 +49,35 @@ describe("SensorJsTest", function () {
...
@@ -49,34 +49,35 @@ describe("SensorJsTest", function () {
})
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
* @tc.name:subscribeProximity_SensorJsTest001
* @tc.name:subscribeProximity_SensorJsTest001
* @tc.desc:verify app info is not null
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.type: FUNC
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeProximity_SensorJsTest001
"
,
0
,
async
function
(
done
)
{
it
(
"
subscribeProximity_SensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest001---------------------------
'
);
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest001---------------------------
'
);
sensor
.
subscribeProximity
({
sensor
.
subscribeProximity
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeProximity_SensorJsTest001 success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeProximity_SensorJsTest001 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
distance
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
distance
)).
assertEqual
(
"
number
"
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
subscribeProximity_SensorJsTest001 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
console
.
error
(
'
subscribeProximity_SensorJsTest001 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeProximity
();
sensor
.
unsubscribeProximity
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
error
);
console
.
info
(
error
);
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
done
();
done
();
},
500
);
},
500
);
...
@@ -90,7 +91,7 @@ describe("SensorJsTest", function () {
...
@@ -90,7 +91,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeProximity_SensorJsTest002
"
,
0
,
function
(
done
)
{
it
(
"
subscribeProximity_SensorJsTest002
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest002---------------------------
'
);
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest002---------------------------
'
);
try
{
try
{
sensor
.
subscribeProximity
({
sensor
.
subscribeProximity
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -117,7 +118,7 @@ describe("SensorJsTest", function () {
...
@@ -117,7 +118,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeProximity_SensorJsTest003
"
,
0
,
function
(
done
)
{
it
(
"
subscribeProximity_SensorJsTest003
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest003---------------------------
'
);
try
{
try
{
sensor
.
subscribeProximity
({
sensor
.
subscribeProximity
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -199,7 +200,7 @@ describe("SensorJsTest", function () {
...
@@ -199,7 +200,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeProximity_SensorJsTest007
"
,
0
,
function
(
done
)
{
it
(
"
subscribeProximity_SensorJsTest007
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest007---------------------------
'
);
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest007---------------------------
'
);
sensor
.
subscribeProximity
({
sensor
.
subscribeProximity
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeProximity_SensorJsTest007 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeProximity_SensorJsTest007 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -220,7 +221,6 @@ describe("SensorJsTest", function () {
...
@@ -220,7 +221,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeProximity
();
sensor
.
unsubscribeProximity
();
...
@@ -245,7 +245,7 @@ describe("SensorJsTest", function () {
...
@@ -245,7 +245,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeProximity
();
sensor
.
unsubscribeProximity
();
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeProximity_SensorJsTest008 error:
'
+
error
);
console
.
info
(
'
subscribeProximity_SensorJsTest008 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -259,7 +259,7 @@ describe("SensorJsTest", function () {
...
@@ -259,7 +259,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeProximity_SensorJsTest009
"
,
0
,
function
(
done
)
{
it
(
"
subscribeProximity_SensorJsTest009
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest009---------------------------
'
);
console
.
info
(
'
----------------------subscribeProximity_SensorJsTest009---------------------------
'
);
sensor
.
subscribeProximity
({
sensor
.
subscribeProximity
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeProximity_SensorJsTest009 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeProximity_SensorJsTest009 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -270,7 +270,6 @@ describe("SensorJsTest", function () {
...
@@ -270,7 +270,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
try
{
try
{
sensor
.
unsubscribeProximity
();
sensor
.
unsubscribeProximity
();
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
sensors/sensor_standard/src/main/js/default/test/subscribeStepCounter.js
→
sensors/sensor_standard/src/main/js/default/test/
Subscribe_
subscribeStepCounter.js
浏览文件 @
1c688540
...
@@ -49,34 +49,35 @@ describe("SensorJsTest", function () {
...
@@ -49,34 +49,35 @@ describe("SensorJsTest", function () {
})
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
UnsubscribeSensor failed
'
,
'
Wrong argument type, should be object
'
];
'
Wrong argument type, should be object
'
];
let
errMessage
;
let
errMessage
;
/*
/*
* @tc.name:subscribeStepCounter_SensorJsTest001
* @tc.name:subscribeStepCounter_SensorJsTest001
* @tc.desc:verify app info is not null
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.type: FUNC
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeStepCounter_SensorJsTest001
"
,
0
,
async
function
(
done
)
{
it
(
"
subscribeStepCounter_SensorJsTest001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest001---------------------------
'
);
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest001---------------------------
'
);
sensor
.
subscribeStepCounter
({
sensor
.
subscribeStepCounter
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeStepCounter_SensorJsTest001 success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeStepCounter_SensorJsTest001 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
steps
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
steps
)).
assertEqual
(
"
number
"
);
},
},
fail
:
function
(
data
,
code
)
{
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
subscribeStepCounter_SensorJsTest001 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
console
.
error
(
'
subscribeStepCounter_SensorJsTest001 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeStepCounter
();
sensor
.
unsubscribeStepCounter
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
subscribeStepCounter_SensorJsTest001_unsubscribeStepCounter error
'
+
error
);
console
.
info
(
'
subscribeStepCounter_SensorJsTest001_unsubscribeStepCounter error
'
+
error
);
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
done
();
done
();
},
500
);
},
500
);
...
@@ -90,7 +91,7 @@ describe("SensorJsTest", function () {
...
@@ -90,7 +91,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeStepCounter_SensorJsTest002
"
,
0
,
function
(
done
)
{
it
(
"
subscribeStepCounter_SensorJsTest002
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest002---------------------------
'
);
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest002---------------------------
'
);
try
{
try
{
sensor
.
subscribeStepCounter
({
sensor
.
subscribeStepCounter
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -117,7 +118,7 @@ describe("SensorJsTest", function () {
...
@@ -117,7 +118,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeStepCounter_SensorJsTest003
"
,
0
,
function
(
done
)
{
it
(
"
subscribeStepCounter_SensorJsTest003
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest003---------------------------
'
);
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest003---------------------------
'
);
try
{
try
{
sensor
.
subscribeStepCounter
({
sensor
.
subscribeStepCounter
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -128,7 +129,8 @@ describe("SensorJsTest", function () {
...
@@ -128,7 +129,8 @@ describe("SensorJsTest", function () {
console
.
error
(
'
subscribeStepCounter_SensorJsTest003 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
console
.
error
(
'
subscribeStepCounter_SensorJsTest003 failed. Code:
'
+
code
+
'
; Data:
'
+
data
);
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
},
function
()
{},
25
);
},
function
()
{
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
errMessage
=
error
.
toString
().
slice
(
19
,
56
);
console
.
info
(
'
subscribeStepCounter_SensorJsTest003 error:
'
+
error
);
console
.
info
(
'
subscribeStepCounter_SensorJsTest003 error:
'
+
error
);
...
@@ -198,7 +200,7 @@ describe("SensorJsTest", function () {
...
@@ -198,7 +200,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeStepCounter_SensorJsTest007
"
,
0
,
function
(
done
)
{
it
(
"
subscribeStepCounter_SensorJsTest007
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest007---------------------------
'
);
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest007---------------------------
'
);
sensor
.
subscribeStepCounter
({
sensor
.
subscribeStepCounter
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeStepCounter_SensorJsTest007 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeStepCounter_SensorJsTest007 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -219,7 +221,6 @@ describe("SensorJsTest", function () {
...
@@ -219,7 +221,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
try
{
try
{
sensor
.
unsubscribeStepCounter
();
sensor
.
unsubscribeStepCounter
();
...
@@ -244,7 +245,7 @@ describe("SensorJsTest", function () {
...
@@ -244,7 +245,7 @@ describe("SensorJsTest", function () {
try
{
try
{
sensor
.
unsubscribeStepCounter
();
sensor
.
unsubscribeStepCounter
();
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
errMessage
=
error
.
toString
().
slice
(
21
,
45
);
console
.
info
(
'
subscribeStepCounter_SensorJsTest008 error:
'
+
error
);
console
.
info
(
'
subscribeStepCounter_SensorJsTest008 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
...
@@ -258,7 +259,7 @@ describe("SensorJsTest", function () {
...
@@ -258,7 +259,7 @@ describe("SensorJsTest", function () {
* @tc.require: SR000H0ALK, AR000H0ALM
* @tc.require: SR000H0ALK, AR000H0ALM
*/
*/
it
(
"
subscribeStepCounter_SensorJsTest009
"
,
0
,
function
(
done
)
{
it
(
"
subscribeStepCounter_SensorJsTest009
"
,
0
,
function
(
done
)
{
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest009---------------------------
'
);
console
.
info
(
'
----------------------subscribeStepCounter_SensorJsTest009---------------------------
'
);
sensor
.
subscribeStepCounter
({
sensor
.
subscribeStepCounter
({
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
info
(
"
subscribeStepCounter_SensorJsTest009 success:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
subscribeStepCounter_SensorJsTest009 success:
"
+
JSON
.
stringify
(
data
));
...
@@ -269,7 +270,6 @@ describe("SensorJsTest", function () {
...
@@ -269,7 +270,6 @@ describe("SensorJsTest", function () {
expect
(
code
).
assertEqual
(
1001
);
expect
(
code
).
assertEqual
(
1001
);
},
},
});
});
try
{
try
{
sensor
.
unsubscribeStepCounter
();
sensor
.
unsubscribeStepCounter
();
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录