提交 9e9ed08d 编写于 作者: L lidanyang16

<lidanyang16@huawei.com>

Signed-off-by: Nlidanyang16 <lidanyang16@huawei.com>
上级 b85bea9e
......@@ -169,6 +169,47 @@ describe("SensorJsTest_sensor_2", function () {
Promise.all(promiseArray).then(done)
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030
* @tc.name: SensorGeomagenticAlgorithmJSTest003
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it('SensorGeomagenticAlgorithmJSTest003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------SensorGeomagenticAlgorithmJSTest003-------------------------");
let geomagneticComponent = [-1417119616, 23146989568, -6406359552, -15.442885398864746,
93.50342559814453, 23190329344, 24058943488, -1417119360, 23146989568, -6406359552, -15.442885398864746,
93.50342559814453, 23190329344, 24058943488]
sensor.getGeomagneticField({ 'latitude': 0, 'longitude': 0, 'altitude': 0 }, 9223372036854775807,
(error, data) => {
if (error) {
console.info('SensorGeomagenticAlgorithmJSTest003 failed');
expect(false).assertTrue();
} else {
console.info('SensorGeomagenticAlgorithmJSTest003 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z
+ ',geomagneticDip: ' + data.geomagneticDip
+ ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity
+ ',totalIntensity: ' + data.totalIntensity)
expect((Math.abs(data.x - geomagneticComponent[0]) < EPS)
|| (Math.abs(data.x - geomagneticComponent[7]) < EPS)).assertTrue();
expect((Math.abs(data.y - geomagneticComponent[1]) < EPS)
|| (Math.abs(data.y - geomagneticComponent[8]) < EPS)).assertTrue();
expect((Math.abs(data.z - geomagneticComponent[2]) < EPS)
|| (Math.abs(data.z - geomagneticComponent[9]) < EPS)).assertTrue();
expect((Math.abs(data.geomagneticDip - geomagneticComponent[3]) < EPS)
|| (Math.abs(data.geomagneticDip - geomagneticComponent[10]) < EPS)).assertTrue();
expect((Math.abs(data.deflectionAngle - geomagneticComponent[4]) < EPS)
|| (Math.abs(data.deflectionAngle - geomagneticComponent[11]) < EPS)).assertTrue();
expect((Math.abs(data.levelIntensity - geomagneticComponent[5]) < EPS)
|| (Math.abs(data.levelIntensity - geomagneticComponent[12]) < EPS)).assertTrue();
expect((Math.abs(data.totalIntensity - geomagneticComponent[6]) < EPS)
|| (Math.abs(data.totalIntensity - geomagneticComponent[13]) < EPS)).assertTrue();
}
setTimeout(() => {
done()
}, 500)
})
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040
* @tc.name: SensorGeomagenticAlgorithmJSTest004
......@@ -803,6 +844,42 @@ describe("SensorJsTest_sensor_2", function () {
done()
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270
* @tc.name: SensorGeomagenticAlgorithmJSTest027
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("SensorGeomagenticAlgorithmJSTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('------------------SensorGeomagenticAlgorithmJSTest027------------------');
let geomagneticComponent = [-1417119616, 23146989568, -6406359552, -15.442885398864746,
93.50342559814453, 23190329344, 24058943488, -1417119360, 23146989568, -6406359552, -15.442885398864746,
93.50342559814453, 23190329344, 24058943488]
await sensor.getGeomagneticField({ 'latitude': 0, 'longitude': 0, 'altitude': 0 },
9223372036854775807).then((data) => {
console.info('SensorGeomagenticAlgorithmJSTest027 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z
+ ',geomagneticDip: ' + data.geomagneticDip
+ ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity
+ ',totalIntensity: ' + data.totalIntensity)
expect((Math.abs(data.x - geomagneticComponent[0]) < EPS)
|| (Math.abs(data.x - geomagneticComponent[7]) < EPS)).assertTrue();
expect((Math.abs(data.y - geomagneticComponent[1]) < EPS)
|| (Math.abs(data.y - geomagneticComponent[8]) < EPS)).assertTrue();
expect((Math.abs(data.z - geomagneticComponent[2]) < EPS)
|| (Math.abs(data.z - geomagneticComponent[9]) < EPS)).assertTrue();
expect((Math.abs(data.geomagneticDip - geomagneticComponent[3]) < EPS)
|| (Math.abs(data.geomagneticDip - geomagneticComponent[10]) < EPS)).assertTrue();
expect((Math.abs(data.deflectionAngle - geomagneticComponent[4]) < EPS)
|| (Math.abs(data.deflectionAngle - geomagneticComponent[11]) < EPS)).assertTrue();
expect((Math.abs(data.levelIntensity - geomagneticComponent[5]) < EPS)
|| (Math.abs(data.levelIntensity - geomagneticComponent[12]) < EPS)).assertTrue();
expect((Math.abs(data.totalIntensity - geomagneticComponent[6]) < EPS)
|| (Math.abs(data.totalIntensity - geomagneticComponent[13]) < EPS)).assertTrue();
}).catch((error) => {
console.info("promise::catch", error)
});
done()
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280
* @tc.name: SensorGeomagenticAlgorithmJSTest028
......
......@@ -50,6 +50,7 @@ describe("SensorJsTest_sensor_26", function () {
console.info('afterEach caled')
})
let BarometerId = 8
/*
* @tc.number:SUB_SensorsSystem_SubscribeBarometer_JSTest_0010
* @tc.name:subscribeBarometer_SensorJsTest001
......@@ -58,7 +59,7 @@ describe("SensorJsTest_sensor_26", function () {
it("subscribeBarometer_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest001---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeBarometer ,(error, data) => {
sensor.getSingleSensor(BarometerId ,(error, data) => {
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest001 success" + JSON.stringify(data));
......@@ -88,7 +89,7 @@ describe("SensorJsTest_sensor_26", function () {
it("subscribeBarometer_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest002---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeBarometer ,(error, data) => {
sensor.getSingleSensor(BarometerId ,(error, data) => {
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest002 success:" + JSON.stringify(data));
......@@ -128,7 +129,7 @@ describe("SensorJsTest_sensor_26", function () {
it("subscribeBarometer_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest003---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeBarometer ,(error, data) => {
sensor.getSingleSensor(BarometerId,(error, data) => {
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest003 success:" + JSON.stringify(data));
......
......@@ -49,6 +49,8 @@ describe("SensorJsTest_sensor_27", function () {
*/
console.info('afterEach caled')
})
let DeviceOrientationId = 256
/*
* @tc.number:SUB_SensorsSystem_SubscribeDeviceOrientation_JSTest_0010
......@@ -58,7 +60,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest001---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'game',
success: function (data) {
......@@ -93,7 +95,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest002---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'ui',
success: function (data) {
......@@ -129,7 +131,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest003---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'normal',
success: function (data) {
......@@ -164,7 +166,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest004---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'normal',
success: function (data) {
......@@ -213,7 +215,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest005---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'xxx',
success: function (data) {
......@@ -244,7 +246,7 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest006---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeDeviceOrientation ,(error, data) => {
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({
interval: 'normal',
success: function (data) {
......
......@@ -50,6 +50,8 @@ describe("SensorJsTest_sensor_29", function () {
console.info('afterEach caled')
})
let GyroscopeId = 2
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0010
* @tc.name: subscribeGyroscope_SensorJsTest001
......@@ -58,7 +60,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest001---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'game',
success: function (data) {
......@@ -91,7 +93,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest002---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'ui',
success: function (data) {
......@@ -124,7 +126,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest003---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
......@@ -157,7 +159,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest004---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
......@@ -204,7 +206,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest005---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'xxx',
success: function (data) {
......@@ -234,7 +236,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest006---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
......@@ -260,7 +262,7 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest007---------------');
try{
sensor.getSingleSensor(sensor.subscribeGyroscope ,(error, data) => {
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
......
......@@ -50,6 +50,7 @@ describe("SensorJsTest_sensor_31", function () {
console.info('afterEach caled')
})
let LightId = 5
/*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0010
* @tc.name: subscribeLight_SensorJsTest001
......@@ -58,7 +59,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest001---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'game',
success: function (data) {
......@@ -89,7 +90,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest002---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'ui',
success: function (data) {
......@@ -120,7 +121,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest003---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
success: function (data) {
console.info("subscribeLight_SensorJsTest003 success" + JSON.stringify(data));
......@@ -150,7 +151,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest004---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
......@@ -193,7 +194,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest005---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'xxx',
success: function (data) {
......@@ -222,7 +223,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest006---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
......@@ -246,7 +247,7 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest007---------------------------');
try{
sensor.getSingleSensor(sensor.subscribeLight ,(error, data) => {
sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册