提交 b535481e 编写于 作者: L lidanyang16

<lidanyang16@huawei.com>

Signed-off-by: Nlidanyang16 <lidanyang16@huawei.com>
上级 1c13b483
master OpenHarmony-3.2-Beta3 OpenHarmony-3.2-Beta4 OpenHarmony-3.2-Beta5 OpenHarmony-3.2-Release OpenHarmony-4.0-Beta1 OpenHarmony-4.0-Beta2 monthly_20221018 monthly_20230815 revert-merge-5164-master revert-merge-5846-master revert-merge-5923-master revert-merge-6291-monthly_20221018 revert-merge-6553-master revert-merge-7801-master revert-merge-8920-master revert-merge-9046-master revert-merge-9047-master revert-merge-9049-master revert-merge-9077-master revert-merge-9108-master revert-merge-9210-master revert-merge-9281-master revert-merge-9324-master revert-merge-9325-master revert-merge-9329-master revert-merge-9330-master revert-merge-9359-master revert-merge-9361-master weekly_20220913 weekly_20220920 weekly_20220927 weekly_20221004 weekly_20221011 weekly_20221018 weekly_20221025 weekly_20221101 weekly_20221108 weekly_20221115 weekly_20221122 weekly_20221129 weekly_20221206 weekly_20221213 weekly_20221220 weekly_20221227 weekly_20230103 weekly_20230110 weekly_20230117 weekly_20230124 weekly_20230131 weekly_20230207 weekly_20230214 weekly_20230221 weekly_20230228 weekly_20230307 weekly_20230314 weekly_20230321 weekly_20230328 weekly_20230404 weekly_20230411 weekly_20230418 weekly_20230425 weekly_20230502 weekly_20230509 weekly_20230516 weekly_20230523 weekly_20230530 weekly_20230606 weekly_20230613 weekly_20230619 weekly_20230626 weekly_20230627 weekly_20230704 weekly_20230712 weekly_20230725 weekly_20230801 weekly_20230808 weekly_20230815 weekly_20230822 weekly_20230829 OpenHarmony-v4.0-Beta2 OpenHarmony-v4.0-Beta1 OpenHarmony-v3.2.2-Release OpenHarmony-v3.2.1-Release OpenHarmony-v3.2-Release OpenHarmony-v3.2-Beta5 OpenHarmony-v3.2-Beta4 OpenHarmony-v3.2-Beta3
无相关合并请求
......@@ -381,16 +381,16 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
*/
it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate("").then(() => {
console.log("VibratorJsTest015 vibrate error");
expect(false).assertTrue();
it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.stop("preset").then(() => {
console.log("VibratorJsTest015 off success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(true).assertTrue();
console.log("VibratorJsTest015 vibrate success");
expect(false).assertTrue();
console.log("VibratorJsTest015 off error");
setTimeout(() => {
done();
}, 500);
......@@ -424,15 +424,15 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
*/
it("VibratorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.stop("preset").then(() => {
console.log("VibratorJsTest017 off success");
expect(true).assertTrue();
vibrator.vibrate("").then(() => {
console.log("VibratorJsTest017 vibrate error");
expect(false).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest017 off error");
expect(true).assertTrue();
console.log("VibratorJsTest017 vibrate success");
setTimeout(() => {
done();
}, 500);
......
......@@ -50,8 +50,7 @@ describe("VibratorJsTest_misc_1", function () {
console.info('afterEach caled')
})
let errMessages = ['Param number is invalid', 'Wrong argument type. function expected',
'Wrong argument type', 'Wrong argument number']
let errMessages = ['Error: ParseParameter: "Get vibrate type fail"', 'Error: ParseParameter: "Wrong argument number"']
let errMessage;
......@@ -194,7 +193,7 @@ describe("VibratorJsTest_misc_1", function () {
},
}, 25);
} catch (error) {
errMessage = error.toString().slice(39);
errMessage = error.toString();
console.info('SubVibratorJsTest0007 error:' + error);
expect(errMessage).assertEqual(errMessages[0]);
done();
......@@ -243,9 +242,9 @@ describe("VibratorJsTest_misc_1", function () {
try {
vibrator.vibrate();
} catch (error) {
errMessage = error.toString().slice(7);
errMessage = error.toString();
console.info('SubVibratorJsTest0009 error:' + error);
expect(errMessage).assertEqual(errMessages[2]);
expect(errMessage).assertEqual(errMessages[1]);
done();
}
})
......@@ -268,9 +267,9 @@ describe("VibratorJsTest_misc_1", function () {
}, function () {
}, 25);
} catch (error) {
errMessage = error.toString().slice(39);
errMessage = error.toString();
console.info('SubVibratorJsTest0010 error:' + error);
expect(errMessage).assertEqual(errMessages[3]);
expect(errMessage).assertEqual(errMessages[0]);
done();
}
})
......
......@@ -18,17 +18,6 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
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() {
describe('SystemParameterTest', function () {
beforeAll(function () {
......@@ -47,19 +36,22 @@ describe('SystemParameterTest', function () {
console.info('afterEach caled')
})
let testSensorId = 0;
let testNullSensorId = -1;
let errMessages = ['SubscribeSensor failed'];
let errMessage;
/**
* @tc.number SUB_SENSORS_Sensor_JSTest_0020
* @tc.name testRegisterSensortest002
* @tc.name testRegisterSensortest001
* @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) {
console.info('SUB_SENSORS_Sensor_JSTest_0020 start');
it('testRegisterSensortest001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('testRegisterSensortest001 start');
function onSensorCallback(data) {
console.info('SensorJsTest002 on error');
console.info('testRegisterSensortest001 on error');
expect(false).assertTrue();
done();
}
......@@ -67,10 +59,11 @@ describe('SystemParameterTest', function () {
try {
sensor.on(testNullSensorId, onSensorCallback);
} catch (error) {
console.info(error);
expect(true).assertTrue();
console.info('testRegisterSensortest001 error' +error);
errMessage = error.toString().slice(12, 34);
expect(errMessage).assertEqual(errMessages[0]);
done();
}
console.info('SUB_SENSORS_Sensor_JSTest_0020 end');
console.info('testRegisterSensortest001 end');
})
})}
......@@ -65,7 +65,6 @@ describe("SensorJsTest_sensor_35", function () {
it("getSensorLists_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest001----------------------------------");
sensor.getSensorList().then((data) => {
console.info("---------------------------getSensorLists_SensorJsTest001 in-----------" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest001 " + JSON.stringify(data[i]));
}
......@@ -88,7 +87,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
console.info('getSensorLists_SensorJsTest002 error');
expect(false).assertTrue();
} else {
console.info("---------------------------getSensorLists_SensorJsTest002 in-----------" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest002 " + JSON.stringify(data[i]));
}
......@@ -164,7 +162,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
expect(true).assertTrue();
done()
} else {
console.info("---------------------------getSensorLists_SensorJsTest006 in-----------" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i]));
}
......@@ -177,7 +174,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level
expect(true).assertTrue();
done()
} else {
console.info("---------------------------getSensorLists_SensorJsTest006 in-----------" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i]));
}
......
......@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_9", function () {
expect(typeof(data.x)).assertEqual("number");
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_9", function () {
expect(typeof(data.x)).assertEqual("number");
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_9", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2);
setTimeout(()=>{
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---------------------------');
}, 500);
setTimeout(()=>{
......@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_9", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2, {'interval': 100000000});
setTimeout(()=>{
console.info('----------------------gravity_SensorJsTest012 off in---------------------------');
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback);
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback);
} catch (error) {
console.info("gravity_SensorJsTest012 error:" + error);
}
console.info('----------------------gravity_SensorJsTest012 off end---------------------------');
}, 500);
setTimeout(()=>{
......
......@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_15", function () {
expect(typeof(data.x)).assertEqual("number");
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_15", function () {
expect(typeof(data.x)).assertEqual("number");
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function() {
......@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_15", function () {
expect(false).assertTrue();
done();
}
try{
try {
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onceSensorCallback, 5);
} catch (error) {
console.info('magnetic_SensorJsTest005 error' +error);
......@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_15", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2);
setTimeout(()=>{
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---------------------------');
}, 500);
setTimeout(()=>{
......@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_15", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2, {'interval': 100000000});
setTimeout(()=>{
console.info('----------------------magnetic_SensorJsTest012 off in---------------------------');
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback);
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---------------------------');
}, 500);
setTimeout(()=>{
......
......@@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_16", function () {
expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_16", function () {
expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_16", function () {
expect(false).assertTrue();
done();
}
try{
try {
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onceSensorCallback, 5);
} catch (error) {
console.info('orientating_SensorJsTest005 error' + error);
......@@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_16", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2);
setTimeout(()=>{
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---------------------------');
}, 500);
setTimeout(()=>{
......@@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_16", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2, {'interval': 100000000});
setTimeout(()=>{
console.info('----------------------orientating_SensorJsTest012 off in---------------------------');
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback);
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback);
} catch (error) {
console.info("orientating_SensorJsTest012 error:" + error);
}
console.info('----------------------orientating_SensorJsTest012 off end---------------------------');
}, 500);
setTimeout(()=>{
......
......@@ -24,6 +24,7 @@ describe("SensorJsTest_sensor_20", function () {
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof(data.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -32,6 +33,7 @@ describe("SensorJsTest_sensor_20", function () {
expect(typeof(data.y)).assertEqual("number");
expect(typeof(data.z)).assertEqual("number");
expect(typeof(data.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function() {
......@@ -147,7 +149,7 @@ describe("SensorJsTest_sensor_20", function () {
expect(false).assertTrue();
done();
}
try{
try {
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onceSensorCallback, 5);
} catch (error) {
console.info('rotatingvector_SensorJsTest005 error' +error);
......@@ -239,7 +241,11 @@ describe("SensorJsTest_sensor_20", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2);
setTimeout(()=>{
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---------------------------');
}, 500);
setTimeout(()=>{
......@@ -278,7 +284,11 @@ describe("SensorJsTest_sensor_20", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2, {'interval': 100000000});
setTimeout(()=>{
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---------------------------');
}, 500);
setTimeout(()=>{
......
......@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_3", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_3", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_3", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2);
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......@@ -282,7 +288,12 @@ describe("SensorJsTest_sensor_3", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2, { 'interval': 100000000 });
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......
......@@ -21,11 +21,13 @@ describe("SensorJsTest_sensor_4", function () {
function callback(data) {
console.info("callback" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
console.info("callback2" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_4", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2);
setTimeout(() => {
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---------------------------');
}, 1000);
setTimeout(() => {
......@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_4", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2, { 'interval': 100000000 });
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......
......@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_5", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_5", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_5", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2);
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......@@ -282,7 +288,11 @@ describe("SensorJsTest_sensor_5", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2, { 'interval': 100000000 });
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......
......@@ -20,11 +20,13 @@ describe("SensorJsTest_sensor_7", function () {
function callback(data) {
console.info("callback" + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
console.info("callback2" + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -232,7 +234,11 @@ describe("SensorJsTest_sensor_7", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2);
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......@@ -271,7 +277,11 @@ describe("SensorJsTest_sensor_7", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2, { 'interval': 100000000 });
setTimeout(() => {
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---------------------------');
}, 500);
setTimeout(() => {
......
......@@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_37", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
......@@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_37", function () {
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
beforeAll(function () {
......@@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_37", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback2);
setTimeout(() => {
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----------------');
}, 500);
setTimeout(() => {
......@@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_37", function () {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback2, { 'interval': 100000000 });
setTimeout(() => {
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----------------');
}, 500);
setTimeout(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部