diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn index 727d8004d687d6b414e09013af86321680b5e4f1..a9d69edc799a18ec4a64f896fcc18fbff2b6830a 100644 --- a/inputmethod/BUILD.gn +++ b/inputmethod/BUILD.gn @@ -19,5 +19,6 @@ group("inputmethod") { "InputMethodEngine:ActsInputMethodEngineTest", "InputMethodTest_Stage:ActsImeAbilityTest", "InputMethodTest_ets:ActsInputMethodEtsTest", + "InputMethodWindManage:ActsInputMethodWindManageTest", ] } diff --git a/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json b/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json index ee69f9a861d9dc269ed6638735d52674583498e1..bc2f90479695ddf73048015cb55b03a60509fef4 100644 --- a/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json +++ b/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string":[ { "name":"app_name", - "value":"ohosProject" + "value":"ActsInputMethodEngineTest" } ] } \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts index aa0fc6ce22f762517b70aab8660c482186ece100..1dbd418fd358d9ccb3574d994e8d25c548169e73 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts @@ -196,6 +196,22 @@ export class KeyboardDelegate { console.debug(TAG + '====>inputMethodAbility_test_0106 event:' + data.event); that.inputMethodAbility_test_106(); break; + case 110: + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 event:' + data.event); + that.Sub_Misc_inputMethod_onSelectByRange_0110(); + break; + case 120: + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 event:' + data.event); + that.Sub_Misc_inputMethod_onSelectByMovement_0120(); + break; + case 130: + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByRange_0130 event:' + data.event); + that.Sub_Misc_inputMethod_offSelectByRange_0130(); + break; + case 140: + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 event:' + data.event); + that.Sub_Misc_inputMethod_offSelectByMovement_0140(); + break; } } @@ -1299,4 +1315,178 @@ export class KeyboardDelegate { } }); } + + private Sub_Misc_inputMethod_onSelectByRange_0110(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByRange_0110 success'); + try{ + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByRange_0110 success inputStart'); + let commonEventPublishData; + let range = { start: 0, end: 10 }; + inputMethodAbility.off('inputStart'); + + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByRange_0110", commonEventPublishData, this.publishCallback); + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + try { + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 selectByRange success'); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByRange_0110", commonEventPublishData, this.publishCallback); + await InputClient.selectByRange(range); + } catch (err) { + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 selectByRange catch err:' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByRange_0110", commonEventPublishData, this.publishCallback); + + } + } + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByRange_0110 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByRange_0110", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_onSelectByMovement_0120(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByMovement_0120 success'); + try{ + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByMovement_0120 success inputStart'); + let commonEventPublishData; + let movement = { direction: inputMethodEngine.CURSOR_DOWN }; + inputMethodAbility.off('inputStart'); + + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByMovement_0120", commonEventPublishData, this.publishCallback); + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + try { + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement success'); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByMovement_0120", commonEventPublishData, this.publishCallback); + await InputClient.selectByMovement(movement); + } catch (err) { + console.debug(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement catch err:' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByMovement_0120", commonEventPublishData, this.publishCallback); + + } + } + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByMovement_0120 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_onSelectByMovement_0120", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_offSelectByRange_0130(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByRange_0130 success'); + try{ + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByRange_0130 success inputStart'); + let commonEventPublishData; + let timeCount = 0; + let range = { start: 0, end: 10 }; + inputMethodAbility.off('inputStart'); + + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByRange_0130", commonEventPublishData, this.publishCallback); + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + try { + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByRange_0130 offSelectByRange in'); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByRange_0130", commonEventPublishData, this.publishCallback); + let t1 = setInterval(async () => {; + await InputClient.selectByRange(range); + timeCount += 1; + console.info(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 this.softKeyboardPanel.hide setInterval timeCount: ' + timeCount); + if(timeCount === 2){ + clearInterval(t1); + } + },100); + } catch (err) { + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByRange_0130 offSelectByRange catch err:' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByRange_0130", commonEventPublishData, this.publishCallback); + + } + } + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByRange_0130 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByRange_0130", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_offSelectByMovement_0140(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByMovement_0140 success'); + try{ + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByMovement_0140 success inputStart'); + let commonEventPublishData; + let timeCount = 0; + let movement = { direction: inputMethodEngine.CURSOR_DOWN }; + inputMethodAbility.off('inputStart'); + + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByMovement_0140", commonEventPublishData, this.publishCallback); + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + try { + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 offSelectByMovement in'); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByMovement_0140", commonEventPublishData, this.publishCallback); + let t1 = setInterval(async () => {; + await InputClient.selectByMovement(movement); + timeCount += 1; + console.info(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 this.softKeyboardPanel.hide setInterval timeCount: ' + timeCount); + if(timeCount === 2){ + clearInterval(t1); + } + },100); + } catch (err) { + console.debug(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 offSelectByMovement catch err:' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByMovement_0140", commonEventPublishData, this.publishCallback); + + } + } + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByMovement_0140 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_offSelectByMovement_0140", commonEventPublishData, this.publishCallback); + } + } + + } \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets index 6fec798aa59cea334f986692d0f000cf6f694921..42817b2264d397eea6c65c9b566d4a9ae40de4ab 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets @@ -30,9 +30,18 @@ export default function inputMethodAbility() { extra:{} } + var inputServerCopy = { + packageName: '', + methodId: '', + name:'', + id:'', + extra:{} + } + let display_info; let getFocusCmd = ''; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let inputMethodController = inputMethod.getController(); async function runCmd(cmd){ console.debug('====>runCmd info:' + cmd); await abilityDelegator.executeShellCommand(cmd); @@ -67,6 +76,12 @@ export default function inputMethodAbility() { }catch(err){ console.debug("====>beforeAll inputMethodStageJSUnit switchCurrentInputMethodSubtype failed"); } + let inputCurrent = inputMethod.getCurrentInputMethod(); + inputServerCopy.packageName = inputCurrent.packageName; + inputServerCopy.methodId = inputCurrent.methodId; + inputServerCopy.name = inputCurrent.packageName; + inputServerCopy.id = inputCurrent.methodId; + console.info("====>Sub_Misc_inputMethod_onImeChange_0010 restore to: " + JSON.stringify(inputServerCopy)); }) afterAll(async (done) => { @@ -2208,5 +2223,300 @@ export default function inputMethodAbility() { } commonEventManager.publish('test', commonEventPublishData, publishCallback); }); + + it('Sub_Misc_inputMethod_onSelectByRange_0110', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_onSelectByRange_0110"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_onSelectByRange_0110 subscriber finish") + }) + + inputMethodController.on("selectByRange", async (range) => { + console.info('====>Sub_Misc_inputMethod_onSelectByRange_0110 onSelectByRange start'); + inputMethodController.off("selectByRange"); + try { + expect(range.start).assertEqual(0); + expect(range.end).assertEqual(10); + console.info('====>Sub_Misc_inputMethod_onSelectByRange_0110 Succeed onSelectByRange: ' + JSON.stringify(range)); + done(); + } catch (err) { + console.info('====>Sub_Misc_inputMethod_onSelectByRange_0110 selectByRange success'); + done(); + } + }); + + var commonEventPublishData = { + code:110 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_onSelectByMovement_0120', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_onSelectByMovement_0120"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_onSelectByMovement_0120 subscriber finish") + }) + + inputMethodController.on("selectByMovement", async (movement) => { + console.info('====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement start'); + inputMethodController.off("selectByMovement"); + try { + expect(movement.direction).assertEqual(2); + console.info('====>Sub_Misc_inputMethod_onSelectByMovement_0120 Succeed onSelectByMovement: ' + JSON.stringify(movement)); + done(); + } catch (err) { + console.info('====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement catch err: ' + JSON.stringify(err)); + done(); + } + }); + + var commonEventPublishData = { + code:120 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_offSelectByRange_0130', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_offSelectByRange_0130"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_offSelectByRange_0130 subscriber finish") + }) + + let count = 0; + inputMethodController.on("selectByRange", async (movement) => { + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 offSelectByRange start'); + inputMethodController.off("selectByRange"); + count += 1; + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 Succeed offSelectByRange: ' + JSON.stringify(movement)); + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 count: ' + count); + }); + + let t = setTimeout(() => { + try { + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 setTimeout count: ' + count); + expect(count).assertEqual(1); + clearTimeout(t); + done(); + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 Succeed offSelectByRange '); + } catch (err) { + console.info('====>Sub_Misc_inputMethod_offSelectByRange_0130 offSelectByRange err: ' + JSON.stringify(err)); + done(); + } + },500); + + var commonEventPublishData = { + code:130 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_offSelectByMovement_0140', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_offSelectByMovement_0140"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_offSelectByMovement_0140 subscriber finish") + }) + + let count = 0; + inputMethodController.on("selectByMovement", async (movement) => { + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 offSelectByMovement start'); + inputMethodController.off("selectByMovement"); + count += 1; + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 Succeed offSelectByMovement: ' + JSON.stringify(movement)); + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 count: ' + count); + }); + + let t = setTimeout(() => { + try { + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 setTimeout count: ' + count); + expect(count).assertEqual(1); + clearTimeout(t); + done(); + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 Succeed offSelectByMovement '); + } catch (err) { + console.info('====>Sub_Misc_inputMethod_offSelectByMovement_0140 offSelectByMovement err: ' + JSON.stringify(err)); + done(); + } + },500); + + var commonEventPublishData = { + code:140 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_onImeChange_0150', 0, async function (done) { + let inputMethodSetting = inputMethod.getSetting(); + inputMethodSetting.on("imeChange", (inputMethodProperty, inputMethodSubtype) => { + inputMethodSetting.off("imeChange"); + console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodProperty:" + JSON.stringify(inputMethodProperty)); + console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodSubtype:" + JSON.stringify(inputMethodSubtype)); + expect(typeof(inputMethodProperty) !== null).assertTrue(); + expect(typeof(inputMethodSubtype) !== null).assertTrue(); + done(); + }) + try { + await inputMethod.switchInputMethod(inputServer); + console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod success" + JSON.stringify(inputServer)); + await inputMethod.switchInputMethod(inputServerCopy); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod fail" + JSON.stringify(err)); + } + }); + + it('Sub_Misc_inputMethod_offImeChange_0160', 0, async function (done) { + let count = 0; + let inputMethodSetting = inputMethod.getSetting(); + inputMethodSetting.on("imeChange", (inputMethodProperty, inputMethodSubtype) => { + inputMethodSetting.off("imeChange"); + count += 1; + console.info("====>Sub_Misc_inputMethod_offImeChange_0160 count:" + count); + }) + + try { + await inputMethod.switchInputMethod(inputServer); + console.info('====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod'); + let t = setTimeout(async () => { + clearTimeout(t); + await inputMethod.switchInputMethod(inputServerCopy); + },100); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod fail" + JSON.stringify(err)); + } + + let t = setTimeout(() => { + clearTimeout(t); + try { + console.info('====>Sub_Misc_inputMethod_offImeChange_0160 setTimeout count: ' + count); + expect(count === 1).assertTrue(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod fail" + JSON.stringify(err)); + } + done(); + },500); + }); + }); }; diff --git a/inputmethod/InputMethodWindManage/AppScope/app.json b/inputmethod/InputMethodWindManage/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..60fdb0ae52777e9061902182df0a604b3bbc3cf3 --- /dev/null +++ b/inputmethod/InputMethodWindManage/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"com.acts.inputmethodwidmanage.test", + "vendor":"hw", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:app_name", + "description":"$string:description_application", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/inputmethod/InputMethodWindManage/AppScope/resources/base/element/string.json b/inputmethod/InputMethodWindManage/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ebb7f9348f8c7ec476b2aad2f5b744222e5a3342 --- /dev/null +++ b/inputmethod/InputMethodWindManage/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ActsInputMethodWindManageTest" + } + ] +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/AppScope/resources/base/media/app_icon.png b/inputmethod/InputMethodWindManage/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/inputmethod/InputMethodWindManage/AppScope/resources/base/media/app_icon.png differ diff --git a/inputmethod/InputMethodWindManage/BUILD.gn b/inputmethod/InputMethodWindManage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..72eec9efc376bcdb49aba5edfde554f16083bbd5 --- /dev/null +++ b/inputmethod/InputMethodWindManage/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsInputMethodWindManageTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":IMExtAbility_ets_assets", + ":IMExtAbility_resources", + ] + ets2abc = true + certificate_profile = "signature/ActsInputMethodWindManageTest.p7b" + hap_name = "ActsInputMethodWindManageTest" + subsystem_name = "inputmethod" + part_name = "imf" +} + +ohos_app_scope("IMExtAbility_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("IMExtAbility_ets_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("IMExtAbility_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":IMExtAbility_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/inputmethod/InputMethodWindManage/Test.json b/inputmethod/InputMethodWindManage/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4c858ce713689d3b73ea39db21a8f9cee32f7b9d --- /dev/null +++ b/inputmethod/InputMethodWindManage/Test.json @@ -0,0 +1,29 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.acts.inputmethodwidmanage.test", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 15000 + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602", + "uinput -T -m 300 720 300 360 200", + "uinput -T -m 650 2760 650 1380 200" + ] + }, + { + "test-file-name": [ + "ActsInputMethodWindManageTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/Application/AbilityStage.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..19fca6496cac2b39252aa3fa7047f229d387c351 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 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 AbilityStage from "@ohos.app.ability.AbilityStage"; + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate"); + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts new file mode 100644 index 0000000000000000000000000000000000000000..d23bca859e4c318716830b89d23a4ddfa7129205 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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 InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility'; +import { KeyboardController } from './KeyboardController'; + +export default class inputMethodWindService extends InputMethodExtensionAbility { + private keyboardController: KeyboardController; + + onCreate(want) { + console.log("====>onCreate inputMethodWindService"); + this.keyboardController = new KeyboardController(this.context); + this.keyboardController.onCreate(); // 初始化窗口 + } + + onDestroy() { + console.log("onDestroy inputMethodEngine**"); + this.context.destroy(); + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts new file mode 100644 index 0000000000000000000000000000000000000000..1dd313622f8c1b741cca8c80d0fa3c0bcfc57e08 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts @@ -0,0 +1,836 @@ +/* + * Copyright (c) 2022 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 inputmethodengine from '@ohos.inputMethodEngine'; +import display from '@ohos.display'; +import windowManager from '@ohos.window'; +import commoneventmanager from '@ohos.commonEventManager'; +import prompt from '@ohos.prompt'; + +let inputMethodAbility = inputmethodengine.getInputMethodAbility(); +const TAG = "keyboardController"; +const SOFT_KEYBOARD = 0; +const STATUS_BAR = 1; +const FLG_FIXED = 0; +const FLG_FLOATING = 1; + +let panelInfo = { + type: SOFT_KEYBOARD, + flag: FLG_FLOATING +}; + +export class KeyboardController { + mContext; + storage: LocalStorage; + WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105; + windowName = 'inputApp'; + private softKeyboardPanel: any = null; + private windowHeight: number = 0; + private windowWidth: number = 0; + private nonBarPosition: number = 0; + + constructor(context) { + this.storage = new LocalStorage(); + this.storage.setOrCreate('storageSimplePorp', 121); + this.mContext = context; + let display_info = display.getDefaultDisplaySync(); + this.windowWidth = display_info.width * 0.3; + this.windowHeight = display_info.height * 0.35; + } + + public onCreate(): void { + this.initWindow(); + let that = this; + inputMethodAbility.on("inputStop", () => { + this.mContext.destroy((err, data) => { + console.info(TAG + '====>inputMethodEngine destorey err:' + JSON.stringify(err)); + console.info(TAG + '====>inputMethodEngine destorey data:' + JSON.stringify(data)); + }); + }); + + inputMethodAbility.createPanel(this.mContext, panelInfo, (err, panel) => { + if (err !== undefined) { + console.info('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + this.softKeyboardPanel = panel; + console.info('Succeed in creating panel.' + JSON.stringify(panel)); + }); + + function subscriberCallback(err, data) { + console.debug(TAG + '====>receive event err: ' + JSON.stringify(err)); + console.debug(TAG + '====>receive event data ' + JSON.stringify(data)); + switch (data.code) { + case 10: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_createPanelCallback_0010(); + break; + case 20: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_createPanelPromise_0020(); + break; + case 30: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(); + break; + case 40: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(); + break; + case 50: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(); + break; + case 60: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(); + break; + case 80: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(); + break; + case 90: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_resizeCallback_0090(); + break; + case 100: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); + break; + case 90: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_resizeCallback_0090(); + break; + case 100: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); + break; + case 110: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_moveToCallback_0110(); + break; + case 120: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_moveToPromise_0120(); + break; + case 130: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showCallback_0130 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_showCallback_0130(); + break; + case 140: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showPromise_0140 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_showPromise_0140(); + break; + case 150: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hideCallback_0150 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_hideCallback_0150(); + break; + case 160: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hidePromise_0160 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_hidePromise_0160(); + break; + case 170: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onShow_0170 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_onShow_0170(); + break; + case 180: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_onHide_0180(); + break; + case 210: + console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 event:' + data.event); + that.Sub_Misc_inputMethod_Panel_changeFlag_0210(); + break; + + } + } + + var commonEventSubscribeInfo = { + events: ["test"] + }; + + var subscriber + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + commoneventmanager.subscribe(subscriber, subscriberCallback) + console.debug(TAG + '====>scene subscribe finish===='); + }) + } + + public onDestroy(): void { + console.log('imsakitjsapp onDestroy'); + globalThis.textInputClient.getTextIndexAtCursor().then((index) => { + console.log('imsakitjsapp getTextIndexAtCursor: index = ' + index); + prompt.showToast({ message: 'getTextIndexAtCursor success' + index, duration: 200, bottom: 500 }) + var win = windowManager.findWindow(this.windowName) + win.destroyWindow() + this.mContext.terminateSelf(); + return true; + }).catch((err) => { + prompt.showToast({ message: 'getTextIndexAtCursor failed', duration: 200, bottom: 500 }) + }) + } + + private initWindow(): void { + display.getDefaultDisplay().then(dis => { + var dWidth = dis.width; + var dHeight = dis.height; + var keyHeightRate = 0.47; + var keyHeight = dHeight * keyHeightRate; + this.windowWidth = dWidth; + this.windowHeight = keyHeight; + this.nonBarPosition = dHeight - keyHeight + + var config = { + name: this.windowName, + windowType: this.WINDOW_TYPE_INPUT_METHOD_FLOAT, + ctx: this.mContext + }; + windowManager.createWindow(config).then((win) => { + win.resize(dWidth, keyHeight).then(() => { + win.moveWindowTo(0, this.nonBarPosition).then(() => { + win.setUIContent('pages/service/index').then(() => { + }); + }); + }); + }); + }); + } + + private publishCallback(err): void { + if (err) { + console.error(TAG + '====>publish failed: ' + JSON.stringify(err)); + } else { + console.log(TAG + '====>publish'); + } + } + + + private Sub_Misc_inputMethod_Panel_createPanelCallback_0010(): void { + let commonEventPublishData; + let panelInfo1 = { + type: STATUS_BAR, + flag: FLG_FLOATING + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 success'); + try{ + inputMethodAbility.createPanel(this.mContext, panelInfo1, async (err, panel) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 Succeed in creating panel.' + JSON.stringify(panel)); + } + await inputMethodAbility.destroyPanel(panel); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); + }) + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_createPanelPromise_0020(): void { + let commonEventPublishData; + let panelInfo1 = { + type: STATUS_BAR, + flag: FLG_FLOATING + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 success'); + try{ + inputMethodAbility.createPanel(this.mContext, panelInfo1).then(async (panel) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 Succeed in creating panel.' + JSON.stringify(panel)); + await inputMethodAbility.destroyPanel(panel); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 createPanel error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); + } + } + + private async Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(): Promise { + let commonEventPublishData; + let panelInfo1 = { + type: STATUS_BAR, + flag: FLG_FIXED + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 success'); + try{ + let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); + inputMethodAbility.destroyPanel(panel, async (err, panel) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 Succeed in destroying panel.' + JSON.stringify(panel)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); + }) + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); + } + } + + private async Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(): Promise { + let commonEventPublishData; + let panelInfo1 = { + type: STATUS_BAR, + flag: FLG_FIXED + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 success'); + try{ + let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); + inputMethodAbility.destroyPanel(panel).then(async () => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 Succeed in destroyPanel panel.' + JSON.stringify(panel)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 destroyPanel error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); + }); + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.setUiContent("pages/Index", async (err, data) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 Succeed setUiContent: ' + JSON.stringify(data)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.setUiContent("pages/Index").then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 Succeed in setUiContent.' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 setUiContent error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.setUiContent("pages/Index", this.storage).then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 Succeed in setUiContent: ' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 setUiContent error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_resizeCallback_0090(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight, async (err, data) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 Succeeded in changing the panel size: ' + JSON.stringify(data)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); + }) + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_resizePromise_0100(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight).then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_resizePromise_0100 Succeed in changing the panel size: ' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 resize error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_moveToCallback_0110(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.moveTo(100, 100, async (err, data) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 Succeed in moving the panel: ' + JSON.stringify(data)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_moveToPromise_0120(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.moveTo(100, 100).then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 Succeed in moving the panel: ' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 moveTo error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_showCallback_0130(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.show(async (err, data) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_showCallback_0130 Succeed in showing the panel: ' + JSON.stringify(data)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); + }) + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_showPromise_0140(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.show().then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_showPromise_0140 Succeed in showing the panel: ' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 show error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_hideCallback_0150(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.hide(async (err, data) => { + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide'); + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); + }else{ + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_hideCallback_0150 Succeed in hiding the panel: ' + JSON.stringify(data)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_hidePromise_0160(): void { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.hide().then(async (data) => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info('====>Sub_Misc_inputMethod_Panel_hidePromise_0160 Succeed in hiding the panel: ' + JSON.stringify(data)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); + }).catch(async (err) => { + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 hide error: ' + JSON.stringify(err)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); + }); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); + } + } + + private async Sub_Misc_inputMethod_Panel_onShow_0170(): Promise { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.on("show", async () => { + commonEventPublishData = { + data: "SUCCESS" + }; + this.softKeyboardPanel.off("show"); + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 onShow error: '); + console.info('====>Sub_Misc_inputMethod_Panel_onShow_0170 Succeed onShow: '); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); + }); + await this.softKeyboardPanel.show(); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); + } + } + + private async Sub_Misc_inputMethod_Panel_onHide_0180(): Promise { + let commonEventPublishData; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 success'); + try{ + if (this.softKeyboardPanel !== null){ + this.softKeyboardPanel.on("hide", async () => { + commonEventPublishData = { + data: "SUCCESS" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 onHide'); + this.softKeyboardPanel.off("hide"); + console.info('====>Sub_Misc_inputMethod_Panel_onHide_0180 Succeed onHide:'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); + }); + await this.softKeyboardPanel.hide(); + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); + } + } + + private Sub_Misc_inputMethod_Panel_changeFlag_0210(): void { + let commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 success'); + try{ + if (this.softKeyboardPanel !== null){ + try{ + this.softKeyboardPanel.changeFlag(1); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); + }catch(err){ + console.error("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 throw_error: " + err); + } + + }else{ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 this.softKeyboardPanel is null'); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); + } + }catch(error){ + commonEventPublishData = { + data: "FAILED" + }; + console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 catch error: ' + JSON.stringify(error)); + commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); + } + } + + + +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/MainAbility/MainAbility.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..744c983f864fdf4008d347eaeb2fa7464dda4804 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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 Ability from '@ohos.app.ability.UIAbility'; + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.info("ImExtAbility onCreate"); + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.info("ImExtAbility onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.info("ImExtAbility onWindowStageCreate"); + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "pages/index/index", null); + console.info("ImExtAbility onWindowStageCreate finish"); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.info("ImExtAbility onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.info("ImExtAbility onForeground"); + } + + onBackground() { + // Ability has back to background + console.info("ImExtAbility onBackground"); + } +}; \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a46bcd66b8783aaeb093197a131378e30efbaa2 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022 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 TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +var abilityDelegator = undefined; +var abilityDelegatorArguments = undefined; + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]); + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}`; + } + } + return targetParams.trim(); +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare "); + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments(); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); + var cmd = 'aa start -d 0 -a com.acts.inputmethodwidmanage.test.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters); + var debug = abilityDelegatorArguments.parameters["-D"]; + if (debug === 'true') + { + cmd += ' -D'; + } + console.info('cmd : '+cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }); + console.info('OpenHarmonyTestRunner onRun end'); + } +}; \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6035aaa9cbbdb8e06af002e39596b456a95ef6cc --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + + 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .defaultFocus(true) + TextArea({ text: this.inputValue }) + .onChange((value: string) => { + this.inputValue = value; + }) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } + + aboutToAppear(){ + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/second/second.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9009a3e8567d1f4557ebc11dded54c7e27c0b0d --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4efc2d440494a5548ad4a4e4cea06af6a081b19 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets @@ -0,0 +1,1023 @@ +/** + * Copyright (c) 2022 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" +import inputMethod from '@ohos.inputMethod'; +import inputMethodEngine from '@ohos.inputMethodEngine'; +import subtype from '@ohos.InputMethodSubtype'; +import commonEventManager from '@ohos.commonEventManager'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry' +import display from '@ohos.display'; + +export default function inputMethodWindManageAbility() { + describe('inputMethodWindManageTest', function () { + var inputServer = { + packageName: '', + methodId: '', + name:'', + id:'', + extra:{} + } + + let display_info; + let getFocusCmd = ''; + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + async function runCmd(cmd){ + console.debug('====>runCmd info:' + cmd); + await abilityDelegator.executeShellCommand(cmd); + } + + beforeAll(async (done)=>{ + display_info = display.getDefaultDisplaySync() + getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}` + let inputM = inputMethod.getCurrentInputMethod() + console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); + inputServer.packageName = inputM.packageName; + inputServer.methodId = inputM.methodId; + inputServer.name = inputM.packageName; + inputServer.id = inputM.methodId; + console.info("====>beforeAll inputMethodStageJSUnit start"); + let inputDemoService: subtype ={ + id: 'inputMethodWindService', + label: '', + name: 'com.acts.inputmethodwidmanage.test', + mode: 'lower', + locale: '', + language: '', + icon: '', + iconId: 0, + extra: {}, + } + try{ + await inputMethod.switchCurrentInputMethodSubtype(inputDemoService); + setTimeout(()=>{ + console.debug("====>beforeAll inputMethodStageJSUnit switchCurrentInputMethodSubtype success: " + JSON.stringify(inputDemoService)); + done(); + },2000) + }catch(err){ + console.debug("====>beforeAll inputMethodStageJSUnit switchCurrentInputMethodSubtype failed"); + } + }) + + afterAll(async (done) => { + try { + await inputMethod.switchInputMethod(inputServer); + setTimeout(() => { + console.info("====>afterAll: inputMethodEngineJSUnit switchInputMethod success: " + JSON.stringify(inputServer)); + done(); + }, 2000) + } catch (err) { + console.info("====>afterAll: inputMethodEngineJSUnit fail" + JSON.stringify(err)); + } + }) + + it('Sub_Misc_inputMethod_Panel_createPanelCallback_0010', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_createPanelCallback_0010"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 10 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_createPanelPromise_0020', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_createPanelPromise_0020"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 20 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 30 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 40 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_setUiContentCallback_0050', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_setUiContentCallback_0050"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 50 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_setUiContentPromise_0060', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_setUiContentPromise_0060"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 60 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_setUiContentPromise_0080', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_setUiContentPromise_0080"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 80 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_resizeCallback_0090', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_resizeCallback_0090"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 90 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_resizePromise_0100', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_resizePromise_0100"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_resizePromise_0100 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 100 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_moveToCallback_0110', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_moveToCallback_0110"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 110 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_moveToPromise_0120', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_moveToPromise_0120"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 120 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_showCallback_0130', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_showCallback_0130 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_showCallback_0130"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_showCallback_0130 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 130 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_hideCallback_0150', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_hideCallback_0150"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_hideCallback_0150 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 150 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_showPromise_0140', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_showPromise_0140 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_showPromise_0140"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_showPromise_0140 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 140 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_hidePromise_0160', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_hidePromise_0160"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_hidePromise_0160 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 160 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_onShow_0170', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_onShow_0170 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_onShow_0170"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_onShow_0170 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 170 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_onHide_0180', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_onHide_0180 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_onHide_0180"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_onHide_0180 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 180 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + it('Sub_Misc_inputMethod_Panel_changeFlag_0210', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 unSubscriberCallback start"); + if (err) { + console.error("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 subscriberCallback data: " + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 end<====" + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 success ====" ); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_Panel_changeFlag_0210"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 subscribe data: " + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 210 + } + commonEventManager.publish("test", commonEventPublishData, publishCallback); + }); + + + }); +}; diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a4d2eb2c97191de50e1c4b320eaef5f462e5c20 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 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 InputMethodWindManage from './InputMethodWindManage.test' + +export default function testsuite() { + InputMethodWindManage(); +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/module.json b/inputmethod/InputMethodWindManage/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a7734963739820ba1c2d837896add691de067b1f --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/module.json @@ -0,0 +1,54 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.inputmethodwidmanage.test.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "description": "inputPanelTest", + "icon": "$media:icon", + "name": "inputMethodWindService", + "srcEntrance": "./ets/InputMethodWindManage/InputMethodWindService.ts", + "type": "inputMethod", + "visible":true + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.CONNECT_IME_ABILITY" + } + ] + } +} diff --git a/inputmethod/InputMethodWindManage/entry/src/main/resources/base/element/string.json b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1f2e74299e6c2d5e51b7788b7969dd98af1f17b0 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsInputMethodWindManageTest" + }, + { + "name": "ime_description", + "value": "input method extension ability." + }, + { + "name": "ime_label", + "value": "inputMethod extension ability services." + }, + { + "name": "ime_label_1", + "value": "inputMethod extension ability services_1." + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} diff --git a/inputmethod/InputMethodWindManage/entry/src/main/resources/base/media/icon.png b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/media/icon.png differ diff --git a/inputmethod/InputMethodWindManage/entry/src/main/resources/base/profile/main_pages.json b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/inputmethod/InputMethodWindManage/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/signature/ActsInputMethodWindManageTest.p7b b/inputmethod/InputMethodWindManage/signature/ActsInputMethodWindManageTest.p7b new file mode 100644 index 0000000000000000000000000000000000000000..75f288ebe1c7ce756c886f045125a003e44c2027 Binary files /dev/null and b/inputmethod/InputMethodWindManage/signature/ActsInputMethodWindManageTest.p7b differ