Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7f1b16a9
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7f1b16a9
编写于
10月 21, 2022
作者:
Z
zwx1016320
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add input API
Signed-off-by:
N
zwx1016320
<
zhangyushuai1@huawei-partners.com
>
上级
ced63417
变更
15
展开全部
显示空白变更内容
内联
并排
Showing
15 changed file
with
722 addition
and
47 deletion
+722
-47
inputmethod/InputMethodTest_Stage/BUILD.gn
inputmethod/InputMethodTest_Stage/BUILD.gn
+1
-1
inputmethod/InputMethodTest_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets
...st_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets
+0
-1
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets
...putMethodTest_Stage/entry/src/main/ets/test/List.test.ets
+4
-1
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
..._Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
+582
-0
inputmethod/InputMethodTest_Stage/entry/src/main/module.json
inputmethod/InputMethodTest_Stage/entry/src/main/module.json
+4
-1
inputmethod/InputMethodTest_Stage/signature/ActInputMethodStageAPITest.p7b
...MethodTest_Stage/signature/ActInputMethodStageAPITest.p7b
+0
-0
inputmethod/InputMethodTest_ets/BUILD.gn
inputmethod/InputMethodTest_ets/BUILD.gn
+1
-1
inputmethod/InputMethodTest_ets/entry/src/main/config.json
inputmethod/InputMethodTest_ets/entry/src/main/config.json
+6
-1
inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
...nputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
+1
-1
inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets
...nputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets
+1
-1
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets
...t_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets
+93
-12
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
...hodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
+19
-18
inputmethod/InputMethodTest_ets/signature/ActInputMethodEtsAPITest.p7b
...nputMethodTest_ets/signature/ActInputMethodEtsAPITest.p7b
+0
-0
theme/wallpaper_ets/Test.json
theme/wallpaper_ets/Test.json
+3
-2
theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
...e/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
+7
-7
未找到文件。
inputmethod/InputMethodTest_Stage/BUILD.gn
浏览文件 @
7f1b16a9
...
...
@@ -21,7 +21,7 @@ ohos_js_hap_suite("ActsImeAbilityTest") {
":IMExtAbility_resources",
]
ets2abc = true
certificate_profile = "signature/
openharmony_sx
.p7b"
certificate_profile = "signature/
ActInputMethodStageAPITest
.p7b"
hap_name = "ActsImeAbilityTest"
subsystem_name = "inputmethod"
part_name = "imf"
...
...
inputmethod/InputMethodTest_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets
浏览文件 @
7f1b16a9
...
...
@@ -71,7 +71,6 @@ export default class ImExtAbility extends inputMethodExtensionAbility {
}).catch((err) => {
console.info('startAbility004 terminateSelf fail: ' + JSON.stringify(err));
})
}
onDestroy() {
...
...
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets
浏览文件 @
7f1b16a9
...
...
@@ -13,7 +13,10 @@
* limitations under the License.
*/
import imeAbilityTest from './imeAbilityTest.test'
import inputMethodStageJSUnit from './inputMethodStageJSUnit';
export default function testsuite() {
imeAbilityTest(globalThis.abilityContext)
imeAbilityTest(globalThis.abilityContext);
inputMethodStageJSUnit();
}
\ No newline at end of file
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
0 → 100644
浏览文件 @
7f1b16a9
此差异已折叠。
点击以展开。
inputmethod/InputMethodTest_Stage/entry/src/main/module.json
浏览文件 @
7f1b16a9
...
...
@@ -48,6 +48,9 @@
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.CONNECT_IME_ABILITY"
}
]
}
...
...
inputmethod/InputMethodTest_Stage/signature/
openharmony_sx
.p7b
→
inputmethod/InputMethodTest_Stage/signature/
ActInputMethodStageAPITest
.p7b
浏览文件 @
7f1b16a9
无法预览此类型文件
inputmethod/InputMethodTest_ets/BUILD.gn
浏览文件 @
7f1b16a9
...
...
@@ -23,7 +23,7 @@ ohos_js_hap_suite("ActsInputMethodEtsTest") {
ets2abc = true
subsystem_name = "inputmethod"
part_name = "imf"
certificate_profile = "./signature/
openharmony_sx
.p7b"
certificate_profile = "./signature/
ActInputMethodEtsAPITest
.p7b"
hap_name = "ActsInputMethodEtsTest"
}
ohos_js_assets("inputMethod_ets_assets") {
...
...
inputmethod/InputMethodTest_ets/entry/src/main/config.json
浏览文件 @
7f1b16a9
...
...
@@ -65,6 +65,11 @@
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.CONNECT_IME_ABILITY"
}
],
"js"
:
[
{
"mode"
:
{
...
...
inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
浏览文件 @
7f1b16a9
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '
hypium/index
'
import { Hypium } from '
@ohos/hypium
'
import testsuite from '../test/List.test'
export default {
...
...
inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets
浏览文件 @
7f1b16a9
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '
hypium/index
'
import { Hypium } from '
@ohos/hypium
'
import testsuite from '../test/List.test'
export default {
...
...
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets
浏览文件 @
7f1b16a9
// @ts-nocheck
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
hypium/index
';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
@ohos/hypium
';
import inputMethodEngine from '@ohos.inputmethodengine';
import Utils from './Utils';
import router from '@system.router';
...
...
@@ -55,11 +54,11 @@ export default function inputMethodEngineJSUnit() {
console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController));
console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient));
});
inputMethodEngineObject.off('keyboardShow', (
err
) => {
console.info("inputMethodEngine beforeEach keyboardShow:"
+ err
);
inputMethodEngineObject.off('keyboardShow', () => {
console.info("inputMethodEngine beforeEach keyboardShow:");
});
inputMethodEngineObject.off('keyboardHide', (
err
) => {
console.info("inputMethodEngine beforeEach keyboardHide:"
+ err
);
inputMethodEngineObject.off('keyboardHide', () => {
console.info("inputMethodEngine beforeEach keyboardHide:");
});
KeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
KeyboardDelegate.off('keyDown', (keyEvent) => {
...
...
@@ -101,11 +100,11 @@ export default function inputMethodEngineJSUnit() {
textInputClient = textInputClient;
kbController = kbController;
});
inputMethodEngineObject.on('keyboardShow', (
err
) => {
console.info("inputMethodEngine beforeEach keyboardShow:"
+ err
);
inputMethodEngineObject.on('keyboardShow', () => {
console.info("inputMethodEngine beforeEach keyboardShow:");
});
inputMethodEngineObject.on('keyboardHide', (
err
) => {
console.info("inputMethodEngine beforeEach keyboardHide:"
+ err
);
inputMethodEngineObject.on('keyboardHide', () => {
console.info("inputMethodEngine beforeEach keyboardHide:");
});
mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
mKeyboardDelegate.on('keyDown', (keyEvent) => {
...
...
@@ -337,6 +336,8 @@ export default function inputMethodEngineJSUnit() {
x: x_value,
y: y_value,
type: TouchType.Move,
screenX: rect.left + (rect.right - rect.left) / 10,
screenY: rect.left + (rect.right - rect.left) / 10,
}
console.info('[inputMethodEngine_test_027] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
...
...
@@ -489,7 +490,7 @@ export default function inputMethodEngineJSUnit() {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getEditorAttribute(1, (editorAttribute) => {
console.info("inputMethodEngine_test_038 getEditorAttribute:" +
valu
e);
console.info("inputMethodEngine_test_038 getEditorAttribute:" +
editorAttribut
e);
expect(editorAttribute.inputPattern).assertEqual(1);
expect(editorAttribute.enterKeyType).assertEqual(1);
});
...
...
@@ -519,7 +520,7 @@ export default function inputMethodEngineJSUnit() {
expect(kbController == null).assertEqual(true);
} else {
kbController.hideKeyboard(() => {
console.info("inputMethodEngine_test_040 hideKeyboard
:" + value
);
console.info("inputMethodEngine_test_040 hideKeyboard
"
);
expect(1 == 1).assertTrue();
});
}
...
...
@@ -631,5 +632,85 @@ export default function inputMethodEngineJSUnit() {
done();
})
it('inputMethodEngine_test_049', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
kbController.hide(() => {
console.info("inputMethodEngine_test_049 hideKeyboard:");
expect(1 == 1).assertTrue();
});
}
done();
});
it('inputMethodEngine_test_050', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
let promise = kbController.hide();
promise.then(res => {
console.info("inputMethodEngine_test_050 hideKeyboard promise result-----" + JSON.stringify(res));
expect(1 == 1).assertTrue();
}).catch(err => {
console.info("inputMethodEngine_test_050 hideKeyboard promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
/*
* @tc.number inputMethodEngine_test_getInputMethodAbility_001
* @tc.name InputMethodAbility object of the current input method.
* @tc.desc Function test
* @tc.level 2
*/
it('inputMethodEngine_test_getInputMethodAbility_001', 0, async function (done) {
console.info("-----------------inputMethodEngine_test_getInputMethodAbility_001 start---------------------");
try{
let inputMethodAbility = inputMethodEngine.getInputMethodAbility();
console.info("inputMethodEngine_test_getInputMethodAbility_001 result:" + typeof inputMethodAbility);
if(typeof inputMethodAbility == "object" ){
console.info("inputMethodEngine_test_getInputMethodAbility_001 getCurrentInputMethodSubtype success");
expect(true).assertTrue();
}else{
console.info("inputMethodEngine_test_getInputMethodAbility_001 getCurrentInputMethodSubtype failed");
expect().assertFail();
};
}catch(error){
console.info("inputMethodEngine_test_getInputMethodAbility_001 getCurrentInputMethodSubtype error" + JSON.stringify(error));
expect().assertFail();
}
console.info("-----------------inputMethodEngine_test_getInputMethodAbility_001 end---------------------");
done();
});
/*
* @tc.number inputMethodEngine_test_getKeyboardDelegate_001
* @tc.name KeyboardDelegate object of the current input method.
* @tc.desc Function test
* @tc.level 2
*/
it('inputMethodEngine_test_getKeyboardDelegate_001', 0, async function (done) {
console.info("-----------------inputMethodEngine_test_getKeyboardDelegate_001 start---------------------");
try{
let inputMethodAbility = inputMethodEngine.getKeyboardDelegate();
console.info("inputMethodEngine_test_getKeyboardDelegate_001 result:" + typeof inputMethodAbility);
if(typeof inputMethodAbility == "object" ){
console.info("inputMethodEngine_test_getKeyboardDelegate_001 getCurrentInputMethodSubtype success");
expect(true).assertTrue();
}else{
console.info("inputMethodEngine_test_getKeyboardDelegate_001 getCurrentInputMethodSubtype failed");
expect().assertFail();
};
}catch(error){
console.info("inputMethodEngine_test_getKeyboardDelegate_001 getCurrentInputMethodSubtype error" + JSON.stringify(error));
expect().assertFail();
}
console.info("-----------------inputMethodEngine_test_getKeyboardDelegate_001 end---------------------");
done();
});
})
}
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
浏览文件 @
7f1b16a9
// @ts-nocheck
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
hypium/index
';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
@ohos/hypium
';
import inputMethod from '@ohos.inputmethod';
export default function inputMethodJSUnit() {
...
...
@@ -161,7 +160,7 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_showSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.showSoftKeyboard((data)=>{
inputMethodCtrl.showSoftKeyboard((
err,
data)=>{
if(data == undefined){
console.info("showSoftKeyboard callbace success" );
expect(true).assertTrue();
...
...
@@ -201,7 +200,7 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_hideSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
inputMethodCtrl.hideSoftKeyboard((data)=>{
inputMethodCtrl.hideSoftKeyboard((
err,
data)=>{
if(data == undefined){
console.info("hideSoftKeyboard callbace success" );
expect(true).assertTrue();
...
...
@@ -251,45 +250,47 @@ export default function inputMethodJSUnit() {
});
/*
* @tc.number inputmethod_test_
listInputMethod
_001
* @tc.number inputmethod_test_
getInputMethods
_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) {
it('inputmethod_test_
getInputMethods
_001', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_
listInputMethod
_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.
listInputMethod
(true, (err, arr) => {
console.info("inputmethod_test_
getInputMethods
_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.
getInputMethods
(true, (err, arr) => {
if (err) {
console.error("inputmethod_test_
listInputMethod
_001 failed because: " + JSON.stringify(err));
console.error("inputmethod_test_
getInputMethods
_001 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_
listInputMethod
_001 listInputMethod result---" + JSON.stringify(arr));
console.info("inputmethod_test_
getInputMethods
_001 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
});
/*
* @tc.number inputmethod_test_
listInputMethod
_002
* @tc.number inputmethod_test_
getInputMethods
_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) {
it('inputmethod_test_
getInputMethods
_002', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("inputmethod_test_
listInputMethod
_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.
listInputMethod
(false, (err, arr) => {
console.info("inputmethod_test_
getInputMethods
_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.
getInputMethods
(false, (err, arr) => {
if (err) {
console.error("inputmethod_test_
listInputMethod
_002 failed because: " + JSON.stringify(err));
console.error("inputmethod_test_
getInputMethods
_002 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("inputmethod_test_
listInputMethod
_002 listInputMethod result---" + JSON.stringify(arr));
console.info("inputmethod_test_
getInputMethods
_002 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
});
done();
});
})
}
});
};
inputmethod/InputMethodTest_ets/signature/
openharmony_sx
.p7b
→
inputmethod/InputMethodTest_ets/signature/
ActInputMethodEtsAPITest
.p7b
浏览文件 @
7f1b16a9
无法预览此类型文件
theme/wallpaper_ets/Test.json
浏览文件 @
7f1b16a9
...
...
@@ -18,10 +18,11 @@
{
"type"
:
"PushKit"
,
"pre-push"
:
[
"mount -o rw,remount /"
"mount -o rw,remount /"
,
"mkdir -p /data/app/el2/100/base/com.acts.theme.wallpapertest/haps"
],
"push"
:
[
"
wp.png ->/system/etc
/wp.png"
"
./resource./wallpaper/wp.png ->/data/app/el2/100/base/com.acts.theme.wallpapertest/haps
/wp.png"
]
}
]
...
...
theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
浏览文件 @
7f1b16a9
...
...
@@ -14,12 +14,12 @@
*/
import wallpaper from '@ohos.wallpaper';
import image from '@ohos.multimedia.image';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
deccjsunit/index
';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
@ohos/hypium
';
const WALLPAPER_SYSTEM = 0;
const WALLPAPER_LOCKSCREEN = 1;
let imageSourceSystem = '/
system/etc
/wp.png';
let imageSourceLockscreen = '/
system/etc
/wp.png';
let imageSourceSystem = '/
data/storage/el2/base/haps
/wp.png';
let imageSourceLockscreen = '/
data/storage/el2/base/haps
/wp.png';
export default function wallpaperJSUnit() {
describe('WallpaperJsunitTest', function () {
...
...
@@ -1050,7 +1050,7 @@ export default function wallpaperJSUnit() {
*/
it('testSetImageCallBack101', 0, async function (done) {
console.info('------------------testSetImageCallBack101 start----------------------');
let wallpaperPath = "/
system/etc
/wp.png";
let wallpaperPath = "/
data/storage/el2/base/haps
/wp.png";
try{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
...
...
@@ -1078,7 +1078,7 @@ export default function wallpaperJSUnit() {
*/
it('testSetImageCallBack102', 0, async function (done) {
console.info('------------------testSetImageCallBack102 start----------------------');
let wallpaperPath = "/
system/etc
/wp.png";
let wallpaperPath = "/
data/storage/el2/base/haps
/wp.png";
try{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN, (error, data) => {
if (error) {
...
...
@@ -1147,7 +1147,7 @@ export default function wallpaperJSUnit() {
*/
it('testSetImagePromise101', 0, async function (done) {
console.info('------------------testSetImagePromise101 start----------------------');
let wallpaperPath = "/
system/etc
/wp.png";
let wallpaperPath = "/
data/storage/el2/base/haps
/wp.png";
try{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`testSetImagePromise101 success to setImage.`);
...
...
@@ -1174,7 +1174,7 @@ export default function wallpaperJSUnit() {
*/
it('testSetImagePromise102', 0, async function (done) {
console.info('------------------testSetImagePromise102 start----------------------');
let wallpaperPath = "/
system/etc
/wp.png";
let wallpaperPath = "/
data/storage/el2/base/haps
/wp.png";
try{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN).then((data) => {
console.log(`testSetImagePromise102 success to setImage.`);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录