From 936bb973e0be47e54ad319b30acbe4cd91a68e54 Mon Sep 17 00:00:00 2001 From: mayunteng_1 Date: Mon, 22 Aug 2022 19:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=A8=A1xts=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mayunteng_1 Change-Id: I0f2daf92f81934c9ae010e2b6989579ed20acfcf --- .../main/js/default/test/InputDevice.test.js | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) 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 index ad4ff880d..d923ec6a8 100755 --- 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 @@ -102,17 +102,17 @@ describe('MultimodalInput_test', function () { inputDevice.getDevice(data[i], (res, err) => { console.info(`getDevice:data ${JSON.stringify(data)}`); arr = Object.keys(res); - expect(res.id).assertInstanceOf('number'); - expect(res.name).assertInstanceOf('string'); + expect(res.id).assertInstanceOf('Number'); + expect(res.name).assertInstanceOf('String'); expect(res.sources).assertInstanceOf('Array'); expect(res.axisRanges).assertInstanceOf('Array'); - expect(res.bus).assertInstanceOf('number'); - expect(res.product).assertInstanceOf('number'); - expect(res.vendor).assertInstanceOf('number'); - expect(res.version).assertInstanceOf('number'); - expect(res.phys).assertInstanceOf('string'); - expect(res.uniq).assertInstanceOf('string'); - expect(res).assertInstanceOf('InputDeviceData'); + expect(res.bus).assertInstanceOf('Number'); + expect(res.product).assertInstanceOf('Number'); + expect(res.vendor).assertInstanceOf('Number'); + expect(res.version).assertInstanceOf('Number'); + expect(res.phys).assertInstanceOf('String'); + expect(res.uniq).assertInstanceOf('String'); + expect(res).assertInstanceOf('Object'); for(let j = 0;j < res.axisRanges.length; j++ ){ expect(res.axisRanges[j].source == 'keyboard' || res.axisRanges[j].source == 'mouse' || res.axisRanges[j].source == 'touchpad' || res.axisRanges[j].source == 'touchscreen' @@ -122,15 +122,14 @@ describe('MultimodalInput_test', function () { || res.axisRanges[j].axis == 'y' || res.axisRanges[j].axis == 'pressure' || res.axisRanges[j].axis == 'toolMinor' || res.axisRanges[j].axis == 'touchMajor' || res.axisRanges[j].axis == 'NULL').assertTrue(); - expect(res.axisRanges[j].max).assertInstanceOf('number'); + expect(res.axisRanges[j].max).assertInstanceOf('Number'); expect(res.axisRanges[j]).assertInstanceOf('AxisRange'); - expect(res.axisRanges[j].min).assertInstanceOf('number'); - expect(res.axisRanges[j].fuzz).assertInstanceOf('number'); - expect(res.axisRanges[j].flat).assertInstanceOf('number'); - expect(res.axisRanges[j].resolution).assertInstanceOf('number'); + expect(res.axisRanges[j].min).assertInstanceOf('Number'); + expect(res.axisRanges[j].fuzz).assertInstanceOf('Number'); + expect(res.axisRanges[j].flat).assertInstanceOf('Number'); + expect(res.axisRanges[j].resolution).assertInstanceOf('Number'); } }) - expect(arr.length > 0).assertTrue(); } } console.info(`inputDevice::getDevice_test-02 exit`); @@ -176,7 +175,7 @@ describe('MultimodalInput_test', function () { } else { for (let i = 0; i < data.length; ++i) { inputDevice.getKeyboardType(data[i], (res, err) => { - expect(res).assertInstanceOf('number'); + expect(res).assertInstanceOf('Number'); }); } } @@ -204,7 +203,7 @@ describe('MultimodalInput_test', function () { } else { for (let i = 0; i < data.length; ++i) { inputDevice.getKeyboardType(data[i]).then((res) => { - expect(res).assertInstanceOf('number'); + expect(res).assertInstanceOf('Number'); }); } } @@ -283,11 +282,13 @@ describe('MultimodalInput_test', function () { */ it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function (done) { console.info(`MultimodalInputDevice_getDeviceIds_Promise_test enter`); - await inputDevice.getDeviceIds().then((data, err) => { + inputDevice.getDeviceIds().then((data, err) => { if (err) { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test err`); expect(false).assertTrue(); done(); } else { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test data`); for (let i = 0; i < data.length; ++i) { inputDevice.supportKeys(data[i], [17, 22, 2055]).then((res, err) => { expect(res).assertInstanceOf('Array'); @@ -306,12 +307,14 @@ describe('MultimodalInput_test', function () { */ it("MultimodalInputDevice_getDevice_Promise_test", 0, async function (done) { console.info(`MultimodalInputDevice_getDevice_Promise_test enter`); - await inputDevice.getDevice(-1).then((data, err) => { + inputDevice.getDevice(-1).then((data, err) => { if (err) { + console.info(`MultimodalInputDevice_getDevice_Promise_test err`); expect(false).assertTrue(); console.info(`MultimodalInputDevice_getDevice_Promise_test ${JSON.stringify(err)}`); done(); } else { + console.info(`MultimodalInputDevice_getDevice_Promise_test data`); expect(JSON.stringify(data) !== "{}").assertTrue(); done(); } -- GitLab