未验证 提交 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 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import inputmethohJsunit from './InputmethohJsunit.test.ets';
import inputmethodEngineJsunit from './InputmethodEngineJsunit.test.ets';
import inputRequestJsunit from './InputRequestJsunit.test.ets';
import requestJsunit from './RequestJsunit.test.ets';
import requestDownloadJsunit from './RequestDownloadTaskJsunit.test.ets';
import inputMethodJSUnit from './inputMethodJSUnit.ets';
import inputMethodEngineJSUnit from './inputMethodEngineJSUnit.ets';
import inputRequestJSUnit from './inputRequestJSUnit.ets';
import requestJSUnit from './requestJSUnit.ets';
import requestDownloadJSUnit from './requestDownloadJSUnit.ets';
export default function testsuite() {
inputmethohJsunit();
inputmethodEngineJsunit();
inputRequestJsunit();
requestDownloadJsunit();
requestJsunit();
inputMethodJSUnit();
inputMethodEngineJSUnit();
inputRequestJSUnit();
requestDownloadJSUnit();
requestJSUnit();
}
\ No newline at end of file
......@@ -57,10 +57,10 @@ export default class Utils {
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
let xStep;
let yStep;
let swipeSteps;
let ret;
xStep = 0;
yStep = 0;
ret = false;
......@@ -71,7 +71,7 @@ export default class Utils {
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
let downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
......@@ -83,8 +83,8 @@ export default class Utils {
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
for (let i = 1;i <= swipeSteps; i++) {
let movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
......@@ -101,7 +101,7 @@ export default class Utils {
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
let upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
......
......@@ -19,12 +19,12 @@ import Utils from './Utils';
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
export default function inputMethodEngineJsunit() {
export default function inputMethodEngineJSUnit() {
describe('appInfoTest_input_1', function () {
var mKeyboardDelegate = null;
var inputMethodEngineObject = inputMethodEngine.getInputMethodEngine();
var textInputClient = null;
var kbController = null;
let mKeyboardDelegate = null;
let inputMethodEngineObject = inputMethodEngine.getInputMethodEngine();
let textInputClient = null;
let kbController = null;
console.info("************* inputMethodEngine Test start*************");
beforeEach(async function (done) {
......
......@@ -16,7 +16,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index';
import inputMethod from '@ohos.inputmethod';
export default function settingUiJsunit() {
export default function inputMethodJSUnit() {
describe('appInfoTest_input_2', function () {
console.info("************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) {
......
......@@ -16,7 +16,7 @@
import {describe, it, expect} from 'hypium/index';
import request from '@ohos.request';
export default function inputRequestJsunit() {
export default function inputRequestJSUnit() {
describe('inputRequestTest', function () {
console.log("************* request Test start*************");
......
......@@ -16,7 +16,7 @@
import {describe, it, expect} from "deccjsunit/index.ets";
import request from '@ohos.request';
export default function requestDownloadJsunit() {
export default function requestDownloadJSUnit() {
describe('requestDownloadTest', function () {
let downloadConfig = {
url: "www.baidu.com"
......@@ -32,10 +32,10 @@ export default function requestDownloadJsunit() {
header: 'HTTP',
method: 'post',
files: file,
data: 'jason/xml'
data: 'json/xml'
};
var receivedSize;
var totalSize;
let receivedSize;
let totalSize;
console.log("************* settings Test start*************");
/**
......
......@@ -16,7 +16,7 @@
import {describe, it, expect} from "deccjsunit/index.ets";
import request from '@ohos.request';
export default function requestJsunit() {
export default function requestJSUnit() {
describe('requestTest', function () {
/**
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
......@@ -13,8 +13,8 @@
* limitations under the License.
*/
import uploadRequestJsunitTest from './uploadCallbackXTSJsunitTest';
import uploadRequestJSUnitTest from './uploadCallbackXTSJSUnitTest';
export default function testsuite() {
uploadRequestJsunitTest()
uploadRequestJSUnitTest()
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getUploadConfig(fileurl){
function getUploadConfig(fileURL){
let File = {
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.
......@@ -52,74 +52,74 @@ function getUploadConfig(fileurl){
}
//upload公共方法
function publicupload(UploadConfig){
console.info(`Testupdate UploadConfig ${JSON.stringify(UploadConfig)}`)
function publicUpload(UploadConfig){
console.info(`TestUpdate UploadConfig ${JSON.stringify(UploadConfig)}`)
return new Promise(function(resolve, reject) {
request.upload(UploadConfig, (err, data) => {
console.info("Testupdate publiconprogress Updatetask =" + JSON.stringify(data));
console.info("TestUpdate publicOnProgress UpdateTask =" + JSON.stringify(data));
resolve(data);
})
})
}
//onprogress公共方法
function publiconprogress(Updatetask, Type){
//OnProgress公共方法
function publicOnProgress(UpdateTask, Type){
return new Promise(function(resolve, reject) {
Updatetask.on(Type, function(data1 ,data2){
UpdateTask.on(Type, function(data1 ,data2){
let progress = {
uploadedSize : data1,
totalSize : data2
}
console.info("Testupdate publiconprogress uploadedSize =" + data1);
console.info("Testupdate publiconprogress totalSize =" + data2);
console.info("TestUpdate publicOnProgress uploadedSize =" + data1);
console.info("TestUpdate publicOnProgress totalSize =" + data2);
resolve(progress);
})
})
}
//offprogress公共方法
function publicoffprogress(Updatetask, Type){
//OffProgress公共方法
function publicOffProgress(UpdateTask, Type){
return new Promise(function(resolve, reject) {
Updatetask.off(Type, function(data1 ,data2){
UpdateTask.off(Type, function(data1 ,data2){
let progress = {
uploadedSize : data1,
totalSize : data2
}
console.info("Testupdate publicoffprogress uploadedSize =" + data1);
console.info("Testupdate publicoffprogress totalSize =" + data2);
console.info("TestUpdate publicOffProgress uploadedSize =" + data1);
console.info("TestUpdate publicOffProgress totalSize =" + data2);
resolve(progress);
})
})
}
//其他on公共方法
function publicon(Updatetask, Type){
function publicOn(UpdateTask, Type){
return new Promise(function(resolve, reject) {
Updatetask.on(Type, function(data){
console.info("Testupdate publicon =" + data);
UpdateTask.on(Type, function(data){
console.info("TestUpdate publicOn =" + data);
resolve(data);
})
})
}
//其他off公共方法
function publicoff(Updatetask, Type){
function publicOff(UpdateTask, Type){
return new Promise(function(resolve, reject) {
Updatetask.off(Type, function(data){
console.info("Testupdate publicoff =" + data);
UpdateTask.off(Type, function(data){
console.info("TestUpdate publicOff =" + data);
resolve(data);
})
})
}
//remove公共方法
function publicremove(Updatetask){
function publicRemove(UpdateTask){
return new Promise(function(resolve, reject) {
Updatetask.remove((err,data) => {
console.info("Testupdate publicremove =" + data);
UpdateTask.remove((err,data) => {
console.info("TestUpdate publicRemove =" + data);
resolve(data);
})
})
}
export{publicupload,publicon,publicoff,publicremove,publiconprogress,publicoffprogress,getUploadConfig,sleep}
\ No newline at end of file
export{publicUpload,publicOn,publicOff,publicRemove,publicOnProgress,publicOffProgress,getUploadConfig,sleep}
\ No newline at end of file
......@@ -15,7 +15,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import request from '@ohos.request';
import * as pubfun from './Publicfunction.ets'
import * as pubFun from './publicFunction.ets'
var typeProgress = 'progress';
var typeHeaderReceive = 'headerReceive';
......@@ -23,7 +23,7 @@ var typeFail = 'fail';
let uploadTask;
let file7url = 'internal://cache/test.txt';
export default function uploadRequestJsunitTest() {
export default function uploadRequestJSUnitTest() {
describe('UploadTest', function () {
beforeAll(function () {
console.info('beforeAll: Prerequisites at the test suite level, ' +
......@@ -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.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('InitUploadtaskCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_API_UploadTask_0001', 0, async function (done) {
try {
console.info("Testupdate before getuploadconfig");
let UploadConfig = pubfun.getUploadConfig(file7url)
console.info("Testupdate before upload UploadConfig = " + JSON.stringify(UploadConfig));
console.info("Testupdate before upload");
await pubfun.publicupload(UploadConfig).then((data) => {
console.info("Testupdate going upload uploadTask = " + data);
console.info("TestUpdate before getUploadConfig");
let UploadConfig = pubFun.getUploadConfig(file7url)
console.info("TestUpdate before upload UploadConfig = " + JSON.stringify(UploadConfig));
console.info("TestUpdate before upload");
await pubFun.publicUpload(UploadConfig).then((data) => {
console.info("TestUpdate going upload uploadTask = " + data);
uploadTask = data;
expect(true).assertEqual((data != undefined) || (data != "") || (data != {}));
done();
}).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();
done();
})
} 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();
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.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SwitchOnProgressCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_API_OnProgress_0001', 0, async function (done) {
try {
pubfun.publiconprogress(uploadTask, typeProgress);
pubFun.publicOnProgress(uploadTask, typeProgress);
expect(true).assertEqual(0 == 0);
done();
} 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();
done();
}
});
/*
* @tc.number : SwitchOffProgressCallback001
* @tc.number : SUB_MISC_REQUEST__OffProgress_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('SwitchOffProgressCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_OffProgress_0001', 0, async function (done) {
try {
pubfun.publiconprogress(uploadTask, typeProgress);
pubFun.publicOnProgress(uploadTask, typeProgress);
expect(true).assertEqual(0 == 0);
await pubfun.publicoffprogress(uploadTask, typeProgress).then((data) => {
console.info("SwitchOffProgressCallback001 data" + JSON.stringify(data));
await pubFun.publicOffProgress(uploadTask, typeProgress).then((data) => {
console.info("SUB_MISC_REQUEST_OffProgress_0001 data" + JSON.stringify(data));
expect(7).assertEqual(data["totalSize"]);
done();
}).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();
done();
})
} 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();
done();
}
})
/*
* @tc.number : SwitchOnFailCallback001
* @tc.number : SUB_MISC_REQUEST_OnFail_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('SwitchOnFailCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_OnFail_0001', 0, async function (done) {
try {
await pubfun.publicon(uploadTask, typeFail).then((data) => {
console.info("SwitchOnFailCallback001 data " + data);
await pubFun.publicOn(uploadTask, typeFail).then((data) => {
console.info("SUB_MISC_REQUEST_OnFail_0001 data " + data);
expect(5).assertEqual(data);
done();
}).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();
done();
})
} 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();
done();
}
})
/*
* @tc.number : SwitchOffFailCallback001
* @tc.number : SUB_MISC_REQUEST_OffFail_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('SwitchOffFailCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_OffFail_0001', 0, async function (done) {
try {
await pubfun.publicon(uploadTask, typeFail)
await pubfun.publicoff(uploadTask, typeFail).then((data) => {
console.info("SwitchOffFailCallback001 data " + data);
await pubFun.publicOn(uploadTask, typeFail)
await pubFun.publicOff(uploadTask, typeFail).then((data) => {
console.info("SUB_MISC_REQUEST_OffFail_0001 data " + data);
expect(5).assertEqual(data);
done();
}).catch((err) => {
console.info("SwitchOffFailCallback001 fail 2" + JSON.stringify(err));
console.info("SUB_MISC_REQUEST_OffFail_0001 fail 2" + JSON.stringify(err));
done();
expect(err).assertFail();
})
} 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();
done();
}
})
/*
* @tc.number : RemoveCallback001
* @tc.number : SUB_MISC_REQUEST_RmvCB_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('RemoveCallback001', 0, async function (done) {
it('SUB_MISC_REQUEST_RmvCB_0001', 0, async function (done) {
try {
await pubfun.publicremove(uploadTask).then((data) => {
console.info("RemoveCallback001 data " + data);
await pubFun.publicRemove(uploadTask).then((data) => {
console.info("SUB_MISC_REQUEST_RmvCB_0001 data " + data);
expect(true).assertEqual(data);
done();
}).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();
done();
})
} 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();
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(){
console.info("-----------------------ScreenlockPromiseTest is starting-----------------------");
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
let now = new Date();
let exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
......@@ -33,134 +33,144 @@ export default function ScreenLockPromiseTest(){
}
/*
* @tc.number ScreenLock_Test_Promise_0100
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test
* @tc.level 0
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_001
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("ScreenLock_Test_Promise_0100", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0100-------------------");
var isScreenLocked = true;
it("SUB_MISC_THEME_screenLock_API_Promise_001", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
let isScreenLocked = true;
try {
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()
})
} 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();
}
console.info("------------------end ScreenLock_Test_Promise_0100-------------------");
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_Promise_0200
* @tc.name Set to unlocked screen, query the lock screen state is unlocked state
* @tc.desc Function test
* @tc.level 0
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_002
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("ScreenLock_Test_Promise_0200", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0200-------------------");
var isScreenLocked = false;
it("SUB_MISC_THEME_screenLock_API_Promise_002", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
let isScreenLocked = false;
try {
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();
});
} 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();
}
console.info("------------------end ScreenLock_Test_Promise_0200-------------------");
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_Promise_0300
* @tc.name Query whether a password has been set, and return the password that has not been set
* @tc.desc Function test
* @tc.level 0
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_003
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("ScreenLock_Test_Promise_0300", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0300-------------------");
it("SUB_MISC_THEME_screenLock_API_Promise_003", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
try {
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();
});
} 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();
}
console.info("------------------end ScreenLock_Test_Promise_0300-------------------");
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_Promise_0400
* @tc.name Request to unlock the device screen, unlock successfully
* @tc.desc Function test
* @tc.level 0
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_004
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("ScreenLock_Test_Promise_0400", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0400-------------------");
it("SUB_MISC_THEME_screenLock_API_Promise_004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
try {
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);
var unlockScreenResult = 0;
var eventType = 'unlockScreenResult';
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
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();
});
sleep(SLEEP_TIME);
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();
});
} catch (error) {
console.info("Screenlock_Test_1400: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end ScreenLock_Test_Promise_0400-------------------");
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_Promise_0500
* @tc.name Request to unlock device screen, unlock failed
* @tc.desc Function test
* @tc.level 0
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_005
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("ScreenLock_Test_Promise_0500", 0, async function (done) {
console.info("------------------start ScreenLock_Test_Promise_0500-------------------");
it("SUB_MISC_THEME_screenLock_API_Promise_005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
try {
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);
var unlockScreenResult = 1;
var eventType = 'unlockScreenResult';
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
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();
});
sleep(SLEEP_TIME);
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();
done();
});
} 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();
}
console.info("------------------end ScreenLock_Test_Promise_0500-------------------");
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
done();
});
......
......@@ -17,768 +17,826 @@ import screenLock from '@ohos.screenLock';
import {describe, expect, it} from "hypium/index";
export default function screenLockJSUnit() {
const INTERACTIVE_STATE_END_SLEEP = 0;
const INTERACTIVE_STATE_USERID = 2;
const INTERACTIVE_STATE_BEGIN_SLEEP = 3;
const SLEEP_TIME = 1000;
describe('ScreenLockServiceTest', function () {
console.info("-----------------------ScreenlockTest is starting-----------------------");
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
/*
* @tc.number ScreenLock_Test_0100
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Function test
* @tc.level 0
*/
it("ScreenLock_Test_0100", 0, async function (done) {
console.info("------------------start ScreenLock_Test_0100-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("ScreenLock_Test_0100 isScreenLocked's status is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage ScreenLock_Test_0100: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end ScreenLock_Test_0100-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_0200
* @tc.name Set to unlocked screen, query the lock screen state is unlocked state
* @tc.desc Function test
* @tc.level 0
*/
it("ScreenLock_Test_0200", 0, async function (done) {
console.info("------------------start ScreenLock_Test_0200-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("ScreenLock_Test_0200 isScreenLocked's status is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage ScreenLock_Test_0200: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end ScreenLock_Test_0200-------------------");
done();
});
/*
* @tc.number ScreenLock_Test_0300
* @tc.name Query whether a password has been set, and return the password that has not been set
* @tc.desc Function test
* @tc.level 0
*/
it("ScreenLock_Test_0300", 0, async function (done) {
console.info("------------------start ScreenLock_Test_0300-------------------");
try {
screenLock.isSecureMode((err, data) => {
console.info("ScreenLock_Test_0300 isSecureMode's result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage ScreenLock_Test_0300: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end ScreenLock_Test_0300-------------------");
done();
});
/*
* @tc.number Screenlock_Test_0400
* @tc.name Request to unlock the device screen, unlock successfully
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_0400", 0, async function (done) {
console.info("------------------start Screenlock_Test_0400-------------------");
try {
screenLock.unlockScreen(() => {
console.info("Screenlock_Test_0400: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
var unlockScreenResult = 0;
var eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("Screenlock_Test_0400: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("Screenlock_Test_0400: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("Screenlock_Test_1400: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end Screenlock_Test_0400-------------------");
done();
});
/*
* @tc.number Screenlock_Test_0500
* @tc.name Request to unlock device screen, unlock failed
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_0500", 0, async function (done) {
console.info("------------------start Screenlock_Test_0500-------------------");
try {
screenLock.unlockScreen(() => {
console.info("Screenlock_Test_0500: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
var unlockScreenResult = 1;
var eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("Screenlock_Test_0500: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("Screenlock_Test_0500: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage Screenlock_Test_0500: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end Screenlock_Test_0500-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2100
* @tc.name After the systemUI is started, it is in the locked state, the lock management sends
the unlock request successfully, and the lock screen application notifies the unlock
success message
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2100", 0, async function (done) {
console.info("------------------start Screenlock_Test_2100-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("Screenlock_Test_2100: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.info("Screenlock_Test_2100: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
var unlockScreenResult = 0;
var eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("Screenlock_Test_2100: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("Screenlock_Test_2100: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("Screenlock_Test_2100: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end Screenlock_Test_2100-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2200
* @tc.name After systemUI is started, it is currently unlocked
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2200", 0, async function (done) {
console.info("------------------start Screenlock_Test_2200-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("Screenlock_Test_2200: isScreenLocked is successful, result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage Screenlock_Test_2200: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end ScreenLock_Test_2200-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2300
* @tc.name After the systemUI is started, it is in the locked state, the lock management sends
the unlock request successfully, and the lock screen application notifies the unlock
failed message
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2300", 0, async function (done) {
console.info("------------------start Screenlock_Test_2300-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.log("Screenlock_Test_2300: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.log("Screenlock_Test_2300: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
var unlockScreenResult = 1;
var eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.log("Screenlock_Test_2300: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.log("Screenlock_Test_2300: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("Screenlock_Test_2300: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end Screenlock_Test_2300-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2400
* @tc.name Device management causes the screen to go off, and run "beginWakeUp" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2400", 0, async function (done) {
console.log("------------------start Screenlock_Test_2400-------------------");
try {
var eventType = 'beginWakeUp';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2400: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2400: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2400-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2500
* @tc.name Device management causes the screen to go off, and run "endWakeUp" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2500", 0, async function (done) {
console.log("------------------start Screenlock_Test_2500-------------------");
try {
var eventType = 'endWakeUp';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2500: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2500: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2500-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2600
* @tc.name Device management causes the screen to go off, and run "beginScreenOn" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2600", 0, async function (done) {
console.log("------------------start Screenlock_Test_2600-------------------");
try {
var eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2600: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2600: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2600-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2700
* @tc.name Device management causes the screen to go off, and run "endScreenOn" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2700", 0, async function (done) {
console.log("------------------start Screenlock_Test_2700-------------------");
try {
var eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2700: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2700: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2700-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2800
* @tc.name User causes the screen to go off, and run "beginScreenOff" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2800", 0, async function (done) {
console.log("------------------start Screenlock_Test_2800-------------------");
try {
var eventType = 'beginScreenOff';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2800: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2800: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2800-------------------");
done();
});
/*
* @tc.number Screenlock_Test_2900
* @tc.name User causes the screen to go off, and run "endScreenOff" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_2900", 0, async function (done) {
console.log("------------------start Screenlock_Test_2900-------------------");
try {
var eventType = 'endScreenOff';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_2900: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_2900: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_2900-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3000
* @tc.name User causes the screen to go off, and run "unlockScreen" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3000", 0, async function (done) {
console.log("------------------start Screenlock_Test_3000-------------------");
try {
var eventType = 'unlockScreen';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3000: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3000: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3000-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3100
* @tc.name User causes the screen to go off, and run "beginExitAnimation" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3100", 0, async function (done) {
console.log("------------------start Screenlock_Test_3100-------------------");
try {
var eventType = 'beginExitAnimation';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3100: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3100: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3100-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3200
* @tc.name No operation for a long time causes the screen to go off, and run "screenlockEnabled" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3200", 0, async function (done) {
console.log("------------------start Screenlock_Test_3200-------------------");
try {
var eventType = 'screenlockEnabled';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3200: test_getRuntimeState screenlockEnabled is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3200: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3200-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3300
* @tc.name No operation for a long time causes the screen to go off, and run "beginSleep" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3300", 0, async function (done) {
console.log("------------------start Screenlock_Test_3300-------------------");
try {
var eventType = 'beginSleep';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3300: test_getRuntimeState beginSleep is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3300: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3300-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3400
* @tc.name No operation for a long time causes the screen to go off, and run "endSleep" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3400", 0, async function (done) {
console.log("------------------start Screenlock_Test_3400-------------------");
try {
var eventType = 'endSleep';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3400: test_getRuntimeState endSleep is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3400: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3400-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3500
* @tc.name No operation for a long time causes the screen to go off, and run "changeUser" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3500", 0, async function (done) {
console.log("------------------start Screenlock_Test_3500-------------------");
try {
var eventType = 'changeUser';
screenLock.off(eventType, () => {
console.log("Screenlock_Test_3500: test_getRuntimeState changeUser is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3500: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3500-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3600
* @tc.name Responding to bright screen events, and run "beginWakeUp" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3600", 0, async function (done) {
console.log("------------------start Screenlock_Test_3600-------------------");
try {
var eventType = 'beginWakeUp';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_3600: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3600: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3600-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3700
* @tc.name Responding to bright screen events, and run "endWakeUp" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3700", 0, async function (done) {
console.log("------------------logMessage Screenlock_Test_3700-------------------");
try {
var eventType = 'endWakeUp';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_3700: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3700: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3700-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3800
* @tc.name Responding to bright screen events, and run "beginScreenOn" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3800", 0, async function (done) {
console.log("------------------start Screenlock_Test_3800-------------------");
try {
var eventType = 'beginScreenOn';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_3800: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3800: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3800-------------------");
done();
});
/*
* @tc.number Screenlock_Test_3900
* @tc.name Responding to bright screen events, and run "endScreenOn" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_3900", 0, async function (done) {
console.log("------------------start Screenlock_Test_3900-------------------");
try {
var eventType = 'endScreenOn';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_3900: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_3900: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_3900-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4000
* @tc.name Responding to bright screen events, and run "beginScreenOff" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4000", 0, async function (done) {
console.log("------------------start Screenlock_Test_4000-------------------");
try {
var eventType = 'beginScreenOff';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_4000: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_4000: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4000-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4100
* @tc.name Responding to bright screen events, and run "endScreenOff" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4100", 0, async function (done) {
console.log("------------------logMessage Screenlock_Test_4100-------------------");
try {
var eventType = 'endScreenOff';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_4100: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_4100: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4100-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4200
* @tc.name Responding to bright screen events, and run "unlockScreen" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4200", 0, async function (done) {
console.log("------------------start Screenlock_Test_4200-------------------");
try {
var eventType = 'unlockScreen';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_4200: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_4200: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4200-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4300
* @tc.name Responding to bright screen events, and run "beginExitAnimation" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4300", 0, async function (done) {
console.log("------------------start Screenlock_Test_4300-------------------");
try {
var eventType = 'beginExitAnimation';
screenLock.on(eventType, () => {
console.log("Screenlock_Test_4300: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end Screenlock_Test_4300: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4300-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4400
* @tc.name Responding to bright screen events, and run "beginSleep" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4400", 0, async function (done) {
console.log("------------------start Screenlock_Test_4400-------------------");
try {
var eventType = 'changeUser';
screenLock.on(eventType, (err, data) => {
console.log("Screenlock_Test_4400: test_getRuntimeState beginSleep is successful");
expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage Screenlock_Test_4400: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4400-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4500
* @tc.name Responding to bright screen events, and run "endSleep" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4500", 0, async function (done) {
console.log("------------------start Screenlock_Test_4500-------------------");
try {
var eventType = 'endSleep';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("Screenlock_Test_4500: test_getRuntimeState endSleep is successful");
expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage Screenlock_Test_4500: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4500-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4600
* @tc.name Responding to bright screen events, and run "changeUser" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4600", 0, async function (done) {
console.log("------------------start Screenlock_Test_4600-------------------");
try {
var eventType = 'changeUser';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("Screenlock_Test_4600: test_getRuntimeState changeUser is successfuls");
expect(data == INTERACTIVE_STATE_USERID).assertTrue();
});
} catch (error) {
console.log("logMessage Screenlock_Test_4600: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4600-------------------");
done();
});
/*
* @tc.number Screenlock_Test_4700
* @tc.name Responding to bright screen events, and run "screenlockEnabled" operate
* @tc.desc Function test
* @tc.level 0
*/
it("Screenlock_Test_4700", 0, async function (done) {
console.log("------------------start Screenlock_Test_4700-------------------");
try {
var eventType = 'screenlockEnabled';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("Screenlock_Test_4700: test_getRuntimeState screenlockEnabled is successfuls");
expect(data == true).assertTrue();
});
} catch (error) {
console.log("logMessage Screenlock_Test_4700: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end Screenlock_Test_4700-------------------");
done();
});
const INTERACTIVE_STATE_END_SLEEP = 0;
const INTERACTIVE_STATE_USERID = 2;
const INTERACTIVE_STATE_BEGIN_SLEEP = 3;
const SLEEP_TIME = 1000;
describe('ScreenLockServiceTest', function () {
console.info("-----------------------ScreenlockTest is starting-----------------------");
function sleep(numberMillis) {
let now = new Date();
let exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0001
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0001", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0001-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0001 screen's status is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0001: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0001-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0002
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0002", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0002-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0002 screen's status is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0002: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0002-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0003
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0003", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0003-------------------");
try {
screenLock.isSecureMode((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0003: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0004
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0004: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0004-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0005
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0005-------------------");
try {
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0005: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0005: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0005: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0005-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0006
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0006", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0006-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.info("SUB_MISC_THEME_screenLock_API_0006: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0006: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0006-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0007
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0007", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0007-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.info("SUB_MISC_THEME_screenLock_API_0007: isScreenLocked is successful, result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_0007: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0007-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0008
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0008", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_0008-------------------");
try {
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.unlockScreen(() => {
console.log("SUB_MISC_THEME_screenLock_API_0008: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked((err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data);
expect(data == true).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_0008: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_0008-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0009
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0009", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0009-------------------");
try {
let eventType = 'beginWakeUp';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0009: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0009: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0009-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0010
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0010", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0010-------------------");
try {
let eventType = 'endWakeUp';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0010: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0010: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0010-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0011
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0011", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0011-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0011: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0011: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0011-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0012
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0012", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0012-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0012: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0012: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0012-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0013
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0013", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0013-------------------");
try {
let eventType = 'beginScreenOff';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0013: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0013: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0013-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0014
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0014", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0014-------------------");
try {
let eventType = 'endScreenOff';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0014: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0014: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0014-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0015
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0015", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0015-------------------");
try {
let eventType = 'unlockScreen';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0015: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0015: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0015-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0016
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0016", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0016-------------------");
try {
let eventType = 'beginExitAnimation';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0016: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0016: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0016-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0017
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0017", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0017-------------------");
try {
let eventType = 'screenLockEnabled';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0017: test_getRuntimeState screenLockEnabled is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0017: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0017-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0018
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0018", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0018-------------------");
try {
let eventType = 'beginSleep';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0018: test_getRuntimeState beginSleep is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0018: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0018-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0019
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0019", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0019-------------------");
try {
let eventType = 'endSleep';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0019: test_getRuntimeState endSleep is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0019: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0019-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0020
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0020", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0020-------------------");
try {
let eventType = 'changeUser';
screenLock.off(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0020: test_getRuntimeState changeUser is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0020: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0020-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0021
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0021", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0021-------------------");
try {
let eventType = 'beginWakeUp';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0021: test_getRuntimeState beginWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0021: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0021-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0022
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0022", 0, async function (done) {
console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0022-------------------");
try {
let eventType = 'endWakeUp';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0022: test_getRuntimeState endWakeUp is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0022: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0022-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0023
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0023", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0023-------------------");
try {
let eventType = 'beginScreenOn';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0023: test_getRuntimeState beginScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0023: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0023-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0024
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0024", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0024-------------------");
try {
let eventType = 'endScreenOn';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0024: test_getRuntimeState endScreenOn is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0024: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0024-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0025
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0025", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0025-------------------");
try {
let eventType = 'beginScreenOff';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0025: test_getRuntimeState beginScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0025: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0025-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0026
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0026", 0, async function (done) {
console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0026-------------------");
try {
let eventType = 'endScreenOff';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0026: test_getRuntimeState endScreenOff is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0026: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0026-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0027
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0027", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0027-------------------");
try {
let eventType = 'unlockScreen';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0027: test_getRuntimeState unlockScreen is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0027: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0027-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0028
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0028", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0028-------------------");
try {
let eventType = 'beginExitAnimation';
screenLock.on(eventType, () => {
console.log("SUB_MISC_THEME_screenLock_API_0028: test_getRuntimeState beginExitAnimation is successful" );
});
} catch (error) {
console.log("end SUB_MISC_THEME_screenLock_API_0028: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0028-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0029
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0029", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0029-------------------");
try {
let eventType = 'changeUser';
screenLock.on(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0029: test_getRuntimeState beginSleep is successful");
expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0029: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0029-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0030
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0030", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0030-------------------");
try {
let eventType = 'endSleep';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0030: test_getRuntimeState endSleep is successful");
expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0030: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0030-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0031
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0031", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0031-------------------");
try {
let eventType = 'changeUser';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0031: test_getRuntimeState changeUser is successful");
expect(data == INTERACTIVE_STATE_USERID).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0031: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0031-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0032
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_0032", 0, async function (done) {
console.log("------------------start SUB_MISC_THEME_screenLock_API_0032-------------------");
try {
let eventType = 'screenLockEnabled';
screenLock.test_getRuntimeState(eventType, (err, data) => {
console.log("SUB_MISC_THEME_screenLock_API_0032: test_getRuntimeState screenLockEnabled is successfuls");
expect(data == true).assertTrue();
});
} catch (error) {
console.log("logMessage SUB_MISC_THEME_screenLock_API_0032: error = " + error);
expect(true).assertTrue();
}
console.log("------------------end SUB_MISC_THEME_screenLock_API_0032-------------------");
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 '
const WALLPAPER_SYSTEM = 0;
const WALLPAPER_LOCKSCREEN = 1;
var imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper';
var imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock';
let imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper';
let imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock';
export default function wallpaperJSUnit() {
describe('WallpaperJsunitTest', function () {
......
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册