Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
426629b5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
426629b5
编写于
11月 25, 2022
作者:
Z
zwx1016320
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimization theme of wallpaper
Signed-off-by:
N
zwx1016320
<
zhangyushuai1@huawei-partners.com
>
上级
8b57c300
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
488 addition
and
460 deletion
+488
-460
theme/wallpaper_ets/entry/src/main/config.json
theme/wallpaper_ets/entry/src/main/config.json
+0
-1
theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
...e/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
+488
-459
未找到文件。
theme/wallpaper_ets/entry/src/main/config.json
浏览文件 @
426629b5
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
"tablet"
,
"tablet"
,
"default"
,
"default"
,
"phone"
,
"phone"
,
"tablet"
,
"tv"
,
"tv"
,
"wearable"
"wearable"
],
],
...
...
theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets
浏览文件 @
426629b5
...
@@ -23,22 +23,6 @@ let imageSourceLockscreen = '/data/storage/el2/base/haps/wp.png';
...
@@ -23,22 +23,6 @@ let imageSourceLockscreen = '/data/storage/el2/base/haps/wp.png';
export default function wallpaperJSUnit() {
export default function wallpaperJSUnit() {
describe('WallpaperJsunitTest', function () {
describe('WallpaperJsunitTest', function () {
beforeAll(async function () {
console.info('beforeAll: Prerequisites at the test suite level, ' +
'which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('beforeEach: Prerequisites at the test case level, ' +
'which are executed before each test case is executed.');
})
afterEach(function () {
console.info('afterEach: Test case-level clearance conditions,' +
' which are executed after each test case is executed.');
})
afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition, ' +
'which is executed after the test suite is executed');
})
/*
/*
* @tc.number testWALLPAPER_SYSTEM
* @tc.number testWALLPAPER_SYSTEM
...
@@ -47,11 +31,13 @@ export default function wallpaperJSUnit() {
...
@@ -47,11 +31,13 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testWALLPAPER_SYSTEM', 0, async function (done) {
it('testWALLPAPER_SYSTEM', 0, async function (done) {
console.info('--------------testWALLPAPER_SYSTEM start-----------------');
console.info('wallpaperXTS ===> testWALLPAPER_SYSTEM : ' +
console.info('wallpaperXTS ===> testWALLPAPER_SYSTEM : ' +
JSON.stringify(wallpaper.WallpaperType.WALLPAPER_SYSTEM));
JSON.stringify(wallpaper.WallpaperType.WALLPAPER_SYSTEM));
expect(wallpaper.WallpaperType.WALLPAPER_SYSTEM == 0).assertTrue();
expect(wallpaper.WallpaperType.WALLPAPER_SYSTEM == 0).assertTrue();
done();
done();
})
console.info('--------------testWALLPAPER_SYSTEM end-----------------');
});
/*
/*
* @tc.number testWALLPAPER_LOCKSCREEN
* @tc.number testWALLPAPER_LOCKSCREEN
...
@@ -60,11 +46,13 @@ export default function wallpaperJSUnit() {
...
@@ -60,11 +46,13 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testWALLPAPER_LOCKSCREEN', 0, async function (done) {
it('testWALLPAPER_LOCKSCREEN', 0, async function (done) {
console.info('--------------testWALLPAPER_LOCKSCREEN start-----------------');
console.info('wallpaperXTS ===> testWALLPAPER_LOCKSCREEN : ' +
console.info('wallpaperXTS ===> testWALLPAPER_LOCKSCREEN : ' +
JSON.stringify(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN));
JSON.stringify(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN));
expect(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN == 1).assertTrue();
expect(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN == 1).assertTrue();
done();
done();
})
console.info('--------------testWALLPAPER_LOCKSCREEN end-----------------');
});
/*
/*
* @tc.number testGetColorsCallbackSystem101
* @tc.number testGetColorsCallbackSystem101
...
@@ -73,29 +61,33 @@ export default function wallpaperJSUnit() {
...
@@ -73,29 +61,33 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetColorsCallbackSystem101', 0, async function (done) {
it('testGetColorsCallbackSystem101', 0, async function (done) {
console.info('--------------testGetColorsCallbackSystem101 start-----------------');
await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data)
{
wallpaper.getColors(WALLPAPER_SYSTEM, (err, RgbaColors) =>
{
let RgbaColor = {
let RgbaColor = {
red: data[0][0],
red: 152,
green: data[0][1],
green: 182,
blue: data[0][2],
blue: 211,
alpha: data[0][3]
alpha: 255
}
console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]);
if (err) {
expect(null).assertFail();
}
}
if ((data != undefined) && (data != null)) {
try {
expect(true).assertTrue();
if (err) {
}
console.info('====>testGetColorsCallbackSystem101 fail: ' + JSON.stringify(err));
})
expect(null).assertFail();
done();
done();
})
}
console.info('====>testGetColorsCallbackSystem101 succesful RgbaColors: ' + JSON.stringify(RgbaColors));
expect(Number.isInteger(RgbaColors[0].red)).assertTrue();
expect(Number.isInteger(RgbaColors[0].green)).assertTrue();
expect(Number.isInteger(RgbaColors[0].blue)).assertTrue();
expect(Number.isInteger(RgbaColors[0].alpha)).assertTrue();
done();
} catch (err) {
console.info('====>testGetColorsCallbackSystem101 catch err: ' + JSON.stringify(err));
done();
};
});
console.info('--------------testGetColorsCallbackSystem101 end-----------------');
});
/*
/*
* @tc.number testGetColorsPromiseSystem101
* @tc.number testGetColorsPromiseSystem101
...
@@ -104,19 +96,21 @@ export default function wallpaperJSUnit() {
...
@@ -104,19 +96,21 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetColorsPromiseSystem101', 0, async function (done) {
it('testGetColorsPromiseSystem101', 0, async function (done) {
await wallpaper.getColors(WALLPAPER_SYSTEM).then((data) => {
console.info('--------------testGetColorsPromiseSystem101 start-----------------');
console.info('wallpaperXTS ===> testGetColorsPromiseSystem data : ' + JSON.stringify(data));
await wallpaper.getColors(WALLPAPER_SYSTEM).then((RgbaColors) => {
if ((data != undefined) && (data != null)) {
console.info('====>testGetColorsPromiseSystem101 succesful RgbaColors: ' + JSON.stringify(RgbaColors));
expect(true).assertTrue();
expect(Number.isInteger(RgbaColors[0].red)).assertTrue();
}
expect(Number.isInteger(RgbaColors[0].green)).assertTrue();
expect(Number.isInteger(RgbaColors[0].blue)).assertTrue();
expect(Number.isInteger(RgbaColors[0].alpha)).assertTrue();
done();
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err));
console.info('====>testGetColorsPromiseSystem101 fail: ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testGetColorsPromiseSystem101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetColorsCallbackLock102
* @tc.number testGetColorsCallbackLock102
...
@@ -125,18 +119,27 @@ export default function wallpaperJSUnit() {
...
@@ -125,18 +119,27 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetColorsCallbackLock102', 0, async function (done) {
it('testGetColorsCallbackLock102', 0, async function (done) {
await wallpaper.getColors(WALLPAPER_LOCKSCREEN, function (err, data) {
console.info('--------------testGetColorsCallbackLock102 start-----------------');
console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err));
wallpaper.getColors(WALLPAPER_LOCKSCREEN, (err, RgbaColors) => {
console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testGetColorsCallbackLock102 fail: ' + JSON.stringify(err));
}
expect(null).assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
}
console.info('====>testGetColorsCallbackLock102 succesful RgbaColors: ' + JSON.stringify(RgbaColors));
})
expect(Number.isInteger(RgbaColors[0].red)).assertTrue();
done();
expect(Number.isInteger(RgbaColors[0].green)).assertTrue();
})
expect(Number.isInteger(RgbaColors[0].blue)).assertTrue();
expect(Number.isInteger(RgbaColors[0].alpha)).assertTrue();
done();
} catch (err) {
console.info('====>testGetColorsCallbackLock102 catch err: ' + JSON.stringify(err));
done();
};
});
console.info('--------------testGetColorsCallbackLock102 end-----------------');
});
/*
/*
* @tc.number testGetColorsPromiseLock102
* @tc.number testGetColorsPromiseLock102
...
@@ -145,39 +148,47 @@ export default function wallpaperJSUnit() {
...
@@ -145,39 +148,47 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetColorsPromiseLock102', 0, async function (done) {
it('testGetColorsPromiseLock102', 0, async function (done) {
await wallpaper.getColors(WALLPAPER_LOCKSCREEN).then((data) => {
console.info('--------------testGetColorsPromiseLock102 start-----------------');
console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data));
await wallpaper.getColors(WALLPAPER_LOCKSCREEN).then((RgbaColors) => {
if ((data != undefined) && (data != null)) {
console.info('====>testGetColorsPromiseLock102 succesful RgbaColors: ' + JSON.stringify(RgbaColors));
expect(true).assertTrue();
expect(Number.isInteger(RgbaColors[0].red)).assertTrue();
}
expect(Number.isInteger(RgbaColors[0].green)).assertTrue();
expect(Number.isInteger(RgbaColors[0].blue)).assertTrue();
expect(Number.isInteger(RgbaColors[0].alpha)).assertTrue();
done();
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err));
console.info('====>testGetColorsPromiseLock102 fail: ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testGetColorsPromiseLock102 end-----------------'
);
})
})
/*
/*
* @tc.number testGet
ColorsPromiseLock102
* @tc.number testGet
IdCallbackSystem101
* @tc.name Test getId() to the ID of the wallpaper of the specified type.
* @tc.name Test getId() to the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.desc Function test
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetIdCallbackSystem101', 0, async function (done) {
it('testGetIdCallbackSystem101', 0, async function (done) {
await wallpaper.getId(WALLPAPER_SYSTEM, function (err, data) {
console.info('--------------testGetIdCallbackSystem101 start-----------------');
console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err));
wallpaper.getId(WALLPAPER_SYSTEM, (err, data) => {
console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testGetIdCallbackSystem101 err : ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testGetIdCallbackSystem101 successful data: ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done();
} catch (err) {
console.info('====>testGetIdCallbackSystem101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
;
done(
);
console.info('--------------testGetIdCallbackSystem101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetIdPromiseSystem101
* @tc.number testGetIdPromiseSystem101
...
@@ -186,18 +197,17 @@ export default function wallpaperJSUnit() {
...
@@ -186,18 +197,17 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetIdPromiseSystem101', 0, async function (done) {
it('testGetIdPromiseSystem101', 0, async function (done) {
console.info('--------------testGetIdCallbackSystem101 start-----------------');
await wallpaper.getId(WALLPAPER_SYSTEM).then((data) => {
await wallpaper.getId(WALLPAPER_SYSTEM).then((data) => {
console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data));
console.info('====>testGetIdCallbackSystem101 data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(Number.isInteger(data)).assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err));
console.info('====>testGetIdCallbackSystem101 fail: ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testGetIdCallbackSystem101 end-----------------'
);
})
})
/*
/*
...
@@ -207,18 +217,24 @@ export default function wallpaperJSUnit() {
...
@@ -207,18 +217,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetIdCallbackLock102', 0, async function (done) {
it('testGetIdCallbackLock102', 0, async function (done) {
await wallpaper.getId(WALLPAPER_LOCKSCREEN, function (err, data) {
console.info('--------------testGetIdCallbackLock102 start-----------------');
console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err));
wallpaper.getId(WALLPAPER_LOCKSCREEN, (err, data) => {
console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testGetIdCallbackLock102 err : ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testGetIdCallbackLock102 successful data: ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done();
} catch (err) {
console.info('====>testGetIdCallbackLock102 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
;
done(
);
console.info('--------------testGetIdCallbackLock102 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetIdPromiseLock102
* @tc.number testGetIdPromiseLock102
...
@@ -227,19 +243,20 @@ export default function wallpaperJSUnit() {
...
@@ -227,19 +243,20 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetIdPromiseLock102', 0, async function (done) {
it('testGetIdPromiseLock102', 0, async function (done) {
console.info('--------------testGetIdPromiseLock102 start-----------------');
await wallpaper.getId(WALLPAPER_LOCKSCREEN).then((data) => {
await wallpaper.getId(WALLPAPER_LOCKSCREEN).then((data) => {
console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data));
console.info('====>testGetIdPromiseLock102 data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(Number.isInteger(data)).assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err));
console.info('====>testGetIdPromiseLock102 fail: ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done();
console.info('--------------testGetIdPromiseLock102 end-----------------');
})
});
/*
/*
* @tc.number testGetMinHeightCallback101
* @tc.number testGetMinHeightCallback101
...
@@ -248,18 +265,24 @@ export default function wallpaperJSUnit() {
...
@@ -248,18 +265,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetMinHeightCallback101', 0, async function (done) {
it('testGetMinHeightCallback101', 0, async function (done) {
await wallpaper.getMinHeight(function (err, data) {
console.info('--------------testGetMinHeightCallback101 start-----------------');
console.info('wallpaperXTS ===> testGetMinHeightCallback err : ' + JSON.stringify(err));
wallpaper.getMinHeight((err, data) => {
console.info('wallpaperXTS ===> testGetMinHeightCallback data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testGetMinHeightCallback101 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testGetMinHeightCallback101 successful data: ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done();
} catch (err) {
console.info('====>testGetMinHeightCallback101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
;
done(
);
console.info('--------------testGetMinHeightCallback101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetMinHeightPromise101
* @tc.number testGetMinHeightPromise101
...
@@ -268,19 +291,18 @@ export default function wallpaperJSUnit() {
...
@@ -268,19 +291,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetMinHeightPromise101', 0, async function (done) {
it('testGetMinHeightPromise101', 0, async function (done) {
console.info('--------------testGetMinHeightPromise101 start-----------------');
await wallpaper.getMinHeight().then((data) => {
await wallpaper.getMinHeight().then((data) => {
console.info('wallpaperXTS ===> testGetMinHeightPromise data : ' + JSON.stringify(data));
console.info('====>testGetMinHeightPromise101 successful data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(Number.isInteger(data)).assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetMinHeightPromise err : ' + JSON.stringify(err));
console.info('====>testGetMinHeightPromise101 err : ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testGetMinHeightPromise101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetMinWidthCallback101
* @tc.number testGetMinWidthCallback101
...
@@ -289,18 +311,24 @@ export default function wallpaperJSUnit() {
...
@@ -289,18 +311,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetMinWidthCallback101', 0, async function (done) {
it('testGetMinWidthCallback101', 0, async function (done) {
await wallpaper.getMinWidth(function (err, data) {
console.info('--------------testGetMinWidthCallback101 start-----------------');
console.info('wallpaperXTS ===> testGetMinWidthCallback err : ' + JSON.stringify(err));
wallpaper.getMinWidth((err, data) => {
console.info('wallpaperXTS ===> testGetMinWidthCallback data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testGetMinWidthCallback101 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testGetMinWidthCallback101 successful data: ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done();
} catch (err) {
console.info('====>testGetMinWidthCallback101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
;
done(
);
console.info('--------------testGetMinWidthCallback101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetMinWidthPromise101
* @tc.number testGetMinWidthPromise101
...
@@ -309,19 +337,18 @@ export default function wallpaperJSUnit() {
...
@@ -309,19 +337,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetMinWidthPromise101', 0, async function (done) {
it('testGetMinWidthPromise101', 0, async function (done) {
console.info('--------------testGetMinWidthPromise101 start-----------------');
await wallpaper.getMinWidth().then((data) => {
await wallpaper.getMinWidth().then((data) => {
console.info('wallpaperXTS ===> testGetMinWidthPromise data : ' + JSON.stringify(data));
console.info('====>testGetMinWidthPromise101 successful data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(Number.isInteger(data)).assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testGetMinWidthPromise err : ' + JSON.stringify(err));
console.info('====>testGetMinWidthPromise101 err : ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testGetMinWidthPromise101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testIsChangePermittedCallback101
* @tc.number testIsChangePermittedCallback101
...
@@ -331,18 +358,24 @@ export default function wallpaperJSUnit() {
...
@@ -331,18 +358,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testIsChangePermittedCallback101', 0, async function (done) {
it('testIsChangePermittedCallback101', 0, async function (done) {
await wallpaper.isChangePermitted(function (err, data) {
console.info('--------------testIsChangePermittedCallback101 start-----------------');
console.info('wallpaperXTS ===> testIsChangePermittedCallback err : ' + JSON.stringify(err));
wallpaper.isChangePermitted((err, data) => {
console.info('wallpaperXTS ===> testIsChangePermittedCallback data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testIsChangePermittedCallback101 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testIsChangePermittedCallback101 successful data: ' + JSON.stringify(data));
expect(typeof data == "boolean").assertTrue();
done();
} catch (err) {
console.info('====>testIsChangePermittedCallback101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
done(
);
console.info('--------------testIsChangePermittedCallback101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testIsChangePermittedPromise101
* @tc.number testIsChangePermittedPromise101
...
@@ -352,19 +385,18 @@ export default function wallpaperJSUnit() {
...
@@ -352,19 +385,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testIsChangePermittedPromise101', 0, async function (done) {
it('testIsChangePermittedPromise101', 0, async function (done) {
console.info('--------------testIsChangePermittedPromise101 start-----------------');
await wallpaper.isChangePermitted().then((data) => {
await wallpaper.isChangePermitted().then((data) => {
console.info('wallpaperXTS ===> testIsChangePermittedPromise data : ' + JSON.stringify(data));
console.info('====>testIsChangePermittedPromise101 successful data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(typeof data == "boolean").assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testIsChangePermittedPromise err : ' + JSON.stringify(err));
console.info('====>testIsChangePermittedPromise101 err : ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testIsChangePermittedPromise101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testIsOperationAllowedCallback101
* @tc.number testIsOperationAllowedCallback101
...
@@ -373,18 +405,24 @@ export default function wallpaperJSUnit() {
...
@@ -373,18 +405,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testIsOperationAllowedCallback101', 0, async function (done) {
it('testIsOperationAllowedCallback101', 0, async function (done) {
await wallpaper.isOperationAllowed(function (err, data) {
console.info('--------------testIsOperationAllowedCallback101 start-----------------');
console.info('wallpaperXTS ===> testIsOperationAllowedCallback err : ' + JSON.stringify(err));
wallpaper.isOperationAllowed((err, data) => {
console.info('wallpaperXTS ===> testIsOperationAllowedCallback data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testIsOperationAllowedCallback101 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
expect(true).assertTrue();
}
console.info('====>testIsOperationAllowedCallback101 successful data: ' + JSON.stringify(data));
expect(typeof data == "boolean").assertTrue();
done();
} catch (err) {
console.info('====>testIsOperationAllowedCallback101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
done(
);
console.info('--------------testIsOperationAllowedCallback101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testIsOperationAllowedPromise101
* @tc.number testIsOperationAllowedPromise101
...
@@ -393,19 +431,18 @@ export default function wallpaperJSUnit() {
...
@@ -393,19 +431,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testIsOperationAllowedPromise101', 0, async function (done) {
it('testIsOperationAllowedPromise101', 0, async function (done) {
console.info('--------------testIsOperationAllowedPromise101 start-----------------');
await wallpaper.isOperationAllowed().then((data) => {
await wallpaper.isOperationAllowed().then((data) => {
console.info('wallpaperXTS ===> testIsOperationAllowedPromise data : ' + JSON.stringify(data));
console.info('====>testIsOperationAllowedPromise101 successful data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(typeof data == "boolean").assertTrue();
expect(true).assertTrue();
done();
}
}).catch((err) => {
}).catch((err) => {
console.info('wallpaperXTS ===> testIsOperationAllowedPromise err : ' + JSON.stringify(err));
console.info('====>testIsOperationAllowedPromise101 err : ' + JSON.stringify(err));
if (err) {
expect().assertFail();
expect(null).assertFail();
done();
}
});
});
done(
);
console.info('--------------testIsOperationAllowedPromise101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testResetCallbackSystem101
* @tc.number testResetCallbackSystem101
...
@@ -414,18 +451,24 @@ export default function wallpaperJSUnit() {
...
@@ -414,18 +451,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testResetCallbackSystem101', 0, async function (done) {
it('testResetCallbackSystem101', 0, async function (done) {
await wallpaper.reset(WALLPAPER_SYSTEM, function (err, data) {
console.info('--------------testResetCallbackSystem101 start-----------------');
console.info('wallpaperXTS ===> testResetCallbackSystem err : ' + JSON.stringify(err));
wallpaper.reset(WALLPAPER_SYSTEM, (err, data) => {
console.info('wallpaperXTS ===> testResetCallbackSystem data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testResetCallbackSystem101 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
}
console.info('====>testResetCallbackSystem101 successful data: ' + JSON.stringify(data));
expect(true).assertTrue();
expect(true).assertTrue();
done();
} catch (err) {
console.info('====>testResetCallbackSystem101 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
done(
);
console.info('--------------testResetCallbackSystem101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testResetPromiseSystem101
* @tc.number testResetPromiseSystem101
...
@@ -434,16 +477,18 @@ export default function wallpaperJSUnit() {
...
@@ -434,16 +477,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testResetPromiseSystem101', 0, async function (done) {
it('testResetPromiseSystem101', 0, async function (done) {
console.info('--------------testResetPromiseSystem101 start-----------------');
await wallpaper.reset(WALLPAPER_SYSTEM).then((data) => {
await wallpaper.reset(WALLPAPER_SYSTEM).then((data) => {
if ((data != undefined) && (data != null)) {
console.info('====>testResetPromiseSystem101 successful data : ' + JSON.stringify(data));
expect(true).assertTrue();
expect(true).assertTrue();
}
done();
done();
}).catch((err) => {
}).catch((err) => {
expect(true).assertTrue();
console.info('====>testResetPromiseSystem101 err : ' + JSON.stringify(err));
expect().assertFail();
done();
done();
});
});
})
console.info('--------------testResetPromiseSystem101 end-----------------');
});
/*
/*
* @tc.number testResetCallbackLock102
* @tc.number testResetCallbackLock102
...
@@ -452,18 +497,24 @@ export default function wallpaperJSUnit() {
...
@@ -452,18 +497,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testResetCallbackLock102', 0, async function (done) {
it('testResetCallbackLock102', 0, async function (done) {
await wallpaper.reset(WALLPAPER_LOCKSCREEN, function (err, data) {
console.info('--------------testResetCallbackLock102 start-----------------');
console.info('wallpaperXTS ===> testResetCallbackLock err : ' + JSON.stringify(err));
wallpaper.reset(WALLPAPER_LOCKSCREEN, (err, data) => {
console.info('wallpaperXTS ===> testResetCallbackLock data : ' + JSON.stringify(data));
try {
if (err) {
if (err) {
expect(null).assertFail();
console.info('====>testResetCallbackLock102 fail: ' + JSON.stringify(err));
}
expect().assertFail();
if ((data != undefined) && (data != null)) {
done();
}
console.info('====>testResetCallbackLock102 successful data: ' + JSON.stringify(data));
expect(true).assertTrue();
expect(true).assertTrue();
done();
} catch (err) {
console.info('====>testResetCallbackLock102 catch err : ' + JSON.stringify(err));
done();
}
}
})
})
done(
);
console.info('--------------testResetCallbackLock102 end-----------------'
);
})
})
;
/*
/*
* @tc.number testResetPromiseLock102
* @tc.number testResetPromiseLock102
...
@@ -472,18 +523,18 @@ export default function wallpaperJSUnit() {
...
@@ -472,18 +523,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testResetPromiseLock102', 0, async function (done) {
it('testResetPromiseLock102', 0, async function (done) {
console.info('--------------testResetPromiseLock102 start-----------------');
await wallpaper.reset(WALLPAPER_LOCKSCREEN).then((data) => {
await wallpaper.reset(WALLPAPER_LOCKSCREEN).then((data) => {
console.info('wallpaperXTS ===> testResetPromiseLock data : ' + JSON.stringify(data));
console.info('====>testResetPromiseLock102 successful data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null)) {
expect(true).assertTrue();
expect(true).assertTrue();
}
done();
done();
}).catch((err) => {
}).catch((err) => {
console.info('
wallpaperXTS ===> testResetPromiseLock---
err : ' + JSON.stringify(err));
console.info('
====>testResetPromiseLock102
err : ' + JSON.stringify(err));
expect(
true).assertTrue
();
expect(
).assertFail
();
done();
done();
});
});
})
console.info('--------------testResetPromiseLock102 end-----------------');
});
/*
/*
* @tc.number testSetWallpaperURLPromiseLock104
* @tc.number testSetWallpaperURLPromiseLock104
...
@@ -494,24 +545,17 @@ export default function wallpaperJSUnit() {
...
@@ -494,24 +545,17 @@ export default function wallpaperJSUnit() {
*/
*/
it('testSetWallpaperURLPromiseLock104', 0, async function (done) {
it('testSetWallpaperURLPromiseLock104', 0, async function (done) {
console.info('--------------------testSetWallpaperURLPromiseLock104 start------------------' );
console.info('--------------------testSetWallpaperURLPromiseLock104 start------------------' );
try{
await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN).then((data) => {
wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN).then((data) => {
console.info('====>testSetWallpaperURLPromiseLock104 successful data : ' + data);
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock104 data : ' + data);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
}).catch((err) => {
}).catch((err) => {
console.info('====>testSetWallpaperURLPromiseLock104 fail: ' + err);
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock104 err : ' + err);
expect().assertFail();
done();
});
}catch(error){
console.info('testSetWallpaperURLPromiseLock104 catch error : ' + error);
expect().assertFail();
expect().assertFail();
done();
done();
}
}
);
console.info('--------------------testSetWallpaperURLPromiseLock104 end------------------' );
console.info('--------------------testSetWallpaperURLPromiseLock104 end------------------' );
});
})
/*
/*
* @tc.number testSetWallpaperURLCallbackSystem103
* @tc.number testSetWallpaperURLCallbackSystem103
...
@@ -522,24 +566,23 @@ export default function wallpaperJSUnit() {
...
@@ -522,24 +566,23 @@ export default function wallpaperJSUnit() {
*/
*/
it('testSetWallpaperURLCallbackSystem103', 0, async function (done) {
it('testSetWallpaperURLCallbackSystem103', 0, async function (done) {
console.info('--------------------testSetWallpaperURLCallbackSystem103 start------------------' );
console.info('--------------------testSetWallpaperURLCallbackSystem103 start------------------' );
try{
wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM, (err, data) => {
wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM, function (err, data) {
try{
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem103 data : ' + data);
if (err) {
if (err) {
console.info('
wallpaperXTS ===>
testSetWallpaperURLCallbackSystem103 err : ' + err);
console.info('
====->
testSetWallpaperURLCallbackSystem103 err : ' + err);
expect().assertFail();
expect().assertFail();
done();
done();
}
}
console.info('====>testSetWallpaperURLCallbackSystem103 successful data: ' + data);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
});
}catch(error){
}catch(error){
console.info('testSetWallpaperURLCallbackSystem103 catch error: ' + error);
console.info('testSetWallpaperURLCallbackSystem103 catch error: ' + error);
done();
expect().assertFail();
}
done();
});
}
console.info('--------------------testSetWallpaperURLCallbackSystem103 end------------------' );
console.info('--------------------testSetWallpaperURLCallbackSystem103 end------------------' );
})
})
;
/*
/*
* @tc.number testSetWallpaperURLPromiseSystem103
* @tc.number testSetWallpaperURLPromiseSystem103
...
@@ -548,25 +591,19 @@ export default function wallpaperJSUnit() {
...
@@ -548,25 +591,19 @@ export default function wallpaperJSUnit() {
* @tc.desc Function test
* @tc.desc Function test
* @tc.level 0
* @tc.level 0
*/
*/
it('testSetWallpaperURLPromiseSystem103', 0, function (done) {
it('testSetWallpaperURLPromiseSystem103', 0,
async
function (done) {
console.info('--------------------testSetWallpaperURLPromiseSystem103 start------------------' );
console.info('--------------------testSetWallpaperURLPromiseSystem103 start------------------' );
try{
await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN).then((data) => {
wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM).then((data) => {
console.info('====>testSetWallpaperURLPromiseSystem103 successful data : ' + data);
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem103 data : ' + data);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
}).catch((err) => {
}).catch((err) => {
console.info('====>testSetWallpaperURLPromiseSystem103 fail: ' + err);
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem103 err : ' + err);
expect().assertFail();
done();
});
}catch(error){
console.info('testSetWallpaperURLPromiseSystem103 err: ' + error);
expect().assertFail();
expect().assertFail();
}
done();
});
console.info('--------------------testSetWallpaperURLPromiseSystem103 end------------------' );
console.info('--------------------testSetWallpaperURLPromiseSystem103 end------------------' );
});
})
/*
/*
* @tc.number testSetWallpaperURLCallbackLock104
* @tc.number testSetWallpaperURLCallbackLock104
...
@@ -577,24 +614,23 @@ export default function wallpaperJSUnit() {
...
@@ -577,24 +614,23 @@ export default function wallpaperJSUnit() {
*/
*/
it('testSetWallpaperURLCallbackLock104', 0, async function (done) {
it('testSetWallpaperURLCallbackLock104', 0, async function (done) {
console.info('--------------------testSetWallpaperURLCallbackLock104 start------------------' );
console.info('--------------------testSetWallpaperURLCallbackLock104 start------------------' );
try{
wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_LOCKSCREEN, (err, data) => {
wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_LOCKSCREEN, function (err, data) {
try{
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock104 data : ' + data);
if (err) {
if (err) {
console.info('
wallpaperXTS ===> testSetWallpaperURLCallbackLock104 err : ' + JSON.stringify(err)
);
console.info('
====->testSetWallpaperURLCallbackLock104 err : ' + err
);
expect().assertFail();
expect().assertFail();
done();
done();
}
}
console.info('====>testSetWallpaperURLCallbackLock104 successful data: ' + data);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
});
}catch(error){
}catch(error){
console.info('testSetWallpaperURLCallbackLock104 catch error: ' + error);
console.info('testSetWallpaperURLCallbackLock104 catch error : ' + error);
done();
expect().assertFail();
}
}
});
console.info('--------------------testSetWallpaperURLCallbackLock104 end------------------' );
console.info('--------------------testSetWallpaperURLCallbackLock104 end------------------' );
})
})
;
/*
/*
* @tc.number testOnCallback101
* @tc.number testOnCallback101
...
@@ -604,18 +640,32 @@ export default function wallpaperJSUnit() {
...
@@ -604,18 +640,32 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testOnCallback101', 0, async function (done) {
it('testOnCallback101', 0, async function (done) {
wallpaper.on('colorChange', function (colors, wallpaperType) {
console.info('--------------testOnCallback101 start-----------------');
console.info('wallpaperXTS ===> testOnCallback colors : ' + JSON.stringify(colors));
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
console.info('wallpaperXTS ===> testOnCallback wallpaperType : ' + JSON.stringify(wallpaperType));
await wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
if ((colors != undefined) && (colors != null)) {
try {
expect(true).assertTrue();
wallpaper.on('colorChange', async (colors, wallpaperType) => {
}
try {
if ((wallpaperType != undefined) && (wallpaperType != null)) {
console.info('====>testOnCallback101 colors: ' + JSON.stringify(colors));
expect(true).assertTrue();
console.info('====>testOnCallback101 wallpaperType: ' + JSON.stringify(wallpaperType));
}
expect(colors != null).assertTrue();
})
expect(wallpaperType != null).assertTrue();
done();
wallpaper.off('colorChange')
})
console.info('====>testOnCallback101 off');
done();
} catch (err) {
console.info('====>testOnCallback101 setImage or other err : ' + JSON.stringify(err));
done();
}
});
} catch (err) {
console.info('====>testOnCallback101 catch err : ' + JSON.stringify(err));
done();
}
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)
console.info('====>testOnCallback10 setImage successful');
console.info('--------------testOnCallback101 end-----------------');
});
/*
/*
* @tc.number testOffCallback101
* @tc.number testOffCallback101
...
@@ -625,18 +675,37 @@ export default function wallpaperJSUnit() {
...
@@ -625,18 +675,37 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testOffCallback101', 0, async function (done) {
it('testOffCallback101', 0, async function (done) {
wallpaper.off('colorChange', function (colors, wallpaperType) {
console.info('--------------testOffCallback101 start-----------------');
console.info('wallpaperXTS ===> testOffCallback colors : ' + JSON.stringify(colors));
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
console.info('wallpaperXTS ===> testOffCallback wallpaperType : ' + JSON.stringify(wallpaperType));
let callbackTimes = 0;
if ((colors != undefined) && (colors != null)) {
await wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM)
expect(true).assertTrue();
try {
}
wallpaper.on('colorChange', async (colors, wallpaperType) => {
if ((wallpaperType != undefined) && (wallpaperType != null)) {
try {
expect(true).assertTrue();
console.info('====>testOffCallback101 colors: ' + JSON.stringify(colors));
}
console.info('====>testOffCallback101 wallpaperType: ' + JSON.stringify(wallpaperType));
})
callbackTimes = callbackTimes + 1;
done();
console.info('====>testOffCallback101 on callbackTime: ' + callbackTimes);
})
expect(callbackTimes == 1).assertTrue();
wallpaper.off('colorChange');
setTimeout(() => {
done();
}, 3000)
} catch (err) {
console.info('====>testOffCallback101 setImage or other err : ' + JSON.stringify(err));
done();
}
});
} catch (err) {
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-----------------');
});
/*
/*
* @tc.number testGetFileCallback101
* @tc.number testGetFileCallback101
...
@@ -645,19 +714,24 @@ export default function wallpaperJSUnit() {
...
@@ -645,19 +714,24 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetFileCallback101', 0, async function (done) {
it('testGetFileCallback101', 0, async function (done) {
wallpaper.getFile(WALLPAPER_SYSTEM, (error, data) => {
console.info('--------------testGetFileCallback101 start-----------------');
if (error) {
wallpaper.getFile(WALLPAPER_SYSTEM, (err, data) => {
console.error("callback failed to getFile because: " + JSON.stringify(error));
try {
expect().assertFail()
if (err) {
} else {
console.info('====>testGetFileCallback101 fail: ' + JSON.stringify(err));
expect(typeof data == "number").assertTrue();
expect().assertFail();
expect(!isNaN(data)).assertTrue();
done();
console.info("callback success to getFile: " + JSON.stringify(data));
}
done()
console.info('====>testGetFileCallback101 successful data: ' + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done();
} catch (err) {
console.info('====>testGetFileCallback101 catch err : ' + JSON.stringify(err));
done();
}
}
});
});
done(
);
console.info('--------------testGetFileCallback101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetFilePromise101
* @tc.number testGetFilePromise101
...
@@ -666,17 +740,18 @@ export default function wallpaperJSUnit() {
...
@@ -666,17 +740,18 @@ export default function wallpaperJSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('testGetFilePromise101', 0, async function (done) {
it('testGetFilePromise101', 0, async function (done) {
wallpaper.getFile(WALLPAPER_SYSTEM).then((data) => {
console.info('--------------testGetFilePromise101 start-----------------');
expect(typeof data == "number").assertTrue();
await wallpaper.getFile(WALLPAPER_LOCKSCREEN).then((data) => {
expect(!isNaN(data)).assertTrue();
console.info('====>testGetFilePromise101 successful data : ' + JSON.stringify(data));
console.info("promise success to getFile: " + JSON.stringify(data));
expect(Number.isInteger(data)).assertTrue();
done()
done();
}).catch((error) => {
}).catch((err) => {
console.error("promise failed to getFile because: " + JSON.stringify(error));
console.info('====>testGetFilePromise101 err : ' + JSON.stringify(err));
expect().assertFail()
expect().assertFail();
done();
});
});
done(
);
console.info('--------------testGetFilePromise101 end-----------------'
);
})
})
;
/*
/*
* @tc.number testGetColorsSync101
* @tc.number testGetColorsSync101
...
@@ -717,7 +792,7 @@ export default function wallpaperJSUnit() {
...
@@ -717,7 +792,7 @@ export default function wallpaperJSUnit() {
let colors = null;
let colors = null;
try{
try{
colors = wallpaper.getColorsSync(WALLPAPER_LOCKSCREEN)
colors = wallpaper.getColorsSync(WALLPAPER_LOCKSCREEN)
console.info('
wallpaperXTS ===>
testGetColorsSync102 data : ' + JSON.stringify(colors));
console.info('
====>
testGetColorsSync102 data : ' + JSON.stringify(colors));
if (colors.length >= 1) {
if (colors.length >= 1) {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -726,12 +801,11 @@ export default function wallpaperJSUnit() {
...
@@ -726,12 +801,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetColorsSync102 err : ' + JSON.stringify(err));
console.info('
====>
testGetColorsSync102 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetColorsSync102 end----------------------');
console.info('------------------testGetColorsSync102 end----------------------');
done()
})
})
/*
/*
...
@@ -745,7 +819,7 @@ export default function wallpaperJSUnit() {
...
@@ -745,7 +819,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getIdSync(WALLPAPER_SYSTEM)
number = wallpaper.getIdSync(WALLPAPER_SYSTEM)
console.info('
wallpaperXTS ===>
testGetIdSync101 data : ' + JSON.stringify(number));
console.info('
====>
testGetIdSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -754,12 +828,11 @@ export default function wallpaperJSUnit() {
...
@@ -754,12 +828,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetIdSync101 err : ' + JSON.stringify(err));
console.info('
====>
testGetIdSync101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetIdSync101 end----------------------');
console.info('------------------testGetIdSync101 end----------------------');
done()
})
})
/*
/*
...
@@ -773,7 +846,7 @@ export default function wallpaperJSUnit() {
...
@@ -773,7 +846,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getIdSync(WALLPAPER_LOCKSCREEN)
number = wallpaper.getIdSync(WALLPAPER_LOCKSCREEN)
console.info('
wallpaperXTS ===>
testGetIdSync102 data : ' + JSON.stringify(number));
console.info('
====>
testGetIdSync102 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -782,12 +855,11 @@ export default function wallpaperJSUnit() {
...
@@ -782,12 +855,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetIdSync102 err : ' + JSON.stringify(err));
console.info('
====>
testGetIdSync102 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetIdSync102 end----------------------');
console.info('------------------testGetIdSync102 end----------------------');
done()
})
})
/*
/*
...
@@ -801,7 +873,7 @@ export default function wallpaperJSUnit() {
...
@@ -801,7 +873,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getFileSync(WALLPAPER_SYSTEM)
number = wallpaper.getFileSync(WALLPAPER_SYSTEM)
console.info('
wallpaperXTS ===>
testGetFileSync101 data : ' + JSON.stringify(number));
console.info('
====>
testGetFileSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -810,12 +882,11 @@ export default function wallpaperJSUnit() {
...
@@ -810,12 +882,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetFileSync101 err : ' + JSON.stringify(err));
console.info('
====>
testGetFileSync101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetFileSync101 end----------------------');
console.info('------------------testGetFileSync101 end----------------------');
done()
})
})
/*
/*
...
@@ -829,7 +900,7 @@ export default function wallpaperJSUnit() {
...
@@ -829,7 +900,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getFileSync(WALLPAPER_LOCKSCREEN)
number = wallpaper.getFileSync(WALLPAPER_LOCKSCREEN)
console.info('
wallpaperXTS ===>
testGetFileSync102 data : ' + JSON.stringify(number));
console.info('
====>
testGetFileSync102 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -838,12 +909,11 @@ export default function wallpaperJSUnit() {
...
@@ -838,12 +909,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetFileSync102 err : ' + JSON.stringify(err));
console.info('
====>
testGetFileSync102 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetFileSync102 end----------------------');
console.info('------------------testGetFileSync102 end----------------------');
done()
})
})
/*
/*
...
@@ -857,7 +927,7 @@ export default function wallpaperJSUnit() {
...
@@ -857,7 +927,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getFileSync(3)
number = wallpaper.getFileSync(3)
console.info('
wallpaperXTS ===>
testGetFileSync103 data : ' + JSON.stringify(number));
console.info('
====>
testGetFileSync103 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -866,13 +936,12 @@ export default function wallpaperJSUnit() {
...
@@ -866,13 +936,12 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetFileSync103 err : ' + JSON.stringify(err));
console.info('
====>
testGetFileSync103 err : ' + JSON.stringify(err));
console.info('
wallpaperXTS ===>
testGetFileSync103 (err.code : ' + err.code);
console.info('
====>
testGetFileSync103 (err.code : ' + err.code);
expect(err.code == "401").assertTrue();
expect(err.code == "401").assertTrue();
done()
done()
}
}
console.info('------------------testGetFileSync103 end----------------------');
console.info('------------------testGetFileSync103 end----------------------');
done()
})
})
/*
/*
...
@@ -886,7 +955,7 @@ export default function wallpaperJSUnit() {
...
@@ -886,7 +955,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getMinHeightSync()
number = wallpaper.getMinHeightSync()
console.info('
wallpaperXTS ===>
testGetMinHeightSync101 data : ' + JSON.stringify(number));
console.info('
====>
testGetMinHeightSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -895,7 +964,7 @@ export default function wallpaperJSUnit() {
...
@@ -895,7 +964,7 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetMinHeightSync101 err : ' + JSON.stringify(err));
console.info('
====>
testGetMinHeightSync101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
...
@@ -914,7 +983,7 @@ export default function wallpaperJSUnit() {
...
@@ -914,7 +983,7 @@ export default function wallpaperJSUnit() {
let number = null;
let number = null;
try{
try{
number = wallpaper.getMinWidthSync()
number = wallpaper.getMinWidthSync()
console.info('
wallpaperXTS ===>
testGetMinWidthSync101 data : ' + JSON.stringify(number));
console.info('
====>
testGetMinWidthSync101 data : ' + JSON.stringify(number));
if (typeof number == "number") {
if (typeof number == "number") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -923,12 +992,11 @@ export default function wallpaperJSUnit() {
...
@@ -923,12 +992,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testGetMinWidthSync101 err : ' + JSON.stringify(err));
console.info('
====>
testGetMinWidthSync101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testGetMinWidthSync101 end----------------------');
console.info('------------------testGetMinWidthSync101 end----------------------');
done()
})
})
/*
/*
...
@@ -942,7 +1010,7 @@ export default function wallpaperJSUnit() {
...
@@ -942,7 +1010,7 @@ export default function wallpaperJSUnit() {
let allow = null;
let allow = null;
try{
try{
allow = wallpaper.isChangeAllowed()
allow = wallpaper.isChangeAllowed()
console.info('
wallpaperXTS ===>
testIsChangeAllowed101 data : ' + JSON.stringify(allow));
console.info('
====>
testIsChangeAllowed101 data : ' + JSON.stringify(allow));
if (typeof allow == "boolean") {
if (typeof allow == "boolean") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -951,12 +1019,11 @@ export default function wallpaperJSUnit() {
...
@@ -951,12 +1019,11 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testIsChangeAllowed101 err : ' + JSON.stringify(err));
console.info('
====>
testIsChangeAllowed101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
console.info('------------------testIsChangeAllowed101 end----------------------');
console.info('------------------testIsChangeAllowed101 end----------------------');
done()
})
})
/*
/*
...
@@ -970,7 +1037,7 @@ export default function wallpaperJSUnit() {
...
@@ -970,7 +1037,7 @@ export default function wallpaperJSUnit() {
let allow = null;
let allow = null;
try{
try{
allow = wallpaper.isUserChangeAllowed()
allow = wallpaper.isUserChangeAllowed()
console.info('
wallpaperXTS ===>
testIsUserChangeAllowed101 data : ' + JSON.stringify(allow));
console.info('
====>
testIsUserChangeAllowed101 data : ' + JSON.stringify(allow));
if (typeof allow == "boolean") {
if (typeof allow == "boolean") {
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
...
@@ -979,7 +1046,7 @@ export default function wallpaperJSUnit() {
...
@@ -979,7 +1046,7 @@ export default function wallpaperJSUnit() {
done()
done()
}
}
}catch(err){
}catch(err){
console.info('
wallpaperXTS ===>
testIsUserChangeAllowed101 err : ' + JSON.stringify(err));
console.info('
====>
testIsUserChangeAllowed101 err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
}
}
...
@@ -995,23 +1062,22 @@ export default function wallpaperJSUnit() {
...
@@ -995,23 +1062,22 @@ export default function wallpaperJSUnit() {
*/
*/
it('testRestoreCallback101', 0, async function (done) {
it('testRestoreCallback101', 0, async function (done) {
console.info('------------------testRestoreCallback101 start----------------------');
console.info('------------------testRestoreCallback101 start----------------------');
try
{
wallpaper.restore(WALLPAPER_LOCKSCREEN, function (err, data)
{
wallpaper.restore(WALLPAPER_LOCKSCREEN, function (err, data)
{
try
{
console.info('
wallpaperXTS ===>
testRestoreCallback101 data : ' + data);
console.info('
====>
testRestoreCallback101 data : ' + data);
if (err) {
if (err) {
console.info('
wallpaperXTS ===> testRestoreCallback101 err
: ' + JSON.stringify(err));
console.info('
====>testRestoreCallback101 fail
: ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done()
done()
;
}
}
console.info('testRestoreCallback101 restore success');
console.info('
====>
testRestoreCallback101 restore success');
expect(true).assertTrue();
expect(true).assertTrue();
done()
done();
})
}catch(err){
}catch(err){
console.info('====>testRestoreCallback101 catch err : ' + JSON.stringify(err));
console.info('testRestoreCallback101 catch err : ' + JSON.stringify(err));
done();
expect().assertFail();
}
done()
});
}
console.info('------------------testRestoreCallback101 end----------------------');
console.info('------------------testRestoreCallback101 end----------------------');
})
})
...
@@ -1023,22 +1089,16 @@ export default function wallpaperJSUnit() {
...
@@ -1023,22 +1089,16 @@ export default function wallpaperJSUnit() {
*/
*/
it('testRestorePromise101', 0, async function (done) {
it('testRestorePromise101', 0, async function (done) {
console.info('------------------testRestorePromise101 start----------------------');
console.info('------------------testRestorePromise101 start----------------------');
try{
await wallpaper.restore(WALLPAPER_SYSTEM).then((data) => {
wallpaper.restore(WALLPAPER_SYSTEM).then((data) => {
console.info('====>testRestorePromise101 data : ' + JSON.stringify(data));
console.info('wallpaperXTS ===> testRestorePromise101 data : ' + JSON.stringify(data));
console.info('====>testRestorePromise101 restore success');
console.info('testRestorePromise101 restore success');
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
}).catch((err) => {
}).catch((err) => {
console.info('====>testRestorePromise101 fail: ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testRestorePromise101 err : ' + JSON.stringify(err));
expect().assertFail();
done();
});
}catch(err){
console.info('testRestorePromise101 catch err : ' + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
done();
done();
}
}
);
console.info('------------------testRestorePromise101 end----------------------');
console.info('------------------testRestorePromise101 end----------------------');
})
})
...
@@ -1051,22 +1111,21 @@ export default function wallpaperJSUnit() {
...
@@ -1051,22 +1111,21 @@ export default function wallpaperJSUnit() {
it('testSetImageCallBack101', 0, async function (done) {
it('testSetImageCallBack101', 0, async function (done) {
console.info('------------------testSetImageCallBack101 start----------------------');
console.info('------------------testSetImageCallBack101 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
try
{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) =>
{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) =>
{
try
{
if (error) {
if (error) {
console.error(`testSetImageCallBack101 failed to setImage because: ` + JSON.stringify(error));
console.error(`
====>
testSetImageCallBack101 failed to setImage because: ` + JSON.stringify(error));
expect().assertFail();
expect().assertFail();
done();
done();
}
}
console.log(`testSetImageCallBack101 success to setImage.`);
console.log(`
====>
testSetImageCallBack101 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
});
}catch(err){
}catch(err){
console.info('====>testSetImageCallBack101 catch err : ' + JSON.stringify(err));
console.info('testSetImageCallBack101 catch err : ' + JSON.stringify(err));
done();
expect().assertFail();
}
done();
});
}
console.info('------------------testSetImageCallBack101 end----------------------');
console.info('------------------testSetImageCallBack101 end----------------------');
})
})
...
@@ -1079,22 +1138,21 @@ export default function wallpaperJSUnit() {
...
@@ -1079,22 +1138,21 @@ export default function wallpaperJSUnit() {
it('testSetImageCallBack102', 0, async function (done) {
it('testSetImageCallBack102', 0, async function (done) {
console.info('------------------testSetImageCallBack102 start----------------------');
console.info('------------------testSetImageCallBack102 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
try
{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN, (error, data) =>
{
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN, (error, data) =>
{
try
{
if (error) {
if (error) {
console.error(`testSetImageCallBack102 failed to setImage because: ` + JSON.stringify(error));
console.error(`
====>
testSetImageCallBack102 failed to setImage because: ` + JSON.stringify(error));
expect().assertFail();
expect().assertFail();
done();
done();
}
}
console.log(`testSetImageCallBack102 success to setImage.`);
console.log(`
====>
testSetImageCallBack102 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
done();
done();
});
}catch(err){
}catch(err){
console.info('====>testSetImageCallBack102 catch err : ' + JSON.stringify(err));
console.info('testSetImageCallBack102 catch err : ' + JSON.stringify(err));
done();
expect().assertFail();
}
done();
});
}
console.info('------------------testSetImageCallBack102 end----------------------');
console.info('------------------testSetImageCallBack102 end----------------------');
})
})
...
@@ -1106,36 +1164,28 @@ export default function wallpaperJSUnit() {
...
@@ -1106,36 +1164,28 @@ export default function wallpaperJSUnit() {
*/
*/
it('testSetImageCallBack103', 0, async function (done) {
it('testSetImageCallBack103', 0, async function (done) {
console.info('------------------testSetImageCallBack103 start----------------------');
console.info('------------------testSetImageCallBack103 start----------------------');
const color = new ArrayBuffer(96);
wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((pixelMap) => {
let bufferArr = new Uint8Array(color);
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
let opts = {
try{
editable: true,
pixelFormat: 3,
size: { height: 4, width: 6 }
}
console.log(`testSetImageCallBack103 opts success`)
try{
image.createPixelMap(color, opts).then((pixelMap) => {
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
if (error) {
console.error(`testSetImageCallBack103 failed to setImage because: ` + JSON.stringify(error));
console.error(`testSetImageCallBack103 failed to setImage because: ` + JSON.stringify(error));
expect().assertFail();
expect().assertFail();
done()
done()
;
}
}
console.log(`testSetImageCallBack103 success to setImage.`);
console.log(`testSetImageCallBack103 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
done()
done()
;
}
);
}
catch(err){
}).catch((error) => {
console.info('testSetImageCallBack103 catch err : ' + JSON.stringify(err));
console.error(`testSetImageCallBack103 failed to createPixelMap because: ` + JSON.stringify(error)
);
expect().assertFail(
);
expect().assertFail
();
done
();
done()
}
});
});
}
catch(err)
{
}
).catch((error) =>
{
console.
info('testSetImageCallBack103 catch err : ' + JSON.stringify(er
r));
console.
error(`testSetImageCallBack103 failed to createPixelMap because: ` + JSON.stringify(erro
r));
expect().assertFail();
expect().assertFail();
done()
;
done()
}
}
);
console.info('------------------testSetImageCallBack103 end----------------------');
console.info('------------------testSetImageCallBack103 end----------------------');
})
})
...
@@ -1148,22 +1198,15 @@ export default function wallpaperJSUnit() {
...
@@ -1148,22 +1198,15 @@ export default function wallpaperJSUnit() {
it('testSetImagePromise101', 0, async function (done) {
it('testSetImagePromise101', 0, async function (done) {
console.info('------------------testSetImagePromise101 start----------------------');
console.info('------------------testSetImagePromise101 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
try{
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`====>testSetImagePromise101 success to setImage.`);
console.log(`testSetImagePromise101 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
done();
}).catch(err => {
expect().assertFail();
console.log(`testSetImagePromise101 promise catch: ` + JSON.stringify(err));
});
}catch(err){
console.info('testSetImagePromise101 catch err : ' + JSON.stringify(err));
expect().assertFail();
done();
done();
}
}).catch(err => {
expect().assertFail();
console.log(`====>testSetImagePromise101 promise fail: ` + JSON.stringify(err));
});
console.info('------------------testSetImagePromise101 end----------------------');
console.info('------------------testSetImagePromise101 end----------------------');
})
})
/*
/*
...
@@ -1175,21 +1218,15 @@ export default function wallpaperJSUnit() {
...
@@ -1175,21 +1218,15 @@ export default function wallpaperJSUnit() {
it('testSetImagePromise102', 0, async function (done) {
it('testSetImagePromise102', 0, async function (done) {
console.info('------------------testSetImagePromise102 start----------------------');
console.info('------------------testSetImagePromise102 start----------------------');
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
let wallpaperPath = "/data/storage/el2/base/haps/wp.png";
try{
await wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN).then((data) => {
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN).then((data) => {
console.log(`====>testSetImagePromise102 success to setImage.`);
console.log(`testSetImagePromise102 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
done();
}).catch(err => {
console.log(`testSetImagePromise102 promise catch: ` + JSON.stringify(err));
expect().assertFail();
done()
});
}catch(err){
console.info('testSetImagePromise102 catch err : ' + JSON.stringify(err));
expect().assertFail();
done();
done();
}
}).catch(err => {
console.log(`====>testSetImagePromise102 promise catch: ` + JSON.stringify(err));
expect().assertFail();
done()
});
console.info('------------------testSetImagePromise102 end----------------------');
console.info('------------------testSetImagePromise102 end----------------------');
})
})
...
@@ -1201,16 +1238,8 @@ export default function wallpaperJSUnit() {
...
@@ -1201,16 +1238,8 @@ export default function wallpaperJSUnit() {
*/
*/
it('testSetImagePromise103', 0, async function (done) {
it('testSetImagePromise103', 0, async function (done) {
console.info('------------------testSetImagePromise103 start----------------------');
console.info('------------------testSetImagePromise103 start----------------------');
const color = new ArrayBuffer(96);
let bufferArr = new Uint8Array(color);
let opts = {
editable: true,
pixelFormat: 3,
size: { height: 4, width: 6 }
}
console.log(`testSetImagePromise103 opts success`)
try{
try{
image.createPixelMap(color, opts
).then((pixelMap) => {
wallpaper.getPixelMap(wallpaper.WallpaperType.WALLPAPER_SYSTEM
).then((pixelMap) => {
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
wallpaper.setImage(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`testSetImagePromise103 success to setImage.`);
console.log(`testSetImagePromise103 success to setImage.`);
expect(true).assertTrue();
expect(true).assertTrue();
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
daa548fe
·
11月 27, 2022
mentioned in commit
daa548fe
mentioned in commit daa548feedecaad1d4d324f1868a4aab940df224
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录