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

!5101 【杂散】【输入法框架】【主题】新增API接口和属性,以及接口修改后的用例适配,挑单合入到monthly

Merge pull request !5101 from 张育帅/cherry-pick-1661218733
...@@ -23,7 +23,7 @@ export default function inputMethodJSUnit() { ...@@ -23,7 +23,7 @@ export default function inputMethodJSUnit() {
let inputMethodSetting = inputMethod.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod((arr) => { inputMethodSetting.listInputMethod((arr) => {
console.info("inputmethoh_test_001 listInputMethod result---" + JSON.stringify(arr)); console.info("appInfoTest_input_2 listInputMethod result---" + JSON.stringify(arr));
expect(1==1).assertTrue(); expect(1==1).assertTrue();
}); });
done(); done();
...@@ -32,17 +32,19 @@ export default function inputMethodJSUnit() { ...@@ -32,17 +32,19 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_002', 0, async function (done) { it('inputmethoh_test_002', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.listInputMethod(); inputMethodSetting.listInputMethod().then(inputMethodProperty => {
console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise)); if (inputMethodProperty.length > 0){
if (promise.length > 0){ let obj = inputMethodProperty[0]
let obj = promise[0]
console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj)); console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.packageName != null).assertTrue(); expect(obj.packageName != null).assertTrue();
expect(obj.methodId != null).assertTrue(); expect(obj.methodId != null).assertTrue();
}else{ }else{
console.info("inputmethoh_test_002 listInputMethod is null"); console.info("inputmethoh_test_002 listInputMethod is null");
except().assertFail() expect().assertFail()
} }
}).catch(err => {
console.info("inputmethoh_test_002 listInputMethod is err: " + JSON.stringify(err));
});
done(); done();
}); });
...@@ -58,9 +60,13 @@ export default function inputMethodJSUnit() { ...@@ -58,9 +60,13 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_004', 0, async function (done) { it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.displayOptionalInputMethod(); inputMethodSetting.displayOptionalInputMethod().then(() => {
console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise)); console.info("inputmethoh_test_004 displayOptionalInputMethod is called");
expect(promise).assertEqual(undefined) expect(true).assertTrue()
}).catch(err => {
console.info("inputmethoh_test_004 displayOptionalInputMethod is err: " + JSON.stringify(err));
expect().assertFail()
});
done(); done();
}); });
...@@ -76,9 +82,13 @@ export default function inputMethodJSUnit() { ...@@ -76,9 +82,13 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_006', 0, async function (done) { it('inputmethoh_test_006', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController(); let inputMethodCtrl = inputMethod.getInputMethodController();
console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl)); console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
let promise = inputMethodCtrl.stopInput(); inputMethodCtrl.stopInput().then(data => {
console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise)); console.info("inputmethoh_test_006 stopInput result----" + data);
expect(promise).assertEqual(true) expect(data == true).assertTrue()
}).catch(err => {
console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err));
expect().assertFail()
});
done(); done();
}); });
...@@ -96,6 +106,29 @@ export default function inputMethodJSUnit() { ...@@ -96,6 +106,29 @@ export default function inputMethodJSUnit() {
done(); done();
}); });
/*
* @tc.number inputmethod_test_switchInputMethod_001
* @tc.name Test Indicates the input method which will replace the current one.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_switchInputMethod_001', 0, async function (done) {
console.info("************* inputmethod_test_switchInputMethod_001 Test start*************");
let inputMethodProperty = {
packageName:"com.example.kikakeyboard",
methodId:"ServiceExtAbility"
}
inputMethod.switchInputMethod(inputMethodProperty).then(data => {
console.info("inputmethod_test_switchInputMethod_001 data:" + data)
expect(data == true).assertTrue();
}).catch( err=> {
console.info("inputmethod_test_switchInputMethod_001 err:" + err)
})
console.info("************* inputmethod_test_switchInputMethod_001 Test end*************");
done();
});
/* /*
* @tc.number inputmethod_test_switchInputMethod_002 * @tc.number inputmethod_test_switchInputMethod_002
* @tc.name Test Indicates the input method which will replace the current one. * @tc.name Test Indicates the input method which will replace the current one.
...@@ -119,5 +152,77 @@ export default function inputMethodJSUnit() { ...@@ -119,5 +152,77 @@ export default function inputMethodJSUnit() {
console.info("************* inputmethod_test_switchInputMethod_002 Test end*************"); console.info("************* inputmethod_test_switchInputMethod_002 Test end*************");
done(); done();
}); });
/*
* @tc.number inputmethod_test_showSoftKeyboard_001
* @tc.name Test Indicates the input method which will show softboard with calback.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_showSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard((data)=>{
if(data == undefined){
console.info("showSoftKeyboard callbace success" );
}else{
console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err))
}
});
console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
});
/*
* @tc.number inputmethod_test_showSoftKeyboard_001
* @tc.name Test Indicates the input method which will show softboard with Promise.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_showSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard().then((data) =>{
console.info("showSoftKeyboard promise success" );
}).catch((err) => {
console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err))
})
console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************");
done();
});
/*
* @tc.number inputmethod_test_showSoftKeyboard_001
* @tc.name Test Indicates the input method which will hide softboard with calback.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_hideSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard((data)=>{
if(data == undefined){
console.info("hideSoftKeyboard callbace success" );
}else{
console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err))
}
});
console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
});
/*
* @tc.number inputmethod_test_showSoftKeyboard_001
* @tc.name Test Indicates the input method which will hide softboard with Promise.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_hideSoftKeyboard_002', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard().then((data) =>{
console.info("hideSoftKeyboard promise success" );
}).catch((err) => {
console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err))
})
console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************");
done();
});
}) })
} }
...@@ -73,15 +73,20 @@ export default function wallpaperJSUnit() { ...@@ -73,15 +73,20 @@ export default function wallpaperJSUnit() {
* @tc.level 0 * @tc.level 0
*/ */
it('testGetColorsCallbackSystem101', 0, async function (done) { it('testGetColorsCallbackSystem101', 0, async function (done) {
await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) { await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) {
let RgbaColor = {
red:data[0][0],
green:data[0][1],
blue:data[0][2],
alpha:data[0][3]
}
console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]);
if (err) { if (err) {
expect(null).assertFail(); expect(null).assertFail();
} }
...@@ -610,5 +615,45 @@ export default function wallpaperJSUnit() { ...@@ -610,5 +615,45 @@ export default function wallpaperJSUnit() {
}) })
done(); done();
}) })
/*
* @tc.number testGetFileCallback101
* @tc.name Obtains a file of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFileCallback101', 0, async function (done) {
wallpaper.getFile(WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error("callback failed to getFile because: " + JSON.stringify(error));
expect().assertFail()
}else{
expect(typeof data == "number").assertTrue();
expect(!isNaN(data)).assertTrue();
console.info("callback success to getFile: " + JSON.stringify(data));
done()
}
});
done();
})
/*
* @tc.number testGetFilePromise101
* @tc.name Obtains a file of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFilePromise101', 0, async function (done) {
wallpaper.getFile(WALLPAPER_SYSTEM).then((data) => {
expect(typeof data == "number").assertTrue();
expect(!isNaN(data)).assertTrue();
console.info("promise success to getFile: " + JSON.stringify(data));
done()
}).catch((error) => {
console.error("promise failed to getFile because: " + JSON.stringify(error));
expect().assertFail()
});
done();
})
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册