Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0e0aac78
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看板
提交
0e0aac78
编写于
11月 16, 2022
作者:
Z
zwx1016320
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimization input API 1
Signed-off-by:
N
zwx1016320
<
zhangyushuai1@huawei-partners.com
>
上级
1f28a7f4
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
281 addition
and
236 deletion
+281
-236
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
...est_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
+23
-19
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
..._Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
+150
-127
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
...hodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
+99
-81
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
+9
-9
未找到文件。
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
浏览文件 @
0e0aac78
...
...
@@ -17,6 +17,13 @@ import inputMethod from '@ohos.inputmethod'
export default function imeAbilityTest(abilityContext) {
describe('imeAbilityTest', function () {
var prop = {
packageName: '',
methodId: '',
name:'',
id:'',
extra:{}
}
/**
* sleep function.
*/
...
...
@@ -28,28 +35,26 @@ export default function imeAbilityTest(abilityContext) {
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
beforeEach(function () {
console.info('====>beforeEach: switchInputMethod to kikakeyboard.');
let serviceAbilityProperty = {
packageName: "com.example.kikakeyboard",
methodId: "ServiceExtAbility",
name:"com.example.kikakeyboard",
id:"ServiceExtAbility",
extra:{}
}
inputMethod.switchInputMethod(serviceAbilityProperty).then((data)=>{
console.info('====>SUB_InputMethod_IMEAbility_0001 switchInputMethod to Kika :' + data);
expect(data == true).assertTrue();
})
beforeAll(function () {
let inputM = inputMethod.getCurrentInputMethod()
console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM));
prop.packageName = inputM.packageName;
prop.methodId = inputM.methodId;
prop.name = inputM.packageName;
prop.id = inputM.methodId;
});
/**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/
afterEach(function () {
console.info('====>afterEach: Test case-level clearance conditions is executed.');
afterAll(async function () {
console.info('====>afterAll: switchInputMethod to origionInput.' + JSON.stringify(prop));
await inputMethod.switchInputMethod(prop).then((data)=>{
console.info('====>afterAll switchInputMethod to origionInput :' + data);
expect(data == true).assertTrue();
}).catch(err =>{
console.info('====>afterAll switchInputMethod to origionInput error: ' + err);
})
});
/**
...
...
@@ -75,7 +80,6 @@ export default function imeAbilityTest(abilityContext) {
});
sleep(Date.now(), 3000);
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------');
done();
})
...
...
@@ -98,7 +102,7 @@ export default function imeAbilityTest(abilityContext) {
}
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
console.info('====>SUB_InputMethod_IMEAbility_000
4
switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_000
2
switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
});
sleep(Date.now(), 2500);
...
...
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/inputMethodStageJSUnit.ets
浏览文件 @
0e0aac78
此差异已折叠。
点击以展开。
inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets
浏览文件 @
0e0aac78
...
...
@@ -12,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 '@ohos/hypium';
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect
} from '@ohos/hypium';
import inputMethod from '@ohos.inputmethod';
export default function inputMethodJSUnit() {
...
...
@@ -23,7 +23,7 @@ export default function inputMethodJSUnit() {
console.info("====>inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod((arr) => {
console.info("====>appInfoTest_input_2 listInputMethod result---" + JSON.stringify(arr));
expect(1
==
1).assertTrue();
expect(1
==
1).assertTrue();
done();
});
});
...
...
@@ -32,18 +32,18 @@ export default function inputMethodJSUnit() {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod().then(inputMethodProperty => {
if (inputMethodProperty.length > 0){
if (inputMethodProperty.length > 0)
{
let obj = inputMethodProperty[0]
console.info("====>inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.packageName != null).assertTrue();
expect(obj.methodId != null).assertTrue();
}
else
{
}
else
{
console.info("====>inputmethoh_test_002 listInputMethod is null");
expect().assertFail()
}
done();
}).catch(err => {
console.info("====>inputmethoh_test_002 listInputMethod is err: " +
JSON.stringify(err));
console.info("====>inputmethoh_test_002 listInputMethod is err: " + JSON.stringify(err));
done();
});
});
...
...
@@ -51,10 +51,10 @@ export default function inputMethodJSUnit() {
it('inputmethoh_test_003', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
setTimeout(()
=>
{
try
{
inputMethodSetting.displayOptionalInputMethod((err) =>
{
if
(err)
{
setTimeout(()
=>
{
inputMethodSetting.displayOptionalInputMethod((err) =>
{
try
{
if
(err)
{
console.info("====>inputmethoh_test_003 displayOptionalInputMethod err:" + JSON.stringify(err));
expect().assertFail();
done();
...
...
@@ -62,19 +62,18 @@ export default function inputMethodJSUnit() {
expect(true).assertTrue();
console.info("====>inputmethoh_test_003 displayOptionalInputMethod---");
done();
});
}catch(err){
console.info("====>inputmethoh_test_004 displayOptionalInputMethod throw_err: " + JSON.stringify(err));
expect().assertFail()
done();
}
},100)
} catch (err) {
console.info("====>inputmethoh_test_004 displayOptionalInputMethod throw_err: " + JSON.stringify(err));
done();
}
});
}, 500)
});
it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
setTimeout(()
=>
{
setTimeout(()
=>
{
inputMethodSetting.displayOptionalInputMethod().then(() => {
console.info("====>inputmethoh_test_004 displayOptionalInputMethod is called");
expect(true).assertTrue()
...
...
@@ -84,7 +83,7 @@ export default function inputMethodJSUnit() {
expect().assertFail()
done();
});
},
100)
},
500)
});
it('inputmethoh_test_005', 0, async function (done) {
...
...
@@ -131,24 +130,25 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_switchInputMethod_001', 0, async function (done) {
console.info("====>************* inputmethod_test_switchInputMethod_001 Test start*************");
let inputM = inputMethod.getCurrentInputMethod()
console.info("inputmethod_test_switchInputMethod_001 getCurrentInputMethod: " + JSON.stringify(inputM));
let inputMethodProperty = {
packageName:
"com.example.kikakeyboard"
,
methodId:
"ServiceExtAbility"
,
name:
"com.example.kikakeyboard"
,
id:
"ServiceExtAbility"
,
extra:{}
packageName:
inputM.packageName
,
methodId:
inputM.methodId
,
name:
inputM.packageName
,
id:
inputM.methodId
,
extra:
{}
}
inputMethod.switchInputMethod(inputMethodProperty).then(data => {
console.info("====>inputmethod_test_switchInputMethod_001 data:" + data)
expect(data == true).assertTrue();
console.info("====>************* inputmethod_test_switchInputMethod_001 Test end*************");
console.info("====>************* inputmethod_test_switchInputMethod_001 Test end*************");
done();
}).catch(
err
=> {
}).catch(
err
=> {
console.info("====>inputmethod_test_switchInputMethod_001 err:" + err)
expect().assertFail();
done();
})
});
});
/*
...
...
@@ -159,25 +159,31 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_switchInputMethod_002', 0, async function (done) {
console.info("====>************* inputmethod_test_switchInputMethod_002 Test start*************");
let inputM = inputMethod.getCurrentInputMethod()
console.info("inputmethod_test_switchInputMethod_002 getCurrentInputMethod: " + JSON.stringify(inputM));
let inputMethodProperty = {
packageName:
"com.example.kikakeyboard"
,
methodId:
"ServiceExtAbility"
,
name:
"com.example.kikakeyboard"
,
id:
"ServiceExtAbility"
,
extra:{}
packageName:
inputM.packageName
,
methodId:
inputM.methodId
,
name:
inputM.packageName
,
id:
inputM.methodId
,
extra:
{}
}
inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{
if(err){
console.info("====>inputmethod_test_switchInputMethod_002 error:" + err);
expect().assertFail();
done();
inputMethod.switchInputMethod(inputMethodProperty, (err, data) => {
try {
if (err) {
console.info("====>inputmethod_test_switchInputMethod_002 error:" + err);
expect().assertFail();
done();
}
console.info("====>inputmethod_test_switchInputMethod_002 data:" + data)
console.info("====>************* inputmethod_test_switchInputMethod_002 Test end*************");
expect(data == true).assertTrue();
done();
} catch (err) {
console.info("====>inputmethod_test_switchInputMethod_002 catch error:" + err);
done();
}
console.info("====>inputmethod_test_switchInputMethod_002 data:" + data)
console.info("====>************* inputmethod_test_switchInputMethod_002 Test end*************");
expect(data == true).assertTrue();
done();
});
});
/*
...
...
@@ -188,27 +194,27 @@ export default function inputMethodJSUnit() {
*/
it('inputmethod_test_showSoftKeyboard_001', 0, async function (done) {
let inputMethodCtrl = inputMethod.getInputMethodController()
try
{
inputMethodCtrl.showSoftKeyboard((err)=>
{
inputMethodCtrl.showSoftKeyboard((err) =>
{
try
{
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_showSoftKeyboard_001 Test end*************");
done();
}
);
}catch(err){
expect().assertFail()
done();
}
}
catch (err) {
expect().assertFail()
done();
}
}
);
});
/*
* @tc.number inputmethod_test_showSoftKeyboard_00
1
* @tc.number inputmethod_test_showSoftKeyboard_00
2
* @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(() =>{
inputMethodCtrl.showSoftKeyboard().then(() =>
{
expect().assertFail()
done();
}).catch((err) => {
...
...
@@ -220,35 +226,35 @@ export default function inputMethodJSUnit() {
});
/*
* @tc.number inputmethod_test_
show
SoftKeyboard_001
* @tc.number inputmethod_test_
hide
SoftKeyboard_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()
try{
inputMethodCtrl.hideSoftKeyboard((err)=>{
console.info('====>hideSoftKeyboard callbacek failed : ' + JSON.stringify(err))
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
inputMethodCtrl.hideSoftKeyboard((err) => {
try {
console.info('====>hideSoftKeyboard callbacek failed : ' + JSON.stringify(err))
expect(err.code).assertEqual('12800003')
console.info("====>************* inputmethod_test_hideSoftKeyboard_001 Test end*************");
done();
} catch (err) {
expect().assertFail();
done();
}
})
}catch(err){
expect().assertFail();
done();
}
});
/*
* @tc.number inputmethod_test_
showSoftKeyboard_001
* @tc.number inputmethod_test_
hideSoftKeyboard_002
* @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(() =>{
inputMethodCtrl.hideSoftKeyboard().then(() =>
{
expect().assertFail();
done();
}).catch((err) => {
...
...
@@ -266,7 +272,7 @@ export default function inputMethodJSUnit() {
* @tc.level 2
*/
it('inputmethod_test_getCurrentInputMethod_001', 0, async function (done) {
let
currentIme = inputMethod.getCurrentInputMethod();
let currentIme = inputMethod.getCurrentInputMethod();
console.info("====>inputmethod_test_getCurrentInputMethod_001 currentIme---" + JSON.stringify(currentIme));
console.info(currentIme.packageName);
console.info(currentIme.methodId);
...
...
@@ -287,15 +293,21 @@ export default function inputMethodJSUnit() {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethod_test_getInputMethods_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.getInputMethods(true, (err, arr) => {
if (err) {
console.error("inputmethod_test_getInputMethods_001 failed because: " + JSON.stringify(err));
expect().assertFail();
done();
};
console.info("====>inputmethod_test_getInputMethods_001 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
console.info("====>************* inputmethod_test_getInputMethods_001 Test end*************");
done();
try {
if (err) {
console.error("inputmethod_test_getInputMethods_001 failed because: " + JSON.stringify(err));
expect().assertFail();
done();
}
;
console.info("====>inputmethod_test_getInputMethods_001 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
console.info("====>************* inputmethod_test_getInputMethods_001 Test end*************");
done();
} catch (err) {
console.error("inputmethod_test_getInputMethods_001 catch error: " + err);
done();
}
});
});
...
...
@@ -310,13 +322,19 @@ export default function inputMethodJSUnit() {
let inputMethodSetting = inputMethod.getInputMethodSetting();
console.info("====>inputmethod_test_getInputMethods_002 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.getInputMethods(false, (err, arr) => {
if (err) {
console.error("inputmethod_test_getInputMethods_002 failed because: " + JSON.stringify(err));
expect().assertFail();
};
console.info("====>inputmethod_test_getInputMethods_002 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
done();
try {
if (err) {
console.error("inputmethod_test_getInputMethods_002 failed because: " + JSON.stringify(err));
expect().assertFail();
}
;
console.info("====>inputmethod_test_getInputMethods_002 listInputMethod result---" + JSON.stringify(arr));
expect(arr != null).assertTrue();
done();
} catch (err) {
console.error("inputmethod_test_getInputMethods_002 catch error: " + err);
done();
}
});
});
});
...
...
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
浏览文件 @
0e0aac78
...
...
@@ -208,7 +208,7 @@ export default function systemTimerTest() {
done();
});
} catch (e) {
console.info('====>SUB_time_systemTimer_createTimer_000
2
arv wrong since ' + e);
console.info('====>SUB_time_systemTimer_createTimer_000
3
arv wrong since ' + e);
expect().assertTrue();
done();
};
...
...
@@ -502,35 +502,35 @@ export default function systemTimerTest() {
});
/**
* @tc.number SUB_time_systemTimer_createTimer
_0002
* @tc.name SUB_time_systemTimer_createTimer
_0002
* @tc.number SUB_time_systemTimer_createTimer
Promise_0001
* @tc.name SUB_time_systemTimer_createTimer
Promise_0001
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Promise)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_time_systemTimer_createTimer
_0002
', 0, async function (done) {
console.info('====>SUB_time_systemTimer_createTimer
_0002
start.');
it('SUB_time_systemTimer_createTimer
Promise_0001
', 0, async function (done) {
console.info('====>SUB_time_systemTimer_createTimer
Promise_0001
start.');
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
console.info('====>SUB_time_systemTimer_createTimer
_0002
create timer.');
console.info('====>SUB_time_systemTimer_createTimer
Promise_0001
create timer.');
systemTimer.createTimer(options).then((timerID)=>{
console.info('====>SUB_time_systemTimer_createTimer
_0002
timerID:' + timerID);
console.info('====>SUB_time_systemTimer_createTimer
Promise_0001
timerID:' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
globalTimerID = timerID;
done();
}).catch( error => {
// 捕获业务逻辑错误
console.info('====>SUB_time_systemTimer_createTimer
_0002
failed to create timer.');
console.info('====>SUB_time_systemTimer_createTimer
Promise_0001
failed to create timer.');
expect().assertTrue();
done();
});
} catch (err) {
// 捕获参数错误
console.info('====>SUB_time_systemTimer_createTimer
_0002
has failed for ' + err);
console.info('====>SUB_time_systemTimer_createTimer
Promise_0001
has failed for ' + err);
expect().assertTrue();
done();
};
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
c365151e
·
11月 18, 2022
mentioned in commit
c365151e
mentioned in commit c365151e3b4294f22d3e2adbeb0a34ae8bd35e34
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录