未验证 提交 3470abf1 编写于 作者: O openharmony_ci 提交者: Gitee

!8926 【杂散】【输入法框架】inputEngine属性接口覆盖

Merge pull request !8926 from 张育帅/OpenHarmony-3.2-Release
......@@ -305,7 +305,7 @@ export class KeyboardController {
} else {
let editorAttribyte = await InputClient.getEditorAttribute();
console.debug(TAG + '====>inputMethodEngine_test_029 editorAttribyte:' + JSON.stringify(editorAttribyte));
let value = await InputClient.sendKeyFunction(editorAttribyte.enterKeyType);
let value = await InputClient.sendKeyFunction(editorAttribyte.inputPattern);
console.debug(TAG + '====>inputMethodEngine_test_029 sendKeyFunction:' + JSON.stringify(value));
if (value){
commonEventPublishData = {
......@@ -867,7 +867,8 @@ export class KeyboardController {
inputKeyboardDelegate.on('keyDown', (keyEvent) => {
inputKeyboardDelegate.off('keyDown');
console.info(TAG + "====>inputKeyboardDelegate.on('keyDown') count: " + count);
if (keyEvent.keyCode === 2000){
console.info(TAG + "====>inputKeyboardDelegate.keyEvent.keyAction " + keyEvent.keyAction);
if (keyEvent.keyCode === 2000 && keyEvent.keyAction === 2){
count += 1;
}
return true;
......@@ -875,7 +876,8 @@ export class KeyboardController {
inputKeyboardDelegate.on('keyUp', (keyEvent) => {
inputKeyboardDelegate.off('keyUp');
console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
if (keyEvent.keyCode === 2000){
console.info(TAG + "====>inputKeyboardDelegate.keyEvent.keyAction " + keyEvent.keyAction);
if (keyEvent.keyCode === 2000 && keyEvent.keyAction === 3){
count += 1;
}
return true;
......
......@@ -1878,5 +1878,6 @@ export default function inputMethodAbility() {
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
});
};
......@@ -19,6 +19,31 @@ import subtype from '@ohos.InputMethodSubtype';
export default function inputMethodStageJSUnit() {
describe('inputMethodTest', function () {
console.info("====>************* settings Test start*************");
var inputServer = {
packageName: '',
methodId: '',
name:'',
id:'',
extra:{}
}
var inputServerCopy = {
packageName : "com.acts.imeability.test",
methodId : "com.acts.imeability.test.ImExtAbility",
name:"com.acts.imeability.test",
id:"com.acts.imeability.test.ImExtAbility",
extra:{}
}
beforeAll(async (done)=>{
let inputM = inputMethod.getCurrentInputMethod()
console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM));
inputServer.packageName = inputM.packageName;
inputServer.methodId = inputM.methodId;
inputServer.name = inputM.packageName;
inputServer.id = inputM.methodId;
})
/*
* @tc.number inputMethod_test_getController_001
* @tc.name get inputMethod controller
......@@ -608,5 +633,63 @@ export default function inputMethodStageJSUnit() {
})
});
it('Sub_Misc_inputMethod_onImeChange_0150', 0, async function (done) {
let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.on("imeChange", async (inputMethodProperty, inputMethodSubtype) => {
inputMethodSetting.off("imeChange");
let t = setTimeout(async () => {
clearTimeout(t);
await inputMethod.switchInputMethod(inputServer);
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodProperty:" + JSON.stringify(inputServerCopy));
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 inputMethodSubtype:" + JSON.stringify(inputMethodSubtype));
expect(typeof(inputMethodProperty) !== null).assertTrue();
expect(typeof(inputMethodSubtype) !== null).assertTrue();
done();
},200);
})
try {
await inputMethod.switchInputMethod(inputServerCopy);
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod success" + JSON.stringify(inputServer));
} catch (err) {
console.info("====>Sub_Misc_inputMethod_onImeChange_0150 switchInputMethod fail" + JSON.stringify(err));
}
});
it('Sub_Misc_inputMethod_offImeChange_0160', 0, async function (done) {
let count = 0;
let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.on("imeChange", (inputMethodProperty, inputMethodSubtype) => {
inputMethodSetting.off("imeChange");
count += 1;
console.info("====>Sub_Misc_inputMethod_offImeChange_0160 count:" + count);
})
try {
console.info('====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod 001');
let t = setTimeout(async () => {
clearTimeout(t);
await inputMethod.switchInputMethod(inputServerCopy);
},200);
console.info('====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod 002');
let t1 = setTimeout(async () => {
clearTimeout(t1);
await inputMethod.switchInputMethod(inputServer);
},200);
} catch (err) {
console.info("====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod fail" + JSON.stringify(err));
}
let t = setTimeout(() => {
clearTimeout(t);
try {
console.info('====>Sub_Misc_inputMethod_offImeChange_0160 setTimeout count: ' + count);
expect(count === 1).assertTrue();
} catch (err) {
console.info("====>Sub_Misc_inputMethod_offImeChange_0160 switchInputMethod fail" + JSON.stringify(err));
}
done();
},1000);
});
});
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册