Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0d04d60f
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看板
未验证
提交
0d04d60f
编写于
7月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4055 【sensors】【monthly_20220614】问题用例整改
Merge pull request !4055 from logic42/monthly_20220614
上级
54e24f99
2e93b1d6
变更
34
展开全部
隐藏空白更改
内联
并排
Showing
34 changed file
with
583 addition
and
591 deletion
+583
-591
sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js
...d/src/main/js/default/test/SensorGeneralalgorithm.test.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js
...rd/src/main/js/default/test/SensorGeomagneticTest.test.js
+377
-377
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js
...standard/src/main/js/default/test/SensorOnOffTest.test.js
+5
-5
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer_Uncalibrated.js
...t/test/SensorOnOffTest.test_Accelerometer_Uncalibrated.js
+5
-5
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Barometer.js
...rc/main/js/default/test/SensorOnOffTest.test_Barometer.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gravity.js
.../src/main/js/default/test/SensorOnOffTest.test_Gravity.js
+42
-42
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope_Uncalibrated.js
...fault/test/SensorOnOffTest.test_Gyroscope_Uncalibrated.js
+3
-3
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Heart_Rate.js
...c/main/js/default/test/SensorOnOffTest.test_Heart_Rate.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Humidity.js
...src/main/js/default/test/SensorOnOffTest.test_Humidity.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Linear_Acceleration.js
.../default/test/SensorOnOffTest.test_Linear_Acceleration.js
+3
-3
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_MagneticField.js
...ain/js/default/test/SensorOnOffTest.test_MagneticField.js
+62
-62
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Magnetic_Field_Uncalibrated.js
.../test/SensorOnOffTest.test_Magnetic_Field_Uncalibrated.js
+5
-5
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Orientating.js
.../main/js/default/test/SensorOnOffTest.test_Orientating.js
+40
-40
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer.js
...rc/main/js/default/test/SensorOnOffTest.test_Pedometer.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer_Detection.js
.../default/test/SensorOnOffTest.test_Pedometer_Detection.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Proxinity.js
...rc/main/js/default/test/SensorOnOffTest.test_Proxinity.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Significant_Motion.js
...s/default/test/SensorOnOffTest.test_Significant_Motion.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Temperature.js
.../main/js/default/test/SensorOnOffTest.test_Temperature.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Wear_Detection.js
...in/js/default/test/SensorOnOffTest.test_Wear_Detection.js
+1
-1
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Accelerometer.js
...src/main/js/default/test/SensorOnOffTest_Accelerometer.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Ambient_light.js
...src/main/js/default/test/SensorOnOffTest_Ambient_light.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_GyroScope.js
...ard/src/main/js/default/test/SensorOnOffTest_GyroScope.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Hall.js
...standard/src/main/js/default/test/SensorOnOffTest_Hall.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/Subscribe_getOnBodyState.js
...dard/src/main/js/default/test/Subscribe_getOnBodyState.js
+3
-4
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeAccelerometer.js
.../main/js/default/test/Subscribe_subscribeAccelerometer.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeBarometer.js
.../src/main/js/default/test/Subscribe_subscribeBarometer.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeCompass.js
...rd/src/main/js/default/test/Subscribe_subscribeCompass.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeDeviceOrientation.js
...n/js/default/test/Subscribe_subscribeDeviceOrientation.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeGyroscope.js
.../src/main/js/default/test/Subscribe_subscribeGyroscope.js
+2
-2
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeHeartRate.js
.../src/main/js/default/test/Subscribe_subscribeHeartRate.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeLight.js
...dard/src/main/js/default/test/Subscribe_subscribeLight.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeOnBodyState.js
...rc/main/js/default/test/Subscribe_subscribeOnBodyState.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeProximity.js
.../src/main/js/default/test/Subscribe_subscribeProximity.js
+2
-3
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeStepCounter.js
...rc/main/js/default/test/Subscribe_subscribeStepCounter.js
+2
-3
未找到文件。
sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_1
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js
浏览文件 @
0d04d60f
此差异已折叠。
点击以展开。
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js
浏览文件 @
0d04d60f
...
...
@@ -78,11 +78,11 @@ describe('SystemParameterTest', function () {
console
.
info
(
'
SUB_SENSORS_Sensor_JSTest_0010 end
'
);
})
/**
* @tc.number SUB_SENSORS_Sensor_JSTest_0020
* @tc.name testRegisterSensortest002
* @tc.desc test get sensor data by wrong sensor id.
*/
/**
* @tc.number SUB_SENSORS_Sensor_JSTest_0020
* @tc.name testRegisterSensortest002
* @tc.desc test get sensor data by wrong sensor id.
*/
it
(
'
SUB_SENSORS_Sensor_JSTest_0020
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_SENSORS_Sensor_JSTest_0020 start
'
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Accelerometer_Uncalibrated.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_6
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -86,8 +86,8 @@ describe("SensorJsTest", function () {
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -121,8 +121,8 @@ describe("SensorJsTest", function () {
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest002 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest002 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
console
.
info
(
'
SensorAccelerometerUncalibratedJSTest002 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Barometer.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_8
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gravity.js
浏览文件 @
0d04d60f
...
...
@@ -19,16 +19,16 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe
(
"
SensorJsTest_sensor_9
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
}
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
}
beforeAll
(
function
()
{
...
...
@@ -64,8 +64,8 @@ describe("SensorJsTest_sensor_9", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
/*
...
...
@@ -73,10 +73,10 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0010
*/
it
(
"
gravity_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest001---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
);
done
();
},
500
);
...
...
@@ -87,10 +87,10 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0020
*/
it
(
"
gravity_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest002---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest002 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
);
console
.
info
(
'
----------------------gravity_SensorJsTest002 off end---------------------------
'
);
...
...
@@ -103,7 +103,7 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0030
*/
it
(
"
gravity_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
gravity_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
gravity_SensorJsTest003 on error
'
);
...
...
@@ -111,9 +111,9 @@ describe("SensorJsTest_sensor_9", function () {
done
();
}
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
'
gravity_SensorJsTest003 error
'
+
error
);
console
.
info
(
'
gravity_SensorJsTest003 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
12
,
49
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
...
...
@@ -125,9 +125,9 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0040
*/
it
(
"
gravity_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -138,16 +138,16 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0050
*/
it
(
"
gravity_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
gravity_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
gravity_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
console
.
info
(
'
gravity_SensorJsTest005 error
'
+
error
);
console
.
info
(
'
gravity_SensorJsTest005 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
14
,
51
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
...
...
@@ -159,7 +159,7 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0060
*/
it
(
"
gravity_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
try
{
sensor
.
off
(
string
,
""
);
}
catch
(
error
)
{
...
...
@@ -175,7 +175,7 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0070
*/
it
(
"
gravity_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
gravity_SensorJsTest007 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -183,7 +183,7 @@ describe("SensorJsTest_sensor_9", function () {
}
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
onSensorCallback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -194,7 +194,7 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0080
*/
it
(
"
gravity_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
gravity_SensorJsTest008 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -215,10 +215,10 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0090
*/
it
(
"
gravity_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest009 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
);
console
.
info
(
'
----------------------gravity_SensorJsTest009 off end---------------------------
'
);
...
...
@@ -231,15 +231,15 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0100
*/
it
(
"
gravity_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
console
.
info
(
'
----------------------gravity_SensorJsTest010 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
console
.
info
(
'
----------------------gravity_SensorJsTest010 off end---------------------------
'
);
...
...
@@ -252,11 +252,11 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0110
*/
it
(
"
gravity_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest011---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest011 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
);
console
.
info
(
'
----------------------gravity_SensorJsTest011 off end---------------------------
'
);
...
...
@@ -269,16 +269,16 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0120
*/
it
(
"
gravity_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest012---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
console
.
info
(
'
----------------------gravity_SensorJsTest012 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
console
.
info
(
'
----------------------gravity_SensorJsTest012 off end---------------------------
'
);
...
...
@@ -291,11 +291,11 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0130
*/
it
(
"
gravity_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
gravity_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------gravity_SensorJsTest013---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest013 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
);
console
.
info
(
'
----------------------gravity_SensorJsTest013 off end---------------------------
'
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Gyroscope_Uncalibrated.js
浏览文件 @
0d04d60f
...
...
@@ -86,8 +86,8 @@ describe("SensorJsTest", function () {
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -121,7 +121,7 @@ describe("SensorJsTest", function () {
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorGyroscopeUncalibratedJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Heart_Rate.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_11
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Humidity.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_12
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Linear_Acceleration.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_13
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -86,7 +86,7 @@ describe("SensorJsTest", function () {
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorLinearAccelerationJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
console
.
info
(
'
SensorLinearAccelerationJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -117,7 +117,7 @@ describe("SensorJsTest", function () {
console
.
info
(
'
SensorLinearAccelerationJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorLinearAccelerationJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
console
.
info
(
'
SensorLinearAccelerationJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_MagneticField.js
浏览文件 @
0d04d60f
...
...
@@ -14,58 +14,58 @@
*/
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_sensor_15
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
}
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
let
errMessage
;
/*
...
...
@@ -73,10 +73,10 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0010
*/
it
(
"
magnetic_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest001---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
);
done
();
},
500
);
...
...
@@ -87,10 +87,10 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0020
*/
it
(
"
magnetic_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest002---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest002 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
);
console
.
info
(
'
----------------------magnetic_SensorJsTest002 off end---------------------------
'
);
...
...
@@ -103,7 +103,7 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0030
*/
it
(
"
magnetic_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
magnetic_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
magnetic_SensorJsTest003 on error
'
);
...
...
@@ -111,9 +111,9 @@ describe("SensorJsTest_sensor_15", function () {
done
();
}
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
'
magnetic_SensorJsTest003 error
'
+
error
);
console
.
info
(
'
magnetic_SensorJsTest003 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
12
,
49
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
...
...
@@ -125,9 +125,9 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0040
*/
it
(
"
magnetic_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -138,16 +138,16 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0050
*/
it
(
"
magnetic_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
magnetic_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
magnetic_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
console
.
info
(
'
magnetic_SensorJsTest005 error
'
+
error
);
console
.
info
(
'
magnetic_SensorJsTest005 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
14
,
51
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
...
...
@@ -159,11 +159,11 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0060
*/
it
(
"
magnetic_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
try
{
sensor
.
off
(
string
,
""
);
}
catch
(
error
)
{
console
.
info
(
'
magnetic_SensorJsTest006 error
'
+
error
);
console
.
info
(
'
magnetic_SensorJsTest006 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
16
,
40
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
...
...
@@ -175,7 +175,7 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0070
*/
it
(
"
magnetic_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
magnetic_SensorJsTest007 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -183,7 +183,7 @@ describe("SensorJsTest_sensor_15", function () {
}
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onSensorCallback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -194,7 +194,7 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0080
*/
it
(
"
magnetic_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
magnetic_SensorJsTest008 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -215,10 +215,10 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0090
*/
it
(
"
magnetic_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest009 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
);
console
.
info
(
'
----------------------magnetic_SensorJsTest009 off end---------------------------
'
);
...
...
@@ -231,15 +231,15 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0100
*/
it
(
"
magnetic_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off end---------------------------
'
);
...
...
@@ -252,11 +252,11 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0110
*/
it
(
"
magnetic_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest011---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest011 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
);
console
.
info
(
'
----------------------magnetic_SensorJsTest011 off end---------------------------
'
);
...
...
@@ -269,16 +269,16 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0120
*/
it
(
"
magnetic_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest012---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off end---------------------------
'
);
...
...
@@ -291,11 +291,11 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0130
*/
it
(
"
magnetic_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
magnetic_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------magnetic_SensorJsTest013---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest013 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
);
console
.
info
(
'
----------------------magnetic_SensorJsTest013 off end---------------------------
'
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Magnetic_Field_Uncalibrated.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_14
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -86,8 +86,8 @@ describe("SensorJsTest", function () {
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest001 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
@@ -121,8 +121,8 @@ describe("SensorJsTest", function () {
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest005 once error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
console
.
info
(
'
SensorMagneticFieldUncalibratedJSTest005 on success, x:
'
+
data
.
x
+
"
y:
"
+
data
.
y
+
"
z:
"
+
data
.
z
+
"
biasX:
"
+
data
.
biasX
+
"
biasY:
"
+
data
.
biasY
+
"
biasZ:
"
+
data
.
biasZ
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Orientating.js
浏览文件 @
0d04d60f
...
...
@@ -19,16 +19,16 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe
(
"
SensorJsTest_sensor_16
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
}
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
}
beforeAll
(
function
()
{
...
...
@@ -64,8 +64,8 @@ describe("SensorJsTest_sensor_16", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
/*
...
...
@@ -73,10 +73,10 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0010
*/
it
(
"
orientating_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest001---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
);
done
();
},
500
);
...
...
@@ -87,10 +87,10 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0020
*/
it
(
"
orientating_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest002---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest002 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
);
console
.
info
(
'
----------------------orientating_SensorJsTest002 off end---------------------------
'
);
...
...
@@ -103,7 +103,7 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0030
*/
it
(
"
orientating_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
orientating_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest003---------------------------
'
);
function
onSensorCallback
(
data
)
{
console
.
info
(
'
orientating_SensorJsTest003 on error
'
);
...
...
@@ -111,7 +111,7 @@ describe("SensorJsTest_sensor_16", function () {
done
();
}
try
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
'
orientating_SensorJsTest005 error
'
+
error
);
errMessage
=
error
.
toString
().
slice
(
12
,
49
);
...
...
@@ -125,9 +125,9 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0040
*/
it
(
"
orientating_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest004
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -138,13 +138,13 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0050
*/
it
(
"
orientating_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
it
(
"
orientating_SensorJsTest005
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
function
(
done
)
{
function
onceSensorCallback
(
data
)
{
console
.
info
(
'
orientating_SensorJsTest005 on error
'
);
expect
(
false
).
assertTrue
();
done
();
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
console
.
info
(
'
orientating_SensorJsTest005 error
'
+
error
);
...
...
@@ -159,7 +159,7 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0060
*/
it
(
"
orientating_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
try
{
sensor
.
off
(
string
,
""
);
}
catch
(
error
)
{
...
...
@@ -175,7 +175,7 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0070
*/
it
(
"
orientating_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest007
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
orientating_SensorJsTest007 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -183,7 +183,7 @@ describe("SensorJsTest_sensor_16", function () {
}
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onSensorCallback
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
...
...
@@ -194,7 +194,7 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0080
*/
it
(
"
orientating_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
orientating_SensorJsTest008 on error
'
);
expect
(
false
).
assertTrue
();
...
...
@@ -215,10 +215,10 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0090
*/
it
(
"
orientating_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest009 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
);
console
.
info
(
'
----------------------orientating_SensorJsTest009 off end---------------------------
'
);
...
...
@@ -231,15 +231,15 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0100
*/
it
(
"
orientating_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
console
.
info
(
'
----------------------orientating_SensorJsTest010 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
console
.
info
(
'
----------------------SensorJsTest010 off end---------------------------
'
);
...
...
@@ -252,11 +252,11 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0110
*/
it
(
"
orientating_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest011---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest011 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
);
console
.
info
(
'
----------------------orientating_SensorJsTest011 off end---------------------------
'
);
...
...
@@ -269,16 +269,16 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0120
*/
it
(
"
orientating_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest012---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
console
.
info
(
'
----------------------orientating_SensorJsTest012 off end---------------------------
'
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
console
.
info
(
'
----------------------orientating_SensorJsTest012 off end---------------------------
'
);
...
...
@@ -291,11 +291,11 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.desc:verify app info is not null
* @tc.number:SUB_SensorSystem_ORIENTATION_JsTest_0130
*/
it
(
"
orientating_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
it
(
"
orientating_SensorJsTest013
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------orientating_SensorJsTest013---------------------------
'
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest013 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
);
console
.
info
(
'
----------------------orientating_SensorJsTest013 off end---------------------------
'
);
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_18
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Pedometer_Detection.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_17
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Proxinity.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_19
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Significant_Motion.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_21
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Temperature.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_22
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_Wear_Detection.js
浏览文件 @
0d04d60f
...
...
@@ -16,7 +16,7 @@ import sensor from '@ohos.sensor'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_23
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Accelerometer.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_3
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
@@ -63,7 +63,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Ambient_light.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_4
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
...
...
@@ -59,7 +59,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_GyroScope.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_5
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
@@ -63,7 +63,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest_Hall.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_7
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
...
...
@@ -59,7 +59,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Should subscribe first
'
,
'
string is not defined
'
];
'
string is not defined
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/Subscribe_getOnBodyState.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_24
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -318,5 +318,4 @@ describe("SensorJsTest", function () {
});
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeAccelerometer.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_25
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
'
UnsubscribeSensor failed
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeBarometer.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_26
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -282,4 +282,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeCompass.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_28
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -312,4 +312,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeDeviceOrientation.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_27
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
'
UnsubscribeSensor failed
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeGyroscope.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_29
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
let
errMessages
=
[
'
The number of parameters is not valid
'
,
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
'
Wrong argument type, should be object
'
,
'
UnsubscribeSensor failed
'
];
let
errMessage
;
...
...
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeHeartRate.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_30
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -283,4 +283,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeLight.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_31
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -312,4 +312,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeOnBodyState.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_32
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -282,4 +282,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeProximity.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_33
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -282,4 +282,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
sensors/sensor_standard/src/main/js/default/test/Subscribe_subscribeStepCounter.js
浏览文件 @
0d04d60f
...
...
@@ -15,7 +15,7 @@
import
sensor
from
'
@system.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest
"
,
function
()
{
describe
(
"
SensorJsTest
_sensor_34
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
})
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
;
...
...
@@ -282,4 +282,3 @@ describe("SensorJsTest", function () {
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录