Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
791c7e88
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
791c7e88
编写于
2月 21, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 21, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7669 【Openharmony4.0.3.2】【monthly分支】【sensor子系统】【ToC】【RK3568】【必现】修改bundle-name,p7b文件,陀螺仪用例
Merge pull request !7669 from ldy/cherry-pick-1676963247
上级
1a6b3ae6
a9e6b633
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
358 addition
and
147 deletion
+358
-147
sensors/miscdevice_standard/Test.json
sensors/miscdevice_standard/Test.json
+2
-2
sensors/miscdevice_standard/signature/openharmony_sx.p7b
sensors/miscdevice_standard/signature/openharmony_sx.p7b
+0
-0
sensors/miscdevice_standard/src/main/config.json
sensors/miscdevice_standard/src/main/config.json
+2
-2
sensors/sensor_standard/src/main/js/test/List.test.js
sensors/sensor_standard/src/main/js/test/List.test.js
+2
-0
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newGyroScope.js
...ard/src/main/js/test/SensorOnOffTest.test_newGyroScope.js
+350
-141
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newMagneticField.js
...src/main/js/test/SensorOnOffTest.test_newMagneticField.js
+2
-2
未找到文件。
sensors/miscdevice_standard/Test.json
浏览文件 @
791c7e88
...
...
@@ -4,8 +4,8 @@
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"160000"
,
"shell-timeout"
:
"160000"
,
"bundle-name"
:
"ohos.acts.sensors.
sensor
.function"
,
"package-name"
:
"ohos.acts.sensors.
sensor
.function"
"bundle-name"
:
"ohos.acts.sensors.
miscdevice
.function"
,
"package-name"
:
"ohos.acts.sensors.
miscdevice
.function"
},
"kits"
:
[
{
...
...
sensors/miscdevice_standard/signature/openharmony_sx.p7b
浏览文件 @
791c7e88
无法预览此类型文件
sensors/miscdevice_standard/src/main/config.json
浏览文件 @
791c7e88
{
"app"
:
{
"bundleName"
:
"ohos.acts.sensors.
sensor
.function"
,
"bundleName"
:
"ohos.acts.sensors.
miscdevice
.function"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
...
...
@@ -13,7 +13,7 @@
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.sensors.
sensor
.function"
,
"package"
:
"ohos.acts.sensors.
miscdevice
.function"
,
"name"
:
".entry"
,
"deviceType"
:
[
"tablet"
,
...
...
sensors/sensor_standard/src/main/js/test/List.test.js
浏览文件 @
791c7e88
...
...
@@ -19,6 +19,7 @@ import SensorJsTest_sensor_60 from './SensorOnOffTest.test_newSensorGeomagnetic.
import
SensorJsTest_sensor_3
from
'
./SensorOnOffTest.test_oldAccelerometer.js
'
import
SensorJsTest_sensor_25
from
'
./Subscribe_subscribeAccelerometer.js
'
import
SensorJsTest_sensor_39
from
'
./SensorOnOffTest.test_newAccelerometer.js
'
import
SensorJsTest_sensor_43
from
'
./SensorOnOffTest.test_newGyroScope.js
'
export
default
function
testsuite
()
{
SensorJsTest_sensor_1
()
...
...
@@ -28,4 +29,5 @@ SystemParameterTest()
SensorJsTest_sensor_3
()
SensorJsTest_sensor_25
()
SensorJsTest_sensor_39
()
SensorJsTest_sensor_43
()
}
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newGyroScope.js
浏览文件 @
791c7e88
...
...
@@ -78,11 +78,25 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest014
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
'
---------newGyroScope_SensorJsTest014--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest014 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
);
setTimeout
(()
=>
{
sensor
.
off
(
sensor
.
SensorId
.
GYROSCOPE
);
done
();
},
500
);
}
})
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest014 Device does not support!
'
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -113,6 +127,12 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest016
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newGyroScope_SensorJsTest016--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest016 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
console
.
info
(
'
---------newGyroScope_SensorJsTest016 off in--------------
'
);
...
...
@@ -120,6 +140,14 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
---------newGyroScope_SensorJsTest016 off end--------------
'
);
done
();
},
500
);
}
})
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest016 Device does not support!
'
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -136,19 +164,27 @@ describe("SensorJsTest_sensor_43", function () {
expect
(
typeof
(
data
.
z
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
timestamp
)).
assertEqual
(
"
number
"
);
}
try
{
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest017 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
onSensorCallback
,
{
'
interval
'
:
100000000
},
5
);
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest017 error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
setTimeout
(()
=>
{
console
.
info
(
'
---------newGyroScope_SensorJsTest017 off in--------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
GYROSCOPE
);
console
.
info
(
'
---------newGyroScope_SensorJsTest017 off end--------------
'
);
done
();
},
500
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest017 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -157,11 +193,25 @@ describe("SensorJsTest_sensor_43", function () {
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it
(
"
newGyroScope_SensorJsTest018
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest018 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
once
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
);
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest018 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -200,10 +250,18 @@ describe("SensorJsTest_sensor_43", function () {
done
();
}
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest020 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
once
(
sensor
.
SensorId
.
GYROSCOPE
,
onceSensorCallback
,
5
);
}
})
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest020 error:
'
+
error
);
expect
(
false
).
assertTrue
();
console
.
info
(
"
newGyroScope_SensorJsTest020 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
...
...
@@ -217,7 +275,7 @@ describe("SensorJsTest_sensor_43", function () {
try
{
sensor
.
off
(
invalid
,
callback
);
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest021
error:
'
+
error
);
console
.
info
(
'
newGyroScope_SensorJsTest021
Device does not support!
'
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
)
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
)
done
();
...
...
@@ -235,28 +293,42 @@ describe("SensorJsTest_sensor_43", function () {
expect
(
false
).
assertTrue
();
done
();
}
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest022 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
onSensorCallback
);
sensor
.
off
(
sensor
.
SensorId
.
GYROSCOPE
,
onSensorCallback
);
setTimeout
(()
=>
{
expect
(
true
).
assertTrue
();
done
();
},
500
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest022 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0230
* @tc.name: new
new
GyroScope_SensorJsTest023
* @tc.name: newGyroScope_SensorJsTest023
* @tc.desc:SensorId1000000 of incoming exception
*/
it
(
"
new
new
GyroScope_SensorJsTest023
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
it
(
"
newGyroScope_SensorJsTest023
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
onSensorCallback
(
data
)
{
console
.
info
(
'
new
new
GyroScope_SensorJsTest023 on error
'
);
console
.
info
(
'
newGyroScope_SensorJsTest023 on error
'
);
expect
(
false
).
assertTrue
();
}
try
{
sensor
.
off
(
1000000
,
onSensorCallback
);
}
catch
(
error
)
{
console
.
info
(
"
new
new
GyroScope_SensorJsTest023 error:
"
+
error
);
console
.
info
(
"
newGyroScope_SensorJsTest023 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
)
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
)
done
();
...
...
@@ -269,6 +341,12 @@ describe("SensorJsTest_sensor_43", function () {
* @tc.desc:Call interface multiple times
*/
it
(
"
newGyroScope_SensorJsTest024
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest024 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
(
data
)
=>
{
console
.
info
(
"
newGyroScope_SensorJsTest024 callback:
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
@@ -289,6 +367,14 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
---------newGyroScope_SensorJsTest024 off end--------------
'
);
done
();
},
1000
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest024 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -300,7 +386,7 @@ describe("SensorJsTest_sensor_43", function () {
try
{
sensor
.
off
(
sensor
.
SensorId
.
GYROSCOPE
,
5
);
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest025
error:
'
+
error
);
console
.
info
(
'
newGyroScope_SensorJsTest025
Device does not support!
'
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
)
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
)
done
();
...
...
@@ -314,6 +400,12 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest026
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newGyroScope_SensorJsTest026--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest024 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
(
data
)
=>
{
console
.
info
(
"
newGyroScope_SensorJsTest026 callback:
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
@@ -334,6 +426,14 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
---------newGyroScope_SensorJsTest026 off end--------------
'
);
done
();
},
1000
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest026 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -343,6 +443,12 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest027
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
---------newGyroScope_SensorJsTest027--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest024 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
(
data
)
=>
{
console
.
info
(
"
newGyroScope_SensorJsTest027 callback:
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
@@ -363,6 +469,14 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
---------newGyroScope_SensorJsTest027 off end--------------
'
);
done
();
},
1000
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest027 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -375,7 +489,7 @@ describe("SensorJsTest_sensor_43", function () {
try
{
sensor
.
on
();
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest028 error:
"
+
error
);
console
.
info
(
"
newGyroScope_SensorJsTest028
_on
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -383,7 +497,7 @@ describe("SensorJsTest_sensor_43", function () {
try
{
sensor
.
once
();
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest028 error:
"
+
error
);
console
.
info
(
"
newGyroScope_SensorJsTest028
_once
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -391,7 +505,7 @@ describe("SensorJsTest_sensor_43", function () {
try
{
sensor
.
off
();
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest028 error:
"
+
error
);
console
.
info
(
"
newGyroScope_SensorJsTest028
_off
error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
...
...
@@ -405,6 +519,12 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest029
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------newGyroScope_SensorJsTest029--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest029 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback2
);
setTimeout
(()
=>
{
...
...
@@ -422,6 +542,14 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
----------------------newGyroScope_SensorJsTest029 off end--------------
'
);
done
();
},
1000
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest029 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -431,6 +559,12 @@ describe("SensorJsTest_sensor_43", function () {
*/
it
(
"
newGyroScope_SensorJsTest030
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------newGyroScope_SensorJsTest030--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest029 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
,
{
'
interval
'
:
100000000
});
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback2
,
{
'
interval
'
:
100000000
});
setTimeout
(()
=>
{
...
...
@@ -449,5 +583,80 @@ describe("SensorJsTest_sensor_43", function () {
console
.
info
(
'
----------------------newGyroScope_SensorJsTest030_2 off end--------------
'
);
done
();
},
1000
);
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest030 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0310
* @tc.name: newGyroScope_SensorJsTest031
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it
(
"
newGyroScope_SensorJsTest031
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------newGyroScope_SensorJsTest031--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest031 error
'
);
}
else
{
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
console
.
info
(
'
----------------------newGyroScope_SensorJsTest031 off in--------------
'
);
try
{
sensor
.
off
(
-
1
,
callback
);
console
.
info
(
'
----------------------newGyroScope_SensorJsTest031 off end--------------
'
);
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest031 error:
"
+
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest031 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0320
* @tc.name: newGyroScope_SensorJsTest032
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it
(
"
newGyroScope_SensorJsTest032
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
----------------------newGyroScope_SensorJsTest032--------------
'
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorId
.
GYROSCOPE
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest032 error
'
);
}
else
{
try
{
sensor
.
on
(
sensor
.
SensorId
.
GYROSCOPE
,
callback
,
{
'
interval
'
:
-
100000000
});
console
.
info
(
'
----------------------newGyroScope_SensorJsTest032 off in---------------------------
'
);
sensor
.
off
(
sensor
.
SensorId
.
GYROSCOPE
);
console
.
info
(
'
----------------------newGyroScope_SensorJsTest032 off end---------------------------
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
'
newGyroScope_SensorJsTest032 On fail, errCode:
'
+
error
.
code
+
'
,msg:
'
+
error
.
message
);
expect
(
error
.
code
).
assertEqual
(
SERVICE_EXCEPTION_CODE
);
expect
(
error
.
message
).
assertEqual
(
SERVICE_EXCEPTION_MSG
);
done
();
}
}
})
}
catch
(
error
)
{
console
.
info
(
"
newGyroScope_SensorJsTest032 Device does not support!
"
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
})}
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newMagneticField.js
浏览文件 @
791c7e88
...
...
@@ -15,8 +15,8 @@
import
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
export
default
function
SensorJsTest_sensor_3
9
()
{
describe
(
"
SensorJsTest_sensor_3
9
"
,
function
()
{
export
default
function
SensorJsTest_sensor_3
7
()
{
describe
(
"
SensorJsTest_sensor_3
7
"
,
function
()
{
function
callback
(
data
)
{
console
.
info
(
"
callback
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
x
)).
assertEqual
(
"
number
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录