提交 7d6f41de 编写于 作者: Z zhangyushuai

input用例优化属性覆盖

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 54746d79
...@@ -201,6 +201,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -201,6 +201,7 @@ export default function inputMethodAuthorityJSUnit() {
name:inputM.packageName, name:inputM.packageName,
id:inputM.methodId, id:inputM.methodId,
label: "", label: "",
labelId: 123,
icon: "", icon: "",
iconId: 124, iconId: 124,
extra:{} extra:{}
...@@ -210,6 +211,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -210,6 +211,7 @@ export default function inputMethodAuthorityJSUnit() {
let inputMethodSubProperty : subtype = { let inputMethodSubProperty : subtype = {
id: inputMS.id, id: inputMS.id,
label: "", label: "",
labelId: 123,
name: inputMS.name, name: inputMS.name,
mode: "lower", mode: "lower",
locale: "", locale: "",
...@@ -253,6 +255,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -253,6 +255,7 @@ export default function inputMethodAuthorityJSUnit() {
name:inputM.packageName, name:inputM.packageName,
id:inputM.methodId, id:inputM.methodId,
label: "", label: "",
labelId: 123,
icon: "", icon: "",
iconId: 124, iconId: 124,
extra:{} extra:{}
...@@ -262,6 +265,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -262,6 +265,7 @@ export default function inputMethodAuthorityJSUnit() {
let inputMethodSubProperty : subtype = { let inputMethodSubProperty : subtype = {
id: inputMS.id, id: inputMS.id,
label: "", label: "",
labelId: 123,
name: inputMS.name, name: inputMS.name,
mode: "lower", mode: "lower",
locale: "", locale: "",
...@@ -302,6 +306,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -302,6 +306,7 @@ export default function inputMethodAuthorityJSUnit() {
let inputMethodSubProperty : subtype = { let inputMethodSubProperty : subtype = {
id: inputMS.id, id: inputMS.id,
label: "", label: "",
labelId: 123,
name: inputMS.name, name: inputMS.name,
mode: "lower", mode: "lower",
locale: "", locale: "",
...@@ -342,6 +347,7 @@ export default function inputMethodAuthorityJSUnit() { ...@@ -342,6 +347,7 @@ export default function inputMethodAuthorityJSUnit() {
let inputMethodSubProperty : subtype = { let inputMethodSubProperty : subtype = {
id: inputMS.id, id: inputMS.id,
label: "", label: "",
labelId: 123,
name: inputMS.name, name: inputMS.name,
mode: "lower", mode: "lower",
locale: "", locale: "",
......
...@@ -25,5 +25,6 @@ export default class InputDemoService extends InputMethodExtensionAbility { ...@@ -25,5 +25,6 @@ export default class InputDemoService extends InputMethodExtensionAbility {
onDestroy() { onDestroy() {
console.log("onDestroy inputStageService**"); console.log("onDestroy inputStageService**");
this.keyboardDelegate.onDestroy();
} }
} }
\ No newline at end of file
...@@ -35,22 +35,21 @@ export class KeyboardDelegate { ...@@ -35,22 +35,21 @@ export class KeyboardDelegate {
this.mContext = context; this.mContext = context;
} }
public onCreate(): void { private onInputStop() {
this.initWindow();
let that = this;
inputMethodAbility.on("inputStop", () => {
inputMethodAbility.off("inputStop", () => {
console.log('====>inputMethodEngine delete inputStop notification.');
});
try{ try{
that.mContext.destroy((err) => { this.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodAbility destroy err:' + JSON.stringify(err)); console.info(TAG + '====>inputMethodEngine destroy err:' + JSON.stringify(err));
}) })
}catch(err){ }catch(err){
console.info(TAG + '====>inputMethodAbility destroy catch err:' + JSON.stringify(err)); console.info(TAG + '====>inputMethodEngine destroy catch err:' + JSON.stringify(err));
console.info(TAG + '====>inputMethodAbility destroy catch err:' + err); }
} }
})
public onCreate(): void {
this.initWindow();
let that = this;
this.onInputStop = this.onInputStop.bind(this)
inputMethodAbility.on('inputStop', this.onInputStop)
function subscriberCallback(err, data) { function subscriberCallback(err, data) {
console.debug(TAG + '====>receive event err:' + JSON.stringify(err)); console.debug(TAG + '====>receive event err:' + JSON.stringify(err));
...@@ -172,6 +171,10 @@ export class KeyboardDelegate { ...@@ -172,6 +171,10 @@ export class KeyboardDelegate {
console.debug(TAG + '====>inputMethodAbility_test_074 event:' + data.event); console.debug(TAG + '====>inputMethodAbility_test_074 event:' + data.event);
that.inputMethodAbility_test_074(); that.inputMethodAbility_test_074();
break; break;
case 91:
console.debug(TAG + '====>inputMethodAbility_test_091 event:' + data.event);
that.inputMethodAbility_test_091();
break;
case 101: case 101:
console.debug(TAG + '====>inputMethodAbility_test_0101 event:' + data.event); console.debug(TAG + '====>inputMethodAbility_test_0101 event:' + data.event);
that.inputMethodAbility_test_101(); that.inputMethodAbility_test_101();
...@@ -255,16 +258,8 @@ export class KeyboardDelegate { ...@@ -255,16 +258,8 @@ export class KeyboardDelegate {
public onDestroy(): void { public onDestroy(): void {
console.debug(TAG + '====>onDestroy'); console.debug(TAG + '====>onDestroy');
globalThis.textInputClient.getTextIndexAtCursor().then((index) => { inputMethodAbility.off('inputStop', this.onInputStop)
console.debug(TAG + '====>getTextIndexAtCursor index:' + index);
promptAction.showToast({ message: 'getTextIndexAtCursor success' + index, duration: 200, bottom: 500 });
var win = windowManager.findWindow(this.windowName);
win.destroyWindow();
this.mContext.terminateSelf();
return true;
}).catch((err) => {
promptAction.showToast({ message: 'getTextIndexAtCursor failed', duration: 200, bottom: 500 });
});
} }
private publishCallback(err): void { private publishCallback(err): void {
...@@ -275,6 +270,25 @@ export class KeyboardDelegate { ...@@ -275,6 +270,25 @@ export class KeyboardDelegate {
} }
} }
public async offInputStop_test() {
console.info(TAG + '====>inputMethodAbility_test_091.offInputStop_test callback');
let commonEventPublishData = {
data: "FAILED"
};
this.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodAbility offInputStop_test destroy err: ' + JSON.stringify(err));
commoneventmanager.publish("inputMethodAbility_test_091", commonEventPublishData,() => {});
})
}
public inputMethodAbility_test_091(): void{
console.info(TAG + '====>inputMethodAbility_test_091 start');
this.offInputStop_test = this.offInputStop_test.bind(this);
inputMethodAbility.on("inputStop",this.offInputStop_test);
inputMethodAbility.off("inputStop",this.offInputStop_test);
console.info(TAG + '====>inputMethodAbility_test_091 end');
}
private inputMethodAbility_test_getInputMethodAbility_001(): void { private inputMethodAbility_test_getInputMethodAbility_001(): void {
console.debug(TAG + '====>receive inputMethodAbility_test_getInputMethodAbility_001 data'); console.debug(TAG + '====>receive inputMethodAbility_test_getInputMethodAbility_001 data');
if (typeof(inputMethodAbility) === 'object') { if (typeof(inputMethodAbility) === 'object') {
......
...@@ -42,6 +42,7 @@ export default function inputMethodAbility() { ...@@ -42,6 +42,7 @@ export default function inputMethodAbility() {
let getFocusCmd = ''; let getFocusCmd = '';
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let inputMethodController = inputMethod.getController(); let inputMethodController = inputMethod.getController();
let inputDemoService: subtype;
async function runCmd(cmd){ async function runCmd(cmd){
console.debug('====>runCmd info:' + cmd); console.debug('====>runCmd info:' + cmd);
await abilityDelegator.executeShellCommand(cmd); await abilityDelegator.executeShellCommand(cmd);
...@@ -279,6 +280,22 @@ export default function inputMethodAbility() { ...@@ -279,6 +280,22 @@ export default function inputMethodAbility() {
done(); done();
}); });
it('Sub_Misc_inputMethodEngine_ExtendAction_0100', 0, async function (done) {
let select_all = inputMethodEngine.ExtendAction.SELECT_ALL;
console.info("====>Sub_Misc_inputMethodEngine_ExtendAction_0100 select_all:" + select_all);
expect(select_all).assertEqual(0);
let cut = inputMethodEngine.ExtendAction.CUT;
console.info("====>Sub_Misc_inputMethodEngine_ExtendAction_0100 cut:" + cut);
expect(cut).assertEqual(3);
let copy = inputMethodEngine.ExtendAction.COPY;
console.info("====>Sub_Misc_inputMethodEngine_ExtendAction_0100 copy:" + copy);
expect(copy).assertEqual(4);
let paste = inputMethodEngine.ExtendAction.PASTE;
console.info("====>Sub_Misc_inputMethodEngine_ExtendAction_0100 paste:" + paste);
expect(paste).assertEqual(5);
done();
});
it('inputMethodAbility_test_getInputMethodAbility_001', 0, async function (done) { it('inputMethodAbility_test_getInputMethodAbility_001', 0, async function (done) {
function unSubscriberCallback (err){ function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_getInputMethodAbility_001 unSubscriberCallback start"); console.info("====>inputMethodAbility_test_getInputMethodAbility_001 unSubscriberCallback start");
...@@ -2469,8 +2486,9 @@ export default function inputMethodAbility() { ...@@ -2469,8 +2486,9 @@ export default function inputMethodAbility() {
it('Sub_Misc_inputMethod_onImeChange_0150', 0, async function (done) { it('Sub_Misc_inputMethod_onImeChange_0150', 0, async function (done) {
let inputMethodSetting = inputMethod.getSetting(); let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.on("imeChange", (inputMethodProperty, inputMethodSubtype) => { inputMethodSetting.on("imeChange", async (inputMethodProperty, inputMethodSubtype) => {
inputMethodSetting.off("imeChange"); inputMethodSetting.off("imeChange");
await inputMethod.switchInputMethod(inputServerCopy);
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodProperty:" + JSON.stringify(inputMethodProperty)); console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodProperty:" + JSON.stringify(inputMethodProperty));
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodSubtype:" + JSON.stringify(inputMethodSubtype)); console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodSubtype:" + JSON.stringify(inputMethodSubtype));
expect(typeof(inputMethodProperty) !== null).assertTrue(); expect(typeof(inputMethodProperty) !== null).assertTrue();
...@@ -2480,7 +2498,6 @@ export default function inputMethodAbility() { ...@@ -2480,7 +2498,6 @@ export default function inputMethodAbility() {
try { try {
await inputMethod.switchInputMethod(inputServer); await inputMethod.switchInputMethod(inputServer);
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod success" + JSON.stringify(inputServer)); console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod success" + JSON.stringify(inputServer));
await inputMethod.switchInputMethod(inputServerCopy);
} catch (err) { } catch (err) {
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod fail" + JSON.stringify(err)); console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod fail" + JSON.stringify(err));
} }
...@@ -2518,5 +2535,60 @@ export default function inputMethodAbility() { ...@@ -2518,5 +2535,60 @@ export default function inputMethodAbility() {
},500); },500);
}); });
it('inputMethodAbility_test_091', 0, async function (done) {
let flag = true;
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_091 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_091 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_091 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_091 subscriberCallback data:" + JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
flag = false;
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_091 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_091 publishCallback failed:" + JSON.stringify(err));
} else {
let t = setTimeout(async () => {
await inputMethod.switchInputMethod(inputServer);
console.info("====>inputMethodAbility_test_091 setTimeout first");
let t1 = setTimeout(async () => {
done();
console.info("====>inputMethodAbility_test_091 setTimeout second: " + flag);
expect(flag).assertTrue();
clearTimeout(t1);
await inputMethod.switchCurrentInputMethodSubtype(inputDemoService);
},1000)
clearTimeout(t);
}, 1000)
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_091"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_091 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_091 subscriber finish");
})
var commonEventPublishData = {
code: 91
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
}); });
}; };
...@@ -425,5 +425,109 @@ export default function inputMethodStageJSUnit() { ...@@ -425,5 +425,109 @@ export default function inputMethodStageJSUnit() {
}) })
}); });
it('Sub_Misc_inputMethod_TextInputType_0100', 0, async function (done) {
let none = inputMethod.TextInputType.NONE;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 none:" + none);
expect(none).assertEqual(-1);
let test = inputMethod.TextInputType.TEXT;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 test:" + test);
expect(test).assertEqual(0);
let nultiline = inputMethod.TextInputType.MULTILINE;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 nultiline:" + nultiline);
expect(nultiline).assertEqual(1);
let number = inputMethod.TextInputType.NUMBER;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 number:" + number);
expect(number).assertEqual(2);
let phone = inputMethod.TextInputType.PHONE;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 phone:" + phone);
expect(phone).assertEqual(3);
let datetime = inputMethod.TextInputType.DATETIME;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 datetime:" + datetime);
expect(datetime).assertEqual(4);
let email_addres = inputMethod.TextInputType.EMAIL_ADDRESS;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 email_addres:" + email_addres);
expect(email_addres).assertEqual(5);
let url = inputMethod.TextInputType.URL;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 url:" + url);
expect(url).assertEqual(6);
let visble_password = inputMethod.TextInputType.VISIBLE_PASSWORD;
console.info("====>Sub_Misc_inputMethod_TextInputType_0100 visble_password:" + visble_password);
expect(visble_password).assertEqual(7);
done();
});
it('Sub_Misc_inputMethod_EnterKeyType_0100', 0, async function (done) {
let unspecified = inputMethod.EnterKeyType.UNSPECIFIED;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 unspecified:" + unspecified);
expect(unspecified).assertEqual(0);
let none = inputMethod.EnterKeyType.NONE;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 none:" + none);
expect(none).assertEqual(1);
let go = inputMethod.EnterKeyType.GO;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 go:" + go);
expect(go).assertEqual(2);
let search = inputMethod.EnterKeyType.SEARCH;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 search:" + search);
expect(search).assertEqual(3);
let send = inputMethod.EnterKeyType.SEND;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 send:" + send);
expect(send).assertEqual(4);
let next = inputMethod.EnterKeyType.NEXT;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 next:" + next);
expect(next).assertEqual(5);
let done_ = inputMethod.EnterKeyType.DONE;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 done_:" + done_);
expect(done_).assertEqual(6);
let previous = inputMethod.EnterKeyType.PREVIOUS;
console.info("====>Sub_Misc_inputMethod_EnterKeyType_0100 previous:" + previous);
expect(previous).assertEqual(7);
done();
});
it('Sub_Misc_inputMethod_KeyboardStatus_0100', 0, async function (done) {
let none = inputMethod.KeyboardStatus.NONE;
console.info("====>Sub_Misc_inputMethod_KeyboardStatus_0100 none:" + none);
expect(none).assertEqual(0);
let hide = inputMethod.KeyboardStatus.HIDE;
console.info("====>Sub_Misc_inputMethod_KeyboardStatus_0100 hide:" + hide);
expect(hide).assertEqual(1);
let show = inputMethod.KeyboardStatus.SHOW;
console.info("====>Sub_Misc_inputMethod_KeyboardStatus_0100 show:" + show);
expect(show).assertEqual(2);
done();
});
it('Sub_Misc_inputMethod_ExtendAction_0100', 0, async function (done) {
let select_all = inputMethod.ExtendAction.SELECT_ALL;
console.info("====>Sub_Misc_inputMethod_ExtendAction_0100 select_all:" + select_all);
expect(select_all).assertEqual(0);
let cut = inputMethod.ExtendAction.CUT;
console.info("====>Sub_Misc_inputMethod_ExtendAction_0100 cut:" + cut);
expect(cut).assertEqual(3);
let copy = inputMethod.ExtendAction.COPY;
console.info("====>Sub_Misc_inputMethod_ExtendAction_0100 copy:" + copy);
expect(copy).assertEqual(4);
let paste = inputMethod.ExtendAction.PASTE;
console.info("====>Sub_Misc_inputMethod_ExtendAction_0100 paste:" + paste);
expect(paste).assertEqual(5);
done();
});
it('Sub_Misc_inputMethod_Direction_0100', 0, async function (done) {
let cursor_up = inputMethod.Direction.CURSOR_UP;
console.info("====>Sub_Misc_inputMethod_Direction_0100 cursor_up:" + cursor_up);
expect(cursor_up).assertEqual(1);
let cursor_down = inputMethod.Direction.CURSOR_DOWN;
console.info("====>Sub_Misc_inputMethod_Direction_0100 cursor_down:" + cursor_down);
expect(cursor_down).assertEqual(2);
let cursor_left = inputMethod.Direction.CURSOR_LEFT;
console.info("====>Sub_Misc_inputMethod_Direction_0100 cursor_left:" + cursor_left);
expect(cursor_left).assertEqual(3);
let cursor_right = inputMethod.Direction.CURSOR_RIGHT;
console.info("====>Sub_Misc_inputMethod_Direction_0100 cursor_right:" + cursor_right);
expect(cursor_right).assertEqual(4);
done();
});
}); });
}; };
...@@ -194,5 +194,54 @@ export default function inputMethodJSUnit() { ...@@ -194,5 +194,54 @@ export default function inputMethodJSUnit() {
} }
}); });
}); });
/*
* @tc.number inputmethod_test_getInputMethods_003
* @tc.name param enable :
* if true, collect enabled input methods.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_getInputMethods_003', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethod_test_getInputMethods_003 result:" + JSON.stringify(inputMethodSetting));
try {
let setting = await inputMethodSetting.getInputMethods(true);
console.info("inputmethod_test_getInputMethods_003 success because: " + setting);
expect(typeof(setting) === 'object').assertTrue();
done();
console.info("====>************* inputmethod_test_getInputMethods_003 Test end*************");
done();
} catch (err) {
console.info("inputmethod_test_getInputMethods_003 catch error: " + err);
expect().assertFail();
done();
}
});
/*
* @tc.number inputmethod_test_getInputMethods_004
* @tc.name param enable :
* if false, collect disabled input methods.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_getInputMethods_004', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethod_test_getInputMethods_004 result:" + JSON.stringify(inputMethodSetting));
try {
let setting = await inputMethodSetting.getInputMethods(false);
console.info("inputmethod_test_getInputMethods_004 success because: " + setting);
expect(typeof(setting) === 'object').assertTrue();
done();
console.info("====>************* inputmethod_test_getInputMethods_004 Test end*************");
done();
} catch (err) {
console.info("inputmethod_test_getInputMethods_004 catch error: " + err);
expect().assertFail();
done();
}
});
}); });
}; };
...@@ -140,6 +140,30 @@ export class KeyboardController { ...@@ -140,6 +140,30 @@ export class KeyboardController {
console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 event:' + data.event); console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 event:' + data.event);
that.Sub_Misc_inputMethod_Panel_onHide_0180(); that.Sub_Misc_inputMethod_Panel_onHide_0180();
break; break;
case 190:
console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offShow_0190 event:' + data.event);
that.Sub_Misc_inputMethod_Panel_offShow_0190();
break;
case 200:
console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offHide_0200 event:' + data.event);
that.Sub_Misc_inputMethod_Panel_offHide_0200();
break;
case 201:
console.debug(TAG + '====>Sub_Misc_inputMethod_onImeShow_0201 event:' + data.event);
that.Sub_Misc_inputMethod_onImeShow_0201();
break;
case 202:
console.debug(TAG + '====>Sub_Misc_inputMethod_onImeHide_0202 event:' + data.event);
that.Sub_Misc_inputMethod_onImeHide_0202();
break;
case 203:
console.debug(TAG + '====>Sub_Misc_inputMethod_offImeShow_0203 event:' + data.event);
that.Sub_Misc_inputMethod_offImeShow_0203();
break;
case 204:
console.debug(TAG + '====>Sub_Misc_inputMethod_offImeHide_0204 event:' + data.event);
that.Sub_Misc_inputMethod_offImeHide_0204();
break;
case 210: case 210:
console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 event:' + data.event); console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 event:' + data.event);
that.Sub_Misc_inputMethod_Panel_changeFlag_0210(); that.Sub_Misc_inputMethod_Panel_changeFlag_0210();
...@@ -790,6 +814,191 @@ export class KeyboardController { ...@@ -790,6 +814,191 @@ export class KeyboardController {
} }
} }
private Sub_Misc_inputMethod_Panel_offShow_0190(): void {
let commonEventPublishData = {
data: "FAILED"
};
let count = 0;
let timeCount = 0;
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 success');
try{
if (this.softKeyboardPanel !== null){
this.softKeyboardPanel.on("show", async (err, data) => {
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 offShow if success: ' + JSON.stringify(err));
this.softKeyboardPanel.off("show");
count += 1;
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 off Show count: ' + count);
});
let t1 = setInterval(async () => {
await this.softKeyboardPanel.show();
await this.softKeyboardPanel.hide();
timeCount += 1;
console.info(TAG + '====>this.softKeyboardPanel.show setInterval timeCount: ' + timeCount);
if(timeCount === 2){
clearInterval(t1);
}
},100);
let t2 = setTimeout(() => {
console.info(TAG + '====>setTimeout count: ' + count);
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback);
clearTimeout(t2);
},500);
}else{
commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 this.softKeyboardPanel is null');
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback);
}
}catch(error){
commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 catch error: ' + JSON.stringify(error));
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback);
}
}
private Sub_Misc_inputMethod_Panel_offHide_0200(): void {
let commonEventPublishData = {
data: "FAILED"
};
let count = 0;
let timeCount = 0;
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 success');
try{
if (this.softKeyboardPanel !== null){
this.softKeyboardPanel.on("hide", async (err, data) => {
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 offHide if success: ' + JSON.stringify(err));
this.softKeyboardPanel.off("hide");
count += 1;
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 off hide count: ' + count);
});
let t1 = setInterval(async () => {;
await this.softKeyboardPanel.show();
await this.softKeyboardPanel.hide();
timeCount += 1;
console.info(TAG + '====>this.softKeyboardPanel.hide setInterval timeCount: ' + timeCount);
if(timeCount === 2){
clearInterval(t1);
}
},100);
let t2 = setTimeout(() => {
console.info(TAG + '====>setTimeout count: ' + count);
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback);
clearTimeout(t2);
},500);
}else{
commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 this.softKeyboardPanel is null');
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback);
}
}catch(error){
commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 catch error: ' + JSON.stringify(error));
commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback);
}
}
private async Sub_Misc_inputMethod_onImeShow_0201(): Promise<void> {
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 success');
try{
if (this.softKeyboardPanel !== null){
let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED;
let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING;
this.softKeyboardPanel.changeFlag(fla_fixed);
await this.softKeyboardPanel.hide();
console.info('====>Sub_Misc_inputMethod_onImeShow_0201 show panel');
await this.softKeyboardPanel.show();
console.info('====>Sub_Misc_inputMethod_onImeShow_0201 hide panel');
this.softKeyboardPanel.changeFlag(fla_floating);
}else{
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 this.softKeyboardPanel is null');
}
}catch(error){
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 catch error: ' + JSON.stringify(error));
}
}
private async Sub_Misc_inputMethod_onImeHide_0202(): Promise<void> {
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 success');
try{
if (this.softKeyboardPanel !== null){
let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED;
let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING;
this.softKeyboardPanel.changeFlag(fla_fixed);
await this.softKeyboardPanel.show();
console.info('====>Sub_Misc_inputMethod_onImeHide_0202 show panel');
await this.softKeyboardPanel.hide();
console.info('====>Sub_Misc_inputMethod_onImeHide_0202 hide panel');
this.softKeyboardPanel.changeFlag(fla_floating);
}else{
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 this.softKeyboardPanel is null');
}
}catch(error){
console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 catch error: ' + JSON.stringify(error));
}
}
private async Sub_Misc_inputMethod_offImeShow_0203(): Promise<void> {
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 success');
try{
if (this.softKeyboardPanel !== null){
let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED;
let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING;
this.softKeyboardPanel.changeFlag(fla_fixed);
await this.softKeyboardPanel.hide();
console.info('====>Sub_Misc_inputMethod_offImeShow_0203 show panel');
await this.softKeyboardPanel.show();
console.info('====>Sub_Misc_inputMethod_offImeShow_0203 hide panel');
this.softKeyboardPanel.changeFlag(fla_floating);
}else{
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 this.softKeyboardPanel is null');
}
}catch(error){
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 catch error: ' + JSON.stringify(error));
}
}
private async Sub_Misc_inputMethod_offImeHide_0204(): Promise<void> {
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 success');
try{
if (this.softKeyboardPanel !== null){
let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED;
let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING;
this.softKeyboardPanel.changeFlag(fla_fixed);
await this.softKeyboardPanel.show();
console.info('====>Sub_Misc_inputMethod_offImeHide_0204 show panel');
await this.softKeyboardPanel.hide();
console.info('====>Sub_Misc_inputMethod_offImeHide_0204 hide panel');
this.softKeyboardPanel.changeFlag(fla_floating);
}else{
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 this.softKeyboardPanel is null');
}
}catch(error){
console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 catch error: ' + JSON.stringify(error));
}
}
private Sub_Misc_inputMethod_Panel_changeFlag_0210(): void { private Sub_Misc_inputMethod_Panel_changeFlag_0210(): void {
let commonEventPublishData = { let commonEventPublishData = {
data: "FAILED" data: "FAILED"
......
...@@ -966,6 +966,266 @@ export default function inputMethodWindManageAbility() { ...@@ -966,6 +966,266 @@ export default function inputMethodWindManageAbility() {
commonEventManager.publish("test", commonEventPublishData, publishCallback); commonEventManager.publish("test", commonEventPublishData, publishCallback);
}); });
it('Sub_Misc_inputMethod_Panel_offShow_0190', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 unSubscriberCallback start");
if (err) {
console.error("====>Sub_Misc_inputMethod_Panel_offShow_0190 unSubscriberCallback failed: " + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 unSubscriberCallback finsh");
}
}
function subscriberCallback(err, data) {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 subscriberCallback data: " + JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 end<====");
clearTimeout(t);
done();
} catch (err) {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 end<====" + JSON.stringify(err));
clearTimeout(t)
done();
}
}, 500)
}
async function publishCallback(err) {
if (err) {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 end<====" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 success ====" );
}
}
var commonEventSubscribeInfo = {
events: ["Sub_Misc_inputMethod_Panel_offShow_0190"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) {
subscriber = data;
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 subscribe data: " + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>Sub_Misc_inputMethod_Panel_offShow_0190 subscribe finish====");
})
var commonEventPublishData = {
code: 190
}
commonEventManager.publish("test", commonEventPublishData, publishCallback);
});
it('Sub_Misc_inputMethod_Panel_offHide_0200', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 unSubscriberCallback start");
if (err) {
console.error("====>Sub_Misc_inputMethod_Panel_offHide_0200 unSubscriberCallback failed: " + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 unSubscriberCallback finsh");
}
}
function subscriberCallback(err, data) {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 subscriberCallback data: " + JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 end<====");
clearTimeout(t);
done();
} catch (err) {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 end<====" + JSON.stringify(err));
clearTimeout(t)
done();
}
}, 500)
}
async function publishCallback(err) {
if (err) {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 end<====" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 success ====" );
}
}
var commonEventSubscribeInfo = {
events: ["Sub_Misc_inputMethod_Panel_offHide_0200"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then(function (data) {
subscriber = data;
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 subscribe data: " + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>Sub_Misc_inputMethod_Panel_offHide_0200 subscribe finish====");
})
var commonEventPublishData = {
code: 200
}
commonEventManager.publish("test", commonEventPublishData, publishCallback);
});
it('Sub_Misc_inputMethod_onImeShow_0201', 0, async function (done) {
function publishCallback(err){
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 publishCallback start");
if (err){
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 publishCallback failed:" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 publishCallback success:");
}
}
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 imeShow start" );
let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.on("imeShow", (inputWindowInfo) => {
inputMethodSetting.off("imeShow");
try {
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 imeShow inputWindowInfo:" + JSON.stringify(inputWindowInfo));
expect(typeof(inputWindowInfo[0].name) === 'string').assertTrue();
expect(typeof(inputWindowInfo[0].left) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].top) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].width) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].height) === 'number').assertTrue();
done();
} catch (err) {
console.info('====>Sub_Misc_inputMethod_onImeShow_0201 imeShow catch err: ' + JSON.stringify(err));
done();
}
})
console.info("====>Sub_Misc_inputMethod_onImeShow_0201 imeShow end" );
var commonEventPublishData = {
code: 201
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('Sub_Misc_inputMethod_onImeHide_0202', 0, async function (done) {
function publishCallback(err){
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 publishCallback start");
if (err){
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 publishCallback failed:" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 publishCallback success:");
}
}
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 imeHide start" );
let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.on("imeHide", (inputWindowInfo) => {
inputMethodSetting.off("imeHide");
try {
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 imeHide inputWindowInfo:" + JSON.stringify(inputWindowInfo));
expect(typeof(inputWindowInfo[0].name) === 'string').assertTrue();
expect(typeof(inputWindowInfo[0].left) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].top) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].width) === 'number').assertTrue();
expect(typeof(inputWindowInfo[0].height) === 'number').assertTrue();
done();
} catch (err) {
console.info('====>Sub_Misc_inputMethod_onImeHide_0202 imeHide catch err: ' + JSON.stringify(err));
done();
}
})
console.info("====>Sub_Misc_inputMethod_onImeHide_0202 imeHide end" );
var commonEventPublishData = {
code: 202
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('Sub_Misc_inputMethod_offImeShow_0203', 0, async function (done) {
function publishCallback(err){
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 publishCallback start");
if (err){
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 publishCallback failed:" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 publishCallback success:");
}
}
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow start" );
let flat = true;
let inputMethodSetting = inputMethod.getSetting();
let inputwind = (inputWindowInfo) => {
flat = false;
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow inputWindowInfo:" + JSON.stringify(inputWindowInfo));
}
inputMethodSetting.on("imeShow", inputwind)
inputMethodSetting.off("imeShow", inputwind);
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow end" );
var commonEventPublishData = {
code: 203
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
let t = setTimeout(() => {
if(flat){
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow off success" );
expect(true).assertTrue();
done();
}else{
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow off fail" );
try{
expect().assertFail();
done();
}catch(err){
console.info("====>Sub_Misc_inputMethod_offImeShow_0203 imeShow off catch err: " + JSON.stringify(err));
done();
}
}
clearTimeout(t);
}, 1000);
});
it('Sub_Misc_inputMethod_offImeHide_0204', 0, async function (done) {
function publishCallback(err){
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 publishCallback start");
if (err){
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 publishCallback failed:" + JSON.stringify(err));
} else {
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 publishCallback success:");
}
}
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide start" );
let flat = true;
let inputMethodSetting = inputMethod.getSetting();
let inputwind = (inputWindowInfo) => {
flat = false;
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide inputWindowInfo:" + JSON.stringify(inputWindowInfo));
}
inputMethodSetting.on("imeHide", inputwind)
inputMethodSetting.off("imeHide", inputwind);
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide end" );
var commonEventPublishData = {
code: 203
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
let t = setTimeout(() => {
if(flat){
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide off success" );
expect(true).assertTrue();
done();
}else{
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide off fail" );
try{
expect().assertFail();
done();
}catch(err){
console.info("====>Sub_Misc_inputMethod_offImeHide_0204 imeHide off catch err: " + JSON.stringify(err));
done();
}
}
clearTimeout(t);
}, 1000);
});
it('Sub_Misc_inputMethod_Panel_changeFlag_0210', 0, async function (done) { it('Sub_Misc_inputMethod_Panel_changeFlag_0210', 0, async function (done) {
function unSubscriberCallback(err) { function unSubscriberCallback(err) {
console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 unSubscriberCallback start"); console.info("====>Sub_Misc_inputMethod_Panel_changeFlag_0210 unSubscriberCallback start");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册