提交 d2dea34b 编写于 作者: L lidanyang16

<lidanyang16@huawei.com>

Signed-off-by: Nlidanyang16 <lidanyang16@huawei.com>
上级 ba6d59ec
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import SystemParameterTest from './SensorOnOffTest.test.js' import SystemParameterTest from './SensorOnOffTest.test.js'
import SensorJsTest_sensor_2 from './SensorGeomagneticTest.test.js' import SensorJsTest_sensor_2 from './SensorGeomagneticTest.test.js'
import SensorJsTest_sensor_1 from './SensorGeneralalgorithm.test.js' import SensorJsTest_sensor_1 from './SensorGeneralalgorithm.test.js'
import SensorJsTest_sensor_60 from './SensorOnOffTest.test_newSensorGeomagnetic.js'
import SensorJsTest_sensor_3 from './SensorOnOffTest.test_oldAccelerometer.js' import SensorJsTest_sensor_3 from './SensorOnOffTest.test_oldAccelerometer.js'
import SensorJsTest_sensor_25 from './Subscribe_subscribeAccelerometer.js' import SensorJsTest_sensor_25 from './Subscribe_subscribeAccelerometer.js'
import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js' import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js'
...@@ -22,6 +23,7 @@ import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js' ...@@ -22,6 +23,7 @@ import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js'
export default function testsuite() { export default function testsuite() {
SensorJsTest_sensor_1() SensorJsTest_sensor_1()
SensorJsTest_sensor_2() SensorJsTest_sensor_2()
SensorJsTest_sensor_60()
SystemParameterTest() SystemParameterTest()
SensorJsTest_sensor_3() SensorJsTest_sensor_3()
SensorJsTest_sensor_25() SensorJsTest_sensor_25()
......
...@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0140 * @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0140
* @tc.name: newAmbient_Light_SensorJsTest027 * @tc.name: newAmbient_Light_SensorJsTest014
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newAmbient_Light_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newAmbient_Light_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest027--------------'); console.info('---------newAmbient_Light_SensorJsTest014--------------');
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
...@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0150 * @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0150
* @tc.name: newAmbient_Light_SensorJsTest028 * @tc.name: newAmbient_Light_SensorJsTest015
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newAmbient_Light_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest028--------------'); console.info('---------newAmbient_Light_SensorJsTest015--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest028 callback in'); console.info('newAmbient_Light_SensorJsTest015 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest028 error:" + error); console.info("newAmbient_Light_SensorJsTest015 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -104,29 +104,29 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -104,29 +104,29 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0160 * @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0160
* @tc.name: newAmbient_Light_SensorJsTest029 * @tc.name: newAmbient_Light_SensorJsTest016
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newAmbient_Light_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------SensorJsTest003--------------'); console.info('---------newAmbient_Light_SensorJsTest016--------------');
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest029 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest029 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest016 off end--------------');
done(); done();
}, 500); }, 500);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0170 * @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0170
* @tc.name: newAmbient_Light_SensorJsTest030 * @tc.name: newAmbient_Light_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newAmbient_Light_SensorJsTest030--------------'); console.info('---------newAmbient_Light_SensorJsTest017--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest030 callback in'); console.info('newAmbient_Light_SensorJsTest017 callback in');
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
done(); done();
...@@ -134,14 +134,14 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -134,14 +134,14 @@ describe("SensorJsTest_sensor_41", function () {
try { try {
sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback, {'interval': 100000000}, 5);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest030 error:" +error); console.info("newAmbient_Light_SensorJsTest017 error:" +error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest030 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest017 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest030 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest017 off end--------------');
done(); done();
}, 500); }, 500);
}) })
......
...@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
...@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
...@@ -73,11 +75,11 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -73,11 +75,11 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0140 * @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0140
* @tc.name:newRotatingVector_SensorJsTest027 * @tc.name:newRotatingVector_SensorJsTest014
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newRotatingVector_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newRotatingVector_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newRotatingVector_SensorJsTest027--------------'); console.info('---------newRotatingVector_SensorJsTest014--------------');
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
...@@ -87,19 +89,19 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -87,19 +89,19 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0150 * @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0150
* @tc.name:newRotatingVector_SensorJsTest028 * @tc.name:newRotatingVector_SensorJsTest015
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newRotatingVector_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest028--------------'); console.info('---------newRotatingVector_SensorJsTest015--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest028 callback in'); console.info('newRotatingVector_SensorJsTest015 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest028 error:" + error); console.info("newRotatingVector_SensorJsTest015 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -108,45 +110,46 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -108,45 +110,46 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0160 * @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0160
* @tc.name:newRotatingVector_SensorJsTest029 * @tc.name:newRotatingVector_SensorJsTest016
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newRotatingVector_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest029--------------'); console.info('---------newRotatingVector_SensorJsTest016--------------');
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest029 off in--------------'); console.info('---------newRotatingVector_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest029 off end--------------'); console.info('---------newRotatingVector_SensorJsTest016 off end--------------');
done(); done();
}, 500); }, 500);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0170 * @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0170
* @tc.name:newRotatingVector_SensorJsTest030 * @tc.name:newRotatingVector_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newRotatingVector_SensorJsTest030--------------'); console.info('---------newRotatingVector_SensorJsTest017--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest030 callback in'); console.info('newRotatingVector_SensorJsTest017 callback in');
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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
try { try {
sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback, {'interval': 100000000}, 5);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest030 error:" +error); console.info("newRotatingVector_SensorJsTest017 error:" +error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest030 off in--------------'); console.info('---------newRotatingVector_SensorJsTest017 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest030 off end--------------'); console.info('---------newRotatingVector_SensorJsTest017 off end--------------');
done(); done();
}, 500); }, 500);
}) })
...@@ -196,6 +199,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -196,6 +199,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
done(); done();
} }
...@@ -245,18 +249,18 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -245,18 +249,18 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0230 * @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0230
* @tc.name: newnewRotatingVector_SensorJsTest023 * @tc.name: newRotatingVector_SensorJsTest023
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newnewRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newnewRotatingVector_SensorJsTest023 on error'); console.info('newRotatingVector_SensorJsTest023 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newnewRotatingVector_SensorJsTest023 error:" +error); console.info("newRotatingVector_SensorJsTest023 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -274,6 +278,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -274,6 +278,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
...@@ -281,6 +286,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -281,6 +286,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
...@@ -319,6 +325,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -319,6 +325,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.once(sensor.SensorId.ROTATION_VECTOR, (data)=>{
...@@ -326,6 +333,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -326,6 +333,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
...@@ -348,6 +356,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -348,6 +356,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
...@@ -355,6 +364,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -355,6 +364,7 @@ describe("SensorJsTest_sensor_49", 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.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
......
...@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -69,11 +69,11 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0120 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0120
* @tc.name: newSignificant_Motion_SensorJsTest023 * @tc.name: newSignificant_Motion_SensorJsTest012
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newSignificant_Motion_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newSignificant_Motion_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newSignificant_Motion_SensorJsTest023--------------'); console.info('---------newSignificant_Motion_SensorJsTest012--------------');
sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, callback); sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.SIGNIFICANT_MOTION); sensor.off(sensor.SensorId.SIGNIFICANT_MOTION);
...@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -83,19 +83,19 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0130 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0130
* @tc.name: newSignificant_Motion_SensorJsTest024 * @tc.name: newSignificant_Motion_SensorJsTest013
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newSignificant_Motion_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newSignificant_Motion_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newSignificant_Motion_SensorJsTest024--------------'); console.info('---------newSignificant_Motion_SensorJsTest013--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newSignificant_Motion_SensorJsTest024 callback in'); console.info('newSignificant_Motion_SensorJsTest013 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newSignificant_Motion_SensorJsTest024 error:" + error); console.info("newSignificant_Motion_SensorJsTest013 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -104,53 +104,53 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -104,53 +104,53 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0140 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0140
* @tc.name: newSignificant_Motion_SensorJsTest025 * @tc.name: newSignificant_Motion_SensorJsTest014
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newSignificant_Motion_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newSignificant_Motion_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newSignificant_Motion_SensorJsTest025--------------'); console.info('---------newSignificant_Motion_SensorJsTest014--------------');
sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newSignificant_Motion_SensorJsTest025 off in--------------'); console.info('---------newSignificant_Motion_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.SIGNIFICANT_MOTION); sensor.off(sensor.SensorId.SIGNIFICANT_MOTION);
console.info('---------newSignificant_Motion_SensorJsTest025 off end--------------'); console.info('---------newSignificant_Motion_SensorJsTest014 off end--------------');
done(); done();
}, 500); }, 500);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0150 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0150
* @tc.name: newSignificant_Motion_SensorJsTest026 * @tc.name: newSignificant_Motion_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newSignificant_Motion_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newSignificant_Motion_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newSignificant_Motion_SensorJsTest026--------------'); console.info('---------newSignificant_Motion_SensorJsTest015--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newSignificant_Motion_SensorJsTest026 callback in'); console.info('newSignificant_Motion_SensorJsTest015 callback in');
expect(typeof (data.scalar)).assertEqual("number"); expect(typeof (data.scalar)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
try { try {
sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.SIGNIFICANT_MOTION, onSensorCallback, {'interval': 100000000}, 5);
} catch (error) { } catch (error) {
console.info("newSignificant_Motion_SensorJsTest026 error:" +error); console.info("newSignificant_Motion_SensorJsTest015 error:" +error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newSignificant_Motion_SensorJsTest026 off in--------------'); console.info('---------newSignificant_Motion_SensorJsTest015 off in--------------');
sensor.off(sensor.SensorId.SIGNIFICANT_MOTION); sensor.off(sensor.SensorId.SIGNIFICANT_MOTION);
console.info('---------newSignificant_Motion_SensorJsTest026 off end--------------'); console.info('---------newSignificant_Motion_SensorJsTest015 off end--------------');
done(); done();
}, 500); }, 500);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0160 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0160
* @tc.name: newSignificant_Motion_SensorJsTest027 * @tc.name: newSignificant_Motion_SensorJsTest016
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newSignificant_Motion_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newSignificant_Motion_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.once(sensor.SensorId.SIGNIFICANT_MOTION, callback); sensor.once(sensor.SensorId.SIGNIFICANT_MOTION, callback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -216,18 +216,18 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -216,18 +216,18 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0200 * @tc.number:SUB_SensorsSystem_SIGNIFICANT_MOTION_JSTest_0200
* @tc.name: newnewSignificant_Motion_SensorJsTest020 * @tc.name: newSignificant_Motion_SensorJsTest020
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newnewSignificant_Motion_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newSignificant_Motion_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newnewSignificant_Motion_SensorJsTest020 on error'); console.info('newSignificant_Motion_SensorJsTest020 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newnewSignificant_Motion_SensorJsTest020 error:" +error); console.info("newSignificant_Motion_SensorJsTest020 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
......
...@@ -16,8 +16,8 @@ import sensor from '@system.sensor' ...@@ -16,8 +16,8 @@ import sensor from '@system.sensor'
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'
export default function SensorJsTest_sensor_26() { export default function SensorJsTest_sensor_27() {
describe("SensorJsTest_sensor_26", function () { describe("SensorJsTest_sensor_27", function () {
beforeAll(function () { beforeAll(function () {
/* /*
......
...@@ -106,7 +106,6 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -106,7 +106,6 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest003---------------------------'); console.info('----------------------subscribeLight_SensorJsTest003---------------------------');
sensor.subscribeLight({ sensor.subscribeLight({
interval: 'normal',
success: function (data) { success: function (data) {
console.info("subscribeLight_SensorJsTest003 success" + JSON.stringify(data)); console.info("subscribeLight_SensorJsTest003 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
...@@ -170,6 +169,7 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -170,6 +169,7 @@ describe("SensorJsTest_sensor_31", function () {
success: function (data) { success: function (data) {
console.info("subscribeLight_SensorJsTest005 success" + JSON.stringify(data)); console.info("subscribeLight_SensorJsTest005 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
done();
}, },
fail: function (data, code) { fail: function (data, code) {
console.log("subscribeLight_SensorJsTest005 is failed, data: " + data + ", code: " + code); console.log("subscribeLight_SensorJsTest005 is failed, data: " + data + ", code: " + code);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册