Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b535481e
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看板
提交
b535481e
编写于
9月 08, 2022
作者:
L
lidanyang16
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<lidanyang16@huawei.com>
Signed-off-by:
N
lidanyang16
<
lidanyang16@huawei.com
>
上级
1c13b483
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
141 addition
and
62 deletion
+141
-62
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
...miscdevice_standard/src/main/js/test/Vibrator_new.test.js
+11
-11
sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
...miscdevice_standard/src/main/js/test/Vibrator_old.test.js
+6
-7
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js
.../sensor_standard/src/main/js/test/SensorOnOffTest.test.js
+12
-19
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js
...d/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js
+0
-4
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js
...standard/src/main/js/test/SensorOnOffTest.test_Gravity.js
+12
-2
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js
...rd/src/main/js/test/SensorOnOffTest.test_MagneticField.js
+13
-3
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js
...dard/src/main/js/test/SensorOnOffTest.test_Orientating.js
+13
-3
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js
...d/src/main/js/test/SensorOnOffTest.test_RotatingVector.js
+13
-3
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js
...tandard/src/main/js/test/SensorOnOffTest_Accelerometer.js
+13
-2
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js
...tandard/src/main/js/test/SensorOnOffTest_Ambient_light.js
+12
-2
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js
...or_standard/src/main/js/test/SensorOnOffTest_GyroScope.js
+12
-2
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js
.../sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js
+12
-2
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js
...main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js
+12
-2
未找到文件。
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
浏览文件 @
b535481e
...
@@ -381,16 +381,16 @@ describe("VibratorJsTest_misc_2", function () {
...
@@ -381,16 +381,16 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
*/
*/
it
(
"
VibratorJsTest015
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
VibratorJsTest015
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
(
"
"
).
then
(()
=>
{
vibrator
.
stop
(
"
preset
"
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest015
vibrate error
"
);
console
.
log
(
"
VibratorJsTest015
off success
"
);
expect
(
fals
e
).
assertTrue
();
expect
(
tru
e
).
assertTrue
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
},
500
);
},
500
);
},
(
error
)
=>
{
},
(
error
)
=>
{
expect
(
tru
e
).
assertTrue
();
expect
(
fals
e
).
assertTrue
();
console
.
log
(
"
VibratorJsTest015
vibrate success
"
);
console
.
log
(
"
VibratorJsTest015
off error
"
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
},
500
);
},
500
);
...
@@ -424,15 +424,15 @@ describe("VibratorJsTest_misc_2", function () {
...
@@ -424,15 +424,15 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
*/
*/
it
(
"
VibratorJsTest017
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
VibratorJsTest017
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
stop
(
"
preset
"
).
then
(()
=>
{
vibrator
.
vibrate
(
"
"
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest017
off success
"
);
console
.
log
(
"
VibratorJsTest017
vibrate error
"
);
expect
(
tru
e
).
assertTrue
();
expect
(
fals
e
).
assertTrue
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
},
500
);
},
500
);
},
(
error
)
=>
{
},
(
error
)
=>
{
expect
(
fals
e
).
assertTrue
();
expect
(
tru
e
).
assertTrue
();
console
.
log
(
"
VibratorJsTest017
off error
"
);
console
.
log
(
"
VibratorJsTest017
vibrate success
"
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
},
500
);
},
500
);
...
...
sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
浏览文件 @
b535481e
...
@@ -50,8 +50,7 @@ describe("VibratorJsTest_misc_1", function () {
...
@@ -50,8 +50,7 @@ describe("VibratorJsTest_misc_1", function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
let
errMessages
=
[
'
Param number is invalid
'
,
'
Wrong argument type. function expected
'
,
let
errMessages
=
[
'
Error: ParseParameter: "Get vibrate type fail"
'
,
'
Error: ParseParameter: "Wrong argument number"
'
]
'
Wrong argument type
'
,
'
Wrong argument number
'
]
let
errMessage
;
let
errMessage
;
...
@@ -194,7 +193,7 @@ describe("VibratorJsTest_misc_1", function () {
...
@@ -194,7 +193,7 @@ describe("VibratorJsTest_misc_1", function () {
},
},
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
()
.
slice
(
39
)
;
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0007 error:
'
+
error
);
console
.
info
(
'
SubVibratorJsTest0007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
...
@@ -243,9 +242,9 @@ describe("VibratorJsTest_misc_1", function () {
...
@@ -243,9 +242,9 @@ describe("VibratorJsTest_misc_1", function () {
try
{
try
{
vibrator
.
vibrate
();
vibrator
.
vibrate
();
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
()
.
slice
(
7
)
;
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0009 error:
'
+
error
);
console
.
info
(
'
SubVibratorJsTest0009 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
done
();
}
}
})
})
...
@@ -268,9 +267,9 @@ describe("VibratorJsTest_misc_1", function () {
...
@@ -268,9 +267,9 @@ describe("VibratorJsTest_misc_1", function () {
},
function
()
{
},
function
()
{
},
25
);
},
25
);
}
catch
(
error
)
{
}
catch
(
error
)
{
errMessage
=
error
.
toString
()
.
slice
(
39
)
;
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0010 error:
'
+
error
);
console
.
info
(
'
SubVibratorJsTest0010 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
3
]);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
}
}
})
})
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js
浏览文件 @
b535481e
...
@@ -18,17 +18,6 @@
...
@@ -18,17 +18,6 @@
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
import
sensor
from
'
@ohos.sensor
'
import
sensor
from
'
@ohos.sensor
'
function
sleep
(
NumberMillis
)
{
let
now
=
new
Date
()
let
exitTime
=
now
.
getTime
()
+
NumberMillis
while
(
true
)
{
now
=
new
Date
()
if
(
now
.
getTime
>
exitTime
)
{
return
}
}
}
export
default
function
SystemParameterTest
()
{
export
default
function
SystemParameterTest
()
{
describe
(
'
SystemParameterTest
'
,
function
()
{
describe
(
'
SystemParameterTest
'
,
function
()
{
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -47,19 +36,22 @@ describe('SystemParameterTest', function () {
...
@@ -47,19 +36,22 @@ describe('SystemParameterTest', function () {
console
.
info
(
'
afterEach caled
'
)
console
.
info
(
'
afterEach caled
'
)
})
})
let
testSensorId
=
0
;
let
testNullSensorId
=
-
1
;
let
testNullSensorId
=
-
1
;
let
errMessages
=
[
'
SubscribeSensor failed
'
];
let
errMessage
;
/**
/**
* @tc.number SUB_SENSORS_Sensor_JSTest_0020
* @tc.number SUB_SENSORS_Sensor_JSTest_0020
* @tc.name testRegisterSensortest00
2
* @tc.name testRegisterSensortest00
1
* @tc.desc test get sensor data by wrong sensor id.
* @tc.desc test get sensor data by wrong sensor id.
*/
*/
it
(
'
SUB_SENSORS_Sensor_JSTest_0020
'
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
'
testRegisterSensortest001
'
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
SUB_SENSORS_Sensor_JSTest_0020
start
'
);
console
.
info
(
'
testRegisterSensortest001
start
'
);
function
onSensorCallback
(
data
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
SensorJsTest002
on error
'
);
console
.
info
(
'
testRegisterSensortest001
on error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
...
@@ -67,10 +59,11 @@ describe('SystemParameterTest', function () {
...
@@ -67,10 +59,11 @@ describe('SystemParameterTest', function () {
try
{
try
{
sensor
.
on
(
testNullSensorId
,
onSensorCallback
);
sensor
.
on
(
testNullSensorId
,
onSensorCallback
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
error
);
console
.
info
(
'
testRegisterSensortest001 error
'
+
error
);
expect
(
true
).
assertTrue
();
errMessage
=
error
.
toString
().
slice
(
12
,
34
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
done
();
}
}
console
.
info
(
'
SUB_SENSORS_Sensor_JSTest_0020
end
'
);
console
.
info
(
'
testRegisterSensortest001
end
'
);
})
})
})}
})}
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js
浏览文件 @
b535481e
...
@@ -65,7 +65,6 @@ describe("SensorJsTest_sensor_35", function () {
...
@@ -65,7 +65,6 @@ describe("SensorJsTest_sensor_35", function () {
it
(
"
getSensorLists_SensorJsTest001
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
it
(
"
getSensorLists_SensorJsTest001
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest001----------------------------------
"
);
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest001----------------------------------
"
);
sensor
.
getSensorList
().
then
((
data
)
=>
{
sensor
.
getSensorList
().
then
((
data
)
=>
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest001 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest001
"
+
JSON
.
stringify
(
data
[
i
]));
console
.
info
(
"
getSensorLists_SensorJsTest001
"
+
JSON
.
stringify
(
data
[
i
]));
}
}
...
@@ -88,7 +87,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
...
@@ -88,7 +87,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
console
.
info
(
'
getSensorLists_SensorJsTest002 error
'
);
console
.
info
(
'
getSensorLists_SensorJsTest002 error
'
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest002 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest002
"
+
JSON
.
stringify
(
data
[
i
]));
console
.
info
(
"
getSensorLists_SensorJsTest002
"
+
JSON
.
stringify
(
data
[
i
]));
}
}
...
@@ -164,7 +162,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
...
@@ -164,7 +162,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
done
()
done
()
}
else
{
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest006 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
}
}
...
@@ -177,7 +174,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
...
@@ -177,7 +174,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
done
()
done
()
}
else
{
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest006 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
}
}
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js
浏览文件 @
b535481e
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_9", function () {
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_9", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_9", function () {
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_9", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_9", function () {
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_9", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------gravity_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
gravity_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------gravity_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------gravity_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_9", function () {
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_9", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------gravity_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------gravity_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GRAVITY
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
gravity_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------gravity_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------gravity_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js
浏览文件 @
b535481e
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_15", function () {
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_15", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_15", function () {
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_15", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_15", function () {
...
@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_15", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onceSensorCallback
,
5
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
magnetic_SensorJsTest005 error
'
+
error
);
console
.
info
(
'
magnetic_SensorJsTest005 error
'
+
error
);
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_15", function () {
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_15", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
magnetic_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------magnetic_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_15", function () {
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_15", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_MAGNETIC_FIELD
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
magnetic_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------magnetic_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js
浏览文件 @
b535481e
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_16", function () {
...
@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_16", function () {
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_16", function () {
...
@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_16", function () {
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
beta
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
gamma
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
alpha
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_16", function () {
...
@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_16", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onceSensorCallback
,
5
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
orientating_SensorJsTest005 error
'
+
error
);
console
.
info
(
'
orientating_SensorJsTest005 error
'
+
error
);
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_16", function () {
...
@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_16", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------orientating_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
orientating_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------orientating_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------orientating_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_16", function () {
...
@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_16", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------orientating_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------orientating_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ORIENTATION
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
orientating_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------orientating_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------orientating_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js
浏览文件 @
b535481e
...
@@ -24,6 +24,7 @@ describe("SensorJsTest_sensor_20", function () {
...
@@ -24,6 +24,7 @@ describe("SensorJsTest_sensor_20", function () {
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -32,6 +33,7 @@ describe("SensorJsTest_sensor_20", function () {
...
@@ -32,6 +33,7 @@ describe("SensorJsTest_sensor_20", function () {
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
w
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -147,7 +149,7 @@ describe("SensorJsTest_sensor_20", function () {
...
@@ -147,7 +149,7 @@ describe("SensorJsTest_sensor_20", function () {
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
}
try
{
try
{
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
onceSensorCallback
,
5
);
sensor
.
once
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
onceSensorCallback
,
5
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
'
rotatingvector_SensorJsTest005 error
'
+
error
);
console
.
info
(
'
rotatingvector_SensorJsTest005 error
'
+
error
);
...
@@ -239,7 +241,11 @@ describe("SensorJsTest_sensor_20", function () {
...
@@ -239,7 +241,11 @@ describe("SensorJsTest_sensor_20", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------rotatingvector_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------rotatingvector_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
rotatingvector_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------rotatingvector_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------rotatingvector_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -278,7 +284,11 @@ describe("SensorJsTest_sensor_20", function () {
...
@@ -278,7 +284,11 @@ describe("SensorJsTest_sensor_20", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------rotatingvector_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------rotatingvector_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ROTATION_VECTOR
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
rotatingvector_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------rotatingvector_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------rotatingvector_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js
浏览文件 @
b535481e
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_3", function () {
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_3", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_3", function () {
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_3", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_3", function () {
...
@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_3", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Accelerometer_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------Accelerometer_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -282,7 +288,12 @@ describe("SensorJsTest_sensor_3", function () {
...
@@ -282,7 +288,12 @@ describe("SensorJsTest_sensor_3", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Accelerometer_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Accelerometer_SensorJsTest012 error:
"
+
error
);
}
console
console
.
info
(
'
----------------------Accelerometer_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------Accelerometer_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js
浏览文件 @
b535481e
...
@@ -21,11 +21,13 @@ describe("SensorJsTest_sensor_4", function () {
...
@@ -21,11 +21,13 @@ describe("SensorJsTest_sensor_4", function () {
function
callback
(
data
)
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
intensity
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_4", function () {
...
@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_4", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest010 off end---------------------------
'
);
},
1000
);
},
1000
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_4", function () {
...
@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_4", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_AMBIENT_LIGHT
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Ambient_Light_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------Ambient_Light_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js
浏览文件 @
b535481e
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_5", function () {
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_5", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_5", function () {
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_5", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_5", function () {
...
@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_5", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
GYROSCOPE_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -282,7 +288,11 @@ describe("SensorJsTest_sensor_5", function () {
...
@@ -282,7 +288,11 @@ describe("SensorJsTest_sensor_5", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_GYROSCOPE
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
GYROSCOPE_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------GYROSCOPE_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js
浏览文件 @
b535481e
...
@@ -20,11 +20,13 @@ describe("SensorJsTest_sensor_7", function () {
...
@@ -20,11 +20,13 @@ describe("SensorJsTest_sensor_7", function () {
function
callback
(
data
)
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
callback2
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
status
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -232,7 +234,11 @@ describe("SensorJsTest_sensor_7", function () {
...
@@ -232,7 +234,11 @@ describe("SensorJsTest_sensor_7", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Hall_SensorJsTest010 off in---------------------------
'
);
console
.
info
(
'
----------------------Hall_SensorJsTest010 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Hall_SensorJsTest010 error:
"
+
error
);
}
console
.
info
(
'
----------------------Hall_SensorJsTest010 off end---------------------------
'
);
console
.
info
(
'
----------------------Hall_SensorJsTest010 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -271,7 +277,11 @@ describe("SensorJsTest_sensor_7", function () {
...
@@ -271,7 +277,11 @@ describe("SensorJsTest_sensor_7", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
----------------------Hall_SensorJsTest012 off in---------------------------
'
);
console
.
info
(
'
----------------------Hall_SensorJsTest012 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_HALL
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
Hall_SensorJsTest012 error:
"
+
error
);
}
console
.
info
(
'
----------------------Hall_SensorJsTest012 off end---------------------------
'
);
console
.
info
(
'
----------------------Hall_SensorJsTest012 off end---------------------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js
浏览文件 @
b535481e
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_37", function () {
...
@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_37", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
function
callback2
(
data
)
{
function
callback2
(
data
)
{
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_37", function () {
...
@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_37", function () {
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
y
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
}
beforeAll
(
function
()
{
beforeAll
(
function
()
{
...
@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_37", function () {
...
@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_37", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback2
);
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback2
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest010 off in----------------
'
);
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest010 off in----------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
SensorLinearAccelerometerJSTest010 error:
"
+
error
);
}
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest010 off end----------------
'
);
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest010 off end----------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_37", function () {
...
@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_37", function () {
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback2
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest012 off in----------------
'
);
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest012 off in----------------
'
);
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback
);
try
{
sensor
.
off
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_LINEAR_ACCELEROMETER
,
callback
);
}
catch
(
error
)
{
console
.
info
(
"
SensorLinearAccelerometerJSTest012 error:
"
+
error
);
}
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest012 off end----------------
'
);
console
.
info
(
'
-----------SensorLinearAccelerometerJSTest012 off end----------------
'
);
},
500
);
},
500
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录