提交 efe7b5d0 编写于 作者: Z zhangyushuai

输入法新文本状态和编辑框携带信息新增用例 004

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 eaa01f8e
......@@ -81,6 +81,39 @@ export class KeyboardDelegate {
console.debug(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 event:' + data.event);
that.SUB_Misc_inputMethod_offSendFunctionKey_0040();
break;
case 50:
console.debug(TAG + '====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 event:' + data.event);
that.SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050();
break;
case 70:
console.debug(TAG + '====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 event:' + data.event);
that.SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070();
break;
case 80:
console.debug(TAG + '====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 event:' + data.event);
that.SUB_Misc_InputMethod_onGetRightTextOfCursor_0080();
break;
case 100:
console.debug(TAG + '====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 event:' + data.event);
that.SUB_Misc_InputMethod_offGetRightTextOfCursor_0100();
break;
case 110:
console.debug(TAG + '====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 event:' + data.event);
that.SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110();
break;
case 130:
console.debug(TAG + '====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 event:' + data.event);
that.SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130();
break;
case 140:
console.debug(TAG + '====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 event:' + data.event);
that.SUB_Misc_inputMethod_onEditorAttributeChanged_0140();
break;
case 160:
console.debug(TAG + '====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 event:' + data.event);
that.SUB_Misc_inputMethod_offEditorAttributeChanged_0160();
break;
}
}
......@@ -147,6 +180,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_onHandleExtendAction_0010(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 sendExtendAction start');
......@@ -159,6 +193,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_offHandleExtendAction_0020(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 sendExtendAction start');
......@@ -173,6 +208,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_onSendFunctionKey_0030(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 sendExtendAction start');
......@@ -185,6 +221,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_offSendFunctionKey_0040(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 sendExtendAction start');
......@@ -196,5 +233,168 @@ export class KeyboardDelegate {
});
}
private SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
let getForward_info = await InputClient.getForward(10000);
console.info(TAG + '====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 getForward_info: ' + getForward_info);
if(getForward_info === 'test'){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
let getForward_info = await InputClient.getForward(10000);
console.info(TAG + '====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 getForward_info: ' + getForward_info);
if(getForward_info === ''){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_InputMethod_onGetRightTextOfCursor_0080(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
let getBackward_info = await InputClient.getBackward(10000);
console.info(TAG + '====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 getBackward_info: ' + getBackward_info);
if(getBackward_info === 'test'){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_onGetRightTextOfCursor_0080", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_InputMethod_offGetRightTextOfCursor_0100(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
let getBackward_info = await InputClient.getBackward(10000);
console.info(TAG + '====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 getBackward_info: ' + getBackward_info);
if(getBackward_info === ''){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_offGetRightTextOfCursor_0100", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
let getTextIndexAtCursor_info = await InputClient.getTextIndexAtCursor();
console.info(TAG + '====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 getTextIndexAtCursor_info: ' + getTextIndexAtCursor_info);
if(getTextIndexAtCursor_info === 10000){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130(): void {
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => {
clearTimeout(t);
console.info(TAG + '====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 getTextIndexAtCursor_info: ');
let getTextIndexAtCursor_info = await InputClient.getTextIndexAtCursor();
console.info(TAG + '====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 getTextIndexAtCursor_info: ' + getTextIndexAtCursor_info);
if(getTextIndexAtCursor_info === -1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130", commonEventPublishData, this.publishCallback);
}, 500);
});
}
private SUB_Misc_inputMethod_onEditorAttributeChanged_0140(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive SUB_Misc_inputMethod_onEditorAttributeChanged_0140 success');
inputKeyboardDelegate.on('editorAttributeChanged', (attr) => {
console.log(`====>Succeeded in receiving attribute of editor, inputPattern = ${attr.inputPattern}, enterKeyType = ${attr.enterKeyType}`);
if(attr.enterKeyType === 0){
commonEventPublishData = {
data: "SUCCESS"
};
inputKeyboardDelegate.off('editorAttributeChanged');
commoneventmanager.publish("SUB_Misc_inputMethod_onEditorAttributeChanged_0140", commonEventPublishData, this.publishCallback);
}
});
}
private SUB_Misc_inputMethod_offEditorAttributeChanged_0160(): void{
let commonEventPublishData = {
data: "SUCCESS"
};
let editorCallback = (attr) => {
console.log(`====>Succeeded in receiving attribute of editor, inputPattern = ${attr.inputPattern}, enterKeyType = ${attr.enterKeyType}`);
commonEventPublishData = {
data: "FAILED"
};
};
console.info(TAG + '====>receive SUB_Misc_inputMethod_offEditorAttributeChanged_0160 success');
inputKeyboardDelegate.on('editorAttributeChanged', editorCallback);
inputKeyboardDelegate.off('editorAttributeChanged', editorCallback);
let t = setTimeout(() => {
clearTimeout(t);
commoneventmanager.publish("SUB_Misc_inputMethod_offEditorAttributeChanged_0160", commonEventPublishData, this.publishCallback);
}, 100);
}
}
\ No newline at end of file
......@@ -21,10 +21,6 @@ import testsuite from '../../test/List.test'
@Component
struct Index {
@State message: string = 'Hello World';
@State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' +
'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' +
'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' +
'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21';
build() {
Row() {
......@@ -32,11 +28,6 @@ struct Index {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.defaultFocus(true)
TextArea({ text: this.inputValue })
.onChange((value: string) => {
this.inputValue = value;
})
Button() {
Text('next page')
.fontSize(20)
......
......@@ -22,29 +22,29 @@ export default function requestUploadJSUnit() {
console.info('====>################################request upload Test start');
/**
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/
beforeAll(function () {
console.info('====>beforeAll: Prerequisites are executed.');
});
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
beforeEach(function () {
console.info('====>beforeEach: Prerequisites is executed.');
});
/**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/
* 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: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/
afterAll(function () {
console.info('====>afterAll: Test suite-level cleanup condition is executed');
});
......@@ -208,7 +208,7 @@ export default function requestUploadJSUnit() {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_0006
* @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME
......@@ -261,15 +261,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig, (err, uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true);
uploadTask.on('progress', (data1, data2) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2);
});
uploadTask.off('progress', (data1, data2) => {
let progress_callback = (data1, data2) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2);
});
}
uploadTask.on('progress', progress_callback);
uploadTask.off('progress', progress_callback);
uploadTask.remove((err, data) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data);
......@@ -284,14 +282,14 @@ export default function requestUploadJSUnit() {
}
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------");
try {
......@@ -299,15 +297,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('headerReceive', (header) => {
let headerReceive_callback = (header) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != {} || header != undefined));
});
expect(true).assertEqual((header != {} || header != undefined));
}
uploadTask.on('headerReceive', headerReceive_callback);
uploadTask.off('headerReceive', (header) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != {} || header != undefined));
});
uploadTask.off('headerReceive',headerReceive_callback);
uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result);
......@@ -337,13 +333,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('complete', (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 on_complete" );
});
uploadTask.off('complete', (taskStates) => {
let complete_callback = (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 off_complete");
});
}
uploadTask.on('complete', complete_callback);
uploadTask.off('complete', complete_callback);
uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_0007 remove result = " + result);
......@@ -374,13 +370,12 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0008 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('fail', (taskStates) => {
let fail_callback = (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0008 on_fail");
});
}
uploadTask.on('fail', fail_callback);
uploadTask.off('fail', (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0008 off_fail");
});
uploadTask.off('fail', fail_callback);
uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_0008 remove result = " + result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册