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

!4961 【OpenHarmony 3.2.6.2】【RK3568】【ToD】【输入法框架】【上传下载】【主题】用例名称修正为规范名称

Merge pull request !4961 from zeng_xingdong/master
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import inputmethohJsunit from './InputmethohJsunit.test.ets'; import inputMethodJSUnit from './inputMethodJSUnit.ets';
import inputmethodEngineJsunit from './InputmethodEngineJsunit.test.ets'; import inputMethodEngineJSUnit from './inputMethodEngineJSUnit.ets';
import inputRequestJsunit from './InputRequestJsunit.test.ets'; import inputRequestJSUnit from './inputRequestJSUnit.ets';
import requestJsunit from './RequestJsunit.test.ets'; import requestJSUnit from './requestJSUnit.ets';
import requestDownloadJsunit from './RequestDownloadTaskJsunit.test.ets'; import requestDownloadJSUnit from './requestDownloadJSUnit.ets';
export default function testsuite() { export default function testsuite() {
inputmethohJsunit(); inputMethodJSUnit();
inputmethodEngineJsunit(); inputMethodEngineJSUnit();
inputRequestJsunit(); inputRequestJSUnit();
requestDownloadJsunit(); requestDownloadJSUnit();
requestJsunit(); requestJSUnit();
} }
\ No newline at end of file
...@@ -57,10 +57,10 @@ export default class Utils { ...@@ -57,10 +57,10 @@ export default class Utils {
} }
static async drags(downX, downY, upX, upY, steps, drag) { static async drags(downX, downY, upX, upY, steps, drag) {
var xStep; let xStep;
var yStep; let yStep;
var swipeSteps; let swipeSteps;
var ret; let ret;
xStep = 0; xStep = 0;
yStep = 0; yStep = 0;
ret = false; ret = false;
...@@ -71,7 +71,7 @@ export default class Utils { ...@@ -71,7 +71,7 @@ export default class Utils {
xStep = (upX - downX) / swipeSteps; xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps; yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = { let downPonit: TouchObject = {
id: 1, id: 1,
x: downX, x: downX,
y: downY, y: downY,
...@@ -83,8 +83,8 @@ export default class Utils { ...@@ -83,8 +83,8 @@ export default class Utils {
if (drag) { if (drag) {
await this.sleep(500) await this.sleep(500)
} }
for (var i = 1;i <= swipeSteps; i++) { for (let i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = { let movePoint: TouchObject = {
id: 1, id: 1,
x: downX + (xStep * i), x: downX + (xStep * i),
y: downY + (yStep * i), y: downY + (yStep * i),
...@@ -101,7 +101,7 @@ export default class Utils { ...@@ -101,7 +101,7 @@ export default class Utils {
if (drag) { if (drag) {
await this.sleep(100) await this.sleep(100)
} }
var upPoint: TouchObject = { let upPoint: TouchObject = {
id: 1, id: 1,
x: upX, x: upX,
y: upY, y: upY,
......
...@@ -19,12 +19,12 @@ import Utils from './Utils'; ...@@ -19,12 +19,12 @@ import Utils from './Utils';
import router from '@system.router'; import router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
export default function inputMethodEngineJsunit() { export default function inputMethodEngineJSUnit() {
describe('appInfoTest_input_1', function () { describe('appInfoTest_input_1', function () {
var mKeyboardDelegate = null; let mKeyboardDelegate = null;
var inputMethodEngineObject = inputMethodEngine.getInputMethodEngine(); let inputMethodEngineObject = inputMethodEngine.getInputMethodEngine();
var textInputClient = null; let textInputClient = null;
var kbController = null; let kbController = null;
console.info("************* inputMethodEngine Test start*************"); console.info("************* inputMethodEngine Test start*************");
beforeEach(async function (done) { beforeEach(async function (done) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index';
import inputMethod from '@ohos.inputmethod'; import inputMethod from '@ohos.inputmethod';
export default function settingUiJsunit() { export default function inputMethodJSUnit() {
describe('appInfoTest_input_2', function () { describe('appInfoTest_input_2', function () {
console.info("************* settings Test start*************"); console.info("************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) { it('inputmethoh_test_001', 0, async function (done) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import {describe, it, expect} from 'hypium/index'; import {describe, it, expect} from 'hypium/index';
import request from '@ohos.request'; import request from '@ohos.request';
export default function inputRequestJsunit() { export default function inputRequestJSUnit() {
describe('inputRequestTest', function () { describe('inputRequestTest', function () {
console.log("************* request Test start*************"); console.log("************* request Test start*************");
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import {describe, it, expect} from "deccjsunit/index.ets"; import {describe, it, expect} from "deccjsunit/index.ets";
import request from '@ohos.request'; import request from '@ohos.request';
export default function requestDownloadJsunit() { export default function requestDownloadJSUnit() {
describe('requestDownloadTest', function () { describe('requestDownloadTest', function () {
let downloadConfig = { let downloadConfig = {
url: "www.baidu.com" url: "www.baidu.com"
...@@ -32,10 +32,10 @@ export default function requestDownloadJsunit() { ...@@ -32,10 +32,10 @@ export default function requestDownloadJsunit() {
header: 'HTTP', header: 'HTTP',
method: 'post', method: 'post',
files: file, files: file,
data: 'jason/xml' data: 'json/xml'
}; };
var receivedSize; let receivedSize;
var totalSize; let totalSize;
console.log("************* settings Test start*************"); console.log("************* settings Test start*************");
/** /**
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import {describe, it, expect} from "deccjsunit/index.ets"; import {describe, it, expect} from "deccjsunit/index.ets";
import request from '@ohos.request'; import request from '@ohos.request';
export default function requestJsunit() { export default function requestJSUnit() {
describe('requestTest', function () { describe('requestTest', function () {
/** /**
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import uploadRequestJsunitTest from './uploadCallbackXTSJsunitTest'; import uploadRequestJSUnitTest from './uploadCallbackXTSJSUnitTest';
export default function testsuite() { export default function testsuite() {
uploadRequestJsunitTest() uploadRequestJSUnitTest()
} }
\ No newline at end of file
...@@ -27,7 +27,7 @@ function sleep(ms) { ...@@ -27,7 +27,7 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
function getUploadConfig(fileurl){ function getUploadConfig(fileURL){
let File = { let File = {
filename: 'test', // When multipart is submitted, the file name in the request header. filename: 'test', // When multipart is submitted, the file name in the request header.
name: 'test', // When multipart is submitted, the name of the form item. The default is file. name: 'test', // When multipart is submitted, the name of the form item. The default is file.
...@@ -52,74 +52,74 @@ function getUploadConfig(fileurl){ ...@@ -52,74 +52,74 @@ function getUploadConfig(fileurl){
} }
//upload公共方法 //upload公共方法
function publicupload(UploadConfig){ function publicUpload(UploadConfig){
console.info(`Testupdate UploadConfig ${JSON.stringify(UploadConfig)}`) console.info(`TestUpdate UploadConfig ${JSON.stringify(UploadConfig)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
request.upload(UploadConfig, (err, data) => { request.upload(UploadConfig, (err, data) => {
console.info("Testupdate publiconprogress Updatetask =" + JSON.stringify(data)); console.info("TestUpdate publicOnProgress UpdateTask =" + JSON.stringify(data));
resolve(data); resolve(data);
}) })
}) })
} }
//onprogress公共方法 //OnProgress公共方法
function publiconprogress(Updatetask, Type){ function publicOnProgress(UpdateTask, Type){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
Updatetask.on(Type, function(data1 ,data2){ UpdateTask.on(Type, function(data1 ,data2){
let progress = { let progress = {
uploadedSize : data1, uploadedSize : data1,
totalSize : data2 totalSize : data2
} }
console.info("Testupdate publiconprogress uploadedSize =" + data1); console.info("TestUpdate publicOnProgress uploadedSize =" + data1);
console.info("Testupdate publiconprogress totalSize =" + data2); console.info("TestUpdate publicOnProgress totalSize =" + data2);
resolve(progress); resolve(progress);
}) })
}) })
} }
//offprogress公共方法 //OffProgress公共方法
function publicoffprogress(Updatetask, Type){ function publicOffProgress(UpdateTask, Type){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
Updatetask.off(Type, function(data1 ,data2){ UpdateTask.off(Type, function(data1 ,data2){
let progress = { let progress = {
uploadedSize : data1, uploadedSize : data1,
totalSize : data2 totalSize : data2
} }
console.info("Testupdate publicoffprogress uploadedSize =" + data1); console.info("TestUpdate publicOffProgress uploadedSize =" + data1);
console.info("Testupdate publicoffprogress totalSize =" + data2); console.info("TestUpdate publicOffProgress totalSize =" + data2);
resolve(progress); resolve(progress);
}) })
}) })
} }
//其他on公共方法 //其他on公共方法
function publicon(Updatetask, Type){ function publicOn(UpdateTask, Type){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
Updatetask.on(Type, function(data){ UpdateTask.on(Type, function(data){
console.info("Testupdate publicon =" + data); console.info("TestUpdate publicOn =" + data);
resolve(data); resolve(data);
}) })
}) })
} }
//其他off公共方法 //其他off公共方法
function publicoff(Updatetask, Type){ function publicOff(UpdateTask, Type){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
Updatetask.off(Type, function(data){ UpdateTask.off(Type, function(data){
console.info("Testupdate publicoff =" + data); console.info("TestUpdate publicOff =" + data);
resolve(data); resolve(data);
}) })
}) })
} }
//remove公共方法 //remove公共方法
function publicremove(Updatetask){ function publicRemove(UpdateTask){
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
Updatetask.remove((err,data) => { UpdateTask.remove((err,data) => {
console.info("Testupdate publicremove =" + data); console.info("TestUpdate publicRemove =" + data);
resolve(data); resolve(data);
}) })
}) })
} }
export{publicupload,publicon,publicoff,publicremove,publiconprogress,publicoffprogress,getUploadConfig,sleep} export{publicUpload,publicOn,publicOff,publicRemove,publicOnProgress,publicOffProgress,getUploadConfig,sleep}
\ No newline at end of file \ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import request from '@ohos.request'; import request from '@ohos.request';
import * as pubfun from './Publicfunction.ets' import * as pubFun from './publicFunction.ets'
var typeProgress = 'progress'; var typeProgress = 'progress';
var typeHeaderReceive = 'headerReceive'; var typeHeaderReceive = 'headerReceive';
...@@ -23,7 +23,7 @@ var typeFail = 'fail'; ...@@ -23,7 +23,7 @@ var typeFail = 'fail';
let uploadTask; let uploadTask;
let file7url = 'internal://cache/test.txt'; let file7url = 'internal://cache/test.txt';
export default function uploadRequestJsunitTest() { export default function uploadRequestJSUnitTest() {
describe('UploadTest', function () { describe('UploadTest', function () {
beforeAll(function () { beforeAll(function () {
console.info('beforeAll: Prerequisites at the test suite level, ' + console.info('beforeAll: Prerequisites at the test suite level, ' +
...@@ -43,159 +43,159 @@ export default function uploadRequestJsunitTest() { ...@@ -43,159 +43,159 @@ export default function uploadRequestJsunitTest() {
}) })
/* /*
* @tc.number : InitUploadtaskCallback001 * @tc.number : SUB_MISC_REQUEST_API_UploadTask_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('InitUploadtaskCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_API_UploadTask_0001', 0, async function (done) {
try { try {
console.info("Testupdate before getuploadconfig"); console.info("TestUpdate before getUploadConfig");
let UploadConfig = pubfun.getUploadConfig(file7url) let UploadConfig = pubFun.getUploadConfig(file7url)
console.info("Testupdate before upload UploadConfig = " + JSON.stringify(UploadConfig)); console.info("TestUpdate before upload UploadConfig = " + JSON.stringify(UploadConfig));
console.info("Testupdate before upload"); console.info("TestUpdate before upload");
await pubfun.publicupload(UploadConfig).then((data) => { await pubFun.publicUpload(UploadConfig).then((data) => {
console.info("Testupdate going upload uploadTask = " + data); console.info("TestUpdate going upload uploadTask = " + data);
uploadTask = data; uploadTask = data;
expect(true).assertEqual((data != undefined) || (data != "") || (data != {})); expect(true).assertEqual((data != undefined) || (data != "") || (data != {}));
done(); done();
}).catch((err) => { }).catch((err) => {
console.info("InitUploadtaskCallback001 fail 1" + JSON.stringify(err)); console.info("SUB_MISC_REQUEST_API_UploadTask_0001 fail 1" + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
} catch (e) { } catch (e) {
console.info("InitUploadtaskCallback001 fail 2" + JSON.stringify(e)); console.info("SUB_MISC_REQUEST_API_UploadTask_0001 fail 2" + JSON.stringify(e));
expect(e).assertFail(); expect(e).assertFail();
done(); done();
} }
}) })
/* /*
* @tc.number : SwitchOnProgressCallback001 * @tc.number : SUB_MISC_REQUEST_API_OnProgress_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('SwitchOnProgressCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_API_OnProgress_0001', 0, async function (done) {
try { try {
pubfun.publiconprogress(uploadTask, typeProgress); pubFun.publicOnProgress(uploadTask, typeProgress);
expect(true).assertEqual(0 == 0); expect(true).assertEqual(0 == 0);
done(); done();
} catch (err) { } catch (err) {
console.info("Testupdate SwitchOnProgressCallback001 catch err " + JSON.stringify(err)); console.info("TestUpdate SUB_MISC_REQUEST_API_OnProgress_0001 catch err " + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done(); done();
} }
}); });
/* /*
* @tc.number : SwitchOffProgressCallback001 * @tc.number : SUB_MISC_REQUEST__OffProgress_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('SwitchOffProgressCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_OffProgress_0001', 0, async function (done) {
try { try {
pubfun.publiconprogress(uploadTask, typeProgress); pubFun.publicOnProgress(uploadTask, typeProgress);
expect(true).assertEqual(0 == 0); expect(true).assertEqual(0 == 0);
await pubfun.publicoffprogress(uploadTask, typeProgress).then((data) => { await pubFun.publicOffProgress(uploadTask, typeProgress).then((data) => {
console.info("SwitchOffProgressCallback001 data" + JSON.stringify(data)); console.info("SUB_MISC_REQUEST_OffProgress_0001 data" + JSON.stringify(data));
expect(7).assertEqual(data["totalSize"]); expect(7).assertEqual(data["totalSize"]);
done(); done();
}).catch((err) => { }).catch((err) => {
console.info("SwitchOffProgressCallback001 fail 2" + JSON.stringify(err)); console.info("SUB_MISC_REQUEST_OffProgress_0001 fail 2" + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
} catch (e) { } catch (e) {
console.info("SwitchOffProgressCallback001 fail 3" + JSON.stringify(e)); console.info("SUB_MISC_REQUEST_OffProgress_0001 fail 3" + JSON.stringify(e));
expect(e).assertFail(); expect(e).assertFail();
done(); done();
} }
}) })
/* /*
* @tc.number : SwitchOnFailCallback001 * @tc.number : SUB_MISC_REQUEST_OnFail_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('SwitchOnFailCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_OnFail_0001', 0, async function (done) {
try { try {
await pubfun.publicon(uploadTask, typeFail).then((data) => { await pubFun.publicOn(uploadTask, typeFail).then((data) => {
console.info("SwitchOnFailCallback001 data " + data); console.info("SUB_MISC_REQUEST_OnFail_0001 data " + data);
expect(5).assertEqual(data); expect(5).assertEqual(data);
done(); done();
}).catch((err) => { }).catch((err) => {
console.info("SwitchOnFailCallback001 fail 2" + JSON.stringify(err)); console.info("SUB_MISC_REQUEST_OnFail_0001 fail 2" + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
} catch (e) { } catch (e) {
console.info("SwitchOnFailCallback001 fail 3" + JSON.stringify(e)); console.info("SUB_MISC_REQUEST_OnFail_0001 fail 3" + JSON.stringify(e));
expect(e).assertFail(); expect(e).assertFail();
done(); done();
} }
}) })
/* /*
* @tc.number : SwitchOffFailCallback001 * @tc.number : SUB_MISC_REQUEST_OffFail_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('SwitchOffFailCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_OffFail_0001', 0, async function (done) {
try { try {
await pubfun.publicon(uploadTask, typeFail) await pubFun.publicOn(uploadTask, typeFail)
await pubfun.publicoff(uploadTask, typeFail).then((data) => { await pubFun.publicOff(uploadTask, typeFail).then((data) => {
console.info("SwitchOffFailCallback001 data " + data); console.info("SUB_MISC_REQUEST_OffFail_0001 data " + data);
expect(5).assertEqual(data); expect(5).assertEqual(data);
done(); done();
}).catch((err) => { }).catch((err) => {
console.info("SwitchOffFailCallback001 fail 2" + JSON.stringify(err)); console.info("SUB_MISC_REQUEST_OffFail_0001 fail 2" + JSON.stringify(err));
done(); done();
expect(err).assertFail(); expect(err).assertFail();
}) })
} catch (e) { } catch (e) {
console.info("SwitchOffFailCallback001 fail 3" + JSON.stringify(e)); console.info("SUB_MISC_REQUEST_OffFail_0001 fail 3" + JSON.stringify(e));
expect(e).assertFail(); expect(e).assertFail();
done(); done();
} }
}) })
/* /*
* @tc.number : RemoveCallback001 * @tc.number : SUB_MISC_REQUEST_RmvCB_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('RemoveCallback001', 0, async function (done) { it('SUB_MISC_REQUEST_RmvCB_0001', 0, async function (done) {
try { try {
await pubfun.publicremove(uploadTask).then((data) => { await pubFun.publicRemove(uploadTask).then((data) => {
console.info("RemoveCallback001 data " + data); console.info("SUB_MISC_REQUEST_RmvCB_0001 data " + data);
expect(true).assertEqual(data); expect(true).assertEqual(data);
done(); done();
}).catch((err) => { }).catch((err) => {
console.info("RemoveCallback001 fail 2" + JSON.stringify(err)); console.info("SUB_MISC_REQUEST_RmvCB_0001 fail 2" + JSON.stringify(err));
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
} catch (e) { } catch (e) {
console.info("RemoveCallback001 fail 3" + JSON.stringify(e)); console.info("SUB_MISC_REQUEST_RmvCB_0001 fail 3" + JSON.stringify(e));
expect(e).assertFail(); expect(e).assertFail();
done(); done();
} }
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -23,8 +23,8 @@ export default function ScreenLockPromiseTest(){ ...@@ -23,8 +23,8 @@ export default function ScreenLockPromiseTest(){
console.info("-----------------------ScreenlockPromiseTest is starting-----------------------"); console.info("-----------------------ScreenlockPromiseTest is starting-----------------------");
function sleep(numberMillis) { function sleep(numberMillis) {
var now = new Date(); let now = new Date();
var exitTime = now.getTime() + numberMillis; let exitTime = now.getTime() + numberMillis;
while (true) { while (true) {
now = new Date(); now = new Date();
if (now.getTime() > exitTime) if (now.getTime() > exitTime)
...@@ -33,134 +33,144 @@ export default function ScreenLockPromiseTest(){ ...@@ -33,134 +33,144 @@ export default function ScreenLockPromiseTest(){
} }
/* /*
* @tc.number ScreenLock_Test_Promise_0100 * @tc.number SUB_MISC_THEME_screenLock_API_Promise_001
* @tc.name Set to locked screen, query the lock screen state is locked state * @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test * @tc.desc Test ScreenLock API functionality.
* @tc.level 0 * @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/ */
it("ScreenLock_Test_Promise_0100", 0, async function (done) { it("SUB_MISC_THEME_screenLock_API_Promise_001", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0100-------------------"); console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
var isScreenLocked = true; let isScreenLocked = true;
try { try {
screenLock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info("ScreenLock_Test_Promise_0100 isScreenLocked result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_001 isScreenLocked result is " + data);
expect(data == true).assertTrue() expect(data == true).assertTrue()
}) })
} catch (error) { } catch (error) {
console.info("ScreenLock_Test_Promise_0100 test_setScreenLocked : error = " + error); console.info("SUB_MISC_THEME_screenLock_API_Promise_001 test_setScreenLocked : error = " + error);
expect(true).assertTrue(); expect(true).assertTrue();
} }
console.info("------------------end ScreenLock_Test_Promise_0100-------------------"); console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done(); done();
}); });
/* /*
* @tc.number ScreenLock_Test_Promise_0200 * @tc.number SUB_MISC_THEME_screenLock_API_Promise_002
* @tc.name Set to unlocked screen, query the lock screen state is unlocked state * @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test * @tc.desc Test ScreenLock API functionality.
* @tc.level 0 * @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/ */
it("ScreenLock_Test_Promise_0200", 0, async function (done) { it("SUB_MISC_THEME_screenLock_API_Promise_002", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0200-------------------"); console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
var isScreenLocked = false; let isScreenLocked = false;
try { try {
screenLock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info("ScreenLock_Test_Promise_0200 isScreenLocked result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_002 isScreenLocked result is " + data);
expect(data == false).assertTrue(); expect(data == false).assertTrue();
}); });
} catch (error) { } catch (error) {
console.info("ScreenLock_Test_Promise_0200 test_setScreenLocked : error = " + error); console.info("SUB_MISC_THEME_screenLock_API_Promise_002 test_setScreenLocked : error = " + error);
expect(true).assertTrue(); expect(true).assertTrue();
} }
console.info("------------------end ScreenLock_Test_Promise_0200-------------------"); console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done(); done();
}); });
/* /*
* @tc.number ScreenLock_Test_Promise_0300 * @tc.number SUB_MISC_THEME_screenLock_API_Promise_003
* @tc.name Query whether a password has been set, and return the password that has not been set * @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test * @tc.desc Test ScreenLock API functionality.
* @tc.level 0 * @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/ */
it("ScreenLock_Test_Promise_0300", 0, async function (done) { it("SUB_MISC_THEME_screenLock_API_Promise_003", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0300-------------------"); console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
try { try {
screenLock.isSecureMode().then((data) => { screenLock.isSecureMode().then((data) => {
console.info("ScreenLock_Test_Promise_0300 isScreenLocked result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked result is " + data);
expect(data == false).assertTrue(); expect(data == false).assertTrue();
}); });
} catch (error) { } catch (error) {
console.info("ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error = " + error); console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked TRUE: error = " + error);
expect(true).assertTrue(); expect(true).assertTrue();
} }
console.info("------------------end ScreenLock_Test_Promise_0300-------------------"); console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done(); done();
}); });
/* /*
* @tc.number ScreenLock_Test_Promise_0400 * @tc.number SUB_MISC_THEME_screenLock_API_Promise_004
* @tc.name Request to unlock the device screen, unlock successfully * @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test * @tc.desc Test ScreenLock API functionality.
* @tc.level 0 * @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/ */
it("ScreenLock_Test_Promise_0400", 0, async function (done) { it("SUB_MISC_THEME_screenLock_API_Promise_004", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0400-------------------"); console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
try { try {
screenLock.unlockScreen().then(() => { screenLock.unlockScreen().then(() => {
console.info("ScreenLock_Test_Promise_0400: send unlockScreen issue success"); console.info("SUB_MISC_THEME_screenLock_API_Promise_004: send unlockScreen issue success");
}); });
sleep(SLEEP_TIME); sleep(SLEEP_TIME);
var unlockScreenResult = 0; let unlockScreenResult = 0;
var eventType = 'unlockScreenResult'; let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("ScreenLock_Test_Promise_0400: sendScreenLockEvent result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}); });
sleep(SLEEP_TIME); sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info("ScreenLock_Test_Promise_0400: isScreenLocked result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_004: isScreenLocked result is " + data);
expect(data == false).assertTrue(); expect(data == false).assertTrue();
}); });
} catch (error) { } catch (error) {
console.info("Screenlock_Test_1400: error = " + error); console.info("Screenlock_Test_1400: error = " + error);
expect(true).assertTrue(); expect(true).assertTrue();
} }
console.info("------------------end ScreenLock_Test_Promise_0400-------------------"); console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
done(); done();
}); });
/* /*
* @tc.number ScreenLock_Test_Promise_0500 * @tc.number SUB_MISC_THEME_screenLock_API_Promise_005
* @tc.name Request to unlock device screen, unlock failed * @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test * @tc.desc Test ScreenLock API functionality.
* @tc.level 0 * @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/ */
it("ScreenLock_Test_Promise_0500", 0, async function (done) { it("SUB_MISC_THEME_screenLock_API_Promise_005", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0500-------------------"); console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
try { try {
screenLock.unlockScreen().then(() => { screenLock.unlockScreen().then(() => {
console.info("ScreenLock_Test_Promise_0500: send unlockScreen issue success"); console.info("SUB_MISC_THEME_screenLock_API_Promise_005: send unlockScreen issue success");
}); });
sleep(SLEEP_TIME); sleep(SLEEP_TIME);
var unlockScreenResult = 1; let unlockScreenResult = 1;
var eventType = 'unlockScreenResult'; let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("ScreenLock_Test_Promise_0500: sendScreenLockEvent result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue(); expect(data == true).assertTrue();
}); });
sleep(SLEEP_TIME); sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info("ScreenLock_Test_Promise_0500: isScreenLocked result is " + data); console.info("SUB_MISC_THEME_screenLock_API_Promise_005: isScreenLocked result is " + data);
expect(data == true).assertTrue(); expect(data == true).assertTrue();
done(); done();
}); });
} catch (error) { } catch (error) {
console.info("logMessage ScreenLock_Test_Promise_0500: error = " + error); console.info("logMessage SUB_MISC_THEME_screenLock_API_Promise_005: error = " + error);
expect(true).assertTrue(); expect(true).assertTrue();
} }
console.info("------------------end ScreenLock_Test_Promise_0500-------------------"); console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
done(); done();
}); });
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -18,8 +18,8 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -18,8 +18,8 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
const WALLPAPER_SYSTEM = 0; const WALLPAPER_SYSTEM = 0;
const WALLPAPER_LOCKSCREEN = 1; const WALLPAPER_LOCKSCREEN = 1;
var imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper'; let imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper';
var imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock'; let imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock';
export default function wallpaperJSUnit() { export default function wallpaperJSUnit() {
describe('WallpaperJsunitTest', function () { describe('WallpaperJsunitTest', function () {
......
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册