diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets index 434cab95a91f7a7a47700330288d3566323b2936..9ff5e35363e7e5e5e663e03077570f68a0e33ef4 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets @@ -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(); }); } diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets index 30d02c27dd8094fa1cae9f782654a1788008c272..3d34a3779796192490fdbabcb3d749f9f9f1c173 100644 --- a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets @@ -255,13 +255,13 @@ 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 - * @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-----------------------"); @@ -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(); + }); + }) }