From 47ca63f93f05d528a3ae9a92dc9c4abb765451de Mon Sep 17 00:00:00 2001 From: zhangyushuai Date: Fri, 1 Sep 2023 02:38:27 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Einput=E5=92=8Ctime=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=87=A0=E5=8F=A3=E7=94=A8=E4=BE=8B=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96beforall=E5=87=BD=E6=95=B0=20003?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangyushuai --- .../InputMethodAbility/InputStageService.ts | 1 - .../InputMethodAbility/KeyboardDelegate.ts | 577 +++++++++ .../InputMethodEngine/KeyboardController.ts | 2 +- .../InputMethodEngineKey/InputKeyService.ts | 1 - .../entry/src/main/ets/pages/index/index.ets | 12 +- .../main/ets/test/inputMethodAbility.test.ets | 1103 ++++++++++++++++- .../main/ets/test/inputMethodEngine.test.ets | 4 +- .../ets/test/inputMethodEngineKey.test.ets | 4 +- .../src/main/ets/test/imeAbilityTest.test.ets | 7 +- .../src/main/ets/MainAbility/pages/index.ets | 11 +- .../ets/test/inputMethodNormalJSUnit.test.ets | 3 +- .../InputMethodWindService.ts | 1 - .../entry/src/main/ets/pages/index/index.ets | 11 +- .../ets/test/InputMethodWindManage.test.ets | 2 +- .../main/ets/test/requestUpload001.test.ets | 14 +- .../entry/src/main/ets/test/List.test.ets | 2 + .../main/ets/test/systemDateTimeSync.test.ets | 286 +++++ 17 files changed, 2017 insertions(+), 24 deletions(-) create mode 100644 time/dateTimeTest/entry/src/main/ets/test/systemDateTimeSync.test.ets diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/InputStageService.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/InputStageService.ts index a126b2637..14d4f356d 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/InputStageService.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/InputStageService.ts @@ -25,6 +25,5 @@ export default class InputDemoService extends InputMethodExtensionAbility { onDestroy() { console.log("onDestroy inputStageService**"); - this.keyboardDelegate.onDestroy(); } } \ No newline at end of file diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts index f1192c420..11b3f28f5 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts @@ -223,6 +223,86 @@ export class KeyboardDelegate { console.debug(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0180 event:' + data.event); that.Sub_Misc_inputMethod_sendExtendAction_0180(); break; + case 200: + console.debug(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0200 event:' + data.event); + that.Sub_Misc_inputMethod_getForward_sync_0200(); + break; + case 201: + console.debug(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 event:' + data.event); + that.Sub_Misc_inputMethod_getForward_sync_0201(); + break; + case 210: + console.debug(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0210 event:' + data.event); + that.Sub_Misc_inputMethod_getBackward_sync_0210(); + break; + case 211: + console.debug(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 event:' + data.event); + that.Sub_Misc_inputMethod_getBackward_sync_0211(); + break; + case 220: + console.debug(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 event:' + data.event); + that.Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220(); + break; + case 221: + console.debug(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 event:' + data.event); + that.Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221(); + break; + case 230: + console.debug(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 event:' + data.event); + that.Sub_Misc_inputMethod_getEditorAttribute_sync_0230(); + break; + case 231: + console.debug(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 event:' + data.event); + that.Sub_Misc_inputMethod_getEditorAttribute_sync_0231(); + break; + case 240: + console.debug(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 event:' + data.event); + that.Sub_Misc_inputMethod_moveCursor_sync_0240(); + break; + case 241: + console.debug(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 event:' + data.event); + that.Sub_Misc_inputMethod_moveCursor_sync_0241(); + break; + case 250: + console.debug(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 event:' + data.event); + that.Sub_Misc_inputMethod_deleteForward_sync_0250(); + break; + case 251: + console.debug(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 event:' + data.event); + that.Sub_Misc_inputMethod_deleteForward_sync_0251(); + break; + case 260: + console.debug(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 event:' + data.event); + that.Sub_Misc_inputMethod_deleteBackward_sync_0260(); + break; + case 261: + console.debug(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 event:' + data.event); + that.Sub_Misc_inputMethod_deleteBackward_sync_0261(); + break; + case 270: + console.debug(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0270 event:' + data.event); + that.Sub_Misc_inputMethod_insertText_sync_0270(); + break; + case 271: + console.debug(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 event:' + data.event); + that.Sub_Misc_inputMethod_insertText_sync_0271(); + break; + case 280: + console.debug(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 event:' + data.event); + that.Sub_Misc_inputMethod_selectByRange_sync_0280(); + break; + case 281: + console.debug(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 event:' + data.event); + that.Sub_Misc_inputMethod_selectByRange_sync_0281(); + break; + case 290: + console.debug(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 event:' + data.event); + that.Sub_Misc_inputMethod_selectByMovement_sync_0290(); + break; + case 291: + console.debug(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 event:' + data.event); + that.Sub_Misc_inputMethod_selectByMovement_sync_0291(); + break; } } @@ -1575,5 +1655,502 @@ export class KeyboardDelegate { }); } + private Sub_Misc_inputMethod_getForward_sync_0200(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getForward_sync_0200 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0200", commonEventPublishData, this.publishCallback); + } else { + let str = InputClient.getForwardSync(1); + console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0200 getForwardSync str: ' + JSON.stringify(str)); + if(typeof(str) === "string"){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0200", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getForward_sync_0201(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getForward_sync_0201 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0201", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.getForwardSync("1"); + console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 getForwardSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 getForwardSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0201", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getBackward_sync_0210(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getBackward_sync_0210 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0210", commonEventPublishData, this.publishCallback); + } else { + let str = InputClient.getBackwardSync(1); + console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0210 getBackwardSync str: ' + JSON.stringify(str)); + if(typeof(str) === "string"){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0210", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getBackward_sync_0211(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getBackward_sync_0211 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0211", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.getBackwardSync("1"); + console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 getBackwardSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 getBackwardSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0211", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220", commonEventPublishData, this.publishCallback); + } else { + let num = InputClient.getTextIndexAtCursorSync(); + console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 getTextIndexAtCursorSync num: ' + JSON.stringify(num)); + if(typeof(num) === "number"){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.getTextIndexAtCursorSync("1"); + console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 getTextIndexAtCursorSync success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 getTextIndexAtCursorSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getEditorAttribute_sync_0230(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_getEditorAttribute_sync_0230 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0230", commonEventPublishData, this.publishCallback); + } else { + let obj = InputClient.getEditorAttributeSync(); + console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 getEditorAttributeSync enterKeyType: ' + JSON.stringify(obj.enterKeyType)); + console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 getEditorAttributeSync inputPattern: ' + JSON.stringify(obj.inputPattern)); + if(typeof(obj.enterKeyType) === "number" && typeof(obj.inputPattern) === "number"){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0230", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_getEditorAttribute_sync_0231(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_getEditorAttribute_sync_0231 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0231", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.getEditorAttributeSync(true); + console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 getEditorAttributeSync success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 getEditorAttributeSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0231", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_moveCursor_sync_0240(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_moveCursor_sync_0240 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0240", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.moveCursorSync(inputMethodEngine.CURSOR_UP); + console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 moveCursorSync success' ); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 moveCursorSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0240", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_moveCursor_sync_0241(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_moveCursor_sync_0241 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0241", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.moveCursorSync(true); + console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 moveCursorSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 moveCursorSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0241", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_deleteForward_sync_0250(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_deleteForward_sync_0250 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0250", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.deleteForwardSync(1); + console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 deleteForwardSync success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 deleteForwardSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0250", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_deleteForward_sync_0251(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteForward_sync_0251 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0251", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.deleteForwardSync(false); + console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 deleteForwardSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 deleteForwardSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0251", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_deleteBackward_sync_0260(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_deleteBackward_sync_0260 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0260", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.deleteBackwardSync(1); + console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 deleteBackwardSync success'); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 deleteBackwardSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0260", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_deleteBackward_sync_0261(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteBackward_sync_0261 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0261", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.deleteBackwardSync(false); + console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 deleteBackwardSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 deleteBackwardSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0261", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_insertText_sync_0270(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_insertText_sync_0270 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0270", commonEventPublishData, this.publishCallback); + } else { + InputClient.insertTextSync('test'); + console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0270 insertTextSync'); + commonEventPublishData = { + data: "SUCCESS" + }; + commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0270", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_insertText_sync_0271(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_insertText_sync_0271 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0271", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.insertTextSync(123); + console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 insertTextSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 insertTextSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0271", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_selectByRange_sync_0280(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_selectByRange_sync_0280 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let range = { start: 0, end: 1 }; + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0280", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.selectByRangeSync(range); + console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 selectByRangeSync success' ); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 selectByRangeSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0280", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_selectByRange_sync_0281(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByRange_sync_0281 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0281", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.selectByRangeSync(true); + console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 selectByRangeSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 selectByRangeSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0281", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_selectByMovement_sync_0290(): void{ + console.debug(TAG + '====>receive Sub_Misc_inputMethod_selectByMovement_sync_0290 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let movement = { direction: inputMethodEngine.CURSOR_DOWN }; + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0290", commonEventPublishData, this.publishCallback); + } else { + try { + InputClient.selectByMovementSync(movement); + console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 selectByMovementSync success' ); + commonEventPublishData = { + data: "SUCCESS" + }; + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 selectByMovementSync err: ' + JSON.stringify(err)); + } + commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0290", commonEventPublishData, this.publishCallback); + } + }); + } + + private Sub_Misc_inputMethod_selectByMovement_sync_0291(): void{ + console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByMovement_sync_0291 data'); + inputMethodAbility.on('inputStart', async(KeyboardDelegate, InputClient) =>{ + inputMethodAbility.off('inputStart'); + let commonEventPublishData = { + data: "FAILED" + }; + if (InputClient == null) { + commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0291", commonEventPublishData, this.publishCallback); + } else { + try { + // @ts-ignore + InputClient.selectByMovementSync(true); + console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 selectByMovementSync over'); + } catch (err) { + console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 selectByMovementSync err: ' + JSON.stringify(err)); + if(err.code === 401){ + commonEventPublishData = { + data: "SUCCESS" + }; + } + } + commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0291", commonEventPublishData, this.publishCallback); + } + }); + } + } \ 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 index c735de848..2491b6aa4 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngine/KeyboardController.ts @@ -925,7 +925,7 @@ export class KeyboardController { } commoneventmanager.publish("inputMethodEngine_test_074", commonEventPublishData, this.publishCallback); clearTimeout(t); - },500); + },700); } private inputMethodEngine_test_076(): void{ diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngineKey/InputKeyService.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngineKey/InputKeyService.ts index 5244e56d2..111454d07 100755 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngineKey/InputKeyService.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodEngineKey/InputKeyService.ts @@ -27,6 +27,5 @@ export default class InputKeyService extends InputMethodExtensionAbility { onDestroy() { console.log("onDestroy InputKeyService**"); - this.context.destroy(); } } \ 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 index 6035aaa9c..22aa97b56 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/pages/index/index.ets +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/pages/index/index.ets @@ -24,8 +24,15 @@ struct Index { @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + - 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; - + 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' + + 'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' + + 'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' + + 'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' + + '8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' + + '44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' + + 'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' + + 'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' + + 'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66'; build() { Row() { Column() { @@ -34,6 +41,7 @@ struct Index { .fontWeight(FontWeight.Bold) .defaultFocus(true) TextArea({ text: this.inputValue }) + .height('80%') .onChange((value: string) => { this.inputValue = value; }) diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets index efde6e184..58e94935f 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodAbility.test.ets @@ -49,7 +49,7 @@ export default function inputMethodAbility() { } beforeAll(async (done)=>{ display_info = display.getDefaultDisplaySync() - getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}` + getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${ Math.round(display_info.height*0.4) }` let inputM = inputMethod.getCurrentInputMethod() console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); inputServer.packageName = inputM.packageName; @@ -2704,5 +2704,1106 @@ export default function inputMethodAbility() { }) }); + it('Sub_Misc_inputMethod_getForward_sync_0200', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getForward_sync_0200"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getForward_sync_0200 subscriber finish"); + + var commonEventPublishData = { + code: 200 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getForward_sync_0201', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getForward_sync_0201"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getForward_sync_0201 subscriber finish"); + + var commonEventPublishData = { + code: 201 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getBackward_sync_0210', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getBackward_sync_0210"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0210 subscriber finish"); + + var commonEventPublishData = { + code: 210 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getBackward_sync_0211', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getBackward_sync_0211"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getBackward_sync_0211 subscriber finish"); + + var commonEventPublishData = { + code: 211 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 subscriber finish"); + + var commonEventPublishData = { + code: 220 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 subscriber finish"); + + var commonEventPublishData = { + code: 221 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getEditorAttribute_sync_0230', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getEditorAttribute_sync_0230"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 subscriber finish"); + + var commonEventPublishData = { + code: 230 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_getEditorAttribute_sync_0231', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_getEditorAttribute_sync_0231"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 subscriber finish"); + + var commonEventPublishData = { + code: 231 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_moveCursor_sync_0240', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_moveCursor_sync_0240"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0240 subscriber finish"); + + var commonEventPublishData = { + code: 240 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_moveCursor_sync_0241', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_moveCursor_sync_0241"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_moveCursor_sync_0241 subscriber finish"); + + var commonEventPublishData = { + code: 241 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_deleteForward_sync_0250', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_deleteForward_sync_0250"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0250 subscriber finish"); + + var commonEventPublishData = { + code: 250 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_deleteForward_sync_0251', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_deleteForward_sync_0251"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_deleteForward_sync_0251 subscriber finish"); + + var commonEventPublishData = { + code: 251 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_deleteBackward_sync_0260', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_deleteBackward_sync_0260"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0260 subscriber finish"); + + var commonEventPublishData = { + code: 260 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_deleteBackward_sync_0261', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_deleteBackward_sync_0261"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_deleteBackward_sync_0261 subscriber finish"); + + var commonEventPublishData = { + code: 261 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_insertText_sync_0270', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_insertText_sync_0270"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_insertText_sync_0270 subscriber finish"); + + var commonEventPublishData = { + code: 270 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_insertText_sync_0271', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_insertText_sync_0271"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_insertText_sync_0271 subscriber finish"); + + var commonEventPublishData = { + code: 271 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_selectByRange_sync_0280', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_selectByRange_sync_0280"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0280 subscriber finish"); + + var commonEventPublishData = { + code: 280 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_selectByRange_sync_0281', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_selectByRange_sync_0281"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_selectByRange_sync_0281 subscriber finish"); + + var commonEventPublishData = { + code: 281 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_selectByMovement_sync_0290', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_selectByMovement_sync_0290"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0290 subscriber finish"); + + var commonEventPublishData = { + code: 290 + } + commonEventManager.publish('test', commonEventPublishData, publishCallback); + }) + }); + + it('Sub_Misc_inputMethod_selectByMovement_sync_0291', 0, async function (done) { + function unSubscriberCallback (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 unSubscriberCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 unSubscriberCallback failed:" + + JSON.stringify(err)); + } else { + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 unSubscriberCallback finish"); + } + } + + function subscriberCallback (err, data){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 subscriberCallback data:" + + JSON.stringify(data)); + commonEventManager.unsubscribe(subscriber, unSubscriberCallback); + let t = setTimeout(() => { + try{ + expect(data.data).assertEqual("SUCCESS"); + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 end"); + clearTimeout(t); + done(); + }catch(err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 err:" + JSON.stringify(err)); + clearTimeout(t); + done(); + } + }, 500) + } + + function publishCallback(err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 publishCallback start"); + if (err){ + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 publishCallback failed:" + JSON.stringify(err)); + } else { + runCmd(getFocusCmd); + } + } + + var commonEventSubscribeInfo = { + events: ["Sub_Misc_inputMethod_selectByMovement_sync_0291"] + } + var subscriber; + commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{ + subscriber = data; + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 subscriber data:" + JSON.stringify(data)); + commonEventManager.subscribe(subscriber, subscriberCallback); + console.info("====>Sub_Misc_inputMethod_selectByMovement_sync_0291 subscriber finish"); + + var commonEventPublishData = { + code: 291 + } + 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 index 3553408fc..f20ad2f99 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngine.test.ets @@ -79,8 +79,8 @@ export default function inputMethodEngineJSUnit() { }) let dis = display.getDefaultDisplaySync(); - let w = dis.width / 2; - let h = dis.height /2; + let w = dis.width * 0.5; + let h = Math.round(dis.height * 0.4); let getFocusCmd = `uinput -T -c ${w} ${h}`; let abilityDelegator; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngineKey.test.ets b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngineKey.test.ets index 190ecde21..4998e8e5c 100755 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngineKey.test.ets +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/test/inputMethodEngineKey.test.ets @@ -79,8 +79,8 @@ export default function inputMethodEngineKeyJSUnit() { }) let dis = display.getDefaultDisplaySync(); - let w = dis.width / 2; - let h = dis.height /2; + let w = dis.width * 0.5; + let h = Math.round(dis.height * 0.4); let getFocusCmd = `uinput -T -c ${w} ${h}` let abilityDelegator; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets index f34b432c2..61e367aa1 100644 --- a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets @@ -28,25 +28,28 @@ export default function imeAbilityTest(abilityContext) { /** * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. */ - beforeAll(function () { + beforeAll(function (done) { let inputM = inputMethod.getCurrentInputMethod() console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); prop.packageName = inputM.packageName; prop.methodId = inputM.methodId; prop.name = inputM.packageName; prop.id = inputM.methodId; + done(); }); /** * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. */ - afterAll(async function () { + afterAll(async function (done) { console.info('====>afterAll: switchInputMethod to origionInput.' + JSON.stringify(prop)); await inputMethod.switchInputMethod(prop).then((data)=>{ console.info('====>afterAll switchInputMethod to origionInput :' + data); expect(data == true).assertTrue(); + done(); }).catch(err =>{ console.info('====>afterAll switchInputMethod to origionInput error: ' + err); + done(); }) }); diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets index de06a2c00..e76f70d4b 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -24,7 +24,15 @@ struct Index { @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + - 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; + 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' + + 'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' + + 'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' + + 'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' + + '8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' + + '44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' + + 'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' + + 'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' + + 'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66'; build() { Row() { @@ -34,6 +42,7 @@ struct Index { .fontWeight(FontWeight.Bold) .defaultFocus(true) TextArea({ text: this.inputValue }) + .height('80%') .onChange((value: string) => { this.inputValue = value; }) diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets index 3239e294a..b5d9d2e07 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets @@ -26,9 +26,10 @@ export default function inputMethodNormalJSUnit() { let getFocusCmd = ''; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); display_info = display.getDefaultDisplaySync(); - getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}`; + getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${ Math.round(display_info.height*0.4) }`; console.debug('====>runCmd info:' + getFocusCmd); await abilityDelegator.executeShellCommand(getFocusCmd); + done(); }) /* diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts index d23bca859..d91dbedf2 100644 --- a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/InputMethodWindService.ts @@ -26,6 +26,5 @@ export default class inputMethodWindService extends InputMethodExtensionAbility onDestroy() { console.log("onDestroy inputMethodEngine**"); - this.context.destroy(); } } \ No newline at end of file diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets index 6035aaa9c..0588cbe45 100644 --- a/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/pages/index/index.ets @@ -24,7 +24,15 @@ struct Index { @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + - 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; + 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' + + 'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' + + 'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' + + 'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' + + '8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' + + '44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' + + 'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' + + 'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' + + 'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66'; build() { Row() { @@ -34,6 +42,7 @@ struct Index { .fontWeight(FontWeight.Bold) .defaultFocus(true) TextArea({ text: this.inputValue }) + .height('80%') .onChange((value: string) => { this.inputValue = value; }) diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets index 8443f8401..371b657ba 100644 --- a/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/test/InputMethodWindManage.test.ets @@ -40,7 +40,7 @@ export default function inputMethodWindManageAbility() { beforeAll(async (done)=>{ display_info = display.getDefaultDisplaySync() - getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}` + getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${ Math.round(display_info.height*0.4) }` let inputM = inputMethod.getCurrentInputMethod() console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); inputServer.packageName = inputM.packageName; diff --git a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestUpload001.test.ets b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestUpload001.test.ets index 58de9b307..7c2747636 100755 --- a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestUpload001.test.ets +++ b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestUpload001.test.ets @@ -768,7 +768,7 @@ export default function requestUploadOnetJSUnitTest() { * @tc.level : Level 2 */ it('SUB_Misc_REQUEST_Off_Upload_Completed_0010', 0, async function (done) { - console.info("====>-----------------------SUB_Misc_REQUEST_Off_Upload_Completed_0040 is starting-----------------------"); + console.info("====>-----------------------SUB_Misc_REQUEST_Off_Upload_Completed_0010 is starting-----------------------"); let config_ = config config_.mode = request.agent.Mode.FOREGROUND; try { @@ -776,11 +776,11 @@ export default function requestUploadOnetJSUnitTest() { request.agent.create(globalThis.abilityContext, config_, async (err, task) => { let on_offCompletedCallback = (pro) => { flag = false; - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 on_offCompletedCallback flag: " + flag); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 on_offCompletedCallback flag: " + flag); } try { if(err){ - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 create err: " + JSON.stringify(err)); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 create err: " + JSON.stringify(err)); expect().assertFail(); } task.on('completed', on_offCompletedCallback); @@ -789,22 +789,22 @@ export default function requestUploadOnetJSUnitTest() { await task.start(); let t = setTimeout(async () => { try { - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 offCompleted success flag: " + flag); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 offCompleted success flag: " + flag); clearTimeout(t); expect(flag).assertTrue(); } catch (err) { - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 offCompleted fail err: " + JSON.stringify(err)); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 offCompleted fail err: " + JSON.stringify(err)); } done(); }, 100) } catch (err) { - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 catch err: " + JSON.stringify(err)); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 catch err: " + JSON.stringify(err)); await sleep(10); done(); } }); } catch (err) { - console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 create catch err: " + JSON.stringify(err)); + console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 create catch err: " + JSON.stringify(err)); await sleep(10); done(); } diff --git a/time/dateTimeTest/entry/src/main/ets/test/List.test.ets b/time/dateTimeTest/entry/src/main/ets/test/List.test.ets index 4e009d9e8..e518ec4f1 100644 --- a/time/dateTimeTest/entry/src/main/ets/test/List.test.ets +++ b/time/dateTimeTest/entry/src/main/ets/test/List.test.ets @@ -13,7 +13,9 @@ * limitations under the License. */ import systemDateTimeJsunit from './systemDateTimeJsunit.test'; +import systemDateTimeSync from './systemDateTimeSync.test'; export default function testsuite() { systemDateTimeJsunit(); + systemDateTimeSync(); } \ No newline at end of file diff --git a/time/dateTimeTest/entry/src/main/ets/test/systemDateTimeSync.test.ets b/time/dateTimeTest/entry/src/main/ets/test/systemDateTimeSync.test.ets new file mode 100644 index 000000000..6cb1524ad --- /dev/null +++ b/time/dateTimeTest/entry/src/main/ets/test/systemDateTimeSync.test.ets @@ -0,0 +1,286 @@ +/* + * 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 systemDateTime from "@ohos.systemDateTime"; + +export default function systemDateTimeSyncJsunit() { + describe('systemDateSyncTimeTest', function () { + console.info('====>---------------systemDateTimeTest start-----------------------'); + + /** + * @tc.number SUB_systemDateTime_getTime_sync_0010 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getTime_sync_0010", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getTime_sync_0010 start----------------"); + let currentTime = systemDateTime.getTime(true); + console.info("====>SUB_systemDateTime_getTime_sync_0010 currentTime: " + JSON.stringify(currentTime)); + expect(typeof(currentTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getTime_sync_0010 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getTime_sync_0020 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getTime_sync_0020", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getTime_sync_0020 start----------------"); + let currentTime = systemDateTime.getTime(false); + console.info("====>SUB_systemDateTime_getTime_sync_0020 currentTime: " + JSON.stringify(currentTime)); + expect(typeof(currentTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getTime_sync_0020 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getTime_sync_0030 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getTime_sync_0030", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getTime_sync_0030 start----------------"); + let currentTime = systemDateTime.getTime(); + console.info("====>SUB_systemDateTime_getTime_sync_0030 currentTime: " + JSON.stringify(currentTime)); + expect(typeof(currentTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getTime_sync_0030 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getTime_sync_0040 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getTime_sync_0040", 0, async function (done) { + console.info("====>-----SUB_systemDateTime_getTime_sync_0040 start----------------"); + try { + console.info("====>SUB_systemDateTime_getTime_sync_0040 into parameters"); + // @ts-ignore + systemDateTime.getTime(123); + console.info("====>SUB_systemDateTime_getTime_sync_0040 getTime Success"); + } catch (err) { + console.info("====>SUB_systemDateTime_getTime_sync_0040 Invalid parameters: " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + console.info("====>-----SUB_systemDateTime_getTime_sync_0040 end------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0050 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0050", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0050 start----------------"); + let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE, true); + console.info("====>SUB_systemDateTime_getUptime_sync_0050 currentTime: " + JSON.stringify(realActiveTime)); + expect(typeof(realActiveTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0050 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0060 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0060", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0060 start----------------"); + let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE, false); + console.info("====>SUB_systemDateTime_getUptime_sync_0060 currentTime: " + JSON.stringify(realActiveTime)); + expect(typeof(realActiveTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0060 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0070 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0070", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0070 start----------------"); + let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE); + console.info("====>SUB_systemDateTime_getUptime_sync_0070 currentTime: " + JSON.stringify(realActiveTime)); + expect(typeof(realActiveTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0070 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0080 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0080", 0, async function (done) { + console.info("====>-----SUB_systemDateTime_getUptime_sync_0080 start----------------"); + try { + console.info("====>SUB_systemDateTime_getUptime_sync_0080 into parameters"); + // @ts-ignore + systemDateTime.getUptime("123"); + expect().assertFail(); + } catch (err) { + console.info("====>SUB_systemDateTime_getUptime_sync_0080 Invalid parameters: " + JSON.stringify(err)); + expect(err.code).assertEqual(401); + } + done(); + console.info("====>-----SUB_systemDateTime_getUptime_sync_0080 end------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0090 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0090", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0090 start----------------"); + let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, true); + console.info("====>SUB_systemDateTime_getUptime_sync_0090 currentTime: " + JSON.stringify(realTime)); + expect(typeof(realTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0090 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0100 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0100", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0100 start----------------"); + let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, false); + console.info("====>SUB_systemDateTime_getUptime_sync_0100 currentTime: " + JSON.stringify(realTime)); + expect(typeof(realTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0100 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0110 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0110", 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getUptime_sync_0110 start----------------"); + let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP); + console.info("====>SUB_systemDateTime_getUptime_sync_0110 currentTime: " + JSON.stringify(realTime)); + expect(typeof(realTime) === 'number').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getUptime_sync_0110 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getUptime_sync_0120 + * @tc.name Test systemTimeDate.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemDateTime_getUptime_sync_0120", 0, async function (done) { + console.info("====>-----SUB_systemDateTime_getUptime_sync_0120 start----------------"); + try { + console.info("====>SUB_systemDateTime_getUptime_sync_0120 into parameters"); + // @ts-ignore + systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, "123"); + console.info("====>SUB_systemDateTime_getUptime_sync_0120 getUptime Success"); + } catch (err) { + console.info("====>SUB_systemDateTime_getUptime_sync_0120 Invalid parameters: " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + console.info("====>-----SUB_systemDateTime_getUptime_sync_0120 end------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getTimezoneSync_sync_0130 + * @tc.name Test systemTime.SUB_systemDateTime_getTimezone_sync_0130 true value + * @tc.desc Test systemTimeDate_setTimezone API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemDateTime_getTimezoneSync_sync_0130', 0, async function (done) { + console.info("====>----------SUB_systemDateTime_getTimezoneSync_sync_0130 start----------------"); + let timeZone = systemDateTime.getTimezoneSync(); + console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0130 currentTime: " + JSON.stringify(timeZone)); + expect(typeof(timeZone) === 'string').assertEqual(true); + done(); + console.info("====>----------SUB_systemDateTime_getTimezoneSync_sync_0130 end-----------------"); + }); + + /** + * @tc.number SUB_systemDateTime_getTimezoneSync_sync_0140 + * @tc.name Test systemTimeDate.setTimezone true value + * @tc.desc Test systemTimeDate_setTimezone API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemDateTime_getTimezoneSync_sync_0140', 0, async function (done) { + console.info("====>-----SUB_systemDateTime_getTimezoneSync_sync_0140 start----------------"); + try { + console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 into parameters"); + // @ts-ignore + systemDateTime.getTimezoneSync("123"); + console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 getTimezoneSync Success"); + } catch (err) { + console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 Invalid parameters: " + JSON.stringify(err)); + expect().assertFail(); + } + done(); + console.info("====>-----SUB_systemDateTime_getTimezoneSync_sync_0140 end------------"); + }); + + }); +}; -- GitLab