提交 56c901e7 编写于 作者: L liuwei

for multimodalinput js xts

Signed-off-by: Nliuwei <liuwei595@huawei.com>
上级 e050693f
......@@ -3,7 +3,7 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "160000",
"package": "ohos.acts.multimodalinput.jsunit",
"package": "ohos.acts.multimodalinput.input",
"shell-timeout": "60000"
},
"kits": [
......
{
"app": {
"bundleName": "ohos.acts.multimodalinput.jsunit",
"bundleName": "ohos.acts.multimodalinput.input",
"vendor": "example",
"version": {
"code": 1,
......@@ -13,7 +13,7 @@
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimodalinput.jsunit",
"package": "ohos.acts.multimodalinput.input",
"name": ".MyApplication",
"deviceType": [
"phone"
......@@ -36,7 +36,7 @@
]
}
],
"name": "ohos.acts.multimodalinput.jsunit.MainAbility",
"name": "ohos.acts.multimodalinput.input.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
......
......@@ -13,81 +13,23 @@
* limitations under the License.
*/
import inputEventClient from '@ohos.multimodalInput.inputEventClient';
import inputDevice from '@ohos.multimodalInput.inputDevice';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const REGISTERED_SUCCESS = 1;
const REGISTERED_FAILED = -1;
const EventCallback = {
ON_SHOW_MENU: 0,
ON_SEND: 1,
ON_COPY: 2,
ON_PASTE: 3,
ON_CUT: 4,
ON_UNDO: 5,
ON_REFRESH: 6,
ON_CANCEL: 8,
ON_ENTER: 9,
ON_PREVIOUS: 10,
ON_NEXT: 11,
ON_BACK: 12,
ON_PRINT: 13,
ON_ANSWER: 14,
ON_REFUSE: 15,
ON_HANGUP: 16,
ON_TELEPHONE_CONTROL: 17,
ON_PLAY: 18,
ON_PAUSE: 19,
ON_MEDIA_CONTROL: 20,
};
const EVENT_UUID = 'uuid-ut';
const EVENT_SOURCE_TYPE = 65535;
const EVENT_DEVICE_ID = 65535;
const CLEAR_ALL_TYPE = 255;
const WINDOW_ID = 123;
const UNIT_TEST_SUCCESS = 0;
describe('ts_unit_test', function () {
it('inputEventClient::answer_test-01', 0, function () {
const multimodalEvent = {
uuid: EVENT_UUID,
occurredTime: Date.now(),
sourceDevice: EVENT_SOURCE_TYPE,
inputDeviceId: EVENT_DEVICE_ID,
type: EventCallback.ON_ANSWER,
}
const eventHandle = (event) => {
expect(event.uuid).assertEqual(multimodalEvent.uuid);
expect(event.occurredTime).assertEqual(multimodalEvent.occurredTime);
expect(event.sourceDevice).assertEqual(multimodalEvent.sourceDevice);
expect(event.inputDeviceId).assertEqual(multimodalEvent.inputDeviceId);
expect(event.type).assertEqual(multimodalEvent.type);
}
const registerResult = inputEventClient.on('answer', eventHandle);
// 新框架老的接口应该注册失败
expect(registerResult).assertEqual(REGISTERED_FAILED);
})
describe('MultimodalInput_test', function () {
it('inputDevice::getDeviceIds_test-01', 0, function () {
console.log(`inputDevice::getDeviceIds_test-01 enter`);
inputDevice.getDeviceIds((obj) => {
if (!obj) {
console.log(`inputDevice::getDeviceIds_test-01 error:${JSON.stringify(obj)}`)
expect(false).assertTrue();
return;
} else {
console.log(`inputDevice::getDeviceIds_test-01 success:${JSON.stringify(obj)}`);
expect(true).assertTrue();
}
console.log(`inputDevice::getDeviceIds_test-01 exit`);
if (!obj) {
console.log(`inputDevice::getDeviceIds_test-01 error:${JSON.stringify(obj)}`)
expect(false).assertTrue();
} else {
console.log(`inputDevice::getDeviceIds_test-01 success:${JSON.stringify(obj)}`);
expect(obj).assertInstanceOf('Array');
}
console.log(`inputDevice::getDeviceIds_test-01 exit`);
})
})
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册