From cdb78334e255086f6ed5fe2e147d88ac8bbc742a Mon Sep 17 00:00:00 2001 From: lidanyang16 Date: Mon, 19 Sep 2022 14:20:52 +0800 Subject: [PATCH] Signed-off-by: lidanyang16 --- .../js/test/Vibrator_newSupplement.test.js | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js index 577e01ee0..4ff9d5654 100644 --- a/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js +++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js @@ -779,6 +779,107 @@ describe("VibratorJsTest_misc_3", function () { console.info("VibratorJsTest039 reject"); }) done(); + }) + /* + * @tc.name:VibratorJsTest040 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0500 + */ + it("VibratorJsTest040", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { + vibrator.vibrate({ + type: "time", + duration: 1000 + }, { + id:0, + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest040 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest040 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest041 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0510 + */ + it("VibratorJsTest041", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "", + duration: 1000 + }, { + id:1, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest042 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0520 + */ + it("VibratorJsTest042", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + id:"xxx", + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest042 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest042 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest043 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0530 + */ + it("VibratorJsTest043", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "preset", + effectId: "", + count: 3, + }, { + id:null, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); }) }) } -- GitLab