From f9b12b4c49c90aaab2059073b3fd035b9ec68f71 Mon Sep 17 00:00:00 2001 From: shaoziyun Date: Wed, 22 Jun 2022 01:58:36 +0000 Subject: [PATCH] =?UTF-8?q?xts=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shaoziyun --- .../main/js/default/test/InputDevice.test.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) mode change 100644 => 100755 multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js old mode 100644 new mode 100755 index b0da362a5..a1b03ac1d --- a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js +++ b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js @@ -143,4 +143,50 @@ describe('MultimodalInput_test', function () { } console.log(`inputDevice::supportKeys_test-02 exit`); }) + + // 参数正常 + it("inputDevice::getKeyboardType_test-01", 0, function () { + console.log(`inputDevice::getKeyboardType_test-01 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + for (let i = 0; i < data.length; ++i) { + inputDevice.getKeyboardType(data[i], (res, err) => { + expect(res).assertInstanceOf('number'); + }); + } + } + console.log(`inputDevice::getKeyboardType_test-01 exit`); + }); + }) + + //参数异常 + it("inputDevice::getKeyboardType_test-02", 0, function () { + console.log(`inputDevice::getKeyboardType_test-02 enter`); + try { + inputDevice.getKeyboardType(-1); + } catch (error) { + expect(error.message).assertEqual("getKeyboardType: \"The second parameter type is wrong\""); + } + console.log(`inputDevice::getKeyboardType_test-02 exit`); + }); + + // 参数正常 + it("inputDevice::getKeyboardType_test-03", 0, function () { + console.log(`inputDevice::getKeyboardType_test-03 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + for (let i = 0; i < data.length; ++i) { + inputDevice.getKeyboardType(data[i]).then((res) => { + expect(res).assertInstanceOf('number'); + done(); + }); + } + } + console.log(`inputDevice::getKeyboardType_test-03 exit`); + }); + }) }) -- GitLab