diff --git a/multimodalinput/input_jsapi/BUILD.gn b/multimodalinput/input_js_standard/BUILD.gn similarity index 100% rename from multimodalinput/input_jsapi/BUILD.gn rename to multimodalinput/input_js_standard/BUILD.gn diff --git a/multimodalinput/input_jsapi/Test.json b/multimodalinput/input_js_standard/Test.json similarity index 87% rename from multimodalinput/input_jsapi/Test.json rename to multimodalinput/input_js_standard/Test.json index ac66454f6b03012feb15db1aa4b6b280b479c1e2..17746afe6aa2d8f8daaed65d269f19dde18bccf1 100644 --- a/multimodalinput/input_jsapi/Test.json +++ b/multimodalinput/input_js_standard/Test.json @@ -3,7 +3,7 @@ "driver": { "type": "JSUnitTest", "test-timeout": "160000", - "package": "ohos.acts.multimodalinput.jsunit", + "package": "ohos.acts.multimodalinput.input", "shell-timeout": "60000" }, "kits": [ diff --git a/multimodalinput/input_jsapi/signature/openharmony_sx.p7b b/multimodalinput/input_js_standard/signature/openharmony_sx.p7b similarity index 100% rename from multimodalinput/input_jsapi/signature/openharmony_sx.p7b rename to multimodalinput/input_js_standard/signature/openharmony_sx.p7b diff --git a/multimodalinput/input_jsapi/src/main/config.json b/multimodalinput/input_js_standard/src/main/config.json similarity index 86% rename from multimodalinput/input_jsapi/src/main/config.json rename to multimodalinput/input_js_standard/src/main/config.json index c9dba0b2aa0470a831450de7ec69c12ef7a17cf7..4c01ce014352faab7c986fd5db0ac03c3928ce11 100644 --- a/multimodalinput/input_jsapi/src/main/config.json +++ b/multimodalinput/input_js_standard/src/main/config.json @@ -1,6 +1,6 @@ { "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", diff --git a/multimodalinput/input_jsapi/src/main/js/default/app.js b/multimodalinput/input_js_standard/src/main/js/default/app.js similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/app.js rename to multimodalinput/input_js_standard/src/main/js/default/app.js diff --git a/multimodalinput/input_jsapi/src/main/js/default/i18n/en-US.json b/multimodalinput/input_js_standard/src/main/js/default/i18n/en-US.json similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/i18n/en-US.json rename to multimodalinput/input_js_standard/src/main/js/default/i18n/en-US.json diff --git a/multimodalinput/input_jsapi/src/main/js/default/i18n/zh-CN.json b/multimodalinput/input_js_standard/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/i18n/zh-CN.json rename to multimodalinput/input_js_standard/src/main/js/default/i18n/zh-CN.json diff --git a/multimodalinput/input_jsapi/src/main/js/default/pages/index/index.css b/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.css similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/pages/index/index.css rename to multimodalinput/input_js_standard/src/main/js/default/pages/index/index.css diff --git a/multimodalinput/input_jsapi/src/main/js/default/pages/index/index.hml b/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.hml similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/pages/index/index.hml rename to multimodalinput/input_js_standard/src/main/js/default/pages/index/index.hml diff --git a/multimodalinput/input_jsapi/src/main/js/default/pages/index/index.js b/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.js similarity index 100% rename from multimodalinput/input_jsapi/src/main/js/default/pages/index/index.js rename to multimodalinput/input_js_standard/src/main/js/default/pages/index/index.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 new file mode 100644 index 0000000000000000000000000000000000000000..32e4647778fbf1bed36b4e468f80ea2cc3acb525 --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import inputDevice from '@ohos.multimodalInput.inputDevice'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +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(); + } else { + console.log(`inputDevice::getDeviceIds_test-01 success:${JSON.stringify(obj)}`); + expect(obj).assertInstanceOf('Array'); + } + console.log(`inputDevice::getDeviceIds_test-01 exit`); + }) +}) + +}) diff --git a/multimodalinput/input_jsapi/src/main/js/default/test/ListMultimodalinput.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js similarity index 94% rename from multimodalinput/input_jsapi/src/main/js/default/test/ListMultimodalinput.test.js rename to multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js index 7fb5f2d427c1bfabfe1cf5437c820b98c3103d08..cdaebe0f867e6ad0ea47b593353fdad488039911 100644 --- a/multimodalinput/input_jsapi/src/main/js/default/test/ListMultimodalinput.test.js +++ b/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js @@ -14,4 +14,4 @@ */ -require('./tsunit.test.js') +require('./InputDevice.test.js') diff --git a/multimodalinput/input_jsapi/src/main/resources/base/element/string.json b/multimodalinput/input_js_standard/src/main/resources/base/element/string.json similarity index 100% rename from multimodalinput/input_jsapi/src/main/resources/base/element/string.json rename to multimodalinput/input_js_standard/src/main/resources/base/element/string.json diff --git a/multimodalinput/input_jsapi/src/main/resources/base/media/icon.png b/multimodalinput/input_js_standard/src/main/resources/base/media/icon.png similarity index 100% rename from multimodalinput/input_jsapi/src/main/resources/base/media/icon.png rename to multimodalinput/input_js_standard/src/main/resources/base/media/icon.png diff --git a/multimodalinput/input_jsapi/src/main/js/default/test/tsunit.test.js b/multimodalinput/input_jsapi/src/main/js/default/test/tsunit.test.js deleted file mode 100644 index 6d9e70acade8ff6733e7d2fcb5853bd4584980cb..0000000000000000000000000000000000000000 --- a/multimodalinput/input_jsapi/src/main/js/default/test/tsunit.test.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * 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); - }) - - 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`); - }) - }) - -})