From 96bf4d766d43126b574f4f801a2af612aed05dc8 Mon Sep 17 00:00:00 2001 From: zhangyushuai Date: Mon, 22 May 2023 11:51:09 +0000 Subject: [PATCH] =?UTF-8?q?add=20input=20=E8=87=AA=E7=BB=98=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=20004?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangyushuai --- inputmethod/BUILD.gn | 1 + .../InputMethodDrawnControl/AppScope/app.json | 21 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes inputmethod/InputMethodDrawnControl/BUILD.gn | 43 + inputmethod/InputMethodDrawnControl/Test.json | 29 + .../src/main/ets/Application/AbilityStage.ts | 23 + .../src/main/ets/MainAbility/MainAbility.ts | 51 ++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 ++ .../entry/src/main/ets/pages/index/index.ets | 67 ++ .../src/main/ets/pages/second/second.ets | 43 + .../entry/src/main/ets/test/List.test.ets | 29 + .../main/ets/test/inputMethod_attach.test.ets | 481 ++++++++++ .../test/inputMethod_changeSelection.test.ets | 819 ++++++++++++++++++ .../inputMethod_setCallingWindow.test.ets | 407 +++++++++ ...howTextInput_hideTextInput_detach.test.ets | 514 +++++++++++ .../test/inputMethod_updateAttribute.test.ets | 340 ++++++++ .../test/inputMethod_updateCursor.test.ets | 409 +++++++++ .../entry/src/main/ets/test/lib/Const.ets | 29 + .../entry/src/main/module.json | 49 ++ .../main/resources/base/element/string.json | 36 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 6 + .../ActsInputMethodDrawnControlTest.p7b | Bin 0 -> 3589 bytes .../InputMethodAbility/KeyboardDelegate.ts | 8 +- .../entry/src/main/ets/test/List.test.ets | 4 +- ... => inputMethodNormalStageJSUnit.test.ets} | 0 ...it.ets => inputMethodStageJSUnit.test.ets} | 0 .../entry/src/main/ets/test/List.test.ets | 4 +- ...dJSUnit.ets => inputMethodJSUnit.test.ets} | 0 ...t.ets => inputMethodNormalJSUnit.test.ets} | 0 .../KeyboardController.ts | 12 +- .../entry/src/main/ets/test/List.test.ets | 4 +- ...est.ets => screenLockPromiseTest.test.ets} | 0 ...enLockTest.ets => screenLockTest.test.ets} | 0 .../entry/src/main/ets/test/List.test.ets | 2 +- ...st.ets => wallpaperauthorityTest.test.ets} | 0 .../entry/src/main/ets/test/List.test.ets | 4 +- ...llpaperTest.ets => wallpaperTest.test.ets} | 0 ...ets => wallpapernopermissionTest.test.ets} | 0 .../entry/src/main/ets/test/List.test.ets | 2 +- ...emTimeTest.ets => systemTimeTest.test.ets} | 0 42 files changed, 3499 insertions(+), 24 deletions(-) create mode 100644 inputmethod/InputMethodDrawnControl/AppScope/app.json create mode 100644 inputmethod/InputMethodDrawnControl/AppScope/resources/base/element/string.json create mode 100644 inputmethod/InputMethodDrawnControl/AppScope/resources/base/media/app_icon.png create mode 100644 inputmethod/InputMethodDrawnControl/BUILD.gn create mode 100644 inputmethod/InputMethodDrawnControl/Test.json create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/Application/AbilityStage.ts create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/index/index.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/second/second.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/List.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_attach.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_changeSelection.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_setCallingWindow.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_showTextInput_hideTextInput_detach.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateAttribute.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateCursor.test.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/lib/Const.ets create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/module.json create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/element/string.json create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/media/icon.png create mode 100644 inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/profile/main_pages.json create mode 100644 inputmethod/InputMethodDrawnControl/signature/ActsInputMethodDrawnControlTest.p7b rename inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/{inputMethodNormalStageJSUnit.ets => inputMethodNormalStageJSUnit.test.ets} (100%) rename inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/{inputMethodStageJSUnit.ets => inputMethodStageJSUnit.test.ets} (100%) rename inputmethod/InputMethodTest_ets/entry/src/main/ets/test/{inputMethodJSUnit.ets => inputMethodJSUnit.test.ets} (100%) rename inputmethod/InputMethodTest_ets/entry/src/main/ets/test/{inputMethodNormalJSUnit.ets => inputMethodNormalJSUnit.test.ets} (100%) rename theme/screenlock_ets/entry/src/main/ets/test/{screenLockPromiseTest.ets => screenLockPromiseTest.test.ets} (100%) rename theme/screenlock_ets/entry/src/main/ets/test/{screenLockTest.ets => screenLockTest.test.ets} (100%) rename theme/wallpaper_authority_ets/entry/src/main/ets/test/{wallpaperauthorityTest.ets => wallpaperauthorityTest.test.ets} (100%) rename theme/wallpaper_ets/entry/src/main/ets/test/{wallpaperTest.ets => wallpaperTest.test.ets} (100%) rename theme/wallpaper_ets/entry/src/main/ets/test/{wallpapernopermissionTest.ets => wallpapernopermissionTest.test.ets} (100%) rename time/timeTest/entry/src/main/ets/test/{systemTimeTest.ets => systemTimeTest.test.ets} (100%) diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn index a9d69edc7..d537ceb78 100644 --- a/inputmethod/BUILD.gn +++ b/inputmethod/BUILD.gn @@ -16,6 +16,7 @@ group("inputmethod") { testonly = true deps = [ "InputMethodAuthorityTest:ActsInputMethodAuthorityTest", + "InputMethodDrawnControl:ActsInputMethodDrawnControlTest", "InputMethodEngine:ActsInputMethodEngineTest", "InputMethodTest_Stage:ActsImeAbilityTest", "InputMethodTest_ets:ActsInputMethodEtsTest", diff --git a/inputmethod/InputMethodDrawnControl/AppScope/app.json b/inputmethod/InputMethodDrawnControl/AppScope/app.json new file mode 100644 index 000000000..27e564f0d --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"com.acts.inputmethoddrawncontrol.test", + "vendor":"hw", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:app_name", + "description":"$string:description_application", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/inputmethod/InputMethodDrawnControl/AppScope/resources/base/element/string.json b/inputmethod/InputMethodDrawnControl/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..eb1e24bbe --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ActsInputMethodDrawnControlTest" + } + ] +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/AppScope/resources/base/media/app_icon.png b/inputmethod/InputMethodDrawnControl/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{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52U)<|cIcntQBI2T#>2;tOxu{%D?kML476AErF(qN9hPva5Nkc@BF zC-tLF@3ZFb%Kpj)M<{)x*l|*Ia@ECeXo2E4h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }); + console.info('OpenHarmonyTestRunner onRun end'); + } +}; \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/index/index.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 000000000..81f4978d7 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + + 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .defaultFocus(true) + TextArea({ text: this.inputValue }) + .onChange((value: string) => { + this.inputValue = value; + }) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } + + aboutToAppear(){ + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/second/second.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 000000000..739642594 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..75096b934 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 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 inputMethod_attach from './inputMethod_attach.test' +import inputMethod_showTextInput_hideTextInput_detach from './inputMethod_showTextInput_hideTextInput_detach.test' +import inputMethod_updateAttribute from './inputMethod_updateAttribute.test' +import inputMethod_changeSelection from './inputMethod_changeSelection.test' +import inputMethod_updateCursor from './inputMethod_updateCursor.test' +import inputMethod_setCallingWindow from './inputMethod_setCallingWindow.test' + +export default function testsuite() { + inputMethod_attach(); + inputMethod_showTextInput_hideTextInput_detach(); + inputMethod_updateAttribute(); + inputMethod_changeSelection(); + inputMethod_updateCursor(); + inputMethod_setCallingWindow(); +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_attach.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_attach.test.ets new file mode 100644 index 000000000..8ae071d64 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_attach.test.ets @@ -0,0 +1,481 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_attach', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + afterEach(async function(){ + clearTimeout(st); + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0100 + * @tc.name Call the attach interface in Async mode. Optional input parameter showkeyboard=true + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0100'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(true,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0200 + * @tc.name Call the attach interface in Async mode. Optional input parameter showkeyboard=false + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0200'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(false,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0300 + * @tc.name Call the attach interface in Async mode. Optional input parameter showkeyboard=0 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0300'; + const SHOW_KEYBOARD:any = 0; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0400 + * @tc.name Call the attach interface in Async mode. Optional input parameter showkeyboard=1 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0400'; + const SHOW_KEYBOARD:any = 1; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0500 + * @tc.name Call the attach interface in Async mode. Optional input parameter showkeyboard='aa' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0500'; + const SHOW_KEYBOARD:any = 'aa'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0600 + * @tc.name Call the attach interface in Async mode. Optional input parameters showkeyboard=true, attribute={} + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0600'; + const ATTRIBUTE:any = {}; + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(true,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_0700 + * @tc.name Call the attach interface in Async mode. Optional input parameters showkeyboard=true, attribute='aa' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_0700'; + const ATTRIBUTE:any = 'aa'; + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(true,ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Async_1000 + * @tc.name Call the attach interface in Async mode and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Async_1000',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Async_1000'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + let CallBack:any = (error,data)=>{ + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().attach(true,ATTRIBUTE,CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0100 + * @tc.name Call the attach interface in Promise mode. Optional input parameter showkeyboard=true + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0100'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + try{ + let data = await inputMethod.getController().attach(true,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0200 + * @tc.name Call the attach interface in Promise mode. Optional input parameter showkeyboard=false + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0200'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + try{ + let data = await inputMethod.getController().attach(false,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0300 + * @tc.name Call the attach interface in Promise mode. Optional input parameter showkeyboard=0 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0300'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + const SHOW_KEYBOARD:any = 0; + try{ + let data = await inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0400 + * @tc.name Call the attach interface in Promise mode. Optional input parameter showkeyboard=1 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0400'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + const SHOW_KEYBOARD:any = 1; + try{ + let data = await inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0500 + * @tc.name Call the attach interface in Promise mode. Optional input parameter showkeyboard='aa' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0500'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + const SHOW_KEYBOARD:any = 'aa'; + try{ + let data = await inputMethod.getController().attach(SHOW_KEYBOARD,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0600 + * @tc.name Call the attach interface in Promise mode. Optional input parameters showkeyboard=true, attribute={} + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0600'; + const ATTRIBUTE:any = {}; + try{ + let data = await inputMethod.getController().attach(true,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_0700 + * @tc.name Call the attach interface in Promise mode. Optional input parameters showkeyboard=true, attribute='aa' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_0700'; + const ATTRIBUTE:any = 'aa'; + try{ + let data = await inputMethod.getController().attach(true,ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_attach_Promise_1000 + * @tc.name Call the attach interface in Promise mode and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_attach_Promise_1000',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_attach_Promise_1000'; + const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} + try{ + let data = await inputMethod.getController().attach(true,ATTRIBUTE,env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_changeSelection.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_changeSelection.test.ets new file mode 100644 index 000000000..69b0581ea --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_changeSelection.test.ets @@ -0,0 +1,819 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_changeSelection', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + beforeEach( + async function (){ + try{ + let data = await inputMethod.getController().attach(true,{inputAttribute:{textInputType:1,enterKeyType:2}}); + console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`); + }; + } + ); + afterEach( + async function (){ + try{ + await inputMethod.getController().detach(); + console.info(`clsoe inputMethod success}`); + }catch(error){ + console.info(`clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + }; + clearTimeout(st); + } + ); + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0100 + * @tc.name Call the changeSelection interface in Async mode, enter the parameter text='Input method keyboard + * test hey hey', start=0, end=5 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0100'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0200 + * @tc.name Call the changeSelection interface in Async mode, enter the parameter text='Input method keyboard + * test hey hey', start=0, end=10 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0200'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END = 10; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0300 + * @tc.name Call the changeSelection interface in Async mode, enter the parameter text='Input method keyboard + * test hey hey', start=- 1, end=5 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0300'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = -1; + const END = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0400 + * @tc.name Call the changeSelection interface in Async mode, enter the parameter text='Input method keyboard + * test hehe', start=8, end=2 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0400'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 8; + const END = 2; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0500 + * @tc.name Async mode calls changeSelection interface, input parameter text=123 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0500'; + const START = 0; + const END = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(env.INVALID_TYPE_NUMBER_123,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0600 + * @tc.name Async mode calls changeSelection interface, input parameter text='' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0600'; + const START = 0; + const END = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(env.INVALID_STRING_NULL,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0700 + * @tc.name Async mode calls changeSelection interface, input parameter start='0' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0700'; + const TEXT = '输入法键盘测试嘿嘿'; + const START:any = '0'; + const END = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_0800 + * @tc.name Async mode calls changeSelection interface, input parameter end='5' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_0800'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = '5'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_1100 + * @tc.name The input method keyboard is not bound, and the changeSelection interface is called in Async mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_1100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_1100'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_1200 + * @tc.name Async mode calls the changeSelection interface, and an invalid input parameter is passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_1200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_1200'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,END,CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_1300 + * @tc.name Async mode calls changeSelection interface. Missing parameter text must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_1300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_1300'; + const START:any = 0; + const END:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(START,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_1400 + * @tc.name Async mode calls the changeSelection interface. If it is missing, the parameter start must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_1400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_1400'; + const TEXT = '输入法键盘测试嘿嘿'; + const END:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,END,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Async_1500 + * @tc.name Async mode calls the changeSelection interface, and the missing parameter must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Async_1500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Async_1500'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().changeSelection(TEXT,START,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0100 + * @tc.name Call changeSelection interface in Promise mode, enter the parameter text='Input method keyboard + * test hey hey', start=0, end=5 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0100'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END = 5; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0200 + * @tc.name Call changeSelection interface in Promise mode, enter the parameter text='Input method keyboard + * test hey hey', start=0, end=10 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0200'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END = 10; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0300 + * @tc.name Call changeSelection interface in Promise mode, enter text='Input method keyboard test hey hey', + * start=- 1, end=5 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0300'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = -1; + const END = 5; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0400 + * @tc.name Call changeSelection interface in Promise mode, enter the parameter text='Input method keyboard + * test hey hey', start=8, end=2 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0400'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 8; + const END = 2; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0500 + * @tc.name Call changeSelection interface in Promise mode, input parameter text=123 + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0500'; + const START = 0; + const END = 5; + try{ + let data = await inputMethod.getController().changeSelection(env.INVALID_TYPE_NUMBER_123,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0600 + * @tc.name Promise mode calls changeSelection interface, input parameter text='' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0600'; + const START = 0; + const END = 5; + try{ + let data = await inputMethod.getController().changeSelection(env.INVALID_STRING_NULL,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0700 + * @tc.name Promise mode calls changeSelection interface, input parameter start='0' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0700'; + const TEXT = '输入法键盘测试嘿嘿'; + const START:any = '0'; + const END = 5; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_0800 + * @tc.name Call changeSelection interface in Promise mode, input parameter end='5' + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_0800'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = '5'; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_1100 + * @tc.name Do not bind the input method keyboard, and call the changeSelection interface in Promise mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_1100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_1100'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = 5; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_1200 + * @tc.name The Promise method calls the changeSelection interface, and an invalid input parameter is passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_1200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_1200'; + const TEXT = '输入法键盘测试嘿嘿'; + const START = 0; + const END:any = 5; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START,END,env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_1300 + * @tc.name The promise method calls the changeSelection interface, and the missing parameter text must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_1300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_1300'; + const START = 0; + const END:any = 5; + try{ + let data = await inputMethod.getController().changeSelection(START,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_1400 + * @tc.name The promise method calls the changeSelection interface. If it is missing, the parameter start must + * be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_1400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_1400'; + const TEXT = '输入法键盘测试嘿嘿'; + const END:any = 5; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,END); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + /** + * @tc.number SUB_Misc_inputMethod_changeSelection_Promise_1500 + * @tc.name The promise method calls the changeSelection interface, and the missing parameter must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_changeSelection_Promise_1500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_changeSelection_Promise_1500'; + const TEXT = '输入法键盘测试嘿嘿'; + const START:any = 0; + try{ + let data = await inputMethod.getController().changeSelection(TEXT,START); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + } + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_setCallingWindow.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_setCallingWindow.test.ets new file mode 100644 index 000000000..07b900d8d --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_setCallingWindow.test.ets @@ -0,0 +1,407 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_setCallingWindow', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + beforeEach( + async function (){ + try{ + let data = await inputMethod.getController().attach(true,{inputAttribute:{textInputType:1,enterKeyType:2}}); + console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`); + }; + } + ); + afterEach( + async function (){ + try{ + await inputMethod.getController().detach(); + console.info(`clsoe inputMethod success}`); + }catch(error){ + console.info(`clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + }; + clearTimeout(st); + } + ); + + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0100 + * @tc.name When calling the setCallingWindow interface in Async mode, the parameter windowId=5 must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0100'; + const WINDOW_ID:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().setCallingWindow(WINDOW_ID,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0200 + * @tc.name When calling the setCallingWindow interface in Async mode, the parameter windowId=0 must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0200'; + const WINDOW_ID:any = 0; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectFalse(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().setCallingWindow(WINDOW_ID,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0300 + * @tc.name When calling the setCallingWindow interface in Async mode, the parameter windowId='5' must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0300'; + const WINDOW_ID:any = '5'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().setCallingWindow(WINDOW_ID,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0600 + * @tc.name The input method keyboard is not bound, and the setCallingWindow interface is called in Async mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0600'; + const WINDOW_ID:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + inputMethod.getController().setCallingWindow(WINDOW_ID,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0700 + * @tc.name Async mode calls the setCallingWindow interface, and an invalid input parameter is passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0700'; + const WINDOW_ID:any = 5; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().setCallingWindow(WINDOW_ID,CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Async_0800 + * @tc.name Async method calls the setCallingWindow interface. Missing parameter windowId must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Async_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Async_0800'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().setCallingWindow(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0100 + * @tc.name When calling the setCallingWindow interface in Promise mode, the parameter + * windowId=5 must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0100'; + const WINDOW_ID:any = 5; + try{ + let data = await inputMethod.getController().setCallingWindow(WINDOW_ID); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0200 + * @tc.name When calling the setCallingWindow interface in Promise mode, the parameter windowId=0 must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0200'; + const WINDOW_ID:any = 0; + try{ + let data = await inputMethod.getController().setCallingWindow(WINDOW_ID); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0300 + * @tc.name When calling the setCallingWindow interface in Promise mode, the parameter windowId='5' must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0300'; + const WINDOW_ID:any = '5'; + try{ + let data = await inputMethod.getController().setCallingWindow(WINDOW_ID); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0600 + * @tc.name The input method keyboard is not bound, and the setCallingWindow interface is called in Promise mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0600'; + const WINDOW_ID:any = 5; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + let data = await inputMethod.getController().setCallingWindow(WINDOW_ID); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0700 + * @tc.name Call setCallingWindow interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0700'; + const WINDOW_ID:any = 5; + try{ + let data = await inputMethod.getController().setCallingWindow(WINDOW_ID,env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_setCallingWindow_Promise_0800 + * @tc.name The setCallingWindow interface is called in Promise mode, and the parameter windowId must be + * passed in if it is missing + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_setCallingWindow_Promise_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_setCallingWindow_Promise_0800'; + try{ + let data = await inputMethod.getController().setCallingWindow(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_showTextInput_hideTextInput_detach.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_showTextInput_hideTextInput_detach.test.ets new file mode 100644 index 000000000..35fd74fa4 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_showTextInput_hideTextInput_detach.test.ets @@ -0,0 +1,514 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_showTextInput_hideTextInput_detach', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + beforeEach( + async function (){ + try{ + let data = await inputMethod.getController().attach(true,{inputAttribute:{textInputType:1,enterKeyType:2}}); + console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`); + }; + } + ); + afterEach( + async function (){ + try{ + await inputMethod.getController().detach(); + console.info(`clsoe inputMethod success}`); + }catch(error){ + console.info(`clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + }; + clearTimeout(st); + } + ); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Async_0100 + * @tc.name Async mode calls the showTextInput interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Async_0100'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().showTextInput(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Async_0400 + * @tc.name Do not bind the input method keyboard, and call the showTextInput interface in Async mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Async_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Async_0400'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + inputMethod.getController().showTextInput(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Async_0500 + * @tc.name Async method calls the showTextInput interface, and an invalid input parameter is passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Async_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Async_0500'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().showTextInput(CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Promise_0100 + * @tc.name Promise mode calls the showTextInput interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Promise_0100'; + try{ + let data = await inputMethod.getController().showTextInput(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Promise_0400 + * @tc.name Do not bind the input method keyboard, and call the showTextInput interface in Promise mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Promise_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Promise_0400'; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + await inputMethod.getController().showTextInput(); + console.info(`${CASE_NAME} execution success`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_showTextInput_Promise_0500 + * @tc.name Call the showTextInput interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_showTextInput_Promise_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_showTextInput_Promise_0500'; + try{ + await inputMethod.getController().showTextInput(env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Async_0100 + * @tc.name Async mode calls the hideTextInput interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Async_0100'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().hideTextInput(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Async_0400 + * @tc.name The input method keyboard is not bound, and the hideTextInput interface is called in Async mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Async_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Async_0400'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + inputMethod.getController().hideTextInput(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Async_0500 + * @tc.name Call the hideTextInput interface in Async mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Async_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Async_0500'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().hideTextInput(CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Promise_0100 + * @tc.name Promise mode calls the hideTextInput interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Promise_0100'; + try{ + await inputMethod.getController().hideTextInput(); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + try{ + let data = await inputMethod.getController().hideTextInput(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Promise_0400 + * @tc.name The input method keyboard is not bound, and the hideTextInput interface is called in Promise mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Promise_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Promise_0400'; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + await inputMethod.getController().hideTextInput(); + console.info(`${CASE_NAME} execution success`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_hideTextInput_Promise_0500 + * @tc.name Call the hideTextInput interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_hideTextInput_Promise_0500',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_hideTextInput_Promise_0500'; + try{ + await inputMethod.getController().hideTextInput(env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_detach_Async_0100 + * @tc.name Async mode calls the detach interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_detach_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_detach_Async_0100'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().detach(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_detach_Async_0400 + * @tc.name Call the detach interface in Async mode and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_detach_Async_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_detach_Async_0400'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().detach(CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_detach_Promise_0100 + * @tc.name Promise mode calls the detach interface without input parameters + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_detach_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_detach_Promise_0100'; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_detach_Promise_0400 + * @tc.name Call the detach interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_detach_Promise_0400',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_detach_Promise_0400'; + try{ + await inputMethod.getController().detach(env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateAttribute.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateAttribute.test.ets new file mode 100644 index 000000000..db0497085 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateAttribute.test.ets @@ -0,0 +1,340 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_updateAttribute', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + beforeEach( + async function (){ + try{ + let data = await inputMethod.getController().attach(true,{inputAttribute:{textInputType:1,enterKeyType:2}}); + console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`); + }; + } + ); + afterEach( + async function (){ + try{ + await inputMethod.getController().detach(); + console.info(`clsoe inputMethod success}`); + }catch(error){ + console.info(`clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + }; + clearTimeout(st); + } + ); + + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Async_0100 + * @tc.name When calling the updateAttribute interface in Async mode, the parameter attribute= + * {textInputType: 0, enterKeyType: 0} must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Async_0100'; + const ATTRIBUTE:any = {textInputType: 0, enterKeyType: 0}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().updateAttribute(ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Async_0200 + * @tc.name When calling the updateAttribute interface in Async mode, the parameter attribute={} must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Async_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Async_0200'; + const ATTRIBUTE:any = {}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().updateAttribute(ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Async_0300 + * @tc.name When calling the updateAttribute interface in Async mode, the parameter attribute='aa' must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Async_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Async_0300'; + const ATTRIBUTE:any = 'aa'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().updateAttribute(ATTRIBUTE,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Async_0700 + * @tc.name Async mode calls the updateAttribute interface and passes in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Async_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Async_0700'; + const ATTRIBUTE:any = {textInputType: 0, enterKeyType: 0}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().updateAttribute(ATTRIBUTE,CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Async_0800 + * @tc.name Async method calls the updateAttribute interface. Missing parameter attribute must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Async_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Async_0800'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().updateAttribute(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Promise_0100 + * @tc.name When calling the updateAttribute interface in Promise mode, the parameter + * attribute={textInputType: 0, enterKeyType: 0} must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Promise_0100'; + const ATTRIBUTE:any = {textInputType: 0, enterKeyType: 0}; + try{ + let data = await inputMethod.getController().updateAttribute(ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Promise_0200 + * @tc.name When calling the updateAttribute interface in Promise mode, the parameter attribute={} must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Promise_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Promise_0200'; + const ATTRIBUTE:any = {}; + try{ + let data = await inputMethod.getController().updateAttribute(ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Promise_0300 + * @tc.name When calling the updateAttribute interface in Promise mode, the parameter attribute='aa' must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Promise_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Promise_0300'; + const ATTRIBUTE:any = 'aa'; + try{ + let data = await inputMethod.getController().updateAttribute(ATTRIBUTE); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Promise_0700 + * @tc.name Call the updateAttribute interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Promise_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Promise_0700'; + const ATTRIBUTE:any = {textInputType: 0, enterKeyType: 0}; + try{ + let data = await inputMethod.getController().updateAttribute(ATTRIBUTE,env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateAttribute_Promise_0800 + * @tc.name The updateAttribute interface is called in Promise mode. If it is missing, + * the parameter attribute must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateAttribute_Promise_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateAttribute_Promise_0800'; + try{ + let data = await inputMethod.getController().updateAttribute(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateCursor.test.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateCursor.test.ets new file mode 100644 index 000000000..796302f09 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/inputMethod_updateCursor.test.ets @@ -0,0 +1,409 @@ +//@ts-nocheck +/* + * Copyright (c) 2023 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 inputMethod from '@ohos.inputmethod'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import * as env from './lib/Const'; + +export default function inputMethodTest() { + describe('inputMethod_updateCursor', function () { + function expectTrue(data) { + try { + expect(data).assertTrue(); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectContain(a,b) { + try { + expect(a).assertContain(b); + }catch (err){ + console.info('assertion failure'); + } + }; + function expectFalse() { + try { + expect().assertFail(); + }catch (err){ + console.info('assertion failure'); + } + }; + let st = null as any; + const sleep = function (timeout) { + return new Promise(resolve => { + const st = setTimeout(() => { + resolve(null); + }, timeout); + }); + }; + beforeEach( + async function (){ + try{ + let data = await inputMethod.getController().attach(true,{inputAttribute:{textInputType:1,enterKeyType:2}}); + console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`); + }; + } + ); + afterEach( + async function (){ + try{ + await inputMethod.getController().detach(); + console.info(`clsoe inputMethod success}`); + }catch(error){ + console.info(`clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + }; + clearTimeout(st); + } + ); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0100 + * @tc.name When calling the changeSelection interface in Async mode, the parameter cursorInfo=CursorInfo object + * must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0100'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().updateCursor(CURSOR_INFO,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0200 + * @tc.name When calling the changeSelection interface in Async mode, the parameter cursorInfo={} must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0200'; + const CURSOR_INFO:any = {}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().updateCursor(CURSOR_INFO,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0300 + * @tc.name When calling the changeSelection interface in Async mode, the parameter cursorInfo='123 'must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0300'; + const CURSOR_INFO:any = '123'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().updateCursor(CURSOR_INFO,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0600 + * @tc.name The input method keyboard is not bound, and the changeSelection interface is called in Async mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0600'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + inputMethod.getController().updateCursor(CURSOR_INFO,CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0700 + * @tc.name Async mode calls the updateCursor interface, and an invalid input parameter is passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0700'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail,error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + } + }; + try{ + inputMethod.getController().updateCursor(CURSOR_INFO,CallBack,env.INVALID_TYPE_STRING_A); + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Async_0800 + * @tc.name Async mode calls the updateCursor interface. If missing, the parameter cursorInfo must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Async_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Async_0800'; + let CallBack:any = (error,data) => { + if (error) { + console.info(`${CASE_NAME} execution fail, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }else{ + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + } + }; + try{ + inputMethod.getController().updateCursor(CallBack); + }catch(error){ + console.info(`${CASE_NAME} catch error, expect error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0100 + * @tc.name To call the changeSelection interface in Promise mode, the parameter cursorInfo=CursorInfo object + * must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0100',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0100'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + try{ + let data = await inputMethod.getController().updateCursor(CURSOR_INFO); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0200 + * @tc.name To call the changeSelection interface in Promise mode, the parameter cursorInfo={} must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0200',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0200'; + const CURSOR_INFO:any = {}; + try{ + let data = await inputMethod.getController().updateCursor(CURSOR_INFO); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0300 + * @tc.name To call the changeSelection interface in Promise mode, the parameter cursorInfo='123' must be + * passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0300',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0300'; + const CURSOR_INFO:any = '123'; + try{ + let data = await inputMethod.getController().updateCursor(CURSOR_INFO); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0600 + * @tc.name The input method keyboard is not bound, and the changeSelection interface is called in Promise mode + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0600',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0600'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + try{ + let data = await inputMethod.getController().detach(); + console.info(`${CASE_NAME} clsoe inputMethod success, data: ${JSON.stringify(data)}`); + }catch(error){ + console.info(`${CASE_NAME} clsoe inputMethod fial, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + try{ + let data = await inputMethod.getController().updateCursor(CURSOR_INFO); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_METHOD_CLIENT_DETACHED); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0700 + * @tc.name Call the updateCursor interface in Promise mode, and pass in an invalid input parameter + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0700',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0700'; + const CURSOR_INFO = {left: 2, top: 2, width: 2, height: 2}; + try{ + let data = await inputMethod.getController().updateCursor(CURSOR_INFO,env.INVALID_TYPE_STRING_A); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, error: [${error.code}, ${error.message}]`); + expectFalse(); + done(); + return; + }; + }); + + /** + * @tc.number SUB_Misc_inputMethod_updateCursor_Promise_0800 + * @tc.name The Promise method calls the updateCursor interface. If it is missing, + * the parameter cursorInfo must be passed in + * @tc.desc Function test + */ + it('SUB_Misc_inputMethod_updateCursor_Promise_0800',0, async function (done) { + const CASE_NAME = 'SUB_Misc_inputMethod_updateCursor_Promise_0800'; + try{ + let data = await inputMethod.getController().updateCursor(); + console.info(`${CASE_NAME} execution success, data: ${JSON.stringify(data)}`); + expectFalse(); + done(); + return; + }catch(error){ + console.info(`${CASE_NAME} catch error, except error: [${error.code}, ${error.message}]`); + expectTrue(error.code === env.INVALID_INPUT_PARAMETER); + done(); + return; + }; + }); + + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/lib/Const.ets b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/lib/Const.ets new file mode 100644 index 000000000..57eb6b51e --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/ets/test/lib/Const.ets @@ -0,0 +1,29 @@ +//ts-nocheck +//public invalid +/* + * Copyright (c) 2023 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. + */ +export const INVALID_OBJ_NULL:any = {}; +export const INVALID_TYPE_NUMBER_123:any = 123; +export const INVALID_TYPE_STRING_123:any = '123'; +export const INVALID_STRING_NULL:any = ''; +export const INVALID_TYPE_STRING_A:any = 'a'; +export const INVALID_NULL:any = null; +export const INVALID_ENUM_N1:any = -1; +export const INVALID_ENUM_2:any = 2; +//---------------------------------------- +export const INVALID_INPUT_PARAMETER = 401; +export const INVALID_INPUT_METHOD_CLIENT_DETACHED = 12800009; + + diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/module.json b/inputmethod/InputMethodDrawnControl/entry/src/main/module.json new file mode 100644 index 000000000..ef30ac2ab --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/module.json @@ -0,0 +1,49 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.inputmethoddrawncontrol.test.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.CONNECT_IME_ABILITY" + } + ] + } +} diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/element/string.json b/inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..b8f160069 --- /dev/null +++ b/inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsInputMethodDrawnControlTest" + }, + { + "name": "ime_description", + "value": "input method extension ability." + }, + { + "name": "ime_label", + "value": "inputMethod extension ability services." + }, + { + "name": "ime_label_1", + "value": "inputMethod extension ability services_1." + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} diff --git a/inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/media/icon.png b/inputmethod/InputMethodDrawnControl/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|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Ud} zZhA4kYkR?$JI|L*dGpv~n&@MtW`uOGN?Px-X3&%SR@o&=SANbwZ)sfbx4w;@jeW3Wzv69mZLdDJjd*cU77fp`z)1MtZ+kf*rXOE48 zVs-EaQF^L6xxv*xOLu9nXUA)gKVJMw{Em|ovbTKu(EE<%$$=Hz>4Z1EJp6`X{T;_E zkgNiQB)bznSU~K$v~lQ09sV}zi-Jj4-bRHg1djdhMWq0@Trmpsk+JYntO7>F3iNtI zm8At#UL92EguyzvtQn{G~di0Wk1~O{dnMuM?NY4%X8;#(ZBY-`aHPt%1y3R zQ-D-X&s)1;{pd5j^QWvib^J1Up|E1ZU6K3!bKk4l_lJS^#$7lZR+joKE#LLuyZ-nS dCik*c+jNDMzn}cg4a?tZ3Rax%?Vs?b=D+Z}hW`Kn literal 0 HcmV?d00001 diff --git a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts index 1dbd418fd..dbed7ee64 100644 --- a/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts +++ b/inputmethod/InputMethodEngine/entry/src/main/ets/InputMethodAbility/KeyboardDelegate.ts @@ -543,7 +543,7 @@ export class KeyboardDelegate { }; commoneventmanager.publish("inputMethodAbility_test_035", commonEventPublishData, this.publishCallback); } else { - let value = InputClient.insertText('test'); + let value = await InputClient.insertText('test'); console.debug(TAG + '====>inputMethodAbility_test_035 insertText value:' + JSON.stringify(value)); if (value) { commonEventPublishData = { @@ -605,7 +605,7 @@ export class KeyboardDelegate { }; commoneventmanager.publish("inputMethodAbility_test_037", commonEventPublishData, this.publishCallback); } else { - let value = InputClient.getForward(1); + let value = await InputClient.getForward(1); console.debug(TAG + '====>inputMethodAbility_test_037 getForward value' + JSON.stringify(value)); if (value) { commonEventPublishData = { @@ -667,7 +667,7 @@ export class KeyboardDelegate { }; commoneventmanager.publish("inputMethodAbility_test_039", commonEventPublishData, this.publishCallback); } else { - let value = InputClient.getEditorAttribute(); + let value = await InputClient.getEditorAttribute(); console.debug(TAG + '====>inputMethodAbility_test_039 getEditorAttribute value:' + JSON.stringify(value)); if (value) { commonEventPublishData = { @@ -787,7 +787,7 @@ export class KeyboardDelegate { }; commoneventmanager.publish("inputMethodAbility_test_043", commonEventPublishData, this.publishCallback); } else { - let value = InputClient.getBackward(1); + let value = await InputClient.getBackward(1); console.debug(TAG + '====>inputMethodAbility_test_043 getBackward value:' + JSON.stringify(value)); commonEventPublishData = { data: "SUCCESS" diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets index 43d444d82..9582c06ac 100644 --- a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets @@ -13,8 +13,8 @@ * limitations under the License. */ import imeAbilityTest from './imeAbilityTest.test' -import inputMethodStageJSUnit from './inputMethodStageJSUnit'; -import inputMethodNormalStageJSUnit from './inputMethodNormalStageJSUnit'; +import inputMethodStageJSUnit from './inputMethodStageJSUnit.test'; +import inputMethodNormalStageJSUnit from './inputMethodNormalStageJSUnit.test'; export default function testsuite() { imeAbilityTest(globalThis.abilityContext); diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodNormalStageJSUnit.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodNormalStageJSUnit.test.ets similarity index 100% rename from inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodNormalStageJSUnit.ets rename to inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodNormalStageJSUnit.test.ets diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.test.ets similarity index 100% rename from inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets rename to inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.test.ets diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets index 6b78af64c..4fe059ec1 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import inputMethodJSUnit from './inputMethodJSUnit'; -import inputMethodNormalJSUnit from './inputMethodNormalJSUnit'; +import inputMethodJSUnit from './inputMethodJSUnit.test'; +import inputMethodNormalJSUnit from './inputMethodNormalJSUnit.test'; export default function testsuite() { inputMethodJSUnit(); diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.test.ets similarity index 100% rename from inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.test.ets diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets similarity index 100% rename from inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodNormalJSUnit.test.ets diff --git a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts index 1dd313622..f4c587c11 100644 --- a/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts +++ b/inputmethod/InputMethodWindManage/entry/src/main/ets/InputMethodWindManage/KeyboardController.ts @@ -108,14 +108,6 @@ export class KeyboardController { console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); break; - case 90: - console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 event:' + data.event); - that.Sub_Misc_inputMethod_Panel_resizeCallback_0090(); - break; - case 100: - console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); - that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); - break; case 110: console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 event:' + data.event); that.Sub_Misc_inputMethod_Panel_moveToCallback_0110(); @@ -306,7 +298,7 @@ export class KeyboardController { console.info('====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 Succeed in destroying panel.' + JSON.stringify(panel)); } commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); - }) + }); }catch(error){ commonEventPublishData = { data: "FAILED" @@ -614,7 +606,7 @@ export class KeyboardController { console.info('====>Sub_Misc_inputMethod_Panel_showCallback_0130 Succeed in showing the panel: ' + JSON.stringify(data)); } commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); - }) + }); }else{ commonEventPublishData = { data: "FAILED" diff --git a/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets b/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets index fd10a4e7c..ce3aca631 100644 --- a/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets +++ b/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets @@ -13,8 +13,8 @@ * limitations under the License. */ -import screenLockJSUnit from './screenLockTest'; -import ScreenLockPromiseTest from './screenLockPromiseTest'; +import screenLockJSUnit from './screenLockTest.test'; +import ScreenLockPromiseTest from './screenLockPromiseTest.test'; export default function testsuite() { screenLockJSUnit(); diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.test.ets similarity index 100% rename from theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets rename to theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.test.ets diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.test.ets similarity index 100% rename from theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets rename to theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.test.ets diff --git a/theme/wallpaper_authority_ets/entry/src/main/ets/test/List.test.ets b/theme/wallpaper_authority_ets/entry/src/main/ets/test/List.test.ets index f1269cd76..85b3db170 100644 --- a/theme/wallpaper_authority_ets/entry/src/main/ets/test/List.test.ets +++ b/theme/wallpaper_authority_ets/entry/src/main/ets/test/List.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import wallpaperAuthorityJSUnit from './wallpaperauthorityTest'; +import wallpaperAuthorityJSUnit from './wallpaperauthorityTest.test'; export default function testsuite() { wallpaperAuthorityJSUnit(); diff --git a/theme/wallpaper_authority_ets/entry/src/main/ets/test/wallpaperauthorityTest.ets b/theme/wallpaper_authority_ets/entry/src/main/ets/test/wallpaperauthorityTest.test.ets similarity index 100% rename from theme/wallpaper_authority_ets/entry/src/main/ets/test/wallpaperauthorityTest.ets rename to theme/wallpaper_authority_ets/entry/src/main/ets/test/wallpaperauthorityTest.test.ets diff --git a/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets b/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets index 7b163c54b..7ed6b6eb6 100644 --- a/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets +++ b/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets @@ -13,8 +13,8 @@ * limitations under the License. */ -import wallpaperJSUnit from './wallpaperTest'; -import wallpaperNoPermissionTest from './wallpapernopermissionTest'; +import wallpaperJSUnit from './wallpaperTest.test'; +import wallpaperNoPermissionTest from './wallpapernopermissionTest.test'; export default function testsuite() { wallpaperJSUnit(); diff --git a/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets b/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.test.ets similarity index 100% rename from theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets rename to theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.test.ets diff --git a/theme/wallpaper_ets/entry/src/main/ets/test/wallpapernopermissionTest.ets b/theme/wallpaper_ets/entry/src/main/ets/test/wallpapernopermissionTest.test.ets similarity index 100% rename from theme/wallpaper_ets/entry/src/main/ets/test/wallpapernopermissionTest.ets rename to theme/wallpaper_ets/entry/src/main/ets/test/wallpapernopermissionTest.test.ets diff --git a/time/timeTest/entry/src/main/ets/test/List.test.ets b/time/timeTest/entry/src/main/ets/test/List.test.ets index 66ced2dad..2e41e200d 100644 --- a/time/timeTest/entry/src/main/ets/test/List.test.ets +++ b/time/timeTest/entry/src/main/ets/test/List.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import systemTimeJsunit from './systemTimeTest'; +import systemTimeJsunit from './systemTimeTest.test'; import systemTimeNoPermissionTest from './timeNoPermission.test' export default function testsuite() { diff --git a/time/timeTest/entry/src/main/ets/test/systemTimeTest.ets b/time/timeTest/entry/src/main/ets/test/systemTimeTest.test.ets similarity index 100% rename from time/timeTest/entry/src/main/ets/test/systemTimeTest.ets rename to time/timeTest/entry/src/main/ets/test/systemTimeTest.test.ets -- GitLab