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

!5458 【杂散】【输入法框架】补充分布式输入框架API接口

Merge pull request !5458 from 张育帅/master
...@@ -84,10 +84,10 @@ export default function inputMethodJSUnit() { ...@@ -84,10 +84,10 @@ export default function inputMethodJSUnit() {
console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl)); console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput().then(data => { inputMethodCtrl.stopInput().then(data => {
console.info("inputmethoh_test_006 stopInput result----" + data); console.info("inputmethoh_test_006 stopInput result----" + data);
expect(data == true).assertTrue() expect(data == true).assertTrue();
}).catch(err => { }).catch(err => {
console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err)); console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err));
expect().assertFail() expect().assertFail();
}); });
done(); done();
}); });
...@@ -118,12 +118,12 @@ export default function inputMethodJSUnit() { ...@@ -118,12 +118,12 @@ export default function inputMethodJSUnit() {
packageName:"com.example.kikakeyboard", packageName:"com.example.kikakeyboard",
methodId:"ServiceExtAbility" methodId:"ServiceExtAbility"
} }
inputMethod.switchInputMethod(inputMethodProperty).then(data => { inputMethod.switchInputMethod(inputMethodProperty).then(data => {
console.info("inputmethod_test_switchInputMethod_001 data:" + data) console.info("inputmethod_test_switchInputMethod_001 data:" + data)
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}).catch( err=> { }).catch( err=> {
console.info("inputmethod_test_switchInputMethod_001 err:" + err) console.info("inputmethod_test_switchInputMethod_001 err:" + err)
expect().assertFail();
}) })
console.info("************* inputmethod_test_switchInputMethod_001 Test end*************"); console.info("************* inputmethod_test_switchInputMethod_001 Test end*************");
done(); done();
...@@ -144,7 +144,7 @@ export default function inputMethodJSUnit() { ...@@ -144,7 +144,7 @@ export default function inputMethodJSUnit() {
inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{ inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{
if(err){ if(err){
console.info("inputmethod_test_switchInputMethod_002 error:" + err); console.info("inputmethod_test_switchInputMethod_002 error:" + err);
expect().assertFail() expect().assertFail();
} }
console.info("inputmethod_test_switchInputMethod_002 data:" + data) console.info("inputmethod_test_switchInputMethod_002 data:" + data)
expect(data == true).assertTrue(); expect(data == true).assertTrue();
...@@ -164,8 +164,10 @@ export default function inputMethodJSUnit() { ...@@ -164,8 +164,10 @@ export default function inputMethodJSUnit() {
inputMethodCtrl.showSoftKeyboard((data)=>{ inputMethodCtrl.showSoftKeyboard((data)=>{
if(data == undefined){ if(data == undefined){
console.info("showSoftKeyboard callbace success" ); console.info("showSoftKeyboard callbace success" );
expect(true).assertTrue();
}else{ }else{
console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err)) console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err))
expect().assertFail();
} }
}); });
console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************"); console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************");
...@@ -182,8 +184,10 @@ export default function inputMethodJSUnit() { ...@@ -182,8 +184,10 @@ export default function inputMethodJSUnit() {
let inputMethodCtrl = inputMethod.getInputMethodController() let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard().then((data) =>{ inputMethodCtrl.showSoftKeyboard().then((data) =>{
console.info("showSoftKeyboard promise success" ); console.info("showSoftKeyboard promise success" );
expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err)) console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err))
expect().assertFail();
}) })
console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************"); console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************");
done(); done();
...@@ -200,8 +204,10 @@ export default function inputMethodJSUnit() { ...@@ -200,8 +204,10 @@ export default function inputMethodJSUnit() {
inputMethodCtrl.hideSoftKeyboard((data)=>{ inputMethodCtrl.hideSoftKeyboard((data)=>{
if(data == undefined){ if(data == undefined){
console.info("hideSoftKeyboard callbace success" ); console.info("hideSoftKeyboard callbace success" );
expect(true).assertTrue();
}else{ }else{
console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err)) console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err))
expect().assertFail();
} }
}); });
console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************"); console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
...@@ -218,11 +224,72 @@ export default function inputMethodJSUnit() { ...@@ -218,11 +224,72 @@ export default function inputMethodJSUnit() {
let inputMethodCtrl = inputMethod.getInputMethodController() let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard().then((data) =>{ inputMethodCtrl.hideSoftKeyboard().then((data) =>{
console.info("hideSoftKeyboard promise success" ); console.info("hideSoftKeyboard promise success" );
expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err)) console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err))
expect().assertFail();
}) })
console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************"); console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************");
done(); done();
}); });
/*
* @tc.number inputmethod_test_getCurrentInputMethod_001
* @tc.name return The InputMethodProperty object of the current input method.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_getCurrentInputMethod_001', 0, async function (done) {
let currentIme = inputMethod.getCurrentInputMethod();
console.info("inputmethod_test_getCurrentInputMethod_001 currentIme---" + JSON.stringify(currentIme));
console.info(currentIme.packageName);
console.info(currentIme.methodId);
expect(currentIme.packageName != null).assertTrue();
expect(currentIme.methodId != null).assertTrue();
console.info("************* inputmethod_test_getCurrentInputMethod_001 Test end*************");
done();
});
/*
* @tc.number inputmethod_test_listInputMethod_001
* @tc.name param enable :
* if true, collect enabled input methods.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_listInputMethod_001', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_listInputMethod_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod(true, (err, arr) => {
if (err) {
console.error("inputmethod_test_listInputMethod_001 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_listInputMethod_001 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
});
/*
* @tc.number inputmethod_test_listInputMethod_002
* @tc.name param enable :
* if false, collect disabled input methods.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_listInputMethod_002', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_listInputMethod_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod(false, (err, arr) => {
if (err) {
console.error("inputmethod_test_listInputMethod_002 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_listInputMethod_002 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
});
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册