提交 8aea518b 编写于 作者: Z zhangyushuai

覆盖input属性和接口 001

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 979060cf
...@@ -305,7 +305,7 @@ export class KeyboardController { ...@@ -305,7 +305,7 @@ export class KeyboardController {
} else { } else {
let editorAttribyte = await InputClient.getEditorAttribute(); let editorAttribyte = await InputClient.getEditorAttribute();
console.debug(TAG + '====>inputMethodEngine_test_029 editorAttribyte:' + JSON.stringify(editorAttribyte)); 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)); console.debug(TAG + '====>inputMethodEngine_test_029 sendKeyFunction:' + JSON.stringify(value));
if (value){ if (value){
commonEventPublishData = { commonEventPublishData = {
...@@ -867,7 +867,8 @@ export class KeyboardController { ...@@ -867,7 +867,8 @@ export class KeyboardController {
inputKeyboardDelegate.on('keyDown', (keyEvent) => { inputKeyboardDelegate.on('keyDown', (keyEvent) => {
inputKeyboardDelegate.off('keyDown'); inputKeyboardDelegate.off('keyDown');
console.info(TAG + "====>inputKeyboardDelegate.on('keyDown') count: " + count); 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; count += 1;
} }
return true; return true;
...@@ -875,7 +876,8 @@ export class KeyboardController { ...@@ -875,7 +876,8 @@ export class KeyboardController {
inputKeyboardDelegate.on('keyUp', (keyEvent) => { inputKeyboardDelegate.on('keyUp', (keyEvent) => {
inputKeyboardDelegate.off('keyUp'); inputKeyboardDelegate.off('keyUp');
console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count); 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; count += 1;
} }
return true; return true;
......
...@@ -1878,5 +1878,6 @@ export default function inputMethodAbility() { ...@@ -1878,5 +1878,6 @@ export default function inputMethodAbility() {
} }
commonEventManager.publish('test', commonEventPublishData, publishCallback); commonEventManager.publish('test', commonEventPublishData, publishCallback);
}); });
}); });
}; };
...@@ -19,6 +19,31 @@ import subtype from '@ohos.InputMethodSubtype'; ...@@ -19,6 +19,31 @@ import subtype from '@ohos.InputMethodSubtype';
export default function inputMethodStageJSUnit() { export default function inputMethodStageJSUnit() {
describe('inputMethodTest', function () { describe('inputMethodTest', function () {
console.info("====>************* settings Test start*************"); 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.number inputMethod_test_getController_001
* @tc.name get inputMethod controller * @tc.name get inputMethod controller
...@@ -608,5 +633,63 @@ export default function inputMethodStageJSUnit() { ...@@ -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.
先完成此消息的编辑!
想要评论请 注册