提交 bd1245a0 编写于 作者: Z zhxiaop

多模xts js用例提交

Signed-off-by: Nzhxiaop <xiaozhuohan@huawei.com>
上级 0adadfc0
...@@ -14,22 +14,41 @@ ...@@ -14,22 +14,41 @@
*/ */
import inputDevice from '@ohos.multimodalInput.inputDevice'; import inputDevice from '@ohos.multimodalInput.inputDevice';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import {
describe,
beforeAll,
beforeEach,
afterEach,
afterAll,
it,
expect
} from 'deccjsunit/index'
describe('MultimodalInput_test', function () { describe('MultimodalInput_test', function () {
// 参数正确,返回一个数组
it('inputDevice::getDeviceIds_test-01', 0, function () { it('inputDevice::getDeviceIds_test-01', 0, function () {
console.log(`inputDevice::getDeviceIds_test-01 enter`); console.log(`inputDevice::getDeviceIds_test-01 enter`);
inputDevice.getDeviceIds((obj) => { inputDevice.getDeviceIds((data, err) => {
if (!obj) { if (err) {
console.log(`inputDevice::getDeviceIds_test-01 error:${JSON.stringify(obj)}`)
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
console.log(`inputDevice::getDeviceIds_test-01 success:${JSON.stringify(obj)}`); expect(data).assertInstanceOf('Array');
expect(obj).assertInstanceOf('Array');
} }
console.log(`inputDevice::getDeviceIds_test-01 exit`); console.log(`inputDevice::getDeviceIds_test-01 exit`);
}) })
}) })
// 参数正确,判断一种或多种设备
it("inputDevice::getDeviceIds_test-02", 0, function () {
console.log(`inputDevice::getDeviceIds_test-02 enter`);
inputDevice.getDeviceIds((data, err) => {
if (err) {
expect(false).assertTrue();
} else {
expect(data.length > 0).assertTure();
}
console.log(`inputDevice::getDeviceIds_test-02 exit`);
})
})
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册