Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1f2693fa
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1f2693fa
编写于
7月 21, 2022
作者:
Z
zhangyushuai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
recover 5 case
Signed-off-by:
N
zhangyushuai
<
zhangyushuai1@huawei.com
>
上级
3465b55b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
159 addition
and
73 deletion
+159
-73
miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets
.../entry/src/main/ets/test/InputmethodEngineJsunit.test.ets
+83
-48
miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets
...st_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets
+76
-25
未找到文件。
miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets
浏览文件 @
1f2693fa
...
@@ -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();
})
})
})
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets
浏览文件 @
1f2693fa
...
@@ -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 input
meth
from '@ohos.inputmethod';
import input
Method
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 = input
meth
.getInputMethodSetting();
let inputMethodSetting = input
Method
.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 = input
meth
.getInputMethodSetting();
let inputMethodSetting = input
Method
.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 = input
meth
.getInputMethodSetting();
let inputMethodSetting = input
Method
.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 = input
meth
.getInputMethodSetting();
let inputMethodSetting = input
Method
.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 = input
meth
.getInputMethodController();
let inputMethodCtrl = input
Method
.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 = input
meth
.getInputMethodController();
let inputMethodCtrl = input
Method
.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 = input
meth
.MAX_TYPE_NUM;
let inputMethodSetting = input
Method
.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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录