未验证 提交 18a664eb 编写于 作者: O openharmony_ci 提交者: Gitee

!9419 【杂散】【输入法框架】输入法新文本状态和编辑框携带信息新增用例

Merge pull request !9419 from 张育帅/master
...@@ -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)
......
...@@ -77,7 +77,27 @@ export default function inputMethodDrawnControlJSUnit() { ...@@ -77,7 +77,27 @@ export default function inputMethodDrawnControlJSUnit() {
} catch (err) { } catch (err) {
console.info("====>afterAll: inputMethodEngineJSUnit fail" + JSON.stringify(err)); console.info("====>afterAll: inputMethodEngineJSUnit fail" + JSON.stringify(err));
} }
}) });
afterEach(
async function (){
try{
let data = await inputMethod.getController().detach();
console.info(`attach inputMethod success, data: ${JSON.stringify(data)}`);
}catch(error){
console.info(`attach inputMethod fail, error: [${error.code}, ${error.message}]`);
};
}
);
let sleep = function (timeout) {
return new Promise(resolve => {
const st = setTimeout(() => {
resolve(null);
clearTimeout(st);
}, timeout);
});
};
it('SUB_Misc_inputMethod_onHandleExtendAction_0010',0, async function (done) { it('SUB_Misc_inputMethod_onHandleExtendAction_0010',0, async function (done) {
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}} const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
...@@ -225,6 +245,585 @@ export default function inputMethodDrawnControlJSUnit() { ...@@ -225,6 +245,585 @@ export default function inputMethodDrawnControlJSUnit() {
commoneventmanager.publish('test', commonEventPublishData, publishCallback); commoneventmanager.publish('test', commonEventPublishData, publishCallback);
}); });
it('SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
inputMethod.getController().on('getLeftTextOfCursor', (length) => {
inputMethod.getController().off('getLeftTextOfCursor');
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 length: " + length);
expect(length).assertEqual(10000);
return 'test'
})
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_onGetLeftTextOfCursor_0050 subscriber finish");
var commonEventPublishData = {
code: 50
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_InputMethod_onGetLeftTextOfCursor_0060', 0, async function (done) {
try {
inputMethod.getController().on('getLeftTextOfCursor', (length) => {
return 'test'
})
console.info("====>SUB_Misc_InputMethod_ongetLeftTextOfCursor_0060 on('getLeftTextOfCursor') Success:");
expect().assertFail();
} catch (err) {
console.info("====>SUB_Misc_InputMethod_ongetLeftTextOfCursor_0060 err:" + JSON.stringify(err));
expect(err.code).assertEqual(12800009);
done();
}
});
it('SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
let getLetTest_callback = (length) => {
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 length: " + length);
expect(length).assertEqual(10000);
return 'test'
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 attach Success");
inputMethod.getController().on('getLeftTextOfCursor', getLetTest_callback);
inputMethod.getController().off('getLeftTextOfCursor', getLetTest_callback);
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_offGetLeftTextOfCursor_0070 subscriber finish");
var commonEventPublishData = {
code: 70
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_InputMethod_onGetRightTextOfCursor_0080', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
inputMethod.getController().on('getRightTextOfCursor', (length) => {
inputMethod.getController().off('getRightTextOfCursor');
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 length: " + length);
expect(length).assertEqual(10000);
return 'test'
})
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_onGetRightTextOfCursor_0080"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0080 subscriber finish");
var commonEventPublishData = {
code: 80
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_InputMethod_onGetRightTextOfCursor_0090', 0, async function (done) {
try {
inputMethod.getController().on('getRightTextOfCursor', (length) => {
return 'test'
})
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0090 on('getLeftTextOfCursor') Success:");
expect().assertFail();
} catch (err) {
console.info("====>SUB_Misc_InputMethod_onGetRightTextOfCursor_0090 err:" + JSON.stringify(err));
expect(err.code).assertEqual(12800009);
done();
}
});
it('SUB_Misc_InputMethod_offGetRightTextOfCursor_0100', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
let getRightTest_callback = (length) => {
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 length: " + length);
expect(length).assertEqual(10000);
return 'test'
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 attach Success");
inputMethod.getController().on('getRightTextOfCursor', getRightTest_callback);
inputMethod.getController().off('getRightTextOfCursor', getRightTest_callback);
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_offGetRightTextOfCursor_0100"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_offGetRightTextOfCursor_0100 subscriber finish");
var commonEventPublishData = {
code: 100
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
inputMethod.getController().on('getTextIndexAtCursor', () => {
inputMethod.getController().off('getTextIndexAtCursor');
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 on('getTextIndexAtCursor')");
return 10000
})
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0110 subscriber finish");
var commonEventPublishData = {
code: 110
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_InputMethod_onGetTextIndexAtCursor_0120', 0, async function (done) {
try {
inputMethod.getController().on('getTextIndexAtCursor', () => {
return 10000
})
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0120 on('getLeftTextOfCursor') Success:");
expect().assertFail();
} catch (err) {
console.info("====>SUB_Misc_InputMethod_onGetTextIndexAtCursor_0120 err:" + JSON.stringify(err));
expect(err.code).assertEqual(12800009);
done();
}
});
it('SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
let getTextTest_callback = () => {
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 getLetTest_callback");
return 10000
}
async function publishCallback(err){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 publishCallback start");
if (err){
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 publishCallback failed:" + JSON.stringify(err));
} else {
await sleep(10);
const ATTRIBUTE:any = {inputAttribute:{textInputType:0,enterKeyType:0}}
await inputMethod.getController().attach(true, ATTRIBUTE);
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 attach Success");
inputMethod.getController().on('getTextIndexAtCursor', getTextTest_callback);
inputMethod.getController().off('getTextIndexAtCursor', getTextTest_callback);
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_InputMethod_offGetTextIndexAtCursor_0130 subscriber finish");
var commonEventPublishData = {
code: 130
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_inputMethod_onEditorAttributeChanged_0140',0, async function (done) {
let inputAttribute = {textInputType:0,enterKeyType:3}
let inputAttribute1 = {textInputType:0,enterKeyType:0}
let cursorInfo = {left: 2, top: 2, width: 2, height: 2}
const textConfig = {
inputAttribute,
cursorInfo ,
windowId: 100
}
function unSubscriberCallback (err){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
async function publishCallback(err){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 onEditorAttributeChanged start");
if (err){
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 publishCallback failed:" + JSON.stringify(err));
} else {
try {
await sleep(10);
await inputMethod.getController().attach(false, textConfig);
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 onEditorAttributeChanged attach");
await sleep(10);
await inputMethod.getController().updateAttribute(inputAttribute1);
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 onEditorAttributeChanged updateAttribute");
} catch (err) {
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 onEditorAttributeChanged catch err: " + JSON.stringify(err));
}
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_inputMethod_onEditorAttributeChanged_0140"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0140 subscriber finish");
var commonEventPublishData = {
code: 140
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
it('SUB_Misc_inputMethod_onEditorAttributeChanged_0150',0, async function (done) {
let inputAttribute = {textInputType:0,enterKeyType:0}
try {
await inputMethod.getController().updateAttribute(inputAttribute);
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0150 onEditorAttributeChanged updateAttribute");
expect().assertFail();
} catch (err) {
console.info("====>SUB_Misc_inputMethod_onEditorAttributeChanged_0150 err:" + JSON.stringify(err));
expect(err.code).assertEqual(12800009);
done();
}
});
it('SUB_Misc_inputMethod_offEditorAttributeChanged_0160',0, async function (done) {
let inputAttribute = {textInputType:0,enterKeyType:0}
let selection = {start: 2, end: 1000}
const textConfig = {
inputAttribute,
selection,
}
function unSubscriberCallback (err){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 unSubscriberCallback start");
if (err){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
async function publishCallback(err){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 onEditorAttributeChanged start");
if (err){
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 publishCallback failed:" + JSON.stringify(err));
} else {
try {
await sleep(10);
await inputMethod.getController().attach(false, textConfig);
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 onEditorAttributeChanged attach");
await inputMethod.getController().updateAttribute(inputAttribute);
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 onEditorAttributeChanged updateAttribute");
} catch (err) {
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 onEditorAttributeChanged catch err: " + JSON.stringify(err));
}
}
}
var commonEventSubscribeInfo = {
events: ["SUB_Misc_inputMethod_offEditorAttributeChanged_0160"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 subscriber data:" + JSON.stringify(data));
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>SUB_Misc_inputMethod_offEditorAttributeChanged_0160 subscriber finish");
var commonEventPublishData = {
code: 160
}
commoneventmanager.publish('test', commonEventPublishData, publishCallback);
})
});
}) })
} }
\ No newline at end of file
...@@ -22,29 +22,29 @@ export default function requestUploadJSUnit() { ...@@ -22,29 +22,29 @@ export default function requestUploadJSUnit() {
console.info('====>################################request upload Test start'); 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 () { beforeAll(function () {
console.info('====>beforeAll: Prerequisites are executed.'); 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 () { beforeEach(function () {
console.info('====>beforeEach: Prerequisites is executed.'); 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 () { afterEach(function () {
console.info('====>afterEach: Test case-level clearance conditions is executed.'); 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 () { afterAll(function () {
console.info('====>afterAll: Test suite-level cleanup condition is executed'); console.info('====>afterAll: Test suite-level cleanup condition is executed');
}); });
...@@ -208,7 +208,7 @@ export default function requestUploadJSUnit() { ...@@ -208,7 +208,7 @@ export default function requestUploadJSUnit() {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------");
done(); done();
}); });
/** /**
* @tc.number SUB_REQUEST_UPLOAD_API_0006 * @tc.number SUB_REQUEST_UPLOAD_API_0006
* @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME
...@@ -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);
...@@ -284,14 +282,14 @@ export default function requestUploadJSUnit() { ...@@ -284,14 +282,14 @@ export default function requestUploadJSUnit() {
} }
}); });
/** /**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001 * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001
* @tc.name : Use getEntries get the value by mixing the string key * @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Mixed strings value can be obtained correctly * @tc.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest * @tc.size : MediumTest
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) { it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------"); console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------");
try { try {
...@@ -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.
先完成此消息的编辑!
想要评论请 注册