提交 1f2693fa 编写于 作者: Z zhangyushuai

recover 5 case

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 3465b55b
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index';
import inputMethodEngine from '@ohos.inputmethodengine'; import inputMethodEngine from '@ohos.inputmethodengine';
import Utils from './Utils'; import Utils from './Utils';
import router from '@system.router'; import router from '@system.router';
...@@ -26,7 +26,7 @@ export default function inputMethodEngineJsunit() { ...@@ -26,7 +26,7 @@ export default function inputMethodEngineJsunit() {
var textInputClient = null; var textInputClient = null;
var kbController = null; var kbController = null;
console.log("************* inputMethodEngine Test start*************"); console.info("************* inputMethodEngine Test start*************");
beforeEach(async function (done) { beforeEach(async function (done) {
let options = { let options = {
uri: 'pages/input', uri: 'pages/input',
...@@ -45,22 +45,22 @@ export default function inputMethodEngineJsunit() { ...@@ -45,22 +45,22 @@ export default function inputMethodEngineJsunit() {
}); });
afterEach(async function () { afterEach(async function () {
console.log("inputMethodEngine afterEach start:" + inputMethodEngineObject); console.info("inputMethodEngine afterEach start:" + inputMethodEngineObject);
await Utils.sleep(1000); await Utils.sleep(1000);
}); });
it('inputMethodEngine_test_000', 0, async function (done) { it('inputMethodEngine_test_000', 0, async function (done) {
inputMethodEngineObject.on('inputStart', (kbController, textInputClient) => { inputMethodEngineObject.on('inputStart', (kbController, textInputClient) => {
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController)); console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController));
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient)); console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient));
textInputClient = textInputClient; textInputClient = textInputClient;
kbController = kbController; kbController = kbController;
}); });
inputMethodEngineObject.on('keyboardShow', (err) => { inputMethodEngineObject.on('keyboardShow', (err) => {
console.log("inputMethodEngine beforeEach keyboardShow:" + err); console.info("inputMethodEngine beforeEach keyboardShow:" + err);
}); });
inputMethodEngineObject.on('keyboardHide', (err) => { inputMethodEngineObject.on('keyboardHide', (err) => {
console.log("inputMethodEngine beforeEach keyboardHide:" + err); console.info("inputMethodEngine beforeEach keyboardHide:" + err);
}); });
mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate(); mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
mKeyboardDelegate.on('keyDown', (keyEvent) => { mKeyboardDelegate.on('keyDown', (keyEvent) => {
...@@ -80,200 +80,200 @@ export default function inputMethodEngineJsunit() { ...@@ -80,200 +80,200 @@ export default function inputMethodEngineJsunit() {
}); });
mKeyboardDelegate.on('cursorContextChange', (x, y, height) => { mKeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine beforeEach cursorContextChange x:" + x); console.info("inputMethodEngine beforeEach cursorContextChange x:" + x);
console.log("inputMethodEngine beforeEach cursorContextChange y:" + y); console.info("inputMethodEngine beforeEach cursorContextChange y:" + y);
console.log("inputMethodEngine beforeEach cursorContextChange height:" + height); console.info("inputMethodEngine beforeEach cursorContextChange height:" + height);
}); });
mKeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { mKeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin); console.info("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin);
console.log("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd); console.info("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd);
console.log("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin); console.info("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin);
console.log("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd); console.info("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd);
}); });
mKeyboardDelegate.on('textChange', (text) => { mKeyboardDelegate.on('textChange', (text) => {
console.log("inputMethodEngine beforeEach textChange:" + text); console.info("inputMethodEngine beforeEach textChange:" + text);
}); });
done(); done();
}); });
it('inputMethodEngine_test_001', 0, async function (done) { it('inputMethodEngine_test_001', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED; let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED;
console.log("inputMethodEngine_test_001 result:" + keyType); console.info("inputMethodEngine_test_001 result:" + keyType);
expect(keyType).assertEqual(0); expect(keyType).assertEqual(0);
done(); done();
}); });
it('inputMethodEngine_test_002', 0, async function (done) { it('inputMethodEngine_test_002', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_GO; let keyType = inputMethodEngine.ENTER_KEY_TYPE_GO;
console.log("inputMethodEngine_test_002 result:" + keyType); console.info("inputMethodEngine_test_002 result:" + keyType);
expect(keyType).assertEqual(2); expect(keyType).assertEqual(2);
done(); done();
}); });
it('inputMethodEngine_test_003', 0, async function (done) { it('inputMethodEngine_test_003', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEARCH; let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEARCH;
console.log("inputMethodEngine_test_003 result:" + keyType); console.info("inputMethodEngine_test_003 result:" + keyType);
expect(keyType).assertEqual(3); expect(keyType).assertEqual(3);
done(); done();
}); });
it('inputMethodEngine_test_004', 0, async function (done) { it('inputMethodEngine_test_004', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEND; let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEND;
console.log("inputMethodEngine_test_004 result:" + keyType); console.info("inputMethodEngine_test_004 result:" + keyType);
expect(keyType).assertEqual(4); expect(keyType).assertEqual(4);
done(); done();
}); });
it('inputMethodEngine_test_005', 0, async function (done) { it('inputMethodEngine_test_005', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_NEXT; let keyType = inputMethodEngine.ENTER_KEY_TYPE_NEXT;
console.log("inputMethodEngine_test_005 result:" + keyType); console.info("inputMethodEngine_test_005 result:" + keyType);
expect(keyType).assertEqual(5); expect(keyType).assertEqual(5);
done(); done();
}); });
it('inputMethodEngine_test_006', 0, async function (done) { it('inputMethodEngine_test_006', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_DONE; let keyType = inputMethodEngine.ENTER_KEY_TYPE_DONE;
console.log("inputMethodEngine_test_006 result:" + keyType); console.info("inputMethodEngine_test_006 result:" + keyType);
expect(keyType).assertEqual(6); expect(keyType).assertEqual(6);
done(); done();
}); });
it('inputMethodEngine_test_007', 0, async function (done) { it('inputMethodEngine_test_007', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_PREVIOUS; let keyType = inputMethodEngine.ENTER_KEY_TYPE_PREVIOUS;
console.log("inputMethodEngine_test_007 result:" + keyType); console.info("inputMethodEngine_test_007 result:" + keyType);
expect(keyType).assertEqual(7); expect(keyType).assertEqual(7);
done(); done();
}); });
it('inputMethodEngine_test_008', 0, async function (done) { it('inputMethodEngine_test_008', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NULL; let keyType = inputMethodEngine.PATTERN_NULL;
console.log("inputMethodEngine_test_008 result:" + keyType); console.info("inputMethodEngine_test_008 result:" + keyType);
expect(keyType).assertEqual(-1); expect(keyType).assertEqual(-1);
done(); done();
}); });
it('inputMethodEngine_test_009', 0, async function (done) { it('inputMethodEngine_test_009', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_TEXT; let keyType = inputMethodEngine.PATTERN_TEXT;
console.log("inputMethodEngine_test_009 result:" + keyType); console.info("inputMethodEngine_test_009 result:" + keyType);
expect(keyType).assertEqual(0); expect(keyType).assertEqual(0);
done(); done();
}); });
it('inputMethodEngine_test_010', 0, async function (done) { it('inputMethodEngine_test_010', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NUMBER; let keyType = inputMethodEngine.PATTERN_NUMBER;
console.log("inputMethodEngine_test_010 result:" + keyType); console.info("inputMethodEngine_test_010 result:" + keyType);
expect(keyType).assertEqual(2); expect(keyType).assertEqual(2);
done(); done();
}); });
it('inputMethodEngine_test_011', 0, async function (done) { it('inputMethodEngine_test_011', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PHONE; let keyType = inputMethodEngine.PATTERN_PHONE;
console.log("inputMethodEngine_test_011 result:" + keyType); console.info("inputMethodEngine_test_011 result:" + keyType);
expect(keyType).assertEqual(3); expect(keyType).assertEqual(3);
done(); done();
}); });
it('inputMethodEngine_test_012', 0, async function (done) { it('inputMethodEngine_test_012', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_DATETIME; let keyType = inputMethodEngine.PATTERN_DATETIME;
console.log("inputMethodEngine_test_012 result:" + keyType); console.info("inputMethodEngine_test_012 result:" + keyType);
expect(keyType).assertEqual(4); expect(keyType).assertEqual(4);
done(); done();
}); });
it('inputMethodEngine_test_013', 0, async function (done) { it('inputMethodEngine_test_013', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_EMAIL; let keyType = inputMethodEngine.PATTERN_EMAIL;
console.log("inputMethodEngine_test_013 result:" + keyType); console.info("inputMethodEngine_test_013 result:" + keyType);
expect(keyType).assertEqual(5); expect(keyType).assertEqual(5);
done(); done();
}); });
it('inputMethodEngine_test_014', 0, async function (done) { it('inputMethodEngine_test_014', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_URI; let keyType = inputMethodEngine.PATTERN_URI;
console.log("inputMethodEngine_test_014 result:" + keyType); console.info("inputMethodEngine_test_014 result:" + keyType);
expect(keyType).assertEqual(6); expect(keyType).assertEqual(6);
done(); done();
}); });
it('inputMethodEngine_test_015', 0, async function (done) { it('inputMethodEngine_test_015', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PASSWORD; let keyType = inputMethodEngine.PATTERN_PASSWORD;
console.log("inputMethodEngine_test_015 result:" + keyType); console.info("inputMethodEngine_test_015 result:" + keyType);
expect(keyType).assertEqual(7); expect(keyType).assertEqual(7);
done(); done();
}); });
it('inputMethodEngine_test_016', 0, async function (done) { it('inputMethodEngine_test_016', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SELECTING; let keyType = inputMethodEngine.FLAG_SELECTING;
console.log("inputMethodEngine_test_016 result:" + keyType); console.info("inputMethodEngine_test_016 result:" + keyType);
expect(keyType).assertEqual(2); expect(keyType).assertEqual(2);
done(); done();
}); });
it('inputMethodEngine_test_017', 0, async function (done) { it('inputMethodEngine_test_017', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SINGLE_LINE; let keyType = inputMethodEngine.FLAG_SINGLE_LINE;
console.log("inputMethodEngine_test_017 result:" + keyType); console.info("inputMethodEngine_test_017 result:" + keyType);
expect(keyType).assertEqual(1); expect(keyType).assertEqual(1);
done(); done();
}); });
it('inputMethodEngine_test_018', 0, async function (done) { it('inputMethodEngine_test_018', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_PART; let keyType = inputMethodEngine.DISPLAY_MODE_PART;
console.log("inputMethodEngine_test_018 result:" + keyType); console.info("inputMethodEngine_test_018 result:" + keyType);
expect(keyType).assertEqual(0); expect(keyType).assertEqual(0);
done(); done();
}); });
it('inputMethodEngine_test_019', 0, async function (done) { it('inputMethodEngine_test_019', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_FULL; let keyType = inputMethodEngine.DISPLAY_MODE_FULL;
console.log("inputMethodEngine_test_019 result:" + keyType); console.info("inputMethodEngine_test_019 result:" + keyType);
expect(keyType).assertEqual(1); expect(keyType).assertEqual(1);
done(); done();
}); });
it('inputMethodEngine_test_020', 0, async function (done) { it('inputMethodEngine_test_020', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_ASCII; let keyType = inputMethodEngine.OPTION_ASCII;
console.log("inputMethodEngine_test_020 result:" + keyType); console.info("inputMethodEngine_test_020 result:" + keyType);
expect(keyType).assertEqual(20); expect(keyType).assertEqual(20);
done(); done();
}); });
it('inputMethodEngine_test_021', 0, async function (done) { it('inputMethodEngine_test_021', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NONE; let keyType = inputMethodEngine.OPTION_NONE;
console.log("inputMethodEngine_test_021 result:" + keyType); console.info("inputMethodEngine_test_021 result:" + keyType);
expect(keyType).assertEqual(0); expect(keyType).assertEqual(0);
done(); done();
}); });
it('inputMethodEngine_test_022', 0, async function (done) { it('inputMethodEngine_test_022', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_CHARACTERS; let keyType = inputMethodEngine.OPTION_AUTO_CAP_CHARACTERS;
console.log("inputMethodEngine_test_022 result:" + keyType); console.info("inputMethodEngine_test_022 result:" + keyType);
expect(keyType).assertEqual(2); expect(keyType).assertEqual(2);
done(); done();
}); });
it('inputMethodEngine_test_023', 0, async function (done) { it('inputMethodEngine_test_023', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_SENTENCES; let keyType = inputMethodEngine.OPTION_AUTO_CAP_SENTENCES;
console.log("inputMethodEngine_test_023 result:" + keyType); console.info("inputMethodEngine_test_023 result:" + keyType);
expect(keyType).assertEqual(8); expect(keyType).assertEqual(8);
done(); done();
}); });
it('inputMethodEngine_test_024', 0, async function (done) { it('inputMethodEngine_test_024', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_WORDS; let keyType = inputMethodEngine.OPTION_AUTO_WORDS;
console.log("inputMethodEngine_test_024 result:" + keyType); console.info("inputMethodEngine_test_024 result:" + keyType);
expect(keyType).assertEqual(4); expect(keyType).assertEqual(4);
done(); done();
}); });
it('inputMethodEngine_test_025', 0, async function (done) { it('inputMethodEngine_test_025', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_MULTI_LINE; let keyType = inputMethodEngine.OPTION_MULTI_LINE;
console.log("inputMethodEngine_test_025 result:" + keyType); console.info("inputMethodEngine_test_025 result:" + keyType);
expect(keyType).assertEqual(1); expect(keyType).assertEqual(1);
done(); done();
}); });
it('inputMethodEngine_test_026', 0, async function (done) { it('inputMethodEngine_test_026', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NO_FULLSCREEN; let keyType = inputMethodEngine.OPTION_NO_FULLSCREEN;
console.log("inputMethodEngine_test_026 result:" + keyType); console.info("inputMethodEngine_test_026 result:" + keyType);
expect(keyType).assertEqual(10); expect(keyType).assertEqual(10);
done(); done();
}); });
...@@ -304,7 +304,7 @@ export default function inputMethodEngineJsunit() { ...@@ -304,7 +304,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.sendKeyFunction(0, (value) => { textInputClient.sendKeyFunction(0, (value) => {
console.log("inputMethodEngine_test_028 textInputClient sendKeyFunction:" + value); console.info("inputMethodEngine_test_028 textInputClient sendKeyFunction:" + value);
expect(value).assertEqual(true); expect(value).assertEqual(true);
}); });
} }
...@@ -332,7 +332,7 @@ export default function inputMethodEngineJsunit() { ...@@ -332,7 +332,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.deleteForward(1, (value) => { textInputClient.deleteForward(1, (value) => {
console.log("inputMethodEngine_test_030 deleteForward:" + value); console.info("inputMethodEngine_test_030 deleteForward:" + value);
expect(value).assertEqual(true); expect(value).assertEqual(true);
}); });
} }
...@@ -360,7 +360,7 @@ export default function inputMethodEngineJsunit() { ...@@ -360,7 +360,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.deleteBackward(1, (value) => { textInputClient.deleteBackward(1, (value) => {
console.log("inputMethodEngine_test_032 deleteBackward:" + value); console.info("inputMethodEngine_test_032 deleteBackward:" + value);
expect(value).assertEqual(true); expect(value).assertEqual(true);
}); });
} }
...@@ -388,7 +388,7 @@ export default function inputMethodEngineJsunit() { ...@@ -388,7 +388,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.InsertText('test', (value) => { textInputClient.InsertText('test', (value) => {
console.log("inputMethodEngine_test_034 InsertText:" + value); console.info("inputMethodEngine_test_034 InsertText:" + value);
expect(value).assertEqual(true); expect(value).assertEqual(true);
}); });
} }
...@@ -416,7 +416,7 @@ export default function inputMethodEngineJsunit() { ...@@ -416,7 +416,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.getForward(1, (value) => { textInputClient.getForward(1, (value) => {
console.log("inputMethodEngine_test_036 getForward:" + value); console.info("inputMethodEngine_test_036 getForward:" + value);
expect(value).assertEqual(true); expect(value).assertEqual(true);
}); });
} }
...@@ -444,7 +444,7 @@ export default function inputMethodEngineJsunit() { ...@@ -444,7 +444,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true); expect(textInputClient == null).assertEqual(true);
} else { } else {
textInputClient.getEditorAttribute(1, (editorAttribute) => { textInputClient.getEditorAttribute(1, (editorAttribute) => {
console.log("inputMethodEngine_test_038 getEditorAttribute:" + value); console.info("inputMethodEngine_test_038 getEditorAttribute:" + value);
expect(editorAttribute.inputPattern).assertEqual(1); expect(editorAttribute.inputPattern).assertEqual(1);
expect(editorAttribute.enterKeyType).assertEqual(1); expect(editorAttribute.enterKeyType).assertEqual(1);
}); });
...@@ -474,7 +474,7 @@ export default function inputMethodEngineJsunit() { ...@@ -474,7 +474,7 @@ export default function inputMethodEngineJsunit() {
expect(kbController == null).assertEqual(true); expect(kbController == null).assertEqual(true);
} else { } else {
kbController.hideKeyboard(() => { kbController.hideKeyboard(() => {
console.log("inputMethodEngine_test_040 hideKeyboard:" + value); console.info("inputMethodEngine_test_040 hideKeyboard:" + value);
expect(1 == 1).assertTrue(); expect(1 == 1).assertTrue();
}); });
} }
...@@ -525,5 +525,40 @@ export default function inputMethodEngineJsunit() { ...@@ -525,5 +525,40 @@ export default function inputMethodEngineJsunit() {
done(); done();
}); });
it('inputMethodEngine_test_044', 0, async function (done) {
let keyType = inputMethodEngine.WINDOW_TYPE_INPUT_METHOD_FLOAT;
console.error("inputMethodEngine_test_044 result:" + keyType);
expect(keyType == null).assertTrue();
done();
});
it('inputMethodEngine_test_045', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.moveCursor(1, (value) => {
console.info("inputMethodEngine_test_045 getBackward:" + value);
expect(value == null).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_046', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.moveCursor(1);
promise.then(res => {
console.info("inputMethodEngine_test_046 getBackward promise result-----" + JSON.stringify(res));
expect(res == null).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_046 getBackward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
})
}) })
} }
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index';
import inputmeth from '@ohos.inputmethod'; import inputMethod from '@ohos.inputmethod';
export default function settingUiJsunit() { export default function settingUiJsunit() {
describe('appInfoTest_input_2', function () { describe('appInfoTest_input_2', function () {
console.log("************* settings Test start*************"); console.info("************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) { it('inputmethoh_test_001', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.log("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("inputmethoh_test_001 listInputMethod result---" + JSON.stringify(arr));
expect(1==1).assertTrue(); expect(1==1).assertTrue();
...@@ -30,20 +30,25 @@ export default function settingUiJsunit() { ...@@ -30,20 +30,25 @@ export default function settingUiJsunit() {
}); });
it('inputmethoh_test_002', 0, async function (done) { it('inputmethoh_test_002', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.log("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.listInputMethod(); let promise = inputMethodSetting.listInputMethod();
console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise)); console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise));
let obj = promise[0]; if (promise.length > 0){
console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj)); let obj = promise[0]
expect(obj.packageName=='com.example.kikakeyboard').assertTrue(); console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.methodId=='ServiceExtAbility').assertTrue(); expect(obj.packageName != null).assertTrue();
expect(obj.methodId != null).assertTrue();
}else{
console.info("inputmethoh_test_002 listInputMethod is null");
except().assertFail()
}
done(); done();
}); });
it('inputmethoh_test_003', 0, async function (done) { it('inputmethoh_test_003', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.log("inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.displayOptionalInputMethod(() => { inputMethodSetting.displayOptionalInputMethod(() => {
console.info("inputmethoh_test_003 displayOptionalInputMethod---"); console.info("inputmethoh_test_003 displayOptionalInputMethod---");
}); });
...@@ -51,8 +56,8 @@ export default function settingUiJsunit() { ...@@ -51,8 +56,8 @@ export default function settingUiJsunit() {
}); });
it('inputmethoh_test_004', 0, async function (done) { it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting(); let inputMethodSetting = inputMethod.getInputMethodSetting();
console.log("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting)); console.info("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.displayOptionalInputMethod(); let promise = inputMethodSetting.displayOptionalInputMethod();
console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise)); console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise));
expect(promise).assertEqual(undefined) expect(promise).assertEqual(undefined)
...@@ -60,8 +65,8 @@ export default function settingUiJsunit() { ...@@ -60,8 +65,8 @@ export default function settingUiJsunit() {
}); });
it('inputmethoh_test_005', 0, async function (done) { it('inputmethoh_test_005', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController(); let inputMethodCtrl = inputMethod.getInputMethodController();
console.log("inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl)); console.info("inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput((res) => { inputMethodCtrl.stopInput((res) => {
console.info("inputmethoh_test_005 stopInput result----" + res); console.info("inputmethoh_test_005 stopInput result----" + res);
}); });
...@@ -69,8 +74,8 @@ export default function settingUiJsunit() { ...@@ -69,8 +74,8 @@ export default function settingUiJsunit() {
}); });
it('inputmethoh_test_006', 0, async function (done) { it('inputmethoh_test_006', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController(); let inputMethodCtrl = inputMethod.getInputMethodController();
console.log("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl)); console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
let promise = inputMethodCtrl.stopInput(); let promise = inputMethodCtrl.stopInput();
console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise)); console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise));
expect(promise).assertEqual(true) expect(promise).assertEqual(true)
...@@ -78,17 +83,63 @@ export default function settingUiJsunit() { ...@@ -78,17 +83,63 @@ export default function settingUiJsunit() {
}); });
/* /*
* @tc.number : inputmethod_test_MAX_TYPE_NUM_001 * @tc.number: inputmethod_test_MAX_TYPE_NUM_001
* @tc.name : inputMethod::MAX_TYPE_NUM * @tc.name: inputMethod::MAX_TYPE_NUM
* @tc.desc : Verify Max_ TYPE_ NUM * @tc.desc: Verify Max_ TYPE_ NUM
*/ */
it('inputmethod_test_MAX_TYPE_NUM_001', 0, async function (done) { it('inputmethod_test_MAX_TYPE_NUM_001', 0, async function (done) {
console.log("************* inputmethod_test_MAX_TYPE_NUM_001 Test start*************"); console.info("************* inputmethod_test_MAX_TYPE_NUM_001 Test start*************");
let inputMethodSetting = inputmeth.MAX_TYPE_NUM; let inputMethodSetting = inputMethod.MAX_TYPE_NUM;
console.log("inputmethod_test_001 result:" + inputMethodSetting); console.info("inputmethod_test_001 result:" + inputMethodSetting);
expect(inputMethodSetting != null).assertTrue(); expect(inputMethodSetting != null).assertTrue();
console.info("************* inputmethod_test_MAX_TYPE_NUM_001 Test end*************");
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).assertEqual(true);
}).catch((err) => {
console.error('inputmethod_test_switchInputMethod_001 failed because ' + JSON.stringify(err));
});
console.info("************* inputmethod_test_switchInputMethod_001 Test end*************");
done();
});
/*
* @tc.number inputmethod_test_switchInputMethod_002
* @tc.name Test Indicates the input method which will replace the current one.
* @tc.desc Function test
* @tc.level 2
*/
it('inputmethod_test_switchInputMethod_002', 0, async function (done) {
console.info("************* inputmethod_test_switchInputMethod_002 Test start*************");
let inputMethodProperty = {
packageName:"com.example.kikakeyboard",
methodId:"ServiceExtAbility"
}
inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{
if(err){
console.info("inputmethod_test_switchInputMethod_002 error:" + err);
expect().assertFail()
}
console.info("inputmethod_test_switchInputMethod_002 data:" + data)
expect(data == true).assertTrue();
});
console.info("************* inputmethod_test_switchInputMethod_002 Test end*************");
done(); done();
console.log("************* inputmethod_test_MAX_TYPE_NUM_001 Test end*************");
}); });
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册