提交 efe7b5d0 编写于 作者: Z zhangyushuai

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

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 eaa01f8e
...@@ -81,6 +81,39 @@ export class KeyboardDelegate { ...@@ -81,6 +81,39 @@ export class KeyboardDelegate {
console.debug(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 event:' + data.event); console.debug(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 event:' + data.event);
that.SUB_Misc_inputMethod_offSendFunctionKey_0040(); that.SUB_Misc_inputMethod_offSendFunctionKey_0040();
break; 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 { ...@@ -147,6 +180,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_onHandleExtendAction_0010(): void { private SUB_Misc_inputMethod_onHandleExtendAction_0010(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 start'); console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => { inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => { let t = setTimeout(async () => {
clearTimeout(t); clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 sendExtendAction start'); console.info(TAG + '====>SUB_Misc_inputMethod_onHandleExtendAction_0010 sendExtendAction start');
...@@ -159,6 +193,7 @@ export class KeyboardDelegate { ...@@ -159,6 +193,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_offHandleExtendAction_0020(): void { private SUB_Misc_inputMethod_offHandleExtendAction_0020(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 start'); console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => { inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => { let t = setTimeout(async () => {
clearTimeout(t); clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 sendExtendAction start'); console.info(TAG + '====>SUB_Misc_inputMethod_offHandleExtendAction_0020 sendExtendAction start');
...@@ -173,6 +208,7 @@ export class KeyboardDelegate { ...@@ -173,6 +208,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_onSendFunctionKey_0030(): void { private SUB_Misc_inputMethod_onSendFunctionKey_0030(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 start'); console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => { inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => { let t = setTimeout(async () => {
clearTimeout(t); clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 sendExtendAction start'); console.info(TAG + '====>SUB_Misc_inputMethod_onSendFunctionKey_0030 sendExtendAction start');
...@@ -185,6 +221,7 @@ export class KeyboardDelegate { ...@@ -185,6 +221,7 @@ export class KeyboardDelegate {
private SUB_Misc_inputMethod_offSendFunctionKey_0040(): void { private SUB_Misc_inputMethod_offSendFunctionKey_0040(): void {
console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 start'); console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 start');
inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => { inputMethodAbility.on("inputStart", async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
let t = setTimeout(async () => { let t = setTimeout(async () => {
clearTimeout(t); clearTimeout(t);
console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 sendExtendAction start'); console.info(TAG + '====>SUB_Misc_inputMethod_offSendFunctionKey_0040 sendExtendAction start');
...@@ -196,5 +233,168 @@ export class KeyboardDelegate { ...@@ -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' ...@@ -21,10 +21,6 @@ import testsuite from '../../test/List.test'
@Component @Component
struct Index { struct Index {
@State message: string = 'Hello World'; @State message: string = 'Hello World';
@State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' +
'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' +
'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' +
'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21';
build() { build() {
Row() { Row() {
...@@ -32,11 +28,6 @@ struct Index { ...@@ -32,11 +28,6 @@ struct Index {
Text(this.message) Text(this.message)
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.defaultFocus(true)
TextArea({ text: this.inputValue })
.onChange((value: string) => {
this.inputValue = value;
})
Button() { Button() {
Text('next page') Text('next page')
.fontSize(20) .fontSize(20)
......
...@@ -261,15 +261,13 @@ export default function requestUploadJSUnit() { ...@@ -261,15 +261,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig, (err, uploadTask) => { request.upload(uploadConfig, (err, uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask)); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true); expect(uploadTask != undefined).assertEqual(true);
uploadTask.on('progress', (data1, data2) => { let progress_callback = (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) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2); 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) => { uploadTask.remove((err, data) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data); console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data);
...@@ -299,15 +297,13 @@ export default function requestUploadJSUnit() { ...@@ -299,15 +297,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => { request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined)); expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('headerReceive', (header) => { let headerReceive_callback = (header) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + 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) => { uploadTask.off('headerReceive',headerReceive_callback);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != {} || header != undefined));
});
uploadTask.remove().then((result)=>{ uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result); console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result);
...@@ -337,13 +333,13 @@ export default function requestUploadJSUnit() { ...@@ -337,13 +333,13 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => { request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 uploadTask = " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_0007 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined)); expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('complete', (taskStates) => { let complete_callback = (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 on_complete" );
});
uploadTask.off('complete', (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0007 off_complete"); console.info("====>SUB_REQUEST_UPLOAD_API_0007 off_complete");
}); }
uploadTask.on('complete', complete_callback);
uploadTask.off('complete', complete_callback);
uploadTask.remove().then((result)=>{ uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_0007 remove result = " + result); console.info("====>SUB_REQUEST_UPLOAD_API_0007 remove result = " + result);
...@@ -374,13 +370,12 @@ export default function requestUploadJSUnit() { ...@@ -374,13 +370,12 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig).then((uploadTask) => { request.upload(uploadConfig).then((uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0008 uploadTask = " + uploadTask); console.info("====>SUB_REQUEST_UPLOAD_API_0008 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined)); expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('fail', (taskStates) => { let fail_callback = (taskStates) => {
console.info("====>SUB_REQUEST_UPLOAD_API_0008 on_fail"); console.info("====>SUB_REQUEST_UPLOAD_API_0008 on_fail");
}); }
uploadTask.on('fail', fail_callback);
uploadTask.off('fail', (taskStates) => { uploadTask.off('fail', fail_callback);
console.info("====>SUB_REQUEST_UPLOAD_API_0008 off_fail");
});
uploadTask.remove().then((result)=>{ uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_0008 remove result = " + 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.
先完成此消息的编辑!
想要评论请 注册