提交 01729acd 编写于 作者: Z zhangyushuai

删掉systemAPI和下掉的Api,挑单monthly 005

Signed-off-by: Nzhangyushuai <zhangyushuai1@huawei.com>
上级 96b494dc
......@@ -114,10 +114,9 @@ export default function ScreenLockPromiseTest(){
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
try {
screenLock.unlockScreen().then((data) => {
let currentResult = screenLock.isLocked()
expect(currentResult).assertEqual(false)
console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004 success.");
console.info('====>-------------SUB_MISC_THEME_screenLock_API_Promise_004 end----------------------');
expect(true).assertTrue()
done();
}).catch( err => {
console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004 failed because: " + JSON.stringify(err));
......@@ -126,10 +125,9 @@ export default function ScreenLockPromiseTest(){
});
} catch (error) {
console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004: error = " + error);
expect(true).assertTrue();
expect().assertFail();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
done();
});
})
}
......@@ -29,67 +29,6 @@ export default function screenLockJSUnit() {
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0012
* @tc.name Test unlock() to Unlocks the screen.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0012', 0, async function (done) {
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0012 start----------------------');
try{
screenLock.unlock((err, data) => {
try{
if (err) {
console.info("====>SUB_MISC_THEME_screenLock_API_0012 failed because: " + JSON.stringify(err));
expect().assertFail();
done();
}
let currentResult = screenLock.isLocked()
expect(currentResult).assertEqual(false)
console.info("====>SUB_MISC_THEME_screenLock_API_0012 success.");
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0012 end----------------------');
done();
}catch(err){
console.info('====>SUB_MISC_THEME_screenLock_API_0012 throw_err : ' + JSON.stringify(err));
expect().assertFail();
done();
}
});
}catch(err){
console.info('====>SUB_MISC_THEME_screenLock_API_0012 catch err : ' + JSON.stringify(err));
expect(err.code).assertEqual(201);
done();
}
})
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0013
* @tc.name Test unlock() to Unlocks the screen.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0013', 0, async function (done) {
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0013 start----------------------');
try{
screenLock.unlock().then((data) => {
let currentResult = screenLock.isLocked()
expect(currentResult).assertEqual(false)
console.info("====>SUB_MISC_THEME_screenLock_API_0013 success.");
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0013 end----------------------');
done();
}).catch( err => {
console.info("====>SUB_MISC_THEME_screenLock_API_0013 failed because: " + JSON.stringify(err));
expect().assertFail();
done();
});
}catch(err){
console.info('====>SUB_MISC_THEME_screenLock_API_0013 catch err : ' + JSON.stringify(err));
expect().assertFail();
done();
}
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0001
* @tc.name Set to locked screen, query the lock screen state is locked state
......@@ -170,7 +109,7 @@ export default function screenLockJSUnit() {
screenLock.isSecureMode((err, data) => {
try{
console.info("====>SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
expect(data == result).assertTrue();
expect(data == false).assertTrue();
console.info("====>------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
done();
}catch(err){
......@@ -205,8 +144,7 @@ export default function screenLockJSUnit() {
expect().assertFail();
done();
}
let currentResult = screenLock.isLocked()
expect(currentResult).assertEqual(false)
expect(true).assertTrue()
console.info("====>SUB_MISC_THEME_screenLock_API_0004 success.");
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0004 end----------------------');
done();
......@@ -251,56 +189,6 @@ export default function screenLockJSUnit() {
expect().assertFail();
done();
}
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0010
* @tc.name Test isLocked() to Checks whether the screen is currently locked.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0010', 0, async function (done) {
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0010 start----------------------');
let lock = null;
try{
lock = await screenLock.isLocked()
console.info('====>SUB_MISC_THEME_screenLock_API_0010 data : ' + JSON.stringify(lock));
expect(lock).assertEqual(result);
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0010 end----------------------');
done()
}catch(err){
console.info('====>SUB_MISC_THEME_screenLock_API_0010 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0011
* @tc.name Test isSecure() to Checks whether the screen lock of the current device is secure.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0011', 0, async function (done) {
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0011 start----------------------');
let secured = null;
try{
secured = screenLock.isSecure()
console.info('====>SUB_MISC_THEME_screenLock_API_0011 data : ' + JSON.stringify(secured));
if (typeof secured == "boolean") {
expect(true).assertTrue();
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0011 end----------------------');
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>SUB_MISC_THEME_screenLock_API_0011 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
});
});
}
......@@ -63,12 +63,6 @@ export default function wallpaperJSUnit() {
it('testGetColorsCallbackSystem101', 0, async function (done) {
console.info('--------------testGetColorsCallbackSystem101 start-----------------');
wallpaper.getColors(WALLPAPER_SYSTEM, (err, RgbaColors) => {
let RgbaColor = {
red: 152,
green: 182,
blue: 211,
alpha: 255
}
try {
if (err) {
console.info('====>testGetColorsCallbackSystem101 fail: ' + JSON.stringify(err));
......@@ -446,7 +440,7 @@ export default function wallpaperJSUnit() {
/*
* @tc.number testResetCallbackSystem101
* @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one.
* @tc.name Test reset() to removes a wallpaper of the specified type and reset the default one.
* @tc.desc Function test
* @tc.level 0
*/
......@@ -472,7 +466,7 @@ export default function wallpaperJSUnit() {
/*
* @tc.number testResetPromiseSystem101
* @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one.
* @tc.name Test reset() to removes a wallpaper of the specified type and reset the default one.
* @tc.desc Function test
* @tc.level 0
*/
......@@ -492,7 +486,7 @@ export default function wallpaperJSUnit() {
/*
* @tc.number testResetCallbackLock102
* @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one.
* @tc.name Test reset() to removes a wallpaper of the specified type and reset the default one.
* @tc.desc Function test
* @tc.level 0
*/
......@@ -518,7 +512,7 @@ export default function wallpaperJSUnit() {
/*
* @tc.number testResetPromiseLock102
* @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one.
* @tc.name Test reset() to removes a wallpaper of the specified type and reset the default one.
* @tc.desc Function test
* @tc.level 0
*/
......@@ -642,7 +636,7 @@ export default function wallpaperJSUnit() {
it('testOnCallback101', 0, async function (done) {
console.info('--------------testOnCallback101 start-----------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
await wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
await wallpaper.reset(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
try {
wallpaper.on('colorChange', async (colors, wallpaperType) => {
try {
......@@ -654,7 +648,7 @@ export default function wallpaperJSUnit() {
console.info('====>testOnCallback101 off');
done();
} catch (err) {
console.info('====>testOnCallback101 setImage or other err : ' + JSON.stringify(err));
console.info('====>testOnCallback101 setWallpaper or other err : ' + JSON.stringify(err));
done();
}
});
......@@ -662,8 +656,8 @@ export default function wallpaperJSUnit() {
console.info('====>testOnCallback101 catch err : ' + JSON.stringify(err));
done();
}
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
console.info('====>testOnCallback10 setImage successful');
await wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
console.info('====>testOnCallback10 setWallpaper successful');
console.info('--------------testOnCallback101 end-----------------');
});
......@@ -678,7 +672,7 @@ export default function wallpaperJSUnit() {
console.info('--------------testOffCallback101 start-----------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
let callbackTimes = 0;
await wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM)
await wallpaper.reset(wallpaper.WallpaperType.WALLPAPER_SYSTEM)
try {
wallpaper.on('colorChange', async (colors, wallpaperType) => {
try {
......@@ -688,11 +682,13 @@ export default function wallpaperJSUnit() {
console.info('====>testOffCallback101 on callbackTime: ' + callbackTimes);
expect(callbackTimes == 1).assertTrue();
wallpaper.off('colorChange');
setTimeout(() => {
await wallpaper.reset(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
await wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
console.info('====>testOffCallback101 setWallpaper successful');
console.info('--------------testOffCallback101 end-----------------');
done();
}, 3000)
} catch (err) {
console.info('====>testOffCallback101 setImage or other err : ' + JSON.stringify(err));
console.info('====>testOffCallback101 setWallpaper or other err : ' + JSON.stringify(err));
done();
}
});
......@@ -700,11 +696,7 @@ export default function wallpaperJSUnit() {
console.info('====>testOffCallback101 catch err : ' + JSON.stringify(err));
done();
}
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM)
await wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM)
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM)
console.info('====>testOffCallback101 setImage successful');
console.info('--------------testOffCallback101 end-----------------');
await wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM)
});
/*
......@@ -741,6 +733,7 @@ export default function wallpaperJSUnit() {
*/
it('testGetFilePromise101', 0, async function (done) {
console.info('--------------testGetFilePromise101 start-----------------');
await wallpaper.setWallpaper(imageSourceLockscreen, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN);
await wallpaper.getFile(WALLPAPER_LOCKSCREEN).then((data) => {
console.info('====>testGetFilePromise101 successful data : ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
......@@ -753,449 +746,5 @@ export default function wallpaperJSUnit() {
console.info('--------------testGetFilePromise101 end-----------------');
});
/*
* @tc.number testGetColorsSync101
* @tc.name Test getColorsSync() to obtains the wallpaper colors for the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetColorsSync101', 0, async function (done) {
console.info('------------------testGetColorsSync101 start----------------------');
let colors = null;
try{
colors = wallpaper.getColorsSync(WALLPAPER_SYSTEM)
console.info('wallpaperXTS ===> testGetColorsSync101 data : ' + JSON.stringify(colors));
if (colors.length >= 1) {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('wallpaperXTS ===> testGetColorsSync101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetColorsSync101 end----------------------');
done()
})
/*
* @tc.number testGetColorsSync102
* @tc.name Test getColorsSync() to obtains the wallpaper colors for the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetColorsSync102', 0, async function (done) {
console.info('------------------testGetColorsSync102 start----------------------');
let colors = null;
try{
colors = wallpaper.getColorsSync(WALLPAPER_LOCKSCREEN)
console.info('====>testGetColorsSync102 data : ' + JSON.stringify(colors));
if (colors.length >= 1) {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetColorsSync102 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetColorsSync102 end----------------------');
})
/*
* @tc.number testGetIdSync101
* @tc.name Test getIdSync() to Obtains the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetIdSync101', 0, async function (done) {
console.info('------------------testGetIdSync101 start----------------------');
let number = null;
try{
number = wallpaper.getIdSync(WALLPAPER_SYSTEM)
console.info('====>testGetIdSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetIdSync101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetIdSync101 end----------------------');
})
/*
* @tc.number testGetIdSync102
* @tc.name Test getIdSync() to Obtains the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetIdSync102', 0, async function (done) {
console.info('------------------testGetIdSync102 start----------------------');
let number = null;
try{
number = wallpaper.getIdSync(WALLPAPER_LOCKSCREEN)
console.info('====>testGetIdSync102 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetIdSync102 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetIdSync102 end----------------------');
})
/*
* @tc.number testGetFileSync101
* @tc.name Test getFileSync() to Obtains a file of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFileSync101', 0, async function (done) {
console.info('------------------testGetFileSync101 start----------------------');
let number = null;
try{
number = wallpaper.getFileSync(WALLPAPER_SYSTEM)
console.info('====>testGetFileSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetFileSync101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetFileSync101 end----------------------');
})
/*
* @tc.number testGetFileSync102
* @tc.name Test getFileSync() to Obtains a file of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFileSync102', 0, async function (done) {
console.info('------------------testGetFileSync102 start----------------------');
let number = null;
try{
number = wallpaper.getFileSync(WALLPAPER_LOCKSCREEN)
console.info('====>testGetFileSync102 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetFileSync102 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetFileSync102 end----------------------');
})
/*
* @tc.number testGetFileSync103
* @tc.name Test getFileSync() to Obtains a file of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFileSync103', 0, async function (done) {
console.info('------------------testGetFileSync103 start----------------------');
let number = null;
try{
number = wallpaper.getFileSync(3)
console.info('====>testGetFileSync103 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetFileSync103 err : ' + JSON.stringify(err));
console.info('====>testGetFileSync103 (err.code : ' + err.code);
expect(err.code == "401").assertTrue();
done()
}
console.info('------------------testGetFileSync103 end----------------------');
})
/*
* @tc.number testGetMinHeightSync101
* @tc.name Test getMinHeightSync() to Obtains the minimum height of the wallpaper.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetMinHeightSync101', 0, async function (done) {
console.info('------------------testGetMinHeightSync101 start----------------------');
let number = null;
try{
number = wallpaper.getMinHeightSync()
console.info('====>testGetMinHeightSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetMinHeightSync101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetMinHeightSync101 end----------------------');
done()
})
/*
* @tc.number testGetMinWidthSync101
* @tc.name Test getMinWidthSync() to Obtains the minimum width of the wallpaper.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetMinWidthSync101', 0, async function (done) {
console.info('------------------testGetMinWidthSync101 start----------------------');
let number = null;
try{
number = wallpaper.getMinWidthSync()
console.info('====>testGetMinWidthSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testGetMinWidthSync101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testGetMinWidthSync101 end----------------------');
})
/*
* @tc.number testIsChangeAllowed101
* @tc.name Test isChangeAllowed() to Checks whether to allow the application to change the wallpaper for the current user.
* @tc.desc Function test
* @tc.level 0
*/
it('testIsChangeAllowed101', 0, async function (done) {
console.info('------------------testIsChangeAllowed101 start----------------------');
let allow = null;
try{
allow = wallpaper.isChangeAllowed()
console.info('====>testIsChangeAllowed101 data : ' + JSON.stringify(allow));
if (typeof allow == "boolean") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testIsChangeAllowed101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testIsChangeAllowed101 end----------------------');
})
/*
* @tc.number testIsChangeAllowed101
* @tc.name Test isUserChangeAllowed() to Checks whether a user is allowed to set wallpapers.
* @tc.desc Function test
* @tc.level 0
*/
it('testIsUserChangeAllowed101', 0, async function (done) {
console.info('------------------testIsUserChangeAllowed101 start----------------------');
let allow = null;
try{
allow = wallpaper.isUserChangeAllowed()
console.info('====>testIsUserChangeAllowed101 data : ' + JSON.stringify(allow));
if (typeof allow == "boolean") {
expect(true).assertTrue();
done()
}else{
expect().assertFail();
done()
}
}catch(err){
console.info('====>testIsUserChangeAllowed101 err : ' + JSON.stringify(err));
expect().assertFail();
done()
}
console.info('------------------testIsUserChangeAllowed101 end----------------------');
done()
})
/*
* @tc.number testRestoreCallback101
* @tc.name Test restore() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testRestoreCallback101', 0, async function (done) {
console.info('------------------testRestoreCallback101 start----------------------');
wallpaper.restore(WALLPAPER_LOCKSCREEN, function (err, data) {
try{
console.info('====>testRestoreCallback101 data : ' + data);
if (err) {
console.info('====>testRestoreCallback101 fail: ' + JSON.stringify(err));
expect().assertFail();
done();
}
console.info('====>testRestoreCallback101 restore success');
expect(true).assertTrue();
done();
}catch(err){
console.info('====>testRestoreCallback101 catch err : ' + JSON.stringify(err));
done();
}
});
console.info('------------------testRestoreCallback101 end----------------------');
})
/*
* @tc.number testRestorePromise101
* @tc.name Test restore() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testRestorePromise101', 0, async function (done) {
console.info('------------------testRestorePromise101 start----------------------');
await wallpaper.restore(WALLPAPER_SYSTEM).then((data) => {
console.info('====>testRestorePromise101 data : ' + JSON.stringify(data));
console.info('====>testRestorePromise101 restore success');
expect(true).assertTrue();
done()
}).catch((err) => {
console.info('====>testRestorePromise101 fail: ' + JSON.stringify(err));
expect().assertFail();
done();
});
console.info('------------------testRestorePromise101 end----------------------');
})
/*
* @tc.number testSetImageCallBack101
* @tc.name Test setImage() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testSetImageCallBack101', 0, async function (done) {
console.info('------------------testSetImageCallBack101 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
try{
if (error) {
console.error(`====>testSetImageCallBack101 failed to setImage because: ` + JSON.stringify(error));
expect().assertFail();
done();
}
console.log(`====>testSetImageCallBack101 success to setImage.`);
expect(true).assertTrue();
done();
}catch(err){
console.info('====>testSetImageCallBack101 catch err : ' + JSON.stringify(err));
done();
}
});
console.info('------------------testSetImageCallBack101 end----------------------');
})
/*
* @tc.number testSetImageCallBack102
* @tc.name Test setImage() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testSetImageCallBack102', 0, async function (done) {
console.info('------------------testSetImageCallBack102 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN, (error, data) => {
try{
if (error) {
console.error(`====>testSetImageCallBack102 failed to setImage because: ` + JSON.stringify(error));
expect().assertFail();
done();
}
console.log(`====>testSetImageCallBack102 success to setImage.`);
expect(true).assertTrue();
done();
}catch(err){
console.info('====>testSetImageCallBack102 catch err : ' + JSON.stringify(err));
done();
}
});
console.info('------------------testSetImageCallBack102 end----------------------');
})
/*
* @tc.number testSetImagePromise101
* @tc.name Test setImage() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testSetImagePromise101', 0, async function (done) {
console.info('------------------testSetImagePromise101 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`====>testSetImagePromise101 success to setImage.`);
expect(true).assertTrue();
done();
}).catch(err => {
expect().assertFail();
console.log(`====>testSetImagePromise101 promise fail: ` + JSON.stringify(err));
});
console.info('------------------testSetImagePromise101 end----------------------');
})
/*
* @tc.number testSetImagePromise102
* @tc.name Test setImage() to removes a wallpaper of the specified type and restores the default one.
* @tc.desc Function test
* @tc.level 0
*/
it('testSetImagePromise102', 0, async function (done) {
console.info('------------------testSetImagePromise102 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN).then((data) => {
console.log(`====>testSetImagePromise102 success to setImage.`);
expect(true).assertTrue();
done();
}).catch(err => {
console.log(`====>testSetImagePromise102 promise catch: ` + JSON.stringify(err));
expect().assertFail();
done()
});
console.info('------------------testSetImagePromise102 end----------------------');
})
});
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册