提交 7028e17a 编写于 作者: Y yuexinyao1

yuexinyao1@huawei.com

Signed-off-by: Nyuexinyao1 <yuexinyao1@huawei.com>
上级 704b0289
......@@ -16,36 +16,63 @@
import inputDevice from '@ohos.multimodalInput.inputDevice';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function MultimodalInput_Device_test() {
describe('MultimodalInput_Device_test', function () {
describe('MultimodalInput_Device_test', function () {
const errCode = {
COMMON_PARAMETER_CODE: 401
}
const errMsg = {
PARAMETER_COUNT_MSG: `Parameter count error`,
PARAMETER_TYPE_MSG: `Parameter error. The type of type must be string.`,
PARAMETER_DEVICEID_TYPE_MSG: `Parameter error. The type of deviceId must be number.`,
PARAMETER_LISTENER_TYPE_MSG: `Parameter error. The type of listener must be function.`,
PARAMETER_CALLBACK_TYPE_MSG: `Parameter error. The type of callback must be function.`
}
// 参数正确,返回一个数组
it('inputDevice::getDeviceIds_test-01', 0, function () {
it('inputDevice::getDeviceIds_test-01', 0, async function (done) {
console.info(`inputDevice::getDeviceIds_test-01 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds((err, data) => {
if (err) {
expect(false).assertTrue();
} else {
expect(data).assertInstanceOf('Array');
}
console.info(`inputDevice::getDeviceIds_test-01 exit`);
done();
})
} catch (error) {
console.info(`inputDevice::getDeviceIds_test-01 error`);
expect(false).assertTrue();
done();
}
})
// 参数正确,判断一种或多种设备
it("inputDevice::getDeviceIds_test-02", 0, function () {
it("inputDevice::getDeviceIds_test-02", 0, async function (done) {
console.info(`inputDevice::getDeviceIds_test-02 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds((err, data) => {
console.info(`inputDevice::getDeviceIds_test-02 err:${JSON.stringify(err)}`);
console.info(`inputDevice::getDeviceIds_test-02 data:${JSON.stringify(data)}`);
if (err) {
expect(false).assertTrue();
} else {
expect(data.length > 0).assertTrue();
}
console.info(`inputDevice::getDeviceIds_test-02 exit`);
done();
})
} catch (error) {
console.info(`inputDevice::getDeviceIds_test-02 error`);
expect(false).assertTrue();
done();
}
})
// 参数类型错误
it("inputDevice::getDeviceIds_test-03", 0, function () {
it("inputDevice::getDeviceIds_test-03", 0, async function (done) {
console.info(`inputDevice::getDeviceIds_test-03 enter`);
try {
inputDevice.getDeviceIds(-1);
......@@ -53,25 +80,28 @@ describe('MultimodalInput_Device_test', function () {
expect(error.message).assertEqual("GetDeviceIds: \"The first parameter type is wrong\"");
}
console.info(`inputDevice::getDeviceIds_test-03 exit`);
done();
})
// 参数数量错误
it("inputDevice::getDeviceIds_test-04", 0, function () {
it("inputDevice::getDeviceIds_test-04", 0, async function (done) {
console.info(`inputDevice::getDeviceIds_test-04 enter`);
try {
inputDevice.getDeviceIds(-1, (data) => {
inputDevice.getDeviceIds(-1, (err, data) => {
console.info(data);
});
} catch (error) {
expect(error.message).assertEqual("GetDeviceIds: \"too many parameters\"");
}
console.info(`inputDevice::getDeviceIds_test-04 exit`);
done();
})
// 无效的设备id
it("inputDevice::getDevice_test-01", 0, function () {
it("inputDevice::getDevice_test-01", 0, async function (done) {
console.info(`inputDevice::getDevice_test-01 enter`);
inputDevice.getDevice(-1, (data, err) => {
try {
inputDevice.getDevice(-1, (err, data) => {
if (err) {
expect(false).assertTrue();
console.info(`inputDevice::getDevice_test-01 ${JSON.stringify(err)}`);
......@@ -80,20 +110,35 @@ describe('MultimodalInput_Device_test', function () {
}
console.info(`inputDevice::getDevice_test-01 exit`);
})
} catch (error) {
console.info(`inputDevice::getDevice_test-01 error`);
expect(false).assertTrue();
} finally {
done();
}
})
// 参数正常,返回值正常
it("inputDevice::getDevice_test-02", 0, function () {
it("inputDevice::getDevice_test-02", 0, async function (done) {
console.info(`inputDevice::getDevice_test-02 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds(async (err, data) => {
console.info(`inputDevice::getDeviceIds_test-02 err:${JSON.stringify(err)}`);
console.info(`inputDevice::getDeviceIds_test-02 data:${JSON.stringify(data)}`);
if (err) {
expect(false).assertTrue();
} else {
let arr = [];
for (let i = 0; i < data.length; i++) {
inputDevice.getDevice(data[i], (res, err) => {
console.info(`getDevice:data ${JSON.stringify(data)}`);
arr = Object.keys(res);
console.info(`inputDevice::getDevice_test-02 for`);
await getDevicePromise(data[i])
}
function getDevicePromise(data) {
console.info(`inputDevice::getDevice_test-02 getDevicePromise`)
return new Promise((resolve, reject) => {
inputDevice.getDevice(data, (err, res) => {
console.info(`getDevice:data =${JSON.stringify(data)}`);
console.info(`getDevice:res =${JSON.stringify(res)}`);
let arr = Object.keys(res);
expect(res.id).assertInstanceOf('Number');
expect(res.name).assertInstanceOf('String');
expect(res.sources).assertInstanceOf('Array');
......@@ -105,7 +150,8 @@ describe('MultimodalInput_Device_test', function () {
expect(res.phys).assertInstanceOf('String');
expect(res.uniq).assertInstanceOf('String');
expect(res).assertInstanceOf('Object');
for(let j = 0;j < res.axisRanges.length; j++ ){
console.info(`inputDevice::getDevice_test-02 getDevice expect res`);
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'
|| res.axisRanges[j].source == 'joystick' || res.axisRanges[j].source == 'trackball').assertTrue();
......@@ -121,17 +167,26 @@ describe('MultimodalInput_Device_test', function () {
expect(res.axisRanges[j].flat).assertInstanceOf('Number');
expect(res.axisRanges[j].resolution).assertInstanceOf('Number');
}
resolve(res);
})
})
}
}
console.info(`inputDevice::getDevice_test-02 exit`);
done();
});
} catch (error) {
console.info(`inputDevice::getDevice_test-02 error`);
expect(false).assertTrue();
done();
}
})
// 参数正常,返回值正常
it("inputDevice::supportKeys_test-01", 0, function () {
it("inputDevice::supportKeys_test-01", 0, async function (done) {
console.info(`inputDevice::supportKeys_test-01 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds((err, data) => {
if (err) {
expect(false).assertTrue();
} else {
......@@ -142,26 +197,34 @@ describe('MultimodalInput_Device_test', function () {
}
}
console.info(`inputDevice::supportKeys_test-01 exit`);
done();
});
} catch (error) {
console.info(`inputDevice::supportKeys_test-01 error`);
expect(false).assertTrue();
done();
}
})
// 第二个参数异常
it("inputDevice::supportKeys_test-02", 0, function () {
it("inputDevice::supportKeys_test-02", 0, async function (done) {
console.info(`inputDevice::supportKeys_test-02 enter`);
try {
inputDevice.supportKeys(0, 2022, (res) => {
inputDevice.supportKeys(0, 2022, (err, res) => {
console.info(res);
});
} catch (error) {
expect(error.message).assertEqual("Parameter error. The type of keys must be array.");
}
console.info(`inputDevice::supportKeys_test-02 exit`);
done();
})
// 参数正常
it("inputDevice::getKeyboardType_test-01", 0, function () {
it("inputDevice::getKeyboardType_test-01", 0, async function (done) {
console.info(`inputDevice::getKeyboardType_test-01 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds((err, data) => {
if (err) {
expect(false).assertTrue();
} else {
......@@ -172,11 +235,17 @@ describe('MultimodalInput_Device_test', function () {
}
}
console.info(`inputDevice::getKeyboardType_test-01 exit`);
done();
});
} catch (error) {
console.info(`inputDevice::getKeyboardType_test-01 error`);
expect(false).assertTrue();
done();
}
})
//参数异常
it("inputDevice::getKeyboardType_test-02", 0, function () {
it("inputDevice::getKeyboardType_test-02", 0, async function (done) {
console.info(`inputDevice::getKeyboardType_test-02 enter`);
try {
inputDevice.getKeyboardType(-1);
......@@ -184,23 +253,34 @@ describe('MultimodalInput_Device_test', function () {
expect(error.message).assertEqual("Invalid input device id");
}
console.info(`inputDevice::getKeyboardType_test-02 exit`);
done();
});
// 参数正常
it("inputDevice::getKeyboardType_test-03", 0, function () {
it("inputDevice::getKeyboardType_test-03", 0, async function (done) {
console.info(`inputDevice::getKeyboardType_test-03 enter`);
inputDevice.getDeviceIds((data, err) => {
try {
inputDevice.getDeviceIds((err, data) => {
if (err) {
expect(false).assertTrue();
} else {
for (let i = 0; i < data.length; ++i) {
inputDevice.getKeyboardType(data[i]).then((res) => {
expect(res).assertInstanceOf('Number');
}).catch((err) => {
console.info(`inputDevice::getKeyboardType_test-03 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
});
}
}
console.info(`inputDevice::getKeyboardType_test-03 exit`);
done();
});
} catch (error) {
console.info(`inputDevice::getKeyboardType_test-03 error`);
expect(false).assertTrue();
done();
}
})
/**
......@@ -274,22 +354,30 @@ describe('MultimodalInput_Device_test', function () {
*/
it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function (done) {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test enter`);
inputDevice.getDeviceIds().then((data, err) => {
if (err) {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test err`);
expect(false).assertTrue();
done();
} else {
try {
inputDevice.getDeviceIds().then(data => {
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) => {
inputDevice.supportKeys(data[i], [17, 22, 2055]).then(res => {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test res`);
expect(res).assertInstanceOf('Array');
}).catch((err) => {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
});
}
done();
}).catch((err) => {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
done();
});
} catch (error) {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test error`);
expect(false).assertTrue();
done();
}
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test exit`);
});
})
/**
......@@ -297,19 +385,22 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_getDevice_Promise_test
* @tc.desc inputdevice interface getDevice test
*/
it("MultimodalInputDevice_getDevice_Promise_test", 0, function () {
it("MultimodalInputDevice_getDevice_Promise_test", 0, async function (done) {
console.info(`MultimodalInputDevice_getDevice_Promise_test enter`);
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)}`);
} else {
try {
inputDevice.getDevice(-1).then(data => {
console.info(`MultimodalInputDevice_getDevice_Promise_test data`);
expect(JSON.stringify(data) !== "{}").assertTrue();
}
console.info(`MultimodalInputDevice_getDevice_Promise_test exit`);
}).catch((err) => {
console.info(`MultimodalInputDevice_getDevice_Promise_test err`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test error`);
expect(false).assertTrue();
}
console.info(`MultimodalInputDevice_getDeviceIds_Promise_test exit`);
done();
})
/**
......@@ -317,13 +408,14 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_on_test
* @tc.desc inputdevice interface getDevice test
*/
it("MultimodalInputDevice_on_test", 0, function () {
it("MultimodalInputDevice_on_test", 0, async function (done) {
console.info(`MultimodalInputDevice_on_test enter`);
try {
let isPhysicalKeyboardExist = true;
inputDevice.on("change", (data) => {
console.info("type: " + data.type + ", deviceId: " + data.deviceId);
console.info("MultimodalInputDevice_on_test type: " + data.type + ", deviceId: " + data.deviceId);
inputDevice.getKeyboardType(data.deviceId, (err, ret) => {
console.info("The keyboard type of the device is: " + ret);
console.info("MultimodalInputDevice_on_test The keyboard type of the device is: " + ret);
if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') {
// 监听物理键盘已连接。
isPhysicalKeyboardExist = true;
......@@ -333,7 +425,12 @@ describe('MultimodalInput_Device_test', function () {
}
});
});
} catch (error) {
console.info(`MultimodalInputDevice_on_test error`);
expect(false).assertTrue();
}
console.info(`MultimodalInputDevice_on_test exit`);
done();
})
/**
......@@ -341,16 +438,22 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_off_test
* @tc.desc inputdevice interface getDevice test
*/
it("MultimodalInputDevice_off_test", 0, function () {
it("MultimodalInputDevice_off_test", 0, async function (done) {
console.info(`MultimodalInputDevice_off_test enter`);
function listener(data) {
console.info("type: " + data.type + ", deviceId: " + data.deviceId);
expect(data.type== 'add' || data.type== 'remove').assertTrue();
expect(data.type == 'add' || data.type == 'remove').assertTrue();
expect(data).assertInstanceOf('Object');
}
// 单独取消listener的监听。
try {
inputDevice.off("change", listener);
} catch (error) {
console.info(`MultimodalInputDevice_on_test error`);
expect(false).assertTrue();
}
console.info(`MultimodalInputDevice_off_test exit`);
done();
})
/**
......@@ -358,7 +461,7 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_GetDeviceList_test
* @tc.desc inputdevice interface getDeviceList test
*/
it('inputDevice::getDeviceList_test-01', 0, function () {
it('inputDevice::getDeviceList_test-01', 0, async function (done) {
console.info(`inputDevice::getDeviceList_async_test enter`);
try {
inputDevice.getDeviceList((err, data) => {
......@@ -368,9 +471,11 @@ describe('MultimodalInput_Device_test', function () {
expect(data).assertInstanceOf('Array');
}
console.info(`inputDevice::getDeviceList_async_test exit`);
done();
})
} catch (err) {
expect(false).assertTrue();
done();
}
})
......@@ -380,7 +485,7 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_GetDeviceList_test
* @tc.desc inputdevice interface getDeviceList test
*/
it('inputDevice::getDeviceList_test-02', 0, function () {
it('inputDevice::getDeviceList_test-02', 0, async function (done) {
console.info(`inputDevice::getDeviceList_promise_test enter`);
try {
inputDevice.getDeviceList().then(data => {
......@@ -392,6 +497,7 @@ describe('MultimodalInput_Device_test', function () {
expect(false).assertTrue();
}
console.info(`inputDevice::getDeviceList_promise_test exit`);
done();
})
/**
......@@ -399,18 +505,23 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_GetDeviceInfo_test
* @tc.desc inputdevice interface getDeviceInfo test
*/
it('inputDevice::getDeviceInfo_test-01', 0, function () {
it('inputDevice::getDeviceInfo_test-01', 0, async function (done) {
console.info(`inputDevice::getDeviceInfo_async_test enter`);
try {
inputDevice.getDeviceList().then((data) => {
await inputDevice.getDeviceList().then((data) => {
console.info(`getDeviceInfo:data assertInstanceOf Array` + typeof (data));
expect(data).assertInstanceOf('Array');
if (data.length() <= 0) {
console.info(`getDeviceInfo:data assertInstanceOf Array end ${data.length}`);
if (data.length <= 0) {
done()
return;
}
try {
inputDevice.getDeviceInfo(data[0], (err, res) => {
console.info(`getDeviceInfo:data enter`);
if (err) {
expect(false).assertTrue();
done()
return;
}
let arr = [];
......@@ -427,7 +538,7 @@ describe('MultimodalInput_Device_test', function () {
expect(res.phys).assertInstanceOf('String');
expect(res.uniq).assertInstanceOf('String');
expect(res).assertInstanceOf('Object');
for(let j = 0;j < res.axisRanges.length; j++ ){
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'
|| res.axisRanges[j].source == 'joystick' || res.axisRanges[j].source == 'trackball').assertTrue();
......@@ -443,12 +554,15 @@ describe('MultimodalInput_Device_test', function () {
expect(res.axisRanges[j].flat).assertInstanceOf('Number');
expect(res.axisRanges[j].resolution).assertInstanceOf('Number');
}
done()
})
} catch (err) {
console.info(`inputDevice::getDeviceInfo_test-01 inputDevice.getDeviceInfo ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
})
} catch (err) {
console.info(`inputDevice::getDeviceInfo_test-01 inputDevice.getDeviceList ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
console.info(`inputDevice::getDeviceInfo_async_test exit`);
......@@ -459,12 +573,12 @@ describe('MultimodalInput_Device_test', function () {
* @tc.name MultimodalInputDevice_GetDeviceInfo_test
* @tc.desc inputdevice interface getDeviceInfo test
*/
it('inputDevice::getDeviceInfo_test-02', 0, function () {
it('inputDevice::getDeviceInfo_test-02', 0, async function (done) {
console.info(`inputDevice::getDeviceInfo_promise_test enter`);
try {
inputDevice.getDeviceList().then((data) => {
expect(data).assertInstanceOf('Array');
if (data.length() <= 0) {
if (data.length <= 0) {
return;
}
try {
......@@ -483,7 +597,7 @@ describe('MultimodalInput_Device_test', function () {
expect(res.phys).assertInstanceOf('String');
expect(res.uniq).assertInstanceOf('String');
expect(res).assertInstanceOf('Object');
for(let j = 0;j < res.axisRanges.length; j++ ){
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'
|| res.axisRanges[j].source == 'joystick' || res.axisRanges[j].source == 'trackball').assertTrue();
......@@ -510,6 +624,231 @@ describe('MultimodalInput_Device_test', function () {
expect(false).assertTrue();
}
console.info(`inputDevice::getDeviceInfo_promise_test exit`);
done();
})
/**
* @tc.number MultimodalInputDevice_js_0150
* @tc.name MultimodalInputDevice_GetkeyboardType_Exception_test_01
* @tc.desc inputdevice interface getKeyboardType exception test
*/
it("MultimodalInputDevice_GetkeyboardType_Exception_test_01", 0, async function (done) {
console.info(`MultimodalInputDevice_GetkeyboardType_Exception_test_01 enter`);
try {
inputDevice.getKeyboardType();
} catch (error) {
console.info(`GetkeyboardType_Exception_test_01: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_COUNT_MSG);
}
console.info("MultimodalInputDevice_GetkeyboardType_Exception_test_01 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0160
* @tc.name MultimodalInputDevice_GetkeyboardType_Exception_test_02
* @tc.desc inputdevice interface getKeyboardType exception test
*/
it("MultimodalInputDevice_GetkeyboardType_Exception_test_02", 0, async function (done) {
console.info("MultimodalInputDevice_GetkeyboardType_Exception_test_02 enter");
try {
inputDevice.getKeyboardType(`id`).then((data) => {
console.info(`GetkeyboardType_Exception_test_02 success`);
expect(true).assertTrue();
}, (error) => {
console.info(`GetkeyboardType_Exception_test_02 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`GetkeyboardType_Exception_test_02: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_DEVICEID_TYPE_MSG);
}
console.info("MultimodalInputDevice_GetkeyboardType_Exception_test_02 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0170
* @tc.name MultimodalInputDevice_SupportKeys_Exception_test_01
* @tc.desc inputdevice interface supportKeys exception test
*/
it("MultimodalInputDevice_SupportKeys_Exception_test_01", 0, async function (done) {
console.info("MultimodalInputDevice_SupportKeys_Exception_test_01 enter");
try {
inputDevice.supportKeys((error, data) => {
if (error) {
console.info(`SupportKeys_Exception_test_01 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
} else {
console.info(`SupportKeys_Exception_test_01 success`);
expect(true).assertTrue();
}
})
} catch (error) {
console.info(`SupportKeys_Exception_test_01: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_COUNT_MSG);
}
console.info("MultimodalInputDevice_SupportKeys_Exception_test_01 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0180
* @tc.name MultimodalInputDevice_SupportKeys_Exception_test_02
* @tc.desc inputdevice interface supportKeys exception test
*/
it("MultimodalInputDevice_SupportKeys_Exception_test_02", 0, async function (done) {
console.info("MultimodalInputDevice_SupportKeys_Exception_test_02 enter");
try {
inputDevice.supportKeys(`id`, [17, 22, 2055], (error, data) => {
if (error) {
console.info(`SupportKeys_Exception_test_02 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
} else {
console.info(`SupportKeys_Exception_test_02 success`);
expect(true).assertTrue();
}
})
} catch (error) {
console.info(`SupportKeys_Exception_test_02: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_DEVICEID_TYPE_MSG);
}
console.info("MultimodalInputDevice_SupportKeys_Exception_test_02 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0190
* @tc.name MultimodalInputDevice_GetDeviceInfo_Exception_test_01
* @tc.desc inputdevice interface getDeviceInfo exception test
*/
it("MultimodalInputDevice_GetDeviceInfo_Exception_test_01", 0, async function (done) {
console.info("MultimodalInputDevice_GetDeviceInfo_Exception_test_01 enter");
try {
inputDevice.getDeviceInfo();
} catch (error) {
console.info(`GetDeviceInfo_Exception_test_01: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_COUNT_MSG);
}
console.info("MultimodalInputDevice_GetDeviceInfo_Exception_test_01 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0200
* @tc.name MultimodalInputDevice_GetDeviceInfo_Exception_test_02
* @tc.desc inputdevice interface getDeviceInfo exception test
*/
it("MultimodalInputDevice_GetDeviceInfo_Exception_test_02", 0, async function (done) {
console.info("MultimodalInputDevice_GetDeviceInfo_Exception_test_02 enter");
try {
inputDevice.getDeviceList().then((data) => {
expect(data).assertInstanceOf('Array');
if (data.length <= 0) {
return;
}
try {
inputDevice.getDeviceInfo(`data[0]`).then((res) => {
console.info(`GetDeviceInfo_Exception_test_02 success`);
expect(true).assertTrue();
}).catch(error => {
console.info(`GetDeviceInfo_Exception_test_02 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`GetDeviceInfo_Exception_test_02: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_DEVICEID_TYPE_MSG);
}
})
} catch (error) {
expect(false).assertTrue();
}
console.info("MultimodalInputDevice_GetDeviceInfo_Exception_test_02 exit");
done();
})
/**
* @tc.number MultimodalInputDevice_js_0210
* @tc.name MultimodalInputDevice_GetDeviceList_Exception_test
* @tc.desc inputdevice interface getDeviceList exception test
*/
it("MultimodalInputDevice_GetDeviceList_Exception_test", 0, async function (done) {
console.info("MultimodalInputDevice_GetDeviceList_Exception_test enter");
try {
inputDevice.getDeviceList(null);
} catch (error) {
console.info(`GetDeviceList_Exception_test_01: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_CALLBACK_TYPE_MSG);
}
console.info(`MultimodalInputDevice_GetDeviceList_Exception_test exit`);
done();
})
/**
* @tc.number MultimodalInputDevice_js_0220
* @tc.name MultimodalInputDevice_On_Exception_test
* @tc.desc inputdevice interface on test
*/
it("MultimodalInputDevice_On_Exception_test", 0, async function (done) {
console.info(`MultimodalInputDevice_On_Exception_test enter`);
try {
inputDevice.on();
} catch (error) {
console.info(`On_Exception_test: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_COUNT_MSG);
}
try {
inputDevice.on(-1, (data) => {
if (error) {
console.info(`On_Exception_test failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
} else {
console.info(`On_Exception_test success`);
expect(true).assertTrue();
}
});
} catch (error) {
console.info(`On_Exception_test: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_TYPE_MSG);
}
console.info(`MultimodalInputDevice_On_Exception_test exit`);
done();
})
/**
* @tc.number MultimodalInputDevice_js_0230
* @tc.name MultimodalInputDevice_Off_Exception_test
* @tc.desc inputdevice interface off test
*/
it("MultimodalInputDevice_Off_Exception_test", 0, async function (done) {
console.info(`MultimodalInputDevice_Off_Exception_test enter`);
try {
inputDevice.off();
} catch (error) {
console.info(`Off_Exception_test: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_COUNT_MSG);
}
try {
inputDevice.off('change', null);
} catch (error) {
console.info(`Off_Exception_test: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_LISTENER_TYPE_MSG);
}
console.info(`MultimodalInputDevice_Off_Exception_test exit`);
done();
})
})
})
}
......@@ -13,13 +13,11 @@
* limitations under the License.
*/
import MultimodalInput_Device_test from './InputDevice.test.js'
import MultimodalInput_KeyCode_test from './MultimodalInputKey_Code.test.js'
import MultimodalInput_Pointer_test from './Pointer.test.js'
export default function testsuite() {
MultimodalInput_Device_test()
MultimodalInput_KeyCode_test()
MultimodalInput_Pointer_test()
MultimodalInput_Device_test()
MultimodalInput_KeyCode_test()
MultimodalInput_Pointer_test()
}
\ No newline at end of file
......@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import inputkeyCode from '@ohos.multimodalInput.keyCode';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function MultimodalInput_KeyCode_test() {
export default function MultimodalInput_KeyCode_test() {
describe('MultimodalInput_KeyCode_test', function () {
it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010', 0, function () {
console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`);
......@@ -2658,6 +2658,5 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 exit`);
})
})
}
})
}
......@@ -16,156 +16,254 @@
import pointer from '@ohos.multimodalInput.pointer'
import window from '@ohos.window'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function MultimodalInput_Pointer_test() {
export default function MultimodalInput_Pointer_test() {
describe('MultimodalInput_Pointer_test', function () {
it('MultimodalInput_Pointer_test::PointerVisibleTest_001', 0, function () {
const errCode = {
COMMON_PARAMETER_CODE: 401
}
const errMsg = {
PARAMETER_COUNT_MSG: `Parameter count error`,
PARAMETER_TYPE_MSG: `Parameter error. The type of type must be string.`,
PARAMETER_VISIBLE_TYPE_MSG: `Parameter error. The type of visible must be boolean.`,
PARAMETER_SPEED_TYPE_MSG: `Parameter error. The type of speed must be number.`,
PARAMETER_WINDOWID_TYPE_MSG: `Parameter error. The type of windowId must be number.`,
PARAMETER_CALLBACK_TYPE_MSG: `Parameter error. The type of callback must be function.`
}
it('MultimodalInput_Pointer_test::PointerVisibleTest_001', 0, async function (done) {
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 enter`);
var callback = function (err, data) {
try {
pointer.setPointerVisible(false, (err, data) => {
if (err) {
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
} else {
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 success`);
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 success_1. data=${JSON.stringify(data)}`);
expect(true).assertTrue();
}
};
pointer.setPointerVisible(false, callback);
pointer.isPointerVisible().then(data => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 success, data=${JSON.stringify(data)}`);
});
} catch (error) {
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 error`);
expect(false).assertTrue();
}
try {
await pointer.isPointerVisible().then(data => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 success_2, data=${JSON.stringify(data)}`);
expect(data == false).assertTrue();
}, err => {
done();
}).catch((err) => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 error`);
expect(false).assertTrue();
}
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 exit`);
})
it('MultimodalInput_Pointer_test::PointerVisibleTest_002', 0, function () {
it('MultimodalInput_Pointer_test::PointerVisibleTest_002', 0, async function (done) {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 enter`);
pointer.setPointerVisible(true).then(data => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`);
try {
await pointer.setPointerVisible(true).then(data => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success_1, data=${JSON.stringify(data)}`);
expect(true).assertTrue();
}, err => {
}).catch((err) => {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
});
var callback = function (err, data) {
} catch (error) {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 error`);
expect(false).assertTrue();
}
try {
pointer.isPointerVisible((err, data) => {
if (err) {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
} else {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`);
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success_2, data=${JSON.stringify(data)}`);
expect(data == true).assertTrue();
done();
}
});
} catch (error) {
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 error`);
expect(false).assertTrue();
}
};
pointer.isPointerVisible(callback);
console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 exit`);
})
it('MultimodalInput_Pointer_test::SetPointerStyle_001', 0, function () {
it('MultimodalInput_Pointer_test::SetPointerStyle_001', 0, async function (done) {
console.info(`SetPointerStyle_001 enter`);
window.getTopWindow((err, data) => {
if (err) {
console.info(`SetPointerStyle_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
var windowClass = data;
windowClass.getProperties((err, data) => {
if (err) {
function getPropertiesPromise(windowClass) {
return new Promise((resolve, reject) => {
windowClass.getProperties(async (err, data) => {
if (err && err.code != 0) {
console.info(`SetPointerStyle_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try {
var windowId = data.id;
pointer.setPointerStyle(windowId, 4).then(() => {
await pointer.setPointerStyle(windowId, 4).then(() => {
expect(true).assertTrue();
console.info(`SetPointerStyle_001 success`);
resolve();
}).catch((err) => {
expect(false).assertTrue();
console.info("promise::catch", err);
console.info(`SetPointerStyle_001 failed_1, err=${JSON.stringify(err)}`);
});
} catch (error) {
console.info(`SetPointerStyle_001 error`);
expect(false).assertTrue();
reject(error);
}
})
})
}
window.getTopWindow(async (err, data) => {
console.info(`case:SetPointerStyle_001 enter`);
var windowClass = data;
if (err && err.code != 0) {
console.info(`case:SetPointerStyle_001,getTopWindow failed, err=${JSON.stringify(err)}`);
return;
}
console.info(`case:SetPointerStyle_001 ===========`);
await getPropertiesPromise(data);
console.info(`case:SetPointerStyle_001 exit`);
done();
})
})
it('MultimodalInput_Pointer_test::SetPointerStyle_002', 0, function () {
it('MultimodalInput_Pointer_test::SetPointerStyle_002', 0, async function (done) {
console.info(`SetPointerStyle_002 enter`);
window.getTopWindow((err, data) => {
var windowClass = data;
if (err) {
console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
function getPropertiesPromise(windowClass) {
return new Promise((resolve, reject) => {
windowClass.getProperties((err, data) => {
if (err) {
if (err && err.code != 0) {
console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try {
var windowId = data.id;
pointer.setPointerStyle(windowId, 4, (err) => {
if (err) {
console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
console.info(`SetPointerStyle_002 failed_1, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
} else {
console.info(`SetPointerStyle_002 success`);
expect(true).assertTrue();
resolve();
}
});
} catch (error) {
console.info(`SetPointerStyle_002 error`);
expect(false).assertTrue();
reject(error);
}
})
})
}
window.getTopWindow(async (err, data) => {
console.info(`case:SetPointerStyle_002 enter`);
var windowClass = data;
if (err && err.code != 0) {
console.info(`case:SetPointerStyle_002,getTopWindow failed, err=${JSON.stringify(err)}`);
return;
}
console.info(`case:SetPointerStyle_002 ===========`);
await getPropertiesPromise(data);
console.info(`case:SetPointerStyle_002 exit`);
done();
})
})
it('MultimodalInput_Pointer_test::GetPointerStyle_001', 0, function () {
it('MultimodalInput_Pointer_test::GetPointerStyle_001', 0, async function (done) {
console.info(`GetPointerStyle_001 enter`);
window.getTopWindow((err, data) => {
if (err) {
console.info(`GetPointerStyle_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
var windowClass = data;
windowClass.getProperties((err, data) => {
if (err) {
function getPropertiesPromise(windowClass) {
return new Promise((resolve, reject) => {
windowClass.getProperties(async (err, data) => {
if (err && err.code != 0) {
console.info(`GetPointerStyle_001 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try {
var windowId = data.id;
pointer.getPointerStyle(windowId).then((data) => {
await pointer.getPointerStyle(windowId).then((data) => {
console.info(`GetPointerStyle_001 success, data=${JSON.stringify(data)}`);
expect(data).assertTrue('Number');
expect(typeof (data)).assertEqual("number");
resolve();
}).catch((err) => {
console.info("promise::catch", err);
console.info(`GetPointerStyle_001 failed_1, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`GetPointerStyle_001 error`);
expect(false).assertTrue();
reject(error);
}
})
})
}
window.getTopWindow(async (err, data) => {
console.info(`case:GetPointerStyle_001 enter`);
var windowClass = data;
if (err && err.code != 0) {
console.info(`case:GetPointerStyle_001,getTopWindow failed, err=${JSON.stringify(err)}`);
return;
}
console.info(`case:GetPointerStyle_001 ===========`);
await getPropertiesPromise(data);
console.info(`case:GetPointerStyle_001 exit`);
done();
})
})
it('MultimodalInput_Pointer_test::GetPointerStyle_002', 0, function () {
it('MultimodalInput_Pointer_test::GetPointerStyle_002', 0, async function (done) {
console.info(`GetPointerStyle_002 enter`);
window.getTopWindow((err, data) => {
if (err) {
console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
}
var windowClass = data;
function getPropertiesPromise(windowClass) {
return new Promise((resolve, reject) => {
windowClass.getProperties((err, data) => {
if (err) {
if (err && err.code != 0) {
console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
reject();
}
try {
var windowId = data.id;
pointer.getPointerStyle(windowId, (err, data) => {
if (err) {
console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`);
console.info(`GetPointerStyle_002 failed_1, err=${JSON.stringify(err)}`);
expect(false).assertTrue();
reject();
} else {
console.info(`GetPointerStyle_002 success, data=${JSON.stringify(data)}`);
expect(data).assertTrue('Number');
console.info(`GetPointerStyle_002 success, data=` + typeof (data));
expect(data).assertInstanceOf('Number');
resolve();
}
});
})
} catch (error) {
console.info(`GetPointerStyle_002 error=${JSON.stringify(error)}`);
expect(false).assertTrue();
reject(error);
}
})
})
}
window.getTopWindow(async (err, data) => {
console.info(`case:GetPointerStyle_002 enter`);
var windowClass = data;
if (err && err.code != 0) {
console.info(`case:GetPointerStyle_002,getTopWindow failed, err=${JSON.stringify(err)}`);
done();
return;
}
console.info(`case:GetPointerStyle_002 ===========`);
await getPropertiesPromise(data);
console.info(`case:GetPointerStyle_002 exit`);
done();
})
})
......@@ -287,5 +385,134 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_SOUTH_WEST_EAST_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH_WEST_EAST);
expect(pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH_WEST_EAST == 38).assertTrue();
})
})
/**
* @tc.number MultimodalInputPointer_Test_001
* @tc.name MultimodalInputDevice_PointerVisibleTest_Exception_Test_001
* @tc.desc Pointer interface PointerVisible exception test
*/
it('MultimodalInputDevice_PointerVisibleTest_Exception_Test_001', 0, async function (done) {
console.info(`MultimodalInputDevice_PointerVisibleTest_Exception_Test_001 enter`);
try {
await pointer.setPointerVisible();
} catch (error) {
console.info(`PointerVisibleTest_Exception_Test_001: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_VISIBLE_TYPE_MSG);
}
try {
pointer.isPointerVisible((error, data) => {
if (error) {
console.info(`PointerVisibleTest_Exception_Test_001 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
} else {
console.info(`PointerVisibleTest_Exception_Test_001 success`);
expect(data).assertInstanceOf('Boolean');
}
done();
});
} catch (error) {
console.info(`PointerVisibleTest_Exception_Test_001: ${JSON.stringify(error, [`code`, `message`])}`);
}
console.info(`MultimodalInputDevice_PointerVisibleTest_Exception_Test_001 exit`);
})
/**
* @tc.number MultimodalInputPointer_Test_002
* @tc.name MultimodalInputDevice_PointerVisibleTest_Exception_Test_002
* @tc.desc Pointer interface PointerVisible exception test
*/
it('MultimodalInputDevice_PointerVisibleTest_Exception_Test_002', 0, async function (done) {
console.info(`MultimodalInputDevice_PointerVisibleTest_Exception_Test_002 enter`);
try {
pointer.setPointerVisible(`state`, (error, data) => {
if (error) {
console.info(`PointerVisibleTest_Exception_Test_002 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
} else {
console.info(`PointerVisibleTest_Exception_Test_002 success`);
expect(true).assertTrue();
}
});
} catch (error) {
console.info(`PointerVisibleTest_Exception_Test_002: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_VISIBLE_TYPE_MSG);
}
try {
await pointer.isPointerVisible(null);
} catch (error) {
console.info(`PointerVisibleTest_Exception_Test_002: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_CALLBACK_TYPE_MSG);
}
console.info(`MultimodalInputDevice_PointerVisibleTest_Exception_Test_002 exit`);
done();
})
/**
* @tc.number MultimodalInputPointer_Test_005
* @tc.name MultimodalInputDevice_PointerStyleTest_Exception_Test_001
* @tc.desc Pointer interface PointerStyle exception test
*/
it('MultimodalInputDevice_PointerStyleTest_Exception_Test_001', 0, async function (done) {
console.info(`MultimodalInputDevice_PointerStyleTest_Exception_Test_001 enter`);
try {
await pointer.setPointerStyle(10, 10, null);
} catch (error) {
console.info(`PointerStyleTest_Exception_Test_001: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_CALLBACK_TYPE_MSG);
}
try {
await pointer.getPointerStyle(10, null).then((data) => {
console.info(`PointerStyleTest_Exception_Test_001 success`);
expect(true).assertTrue();
}, (error) => {
console.info(`PointerStyleTest_Exception_Test_001 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`PointerStyleTest_Exception_Test_001: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_CALLBACK_TYPE_MSG);
}
console.info(`MultimodalInputDevice_PointerStyleTest_Exception_Test_001 exit`);
done();
})
/**
* @tc.number MultimodalInputPointer_Test_006
* @tc.name MultimodalInputDevice_PointerStyleTest_Exception_Test_002
* @tc.desc Pointer interface PointerStyle exception test
*/
it('MultimodalInputDevice_PointerStyleTest_Exception_Test_002', 0, async function (done) {
console.info(`MultimodalInputDevice_PointerStyleTest_Exception_Test_002 enter`);
try {
await pointer.setPointerStyle().then((data) => {
console.info(`PointerStyleTest_Exception_Test_002 success`);
expect(true).assertTrue();
}, (error) => {
console.info(`PointerStyleTest_Exception_Test_002 failed, err=${JSON.stringify(error)}`);
expect(false).assertTrue();
});
} catch (error) {
console.info(`PointerStyleTest_Exception_Test_002 success`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_WINDOWID_TYPE_MSG);
}
try {
await pointer.getPointerStyle();
} catch (error) {
console.info(`PointerStyleTest_Exception_Test_002: ${JSON.stringify(error, [`code`, `message`])}`);
expect(error.code).assertEqual(errCode.COMMON_PARAMETER_CODE);
expect(error.message).assertEqual(errMsg.PARAMETER_WINDOWID_TYPE_MSG);
}
console.info(`MultimodalInputDevice_PointerStyleTest_Exception_Test_002 exit`);
done();
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册