提交 ebe7cee2 编写于 作者: Z zhangyushuai

optrmize inputmethoEngine 001

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 96bea9a1
......@@ -25,6 +25,5 @@ export default class InputDemoService extends InputMethodExtensionAbility {
onDestroy() {
console.log("onDestroy inputStageService**");
this.context.destroy();
}
}
\ No newline at end of file
......@@ -38,6 +38,16 @@ export class KeyboardDelegate {
public onCreate(): void {
this.initWindow();
let that = this;
inputMethodAbility.on("inputStop", () => {
try{
that.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodAbility destroy err:' + JSON.stringify(err));
})
}catch(err){
console.info(TAG + '====>inputMethodAbility destroy catch err:' + JSON.stringify(err));
console.info(TAG + '====>inputMethodAbility destroy catch err:' + err);
}
})
function subscriberCallback(err, data) {
console.debug(TAG + '====>receive event err:' + JSON.stringify(err));
......
......@@ -25,6 +25,5 @@ export default class InputDemoService extends InputMethodExtensionAbility {
onDestroy() {
console.log("onDestroy inputMethodEngine**");
this.context.destroy();
}
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ import commoneventmanager from '@ohos.commonEventManager';
let inputMethodEngine = inputmethodengine.getInputMethodEngine();
let inputKeyboardDelegate = inputmethodengine.createKeyboardDelegate();
let inputMethodAbility = inputmethodengine.getInputMethodAbility();
const TAG = "keyboardController";
export class KeyboardController {
......@@ -38,6 +39,15 @@ export class KeyboardController {
public onCreate(): void {
this.initWindow();
let that = this;
inputMethodAbility.on("inputStop", () => {
try{
that.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodEngine destroy err:' + JSON.stringify(err));
})
}catch(err){
console.info(TAG + '====>inputMethodEngine destroy catch err:' + JSON.stringify(err));
}
})
function subscriberCallback(err, data) {
console.debug(TAG + '====>receive event err: ' + JSON.stringify(err));
......
......@@ -17,5 +17,5 @@ import inputMethodAbility from './inputMethodAbility.test'
export default function testsuite() {
inputMethodEngine();
inputMethodAbility()
inputMethodAbility();
}
\ No newline at end of file
......@@ -69,6 +69,19 @@ export default function inputMethodAbility() {
}
})
afterAll(async (done) => {
try {
await inputMethod.switchInputMethod(inputServer);
console.info("====>afterAll: inputMethodStageJSUnit switchInputMethod success" + JSON.stringify(inputServer));
setTimeout(() => {
console.info("====>afterAll: inputMethodStageJSUnit switchInputMethod success");
done();
}, 2000)
} catch (err) {
console.info("====>afterAll: inputMethodStageJSUnit fail" + JSON.stringify(err));
}
})
it('inputMethodEngine_test_001', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED;
console.info("====>inputMethodEngine_test_001 result:" + keyType);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册