提交 f088d91b 编写于 作者: Z zwx1016320

add API of request and input

Signed-off-by: Nzwx1016320 <zhangyushuai1@huawei-partners.com>
上级 b086ff93
......@@ -573,7 +573,7 @@ export default function inputMethodEngineJSUnit() {
it('inputMethodEngine_test_044', 0, async function (done) {
let keyType = inputMethodEngine.WINDOW_TYPE_INPUT_METHOD_FLOAT;
console.error("inputMethodEngine_test_044 result:" + keyType);
expect(keyType == null).assertTrue();
expect(keyType == 2105).assertTrue();
done();
});
......@@ -581,8 +581,8 @@ export default function inputMethodEngineJSUnit() {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.moveCursor(1, (value) => {
console.info("inputMethodEngine_test_045 getBackward:" + value);
textInputClient.moveCursor(inputMethodEngine.CURSOR_UP, (value) => {
console.info("inputMethodEngine_test_045 moveCursor:" + value);
expect(value == null).assertEqual(true);
});
}
......@@ -593,12 +593,38 @@ export default function inputMethodEngineJSUnit() {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.moveCursor(1);
promise.then(res => {
console.info("inputMethodEngine_test_046 getBackward promise result-----" + JSON.stringify(res));
textInputClient.moveCursor(inputMethodEngine.CURSOR_DOWN, (value) => {
console.info("inputMethodEngine_test_046 moveCursor:" + value);
expect(value == null).assertEqual(true);
});
}
done();
})
it('inputMethodEngine_test_047', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.moveCursor(inputMethodEngine.CURSOR_LEFT).then(res => {
console.info("inputMethodEngine_test_047 moveCursor promise result-----" + JSON.stringify(res));
expect(res == null).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_047 moveCursor promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
})
it('inputMethodEngine_test_048', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.moveCursor(inputMethodEngine.CURSOR_RIGHT).then(res => {
console.info("inputMethodEngine_test_048 moveCursor promise result-----" + JSON.stringify(res));
expect(res == null).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_046 getBackward promise error----" + JSON.stringify(err));
console.info("inputMethodEngine_test_048 moveCursor promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
......
......@@ -255,7 +255,7 @@ export default function requestUploadJSUnit() {
done();
});
/*
/**
* @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
......@@ -296,5 +296,86 @@ export default function requestUploadJSUnit() {
done();
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0002
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0002 is starting-----------------------");
try {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.on('complete', (TaskState) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message);
expect(typeof(TaskState.path) == "string").assertEqual(true);
expect(typeof(TaskState.responseCode) == "number").assertEqual(true);
expect(typeof(TaskState.message) == "string").assertEqual(true);
});
uploadTask.on('fail', (TaskState) => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode);
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message);
expect(typeof(TaskState.path) == "string").assertEqual(true);
expect(typeof(TaskState.responseCode) == "number").assertEqual(true);
expect(typeof(TaskState.message) == "string").assertEqual(true);
expect(true).assertEqual(true);
});
});
} catch (e) {
console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done();
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0003
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0003', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 is starting-----------------------");
try {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.off('complete', () => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
});
uploadTask.off('fail', () => {
console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
});
});
} catch (e) {
console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
sleep(Date.now(), 20000);
console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 end-----------------------");
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册