From 62536d32ee8b748e5e20e4ea505a00f3244c483e Mon Sep 17 00:00:00 2001 From: zhangyushuai Date: Wed, 22 Mar 2023 06:13:45 +0000 Subject: [PATCH] add inputEngine 007 Signed-off-by: zhangyushuai --- inputmethod/BUILD.gn | 1 + .../InputMethodEngine/AppScope/app.json | 21 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes inputmethod/InputMethodEngine/BUILD.gn | 43 + inputmethod/InputMethodEngine/Test.json | 18 + .../src/main/ets/Application/AbilityStage.ts | 23 + .../InputMethodAbility/InputStageService.ts | 30 + .../InputMethodAbility/KeyboardDelegate.ts | 1127 ++++++++++ .../ets/InputMethodEngine/InputDemoService.ts | 30 + .../InputMethodEngine/KeyboardController.ts | 770 +++++++ .../src/main/ets/MainAbility/MainAbility.ts | 51 + .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 + .../entry/src/main/ets/pages/index/index.ets | 66 + .../src/main/ets/pages/second/second.ets | 43 + .../entry/src/main/ets/test/List.test.ets | 21 + .../main/ets/test/inputMethodAbility.test.ets | 1913 +++++++++++++++++ .../main/ets/test/inputMethodEngine.test.ets | 1205 +++++++++++ .../entry/src/main/module.json | 73 + .../main/resources/base/element/string.json | 36 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 6 + .../signature/ActsInputMethodEngineTest.p7b | Bin 0 -> 3618 bytes 23 files changed, 5563 insertions(+) create mode 100644 inputmethod/InputMethodEngine/AppScope/app.json create mode 100644 inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json create mode 100644 inputmethod/InputMethodEngine/AppScope/resources/base/media/app_icon.png create mode 100644 inputmethod/InputMethodEngine/BUILD.gn create mode 100644 inputmethod/InputMethodEngine/Test.json create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/Application/AbilityStage.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/InputStageService.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/InputDemoService.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/pages/index/index.ets create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/pages/second/second.ets create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/test/List.test.ets create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets create mode 100644 inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets create mode 100644 inputmethod/InputMethodEngine/entry/src/main/module.json create mode 100644 inputmethod/InputMethodEngine/entry/src/main/resources/base/element/string.json create mode 100644 inputmethod/InputMethodEngine/entry/src/main/resources/base/media/icon.png create mode 100644 inputmethod/InputMethodEngine/entry/src/main/resources/base/profile/main_pages.json create mode 100644 inputmethod/InputMethodEngine/signature/ActsInputMethodEngineTest.p7b diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn index c14bb038c..adde2230e 100644 --- a/inputmethod/BUILD.gn +++ b/inputmethod/BUILD.gn @@ -15,6 +15,7 @@ import("//build/ohos_var.gni") group("inputmethod") { testonly = true deps = [ + "InputMethodEngine:ActsInputMethodEngineTest", "InputMethodTest_Stage:ActsImeAbilityTest", "InputMethodTest_ets:ActsInputMethodEtsTest", ] diff --git a/inputmethod/InputMethodEngine/AppScope/app.json b/inputmethod/InputMethodEngine/AppScope/app.json new file mode 100644 index 000000000..191de9d4f --- /dev/null +++ b/inputmethod/InputMethodEngine/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"com.acts.inputmethodengine.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/InputMethodEngine/AppScope/resources/base/element/string.json b/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..ee69f9a86 --- /dev/null +++ b/inputmethod/InputMethodEngine/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/AppScope/resources/base/media/app_icon.png b/inputmethod/InputMethodEngine/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5m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6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}yreceive event err:' + JSON.stringify(err)); + console.debug(TAG + '====>receive event data:' + JSON.stringify(data)); + switch (data.code) { + case 1: + console.debug(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 event:' + data.event); + that.inputMethodAbility_test_getInputMethodAbility_001(); + break; + case 2: + console.debug(TAG + '====>inputMethodAbility_test_getInputMethodDelegate_001 event:' + data.event); + that.inputMethodAbility_test_getKeyboardDelegate_001(); + break; + case 28: + console.debug(TAG + '====>inputMethodAbility_test_028 event:' + data.event); + that.inputMethodAbility_test_028(); + break; + case 29: + console.debug(TAG + '====>inputMethodAbility_test_029 event:' + data.event); + that.inputMethodAbility_test_029(); + break; + case 30: + console.debug(TAG + '====>inputMethodAbility_test_030 event:' + data.event); + that.inputMethodAbility_test_030(); + break; + case 31: + console.debug(TAG + '====>inputMethodAbility_test_031 event:' + data.event); + that.inputMethodAbility_test_031(); + break; + case 32: + console.debug(TAG + '====>inputMethodAbility_test_032 event:' + data.event); + that.inputMethodAbility_test_032(); + break; + case 33: + console.debug(TAG + '====>inputMethodAbility_test_033 event:' + data.event); + that.inputMethodAbility_test_033(); + break; + case 34: + console.debug(TAG + '====>inputMethodAbility_test_034 event:' + data.event); + that.inputMethodAbility_test_034(); + break; + case 35: + console.debug(TAG + '====>inputMethodAbility_test_035 event:' + data.event); + that.inputMethodAbility_test_035(); + break; + case 36: + console.debug(TAG + '====>inputMethodAbility_test_036 event:' + data.event); + that.inputMethodAbility_test_036(); + break; + case 37: + console.debug(TAG + '====>inputMethodAbility_test_037 event:' + data.event); + that.inputMethodAbility_test_037(); + break; + case 38: + console.debug(TAG + '====>inputMethodAbility_test_038 event:' + data.event); + that.inputMethodAbility_test_038(); + break; + case 39: + console.debug(TAG + '====>inputMethodAbility_test_039 event:' + data.event); + that.inputMethodAbility_test_039(); + break; + case 40: + console.debug(TAG + '====>inputMethodAbility_test_040 event:' + data.event); + that.inputMethodAbility_test_040(); + break; + case 41: + console.debug(TAG + '====>inputMethodAbility_test_041 event:' + data.event); + that.inputMethodAbility_test_041(); + break; + case 42: + console.debug(TAG + '====>inputMethodAbility_test_042 event:' + data.event); + that.inputMethodAbility_test_042(); + break; + case 43: + console.debug(TAG + '====>inputMethodAbility_test_043 event:' + data.event); + that.inputMethodAbility_test_043(); + break; + case 45: + console.debug(TAG + '====>inputMethodAbility_test_045 event:' + data.event); + that.inputMethodAbility_test_045(); + break; + case 46: + console.debug(TAG + '====>inputMethodAbility_test_046 event:' + data.event); + that.inputMethodAbility_test_046(); + break; + case 47: + console.debug(TAG + '====>inputMethodAbility_test_047 event:' + data.event); + that.inputMethodAbility_test_047(); + break; + case 48: + console.debug(TAG + '====>inputMethodAbility_test_048 event:' + data.event); + that.inputMethodAbility_test_048(); + break; + case 49: + console.debug(TAG + '====>inputMethodAbility_test_049 event:' + data.event); + that.inputMethodAbility_test_049(); + break; + case 50: + console.debug(TAG + '====>inputMethodAbility_test_050 event:' + data.event); + that.inputMethodAbility_test_050(); + break; + case 101: + console.debug(TAG + '====>inputMethodAbility_test_0101 event:' + data.event); + that.inputMethodAbility_test_101(); + break; + case 102: + console.debug(TAG + '====>inputMethodAbility_test_0102 event:' + data.event); + that.inputMethodAbility_test_102(); + break; + case 103: + console.debug(TAG + '====>inputMethodAbility_test_0103 event:' + data.event); + that.inputMethodAbility_test_103(); + break; + case 104: + console.debug(TAG + '====>inputMethodAbility_test_0104 event:' + data.event); + that.inputMethodAbility_test_104(); + break; + case 105: + console.debug(TAG + '====>inputMethodAbility_test_0105 event:' + data.event); + that.inputMethodAbility_test_105(); + break; + case 106: + console.debug(TAG + '====>inputMethodAbility_test_0106 event:' + data.event); + that.inputMethodAbility_test_106(); + 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 initWindow(): void { + let dis = display.getDefaultDisplaySync(); + 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, + cts: this.mContext + }; + + windowManager.createWindow(config).then((win) => { + win.resize(dWidth, keyHeight).then(() => { + win.moveWindowTo(0, this.nonBarPosition).then(() => { + win.setUIContent('page/service/index').then(() => { + }); + }); + }); + }); + } + + public onDestroy(): void { + console.debug(TAG + '====>onDestroy'); + globalThis.textInputClient.getTextIndexAtCursor().then((index) => { + console.debug(TAG + '====>getTextIndexAtCursor index:' + index); + promptAction.showToast({ message: 'getTextIndexAtCursor success' + index, duration: 200, bottom: 500 }); + var win = windowManager.findWindow(this.windowName); + win.destroyWindow(); + this.mContext.terminateSelf(); + return true; + }).catch((err) => { + promptAction.showToast({ message: 'getTextIndexAtCursor failed', duration: 200, bottom: 500 }); + }); + } + + private publishCallback(err): void { + if (err) { + console.error(TAG + '====>publish failed:' + JSON.stringify(err)); + } else { + console.debug(TAG + '====>publish'); + } + } + + private inputMethodAbility_test_getInputMethodAbility_001(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_getInputMethodAbility_001 data'); + if (typeof(inputMethodAbility) === 'object') { + console.debug(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 success'); + var commonEventPublishData = { + data: "SUCCESS" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 failed'); + var commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_getInputMethodAbility_001", commonEventPublishData, this.publishCallback); + } + + private inputMethodAbility_test_getKeyboardDelegate_001(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_getKeyboardDelegate_001 data'); + if (typeof (inputKeyboardDelegate) === 'object') { + console.debug(TAG + '====>inputMethodAbility_test_getKeyboardDelegate_001 success'); + var commonEventPublishData = { + data: "SUCCESS" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_getKeyboardDelegate_001 failed'); + var commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_getKeyboardDelegate_001", commonEventPublishData, this.publishCallback); + } + + private inputMethodAbility_test_028(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_028 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_028", commonEventPublishData, this.publishCallback); + } else { + let editorAttribyte = await InputClient.getEditorAttribute(); + console.debug(TAG + '====>inputMethodAbility_test_028 editorAttribyte:' + JSON.stringify(editorAttribyte)); + InputClient.sendKeyFunction(editorAttribyte.enterKeyType, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_028 sendKeyFunction err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_028 sendKeyFunction value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_028", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_029(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_029 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_029", commonEventPublishData, this.publishCallback); + } else { + let editorAttribyte = await InputClient.getEditorAttribute(); + console.debug(TAG + '====>inputMethodAbility_test_029 editorAttribyte:' + JSON.stringify(editorAttribyte)); + let value = InputClient.sendKeyFunction(editorAttribyte.enterKeyType); + console.debug(TAG + '====>inputMethodAbility_test_029 sendKeyFunction value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_029", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_030(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_030 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_030", commonEventPublishData, this.publishCallback); + } else { + InputClient.deleteForward(1, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_030 deleteForward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_030 deleteForward value:' + JSON.stringify(value)); + if (typeof value === 'boolean') { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_030", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_031(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_031 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_031", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.deleteForward(1); + console.debug(TAG + '====>inputMethodAbility_test_031 deleteForward value:' + value); + if (typeof value === 'boolean') { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_031", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_032(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_032 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_032", commonEventPublishData, this.publishCallback); + } else { + InputClient.deleteBackward(1, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_032 deleteBackward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_032 deleteBackward value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_032", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_033(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_033 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_033", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.deleteBackward(1); + console.debug(TAG + '====>inputMethodAbility_test_033 deleteBackward value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_033", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_034(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_034 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_034", commonEventPublishData, this.publishCallback); + } else { + InputClient.insertText('test', (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_034 insertText err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_034 insertText value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_034", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_035(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_035 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_035", commonEventPublishData, this.publishCallback); + } else { + let value = InputClient.insertText('test'); + console.debug(TAG + '====>inputMethodAbility_test_035 insertText value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_035", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_036(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_036 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_036", commonEventPublishData, this.publishCallback); + } else { + InputClient.getForward(1, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_036 getForward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_036 getForward value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_036", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_037(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_037 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_037", commonEventPublishData, this.publishCallback); + } else { + let value = InputClient.getForward(1); + console.debug(TAG + '====>inputMethodAbility_test_037 getForward value' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_037", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_038(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_038 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_038", commonEventPublishData, this.publishCallback); + } else { + InputClient.getEditorAttribute((err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_038 getEditorAttribute err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_038 getEditorAttribute value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_038", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_039(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_039 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_039", commonEventPublishData, this.publishCallback); + } else { + let value = InputClient.getEditorAttribute(); + console.debug(TAG + '====>inputMethodAbility_test_039 getEditorAttribute value:' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodAbility_test_039", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_040(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_040 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback); + } else { + try { + KeyboardDelegate.hideKeyboard((err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_040 hideKeyboard err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback); + }); + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_040 hideKeyboard throw_err:'); + commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback); + } + } + }); + } + + private inputMethodAbility_test_041(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_041 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_041", commonEventPublishData, this.publishCallback); + } else { + try { + await KeyboardDelegate.hideKeyboard(); + console.debug(TAG + '====>inputMethodAbility_test_041 hideKeyboard success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_041 hideKeyboard catch err:' + JSON.stringify(err)); + } + commoneventmanager.publish("inputMethodAbility_test_041", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_042(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_042 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_042", commonEventPublishData, this.publishCallback); + } else { + InputClient.getBackward(1, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_042 getBackward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_042 getBackward value:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_042", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_043(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_043 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_043", commonEventPublishData, this.publishCallback); + } else { + let value = InputClient.getBackward(1); + console.debug(TAG + '====>inputMethodAbility_test_043 getBackward value:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("inputMethodAbility_test_043", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_045(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_045 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + setTimeout(()=>{ + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_045", commonEventPublishData, this.publishCallback); + } else { + InputClient.moveCursor(inputMethodEngine.CURSOR_UP, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_045 CURSOR_UP err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_045 CURSOR_UP value:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_045", commonEventPublishData, this.publishCallback); + }); + } + },1000); + + }); + } + + private inputMethodAbility_test_046(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_046 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_046", commonEventPublishData, this.publishCallback); + } else { + InputClient.moveCursor(inputMethodEngine.CURSOR_DOWN, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_046 CURSOR_DOWN err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_046 CURSOR_DOWN value:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_046", commonEventPublishData, this.publishCallback); + }); + } + }); + } + + private inputMethodAbility_test_047(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_047 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_047", commonEventPublishData, this.publishCallback); + } else { + await InputClient.moveCursor(inputMethodEngine.CURSOR_LEFT); + console.debug(TAG + '====>inputMethodAbility_test_047 CURSOR_LEFT success'); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("inputMethodAbility_test_047", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_048(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_048 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_048", commonEventPublishData, this.publishCallback); + } else { + await InputClient.moveCursor(inputMethodEngine.CURSOR_RIGHT); + console.debug(TAG + '====>inputMethodAbility_test_048 CURSOR_RIGHT success'); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("inputMethodAbility_test_048", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_049(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_049 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_049", commonEventPublishData, this.publishCallback); + } else { + try { + KeyboardDelegate.hide((err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_049 hide err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_049", commonEventPublishData, this.publishCallback); + }); + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_049 hide throw_err:'); + commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback); + } + } + }); + } + + private inputMethodAbility_test_050(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_050 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_050", commonEventPublishData, this.publishCallback); + } else { + try { + await KeyboardDelegate.hide(); + console.debug(TAG + '====>inputMethodAbility_test_050 hideKeyboard success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_050 hideKeyboard catch err:' + JSON.stringify(err)); + } + commoneventmanager.publish("inputMethodAbility_test_050", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_101(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_101 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + let range = { start: 0, end: 1 }; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_101", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.selectByRange(range, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_101 selectByRange err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_101", commonEventPublishData, this.publishCallback); + }); + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_101 selectByRange throw_err:'); + commoneventmanager.publish("inputMethodAbility_test_101", commonEventPublishData, this.publishCallback); + } + } + }); + } + + private inputMethodAbility_test_102(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_102 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + let range = { start: 0, end: 1 }; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_102", commonEventPublishData, this.publishCallback); + } else { + try { + await InputClient.selectByRange(range); + console.debug(TAG + '====>inputMethodAbility_test_102 selectByRange success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_102 selectByRange catch err:' + JSON.stringify(err)); + } + commoneventmanager.publish("inputMethodAbility_test_102", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_103(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_103 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_103", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.getTextIndexAtCursor((err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor success' + JSON.stringify(value)); + if (typeof value === 'number') { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodAbility_test_103", commonEventPublishData, this.publishCallback); + }); + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor throw_err:'); + commoneventmanager.publish("inputMethodAbility_test_103", commonEventPublishData, this.publishCallback); + } + } + }); + } + + private inputMethodAbility_test_104(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_104 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_104", commonEventPublishData, this.publishCallback); + } else { + try { + let value = await InputClient.getTextIndexAtCursor(); + console.debug(TAG + '====>inputMethodAbility_test_104 getTextIndexAtCursor value:' + JSON.stringify(value)); + if (typeof value === 'number') { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_104 getTextIndexAtCursor catch err:'); + } + commoneventmanager.publish("inputMethodAbility_test_104", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodAbility_test_105(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_105 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + let movement = { direction: inputMethodEngine.CURSOR_DOWN }; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_105", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.selectByMovement(movement, (err, value) => { + if (err) { + console.debug(TAG + '====>inputMethodAbility_test_105 selectByMovement err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodAbility_test_105 selectByMovement success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodAbility_test_105", commonEventPublishData, this.publishCallback); + }); + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_105 selectByMovement throw_err:'); + commoneventmanager.publish("inputMethodAbility_test_105", commonEventPublishData, this.publishCallback); + } + } + }); + } + + private inputMethodAbility_test_106(): void { + console.debug(TAG + '====>receive inputMethodAbility_test_106 data'); + inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => { + inputMethodAbility.off('inputStart'); + let commonEventPublishData; + let movement = { direction: inputMethodEngine.CURSOR_RIGHT }; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodAbility_test_106", commonEventPublishData, this.publishCallback); + } else { + try { + let value = await InputClient.selectByMovement(movement); + console.debug(TAG + '====>inputMethodAbility_test_106 selectByMovement success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodAbility_test_106 getTextIndexAtCursor catch err:'); + } + commoneventmanager.publish("inputMethodAbility_test_106", commonEventPublishData, this.publishCallback); + } + }); + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/InputDemoService.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/InputDemoService.ts new file mode 100644 index 000000000..b309c8521 --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/InputDemoService.ts @@ -0,0 +1,30 @@ +/* + * 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 InputDemoService extends InputMethodExtensionAbility { + private keyboardController: KeyboardController; + + onCreate(want) { + 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/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts new file mode 100644 index 000000000..2529cf2ca --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts @@ -0,0 +1,770 @@ +import prompt from '@ohos.prompt'; +/* + * 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'; + + +let inputMethodEngine = inputmethodengine.getInputMethodEngine(); +let inputKeyboardDelegate = inputmethodengine.createKeyboardDelegate(); +const TAG = "keyboardController"; + +export class KeyboardController { + mContext; + WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105; + windowName = 'inputApp'; + private windowHeight: number = 0; + private windowWidth: number = 0; + private nonBarPosition: number = 0; + + constructor(context) { + this.mContext = context; + } + + public onCreate(): void { + this.initWindow(); + let that = this; + + 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 1: + console.debug(TAG + '====>inputMethodEngine_test_getInputMethodEngine_001 event:' + data.event); + that.inputMethodEngine_test_getInputMethodEngine_001(); + break; + case 2: + console.debug(TAG + '====>inputMethodEngine_test_getKeyboardDelegate_001 event:' + data.event); + that.inputMethodEngine_test_getKeyboardDelegate_001(); + break; + case 28: + console.debug(TAG + '====>inputMethodEngine_test_028 event:' + data.event); + that.inputMethodEngine_test_028(); + break; + case 29: + console.debug(TAG + '====>inputMethodEngine_test_029 event:' + data.event); + that.inputMethodEngine_test_029(); + break; + case 30: + console.debug(TAG + '====>inputMethodEngine_test_030 event:' + data.event); + that.inputMethodEngine_test_030(); + break; + case 31: + console.debug(TAG + '====>inputMethodEngine_test_031 event:' + data.event); + that.inputMethodEngine_test_031(); + break; + case 32: + console.debug(TAG + '====>inputMethodEngine_test_032 event:' + data.event); + that.inputMethodEngine_test_032(); + break; + case 33: + console.debug(TAG + '====>inputMethodEngine_test_033 event:' + data.event); + that.inputMethodEngine_test_033(); + break; + case 34: + console.debug(TAG + '====>inputMethodEngine_test_034 event:' + data.event); + that.inputMethodEngine_test_034(); + break; + case 35: + console.debug(TAG + '====>inputMethodEngine_test_035 event:' + data.event); + that.inputMethodEngine_test_035(); + break; + case 36: + console.debug(TAG + '====>inputMethodEngine_test_036 event:' + data.event); + that.inputMethodEngine_test_036(); + break; + case 37: + console.debug(TAG + '====>inputMethodEngine_test_037 event:' + data.event); + that.inputMethodEngine_test_037(); + break; + case 38: + console.debug(TAG + '====>inputMethodEngine_test_038 event:' + data.event); + that.inputMethodEngine_test_038(); + break; + case 39: + console.debug(TAG + '====>inputMethodEngine_test_039 event:' + data.event); + that.inputMethodEngine_test_039(); + break; + case 40: + console.debug(TAG + '====>inputMethodEngine_test_040 event:' + data.event); + that.inputMethodEngine_test_040(); + break; + case 41: + console.debug(TAG + '====>inputMethodEngine_test_041 event:' + data.event); + that.inputMethodEngine_test_041(); + break; + case 42: + console.debug(TAG + '====>inputMethodEngine_test_042 event:' + data.event); + that.inputMethodEngine_test_042(); + break; + case 43: + console.debug(TAG + '====>inputMethodEngine_test_043 event:' + data.event); + that.inputMethodEngine_test_043(); + break; + case 49: + console.debug(TAG + '====>inputMethodEngine_test_049 event:' + data.event); + that.inputMethodEngine_test_049(); + break; + case 50: + console.debug(TAG + '====>inputMethodEngine_test_050 event:' + data.event); + that.inputMethodEngine_test_050(); + break; + } + } + + var commonEventSubscribeInfo = { + events: ["test1"] + }; + + 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 inputMethodEngine_test_getInputMethodEngine_001(): void { + console.debug(TAG + '====>receive inputMethodEngine_test_getInputMethodEngine_001 data'); + if (typeof(inputMethodEngine) === "object") { + console.info(TAG + '====>receive inputMethodEngine_test_getInputMethodEngine_001 object'); + var commonEventPublishData = { + data: "SUCCESS" + }; + } else { + console.info(TAG + '====>receive inputMethodEngine_test_getInputMethodEngine_001 failed'); + var commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_getInputMethodEngine_001", commonEventPublishData, this.publishCallback); + } + + private inputMethodEngine_test_getKeyboardDelegate_001(): void { + console.debug(TAG + '====>receive inputMethodEngine_test_getKeyboardDelegate_001 data'); + if (typeof(inputKeyboardDelegate) === "object") { + console.info(TAG + '====>receive inputMethodEngine_test_getKeyboardDelegate_001 object'); + var commonEventPublishData = { + data: "SUCCESS" + }; + } else { + console.info(TAG + '====>receive inputMethodEngine_test_getKeyboardDelegate_001 failed'); + var commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_getKeyboardDelegate_001", commonEventPublishData, this.publishCallback); + } + + private inputMethodEngine_test_028(): void { + console.debug(TAG + '====>receive inputMethodEngine_test_028 data'); + inputMethodEngine.on('inputStart', async (keyboardController, TextInputClient) => { + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (TextInputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_028", commonEventPublishData, this.publishCallback); + } else { + let editorAttribyte = await TextInputClient.getEditorAttribute(); + console.debug(TAG + '====>receive inputMethodEngine_test_028 editorAttribyte: ' + JSON.stringify(editorAttribyte)); + TextInputClient.sendKeyFunction(editorAttribyte.enterKeyType, (err, value) => { + if (err) { + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodEngine_test_028 TextInputClient sendKeyFunction err: ' + JSON.stringify(err)); + } else { + console.debug(TAG + '====>inputMethodEngine_test_028 TextInputClient sendKeyFunction value: ' + JSON.stringify(value)); + if (value) { + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + + } + commoneventmanager.publish("inputMethodEngine_test_028", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_029(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_029 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_029", commonEventPublishData, this.publishCallback); + } else { + let editorAttribyte = await InputClient.getEditorAttribute(); + console.debug(TAG + '====>inputMethodEngine_test_029 editorAttribyte:' + JSON.stringify(editorAttribyte)); + let value = await InputClient.sendKeyFunction(editorAttribyte.enterKeyType); + console.debug(TAG + '====>inputMethodEngine_test_029 sendKeyFunction:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_029", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_030(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_030 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_030", commonEventPublishData, this.publishCallback); + } else { + InputClient.deleteForward(1, (err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_030 deleteForward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_030 deleteForward value:' + JSON.stringify(value)); + if (typeof(value) === 'boolean'){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodEngine_test_030", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_031(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_031 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_031", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.deleteForward(1); + console.debug(TAG + '====>inputMethodEngine_test_031 deleteForward:' + JSON.stringify(value)); + if (typeof(value) === 'boolean'){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_031", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_032(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_032 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_032", commonEventPublishData, this.publishCallback); + } else { + InputClient.deleteBackward(1, (err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_032 deleteBackward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_032 deleteBackward value:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodEngine_test_032", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_033(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_033 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_033", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.deleteBackward(1); + console.debug(TAG + '====>inputMethodEngine_test_033 deleteBackward:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_033", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_034(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_034 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_034", commonEventPublishData, this.publishCallback); + } else { + InputClient.insertText('test', (err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_034 insertText err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_034 insertText value:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodEngine_test_034", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_035(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_035 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_035", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.insertText('test'); + console.debug(TAG + '====>inputMethodEngine_test_035 insertText:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_035", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_036(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_036 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_036", commonEventPublishData, this.publishCallback); + } else { + InputClient.getForward(1, (err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_036 getForward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_036 getForward value:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodEngine_test_036", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_037(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_037 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_037", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.getForward(1); + console.debug(TAG + '====>inputMethodEngine_test_037 getForward:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_037", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_038(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_038 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_038", commonEventPublishData, this.publishCallback); + } else { + InputClient.getEditorAttribute((err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_038 getEditorAttribute err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_038 getEditorAttribute value:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + } + commoneventmanager.publish("inputMethodEngine_test_038", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_039(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_039 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_039", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.getEditorAttribute(); + console.debug(TAG + '====>inputMethodEngine_test_039 getEditorAttribute:' + JSON.stringify(value)); + if (value){ + commonEventPublishData = { + data: "SUCCESS" + }; + } else { + commonEventPublishData = { + data: "FAILED" + }; + } + commoneventmanager.publish("inputMethodEngine_test_039", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_040(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_040 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_040", commonEventPublishData, this.publishCallback); + } else { + try{ + KeyboardDelegate.hideKeyboard((err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_040 hideKeyboard:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodEngine_test_040", commonEventPublishData, this.publishCallback); + }); + }catch(err){ + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodEngine_test_040 hideKeyboard throw_err:'); + commoneventmanager.publish("inputMethodEngine_test_040", commonEventPublishData, this.publishCallback); + } + } + }); + } + private inputMethodEngine_test_041(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_041 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_041", commonEventPublishData, this.publishCallback); + } else { + try{ + await KeyboardDelegate.hideKeyboard(); + console.debug(TAG + '====>inputMethodEngine_test_041 hideKeyboard success'); + commonEventPublishData = { + data: "SUCCESS" + }; + }catch(err){ + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodEngine_test_041 hideKeyboard catch err:'); + } + commoneventmanager.publish("inputMethodEngine_test_041", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_042(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_042 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_042", commonEventPublishData, this.publishCallback); + } else { + InputClient.getBackward(1, (err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_042 getBackward err:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + console.debug(TAG + '====>inputMethodEngine_test_042 getBackward value:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodEngine_test_042", commonEventPublishData, this.publishCallback); + }); + } + }); + } + private inputMethodEngine_test_043(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_043 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_043", commonEventPublishData, this.publishCallback); + } else { + let value = await InputClient.getBackward(1); + console.debug(TAG + '====>inputMethodEngine_test_043 getBackward:' + JSON.stringify(value)); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("inputMethodEngine_test_043", commonEventPublishData, this.publishCallback); + } + }); + } + + private inputMethodEngine_test_049(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_049 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_049", commonEventPublishData, this.publishCallback); + } else { + try{ + KeyboardDelegate.hide((err, value) => { + if (err){ + console.debug(TAG + '====>inputMethodEngine_test_049 hide:' + JSON.stringify(err)); + commonEventPublishData = { + data: "FAILED" + }; + } else { + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("inputMethodEngine_test_049", commonEventPublishData, this.publishCallback); + }); + }catch(err){ + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodEngine_test_049 hide throw_err:'); + commoneventmanager.publish("inputMethodEngine_test_040", commonEventPublishData, this.publishCallback); + } + } + }); + } + private inputMethodEngine_test_050(): void{ + console.debug(TAG + '====>receive inputMethodEngine_test_050 data'); + inputMethodEngine.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodEngine.off('inputStart'); + let commonEventPublishData; + if (InputClient == null) { + commonEventPublishData = { + data: "FAILED" + }; + commoneventmanager.publish("inputMethodEngine_test_050", commonEventPublishData, this.publishCallback); + } else { + try{ + await KeyboardDelegate.hide(); + console.debug(TAG + '====>inputMethodEngine_test_050 hideKeyboard success'); + commonEventPublishData = { + data: "SUCCESS" + }; + }catch(err){ + commonEventPublishData = { + data: "FAILED" + }; + console.debug(TAG + '====>inputMethodEngine_test_050 hideKeyboard catch err:'); + } + commoneventmanager.publish("inputMethodEngine_test_050", commonEventPublishData, this.publishCallback); + } + }); + } + + + + +} \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/MainAbility/MainAbility.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 000000000..744c983f8 --- /dev/null +++ b/inputmethod/InputMethodEngine/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/InputMethodEngine/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..3075161ab --- /dev/null +++ b/inputmethod/InputMethodEngine/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.inputmethodengine.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/InputMethodEngine/entry/src/main/ets/pages/index/index.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 000000000..66e02652a --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * 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 = 'inputMethodEngineinputMethodEngineinputMethodEngineinputMethodEngine' + + 'inputMethodEngineinputMethodEngineinputMethodEngineinputMethodEngineinputMethodEngine'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .defaultFocus(true) + TextArea({ text: this.inputValue }) + .height(50) + .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/InputMethodEngine/entry/src/main/ets/pages/second/second.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 000000000..f9009a3e8 --- /dev/null +++ b/inputmethod/InputMethodEngine/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/InputMethodEngine/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..3b1e0268f --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,21 @@ +/* + * 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 './inputMethodEngine.test' +import inputMethodAbility from './inputMethodAbility.test' + +export default function testsuite() { + inputMethodEngine(); + inputMethodAbility() +} \ 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 new file mode 100644 index 000000000..fe62f9186 --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets @@ -0,0 +1,1913 @@ +/** + * 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 inputMethodAbility() { + describe('inputMethodAbility', 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: 'com.acts.inputmethodengine.test', + label: 'inputStageService', + name: '', + mode: 'lower', + locale: '', + language: '', + icon: '', + iconId: 0, + extra: {}, + } + try{ + await inputMethod.switchCurrentInputMethodSubtype(inputDemoService); + setTimeout(()=>{ + console.debug("====>beforeAll inputMethodStageJSUnit switchCurrentInputMethodSubtype success"); + done(); + },2000) + }catch(err){ + console.debug("====>beforeAll inputMethodStageJSUnit switchCurrentInputMethodSubtype failed"); + } + }) + + it('inputMethodEngine_test_001', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED; + console.info("====>inputMethodEngine_test_001 result:" + keyType); + expect(keyType).assertEqual(0); + done(); + }); + + it('inputMethodEngine_test_002', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_GO; + console.info("====>inputMethodEngine_test_002 result:" + keyType); + expect(keyType).assertEqual(2); + done(); + }); + + it('inputMethodEngine_test_003', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEARCH; + console.info("====>inputMethodEngine_test_003 result:" + keyType); + expect(keyType).assertEqual(3); + done(); + }); + + it('inputMethodEngine_test_004', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEND; + console.info("====>inputMethodEngine_test_004 result:" + keyType); + expect(keyType).assertEqual(4); + done(); + }); + + it('inputMethodEngine_test_005', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_NEXT; + console.info("====>inputMethodEngine_test_005 result:" + keyType); + expect(keyType).assertEqual(5); + done(); + }); + + it('inputMethodEngine_test_006', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_DONE; + console.info("====>inputMethodEngine_test_006 result:" + keyType); + expect(keyType).assertEqual(6); + done(); + }); + + it('inputMethodEngine_test_007', 0, async function (done) { + let keyType = inputMethodEngine.ENTER_KEY_TYPE_PREVIOUS; + console.info("====>inputMethodEngine_test_007 result:" + keyType); + expect(keyType).assertEqual(7); + done(); + }); + + it('inputMethodEngine_test_008', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_NULL; + console.info("====>inputMethodEngine_test_008 result:" + keyType); + expect(keyType).assertEqual(-1); + done(); + }); + + it('inputMethodEngine_test_009', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_TEXT; + console.info("====>inputMethodEngine_test_009 result:" + keyType); + expect(keyType).assertEqual(0); + done(); + }); + + it('inputMethodEngine_test_010', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_NUMBER; + console.info("====>inputMethodEngine_test_010 result:" + keyType); + expect(keyType).assertEqual(2); + done(); + }); + + it('inputMethodEngine_test_011', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_PHONE; + console.info("====>inputMethodEngine_test_011 result:" + keyType); + expect(keyType).assertEqual(3); + done(); + }); + + it('inputMethodEngine_test_012', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_DATETIME; + console.info("====>inputMethodEngine_test_012 result:" + keyType); + expect(keyType).assertEqual(4); + done(); + }); + + it('inputMethodEngine_test_013', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_EMAIL; + console.info("====>inputMethodEngine_test_013 result:" + keyType); + expect(keyType).assertEqual(5); + done(); + }); + + it('inputMethodEngine_test_014', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_URI; + console.info("====>inputMethodEngine_test_014 result:" + keyType); + expect(keyType).assertEqual(6); + done(); + }); + + it('inputMethodEngine_test_015', 0, async function (done) { + let keyType = inputMethodEngine.PATTERN_PASSWORD; + console.info("====>inputMethodEngine_test_015 result:" + keyType); + expect(keyType).assertEqual(7); + done(); + }); + + it('inputMethodEngine_test_016', 0, async function (done) { + let keyType = inputMethodEngine.FLAG_SELECTING; + console.info("====>inputMethodEngine_test_016 result:" + keyType); + expect(keyType).assertEqual(2); + done(); + }); + + it('inputMethodEngine_test_017', 0, async function (done) { + let keyType = inputMethodEngine.FLAG_SINGLE_LINE; + console.info("====>inputMethodEngine_test_017 result:" + keyType); + expect(keyType).assertEqual(1); + done(); + }); + + it('inputMethodEngine_test_018', 0, async function (done) { + let keyType = inputMethodEngine.DISPLAY_MODE_PART; + console.info("====>inputMethodEngine_test_018 result:" + keyType); + expect(keyType).assertEqual(0); + done(); + }); + + it('inputMethodEngine_test_019', 0, async function (done) { + let keyType = inputMethodEngine.DISPLAY_MODE_FULL; + console.info("====>inputMethodEngine_test_019 result:" + keyType); + expect(keyType).assertEqual(1); + done(); + }); + + it('inputMethodEngine_test_020', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_ASCII; + console.info("====>inputMethodEngine_test_020 result:" + keyType); + expect(keyType).assertEqual(20); + done(); + }); + + it('inputMethodEngine_test_021', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_NONE; + console.info("====>inputMethodEngine_test_021 result:" + keyType); + expect(keyType).assertEqual(0); + done(); + }); + + it('inputMethodEngine_test_022', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_AUTO_CAP_CHARACTERS; + console.info("====>inputMethodEngine_test_022 result:" + keyType); + expect(keyType).assertEqual(2); + done(); + }); + + it('inputMethodEngine_test_023', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_AUTO_CAP_SENTENCES; + console.info("====>inputMethodEngine_test_023 result:" + keyType); + expect(keyType).assertEqual(8); + done(); + }); + + it('inputMethodEngine_test_024', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_AUTO_WORDS; + console.info("====>inputMethodEngine_test_024 result:" + keyType); + expect(keyType).assertEqual(4); + done(); + }); + + it('inputMethodEngine_test_025', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_MULTI_LINE; + console.info("====>inputMethodEngine_test_025 result:" + keyType); + expect(keyType).assertEqual(1); + done(); + }); + + it('inputMethodEngine_test_026', 0, async function (done) { + let keyType = inputMethodEngine.OPTION_NO_FULLSCREEN; + console.info("====>inputMethodEngine_test_026 result:" + keyType); + expect(keyType).assertEqual(10); + done(); + }); + + it('inputMethodAbility_test_getInputMethodAbility_001', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 publishCallback failed:" + + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_getInputMethodAbility_001"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_getInputMethodAbility_001 subscriber finish"); + }) + + var commonEventPublishData = { + code: 1 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_getKeyboardDelegate_001', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 publishCallback failed:" + + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_getKeyboardDelegate_001"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_getKeyboardDelegate_001 subscriber finish"); + }) + + var commonEventPublishData = { + code: 2 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_028', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_028 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_028 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_028 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_028 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_028 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_028 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_028 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_028 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_028"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_028 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_028 subscriber finish"); + }) + + var commonEventPublishData = { + code: 28 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_029', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_029 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_029 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_029 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_029 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_029 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_029 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_029 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_029 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_029"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_029 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_029 subscriber finish"); + }) + + var commonEventPublishData = { + code: 29 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback) + }); + + it('inputMethodAbility_test_030', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_030 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_030 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_030 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_030 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_030 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_030 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_030 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_030 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_030"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_030 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_030 subscriber finish"); + }) + + var commonEventPublishData = { + code: 30 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_031', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_031 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_031 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_031 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_031 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_031 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_031 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_031 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_031 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_031"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_031 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_031 subscriber finish"); + }) + + var commonEventPublishData = { + code: 31 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_032', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_032 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_032 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_032 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_032 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_032 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_032 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_032 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_032 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_032"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_032 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_032 subscriber finish"); + }) + + var commonEventPublishData = { + code: 32 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_033', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_033 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_033 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_033 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_033 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_033 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_033 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_033 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_033 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_033"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_033 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_033 subscriber finish"); + }) + + var commonEventPublishData = { + code: 33 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback) + }); + + it('inputMethodAbility_test_034', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_034 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_034 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_034 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_034 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_034 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_034 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_034 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_034 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_034"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_034 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_034 subscriber finish"); + }) + + var commonEventPublishData = { + code: 34 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_035', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_035 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_035 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_035 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_035 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_035 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_035 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_035 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_035 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_035"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_035 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_035 subscriber finish"); + }) + + var commonEventPublishData = { + code: 35 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_036', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_036 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_036 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_036 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_036 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_036 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_036 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_036 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_036 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_036"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_036 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_036 subscriber finish"); + }) + + var commonEventPublishData = { + code: 36 + }; + commonEventManager.publish('test', commonEventPublishData, publishCallback);; + }); + + it('inputMethodAbility_test_037', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_037 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_037 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_037 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_037 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_037 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_037 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_037 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_037 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_037"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_037 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_037 subscriber finish"); + }) + + var commonEventPublishData = { + code: 37 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_038', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_038 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_038 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_038 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_038 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_038 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_038 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_038 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_038 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_038"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_038 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_038 subscriber finish"); + }) + + var commonEventPublishData = { + code: 38 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_039', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_039 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_039 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_039 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_039 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_039 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_039 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_039 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_039 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_039"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_039 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_039 subscriber finish"); + }) + + var commonEventPublishData = { + code: 39 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_040', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_040 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_040 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_040 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_040 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_040 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_040 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_040 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_040 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_040"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_040 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_040 subscriber finish"); + }) + + var commonEventPublishData = { + code: 40 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_041', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_041 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_041 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_041 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_041 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_041 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_041 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_041 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_041 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_041"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_041 subscriber data:" + JSON.stringify(data)) + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_041 subscriber finish"); + }) + + var commonEventPublishData = { + code: 41 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_042', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_042 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_042 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_042 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_042 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_042 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_042 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_042 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_042 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_042"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_042 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_042 subscriber finish"); + }) + + var commonEventPublishData = { + code: 42 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_043', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_043 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_043 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_043 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_043 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_043 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_043 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_043 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_043 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_043"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_043 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_043 subscriber finish"); + }) + + var commonEventPublishData = { + code: 43 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_044', 0, async function (done) { + let keyType = inputMethodEngine.WINDOW_TYPE_INPUT_METHOD_FLOAT; + console.info("====>inputMethodEngine_test_044 result:" + keyType); + expect(keyType).assertEqual(2105); + done(); + }); + + it('inputMethodAbility_test_045', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_045 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_045 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_045 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_045 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_045 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_045 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_045 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_045 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_045"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_045 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_045 subscriber finish"); + }) + + var commonEventPublishData = { + code: 45 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_046', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_046 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_046 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_046 unSubscriberCallback finish") + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_046 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_046 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_046 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_046 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_046 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_046"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_046 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_046 subscriber finish"); + }) + + var commonEventPublishData = { + code: 46 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_047', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_047 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_047 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_047 unSubscriberCallback finish") + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_047 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_047 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_047 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_047 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_047 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_047"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_047 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_047 subscriber finish"); + }) + + var commonEventPublishData = { + code: 47 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_048', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_048 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_048 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_048 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_048 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_048 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_048 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_048 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_048 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_048"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_048 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_048 subscriber finish"); + }) + + var commonEventPublishData = { + code: 48 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_049', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_049 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_049 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_049 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_049 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_049 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_049 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_049 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_049 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_049"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_049 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_049 subscriber finish"); + }) + + var commonEventPublishData = { + code: 49 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_050', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_050 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_050 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_050 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_050 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_050 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_050 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_050 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_050 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_050"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_050 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_050 subscriber finish") + }) + + var commonEventPublishData = { + code: 50 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_101', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_101 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_101 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_101 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_101 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_101 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_101 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_101 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_101 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_101"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_101 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_101 subscriber finish"); + }) + + var commonEventPublishData = { + code: 101 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_102', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_102 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_102 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_102 unSubscriberCallback finish") + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_102 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_102 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_102 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_102 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_102 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_102"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_102 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_102 subscriber finish"); + }) + + var commonEventPublishData = { + code: 102 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_103', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_103 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_103 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_103 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_103 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_103 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_103 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_103 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_103 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_103"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_103 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_103 subscriber finish"); + }) + + var commonEventPublishData = { + code: 103 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_104', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_104 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_104 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_104 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_104 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_104 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_104 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_104 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_104 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_104"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_104 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_104 subscriber finish"); + }) + + var commonEventPublishData = { + code: 104 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_105', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_105 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_105 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_105 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_105 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_105 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_105 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_105 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_105 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_105"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_105 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_105 subscriber finish"); + }) + + var commonEventPublishData = { + code: 105 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + + it('inputMethodAbility_test_106', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>inputMethodAbility_test_106 unSubscriberCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_106 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>inputMethodAbility_test_106 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>inputMethodAbility_test_106 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>inputMethodAbility_test_106 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>inputMethodAbility_test_106 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>inputMethodAbility_test_106 publishCallback start"); + if (err){ + console.info("====>inputMethodAbility_test_106 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodAbility_test_106"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>inputMethodAbility_test_106 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>inputMethodAbility_test_106 subscriber finish"); + }) + + var commonEventPublishData = { + code: 106 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }); + }); +}; diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets new file mode 100644 index 000000000..1f2f6b723 --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets @@ -0,0 +1,1205 @@ +/** + * 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 commoneventmanager from '@ohos.commonEventManager'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import subtype from '@ohos.InputMethodSubtype'; +import inputMethod from '@ohos.inputMethod'; +import display from '@ohos.display'; + + +export default function inputMethodEngineJSUnit() { + describe('inputMethodEngine', function () { + var inputSever = { + packageName: '', + methodId: '', + name: '', + id: '', + extra: {} + } + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeAll(async (done) => { + let inputM = inputMethod.getCurrentInputMethod(); + console.info("====>beforeAll: getCurrentInputMethod inputMethodEngineJSUnit to: " + JSON.stringify(inputM)); + inputSever.packageName = inputM.packageName; + inputSever.methodId = inputM.methodId; + inputSever.name = inputM.packageName; + inputSever.id = inputM.methodId; + + let inputDemoService: subtype = { + id: "com.acts.inputmethodengine.test", + label: "InputDemoService", + name: "", + mode: "lower", + locale: "", + language: "", + icon: "", + iconId: 0, + extra: {} + } + try { + await inputMethod.switchCurrentInputMethodSubtype(inputDemoService); + setTimeout(() => { + console.info("====>beforeAll: inputMethodEngineJSUnit switchCurrentInputMethodSubtype success"); + done(); + }, 2000) + } catch (err) { + console.info("====>beforeAll: inputMethodEngineJSUnit fail" + JSON.stringify(err)); + } + }) + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterAll(async (done) => { + try { + await inputMethod.switchInputMethod(inputSever); + setTimeout(() => { + console.info("====>afterAll: inputMethodEngineJSUnit switchInputMethod success"); + done(); + }, 2000) + } catch (err) { + console.info("====>afterAll: inputMethodEngineJSUnit fail" + JSON.stringify(err)); + } + }) + + let dis = display.getDefaultDisplaySync(); + let w = dis.width / 2; + let h = dis.height /2; + let getFocusCmd = `uinput -T -c ${w} ${h}`; + let abilityDelegator; + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + async function runCmd(cmd) { + console.info("====>runCmdInfo: " + cmd); + await abilityDelegator.executeShellCommand(cmd); + } + + it('inputMethodEngine_test_getInputMethodEngine_001', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>inputMethodEngine_test_getInputMethodEngine_001 unSubscriberCallback start"); + if (err) { + console.error("====>inputMethodEngine_test_getInputMethodEngine_001 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>inputMethodEngine_test_getInputMethodEngine_001 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 subscriberCallback data: " + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 end<====" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_getInputMethodEngine_001"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 subscribe data: " + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_getInputMethodEngine_001 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 1 + } + commoneventmanager.publish("test1", commonEventPublishData, publishCallback); + + }); + + it('inputMethodEngine_test_getKeyboardDelegate_001', 0, async function (done) { + function unSubscriberCallback(err) { + console.info("====>inputMethodEngine_test_getKeyboardDelegate_001 unSubscriberCallback start"); + if (err) { + console.error("====>inputMethodEngine_test_getKeyboardDelegate_001 unSubscriberCallback failed: " + JSON.stringify(err)); + } else { + console.info("====>inputMethodEngine_test_getKeyboardDelegate_001 unSubscriberCallback finsh"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 subscriberCallback data: " + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 end<===="); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 end<====" + JSON.stringify(err)); + clearTimeout(t) + done(); + } + }, 500) + } + + async function publishCallback(err) { + if (err) { + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 end<====" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_getKeyboardDelegate_001"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) { + subscriber = data; + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 subscribe data: " + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_getKeyboardDelegate_001 subscribe finish===="); + }) + + var commonEventPublishData = { + code: 2 + } + commoneventmanager.publish("test1", commonEventPublishData, publishCallback); + + }); + + it('inputMethodEngine_test_028', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_028 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_028 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_028 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_028 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_028 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_028 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_028 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_028 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_028"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_028 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_028 subscriber finish"); + }) + + var commonEventPublishData = { + code: 28 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_029', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_029 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_029 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_029 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_029 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_029 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_029 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_029 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_029 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_029"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_029 subscriber data:" + JSON.stringify(data)) + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_029 subscriber finish"); + }) + + var commonEventPublishData = { + code: 29 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_030', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_030 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_030 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_030 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_030 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_030 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_030 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_030 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_030 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_030"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_030 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_030 subscriber finish"); + }) + + var commonEventPublishData = { + code: 30 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_031', 0, async function (done) { + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_031 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_031 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_031 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_031 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_031 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_031 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 10000) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_031 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_031 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_031"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_031 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_031 subscriber finish"); + }) + + var commonEventPublishData = { + code: 31 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_032', 0, async function (done) { + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_032 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_032 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_032 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_032 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_032 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_032 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_032 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_032 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_032"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_032 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_032 subscriber finish"); + }) + + var commonEventPublishData = { + code: 32 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_033', 0, async function (done) { + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_033 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_033 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_033 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_033 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_033 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_033 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_033 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_033 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_033"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_033 subscriber data:" + JSON.stringify(data)) + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_033 subscriber finish") + }) + + var commonEventPublishData = { + code: 33 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback) + }); + + it('inputMethodEngine_test_034', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_034 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_034 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_034 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_034 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_034 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_034 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_034 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_034 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_034"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_034 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_034 subscriber finish"); + }) + + var commonEventPublishData = { + code: 34 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_035', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_035 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_035 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_035 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_035 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_035 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_035 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_035 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_035 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_035"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_035 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_035 subscriber finish"); + }) + + var commonEventPublishData = { + code: 35 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_036', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_036 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_036 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_036 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_036 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_036 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_036 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_036 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_036 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_036"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_036 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_036 subscriber finish"); + }) + + var commonEventPublishData = { + code: 36 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_037', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_037 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_037 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_037 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_037 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_037 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_037 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_037 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_037 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_037"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_037 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_037 subscriber finish"); + }) + + var commonEventPublishData = { + code: 37 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_038', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_038 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_038 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_038 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_038 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_038 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_038 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_038 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_038 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_038"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_038 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_038 subscriber finish"); + }) + + var commonEventPublishData = { + code: 38 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_039', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_039 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_039 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_039 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_039 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_039 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_039 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_039 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_039 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_039"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_039 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_039 subscriber finish"); + }) + + var commonEventPublishData = { + code: 39 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_040', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_040 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_040 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_040 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_040 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_040 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_040 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_040 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_040 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_040"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_040 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_040 subscriber finish"); + }) + + var commonEventPublishData = { + code: 40 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_041', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_041 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_041 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_041 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_041 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_041 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_041 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_041 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_041 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_041"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_041 subscriber data:" + JSON.stringify(data)) + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_041 subscriber finish"); + }) + + var commonEventPublishData = { + code: 41 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_042', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_042 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_042 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_042 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_042 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_042 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_042 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_042 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_042 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_042"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_042 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_042 subscriber finish"); + }) + + var commonEventPublishData = { + code: 42 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_043', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_043 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_043 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_043 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_043 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_043 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_043 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_043 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_043 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_043"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_043 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_043 subscriber finish"); + }) + + var commonEventPublishData = { + code: 43 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_049', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_049 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_049 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_049 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_049 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_049 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_049 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_049 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_049 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_049"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_049 subscriber data:" + JSON.stringify(data)) + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_049 subscriber finish") + }) + + var commonEventPublishData = { + code: 49 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + it('inputMethodEngine_test_050', 0, async function (done) { + + function unSubscriberCallback(err) { + console.debug("====>inputMethodEngine_test_050 unSubscriberCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_050 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.debug("====>inputMethodEngine_test_050 unSubscriberCallback finish"); + } + } + + function subscriberCallback(err, data) { + console.debug("====>inputMethodEngine_test_050 subscriberCallback data:" + + JSON.stringify(data)); + commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try { + expect(data.data).assertEqual("SUCCESS"); + console.debug("====>inputMethodEngine_test_050 end"); + clearTimeout(t); + done(); + } catch (err) { + console.debug("====>inputMethodEngine_test_050 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err) { + console.debug("====>inputMethodEngine_test_050 publishCallback start"); + if (err) { + console.debug("====>inputMethodEngine_test_050 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["inputMethodEngine_test_050"] + } + var subscriber; + commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => { + subscriber = data; + console.debug("====>inputMethodEngine_test_050 subscriber data:" + JSON.stringify(data)); + commoneventmanager.subscribe(subscriber, subscriberCallback); + console.debug("====>inputMethodEngine_test_050 subscriber finish"); + }) + + var commonEventPublishData = { + code: 50 + } + commoneventmanager.publish('test1', commonEventPublishData, publishCallback); + }); + + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/module.json b/inputmethod/InputMethodEngine/entry/src/main/module.json new file mode 100644 index 000000000..a45b1e6b6 --- /dev/null +++ b/inputmethod/InputMethodEngine/entry/src/main/module.json @@ -0,0 +1,73 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "metadata": [ + { + "name": "ArkTSPartialUpdate", + "value": "false" + } + ], + "abilities": [ + { + "name": "com.acts.inputmethodengine.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": "输入法demoStage", + "icon": "$media:icon", + "name": "inputStageService", + "srcEntrance": "./ets/InputMethodAbility/InputStageService.ts", + "type": "inputMethod", + "visible":true + }, + { + "description": "输入法Demo", + "icon": "$media:icon", + "name": "InputDemoService", + "srcEntrance": "./ets/InputMethodEngine/InputDemoService.ts", + "type": "inputMethod", + "visible":true + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CONNECT_IME_ABILITY" + } + ] + } +} diff --git a/inputmethod/InputMethodEngine/entry/src/main/resources/base/element/string.json b/inputmethod/InputMethodEngine/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..ea8ffb9ce --- /dev/null +++ b/inputmethod/InputMethodEngine/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": "ActsImeAbilityTest" + }, + { + "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/InputMethodEngine/entry/src/main/resources/base/media/icon.png b/inputmethod/InputMethodEngine/entry/src/main/resources/base/media/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