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

!4977 杂散子系统适配开发修改

Merge pull request !4977 from 高曦/OpenHarmony-3.1-Release
...@@ -76,7 +76,7 @@ describe('WallpaperJsunitTest', function () { ...@@ -76,7 +76,7 @@ describe('WallpaperJsunitTest', function () {
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]);
if (err) { if (err) {
expect(null).assertFail(); expect(err.code).assertEqual(801);
} }
if ((data != undefined) && (data != null) && (data != '')) { if ((data != undefined) && (data != null) && (data != '')) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -100,7 +100,7 @@ describe('WallpaperJsunitTest', function () { ...@@ -100,7 +100,7 @@ describe('WallpaperJsunitTest', function () {
}).catch((err) => { }).catch((err) => {
console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err));
if (err) { if (err) {
expect(err.code != null ).assertTrue(); expect(err.code).assertEqual(801);
} }
}); });
done(); done();
...@@ -117,7 +117,7 @@ describe('WallpaperJsunitTest', function () { ...@@ -117,7 +117,7 @@ describe('WallpaperJsunitTest', function () {
console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data));
if (err) { if (err) {
expect(err.code === null).assertFalse(); expect(err.code).assertEqual(801);
done(); done();
} }
if ((data != undefined) && (data != null) && (data != '')) { if ((data != undefined) && (data != null) && (data != '')) {
...@@ -144,7 +144,7 @@ describe('WallpaperJsunitTest', function () { ...@@ -144,7 +144,7 @@ describe('WallpaperJsunitTest', function () {
}).catch((err) => { }).catch((err) => {
console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err));
if (err) { if (err) {
expect(err.code === null).assertFalse(); expect(err.code).assertEqual(801);
} }
done(); done();
}); });
...@@ -489,8 +489,11 @@ describe('WallpaperJsunitTest', function () { ...@@ -489,8 +489,11 @@ describe('WallpaperJsunitTest', function () {
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock data : ' + JSON.stringify(data));
if ((data != undefined) && (data != null) && (data != '')) { if ((data != undefined) && (data != null) && (data != '')) {
expect(true).assertTrue(); expect(true).assertTrue();
}
done(); done();
}else{
expect().assertFail();
done();
}
}).catch((err) => { }).catch((err) => {
console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock err : ' + JSON.stringify(err));
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -509,14 +512,14 @@ describe('WallpaperJsunitTest', function () { ...@@ -509,14 +512,14 @@ describe('WallpaperJsunitTest', function () {
await wallpaper.setWallpaper(imageSource, WALLPAPER_SYSTEM, function (err, data) { await wallpaper.setWallpaper(imageSource, WALLPAPER_SYSTEM, function (err, data) {
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem data : ' + JSON.stringify(data));
if (err) { if (data != undefined ) {
expect(null).assertFail(); expect().assertFail();
} done();
if ((data != undefined) && (data != null) && (data != '')) { }else {
expect(true).assertTrue(); expect(true).assertTrue();
done();
} }
}); });
done();
}) })
/* /*
...@@ -556,14 +559,14 @@ describe('WallpaperJsunitTest', function () { ...@@ -556,14 +559,14 @@ describe('WallpaperJsunitTest', function () {
await wallpaper.setWallpaper(imageSource, WALLPAPER_LOCKSCREEN, function (err, data) { await wallpaper.setWallpaper(imageSource, WALLPAPER_LOCKSCREEN, function (err, data) {
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock data : ' + JSON.stringify(data));
if (err) { if (data != undefined) {
expect(null).assertFail(); expect().assertFail();
} done();
if ((data != undefined) && (data != null) && (data != '')) { }else {
expect(true).assertTrue(); expect(true).assertTrue();
done();
} }
}); });
done();
}) })
/* /*
...@@ -574,7 +577,7 @@ describe('WallpaperJsunitTest', function () { ...@@ -574,7 +577,7 @@ describe('WallpaperJsunitTest', function () {
* @tc.level 0 * @tc.level 0
*/ */
it('testOnCallback101', 0, async function (done) { it('testOnCallback101', 0, async function (done) {
await wallpaper.on('colorChange', function (colors, wallpaperType) { let listener = (colors, wallpaperType) => {
console.info('wallpaperXTS ===> testOnCallback colors : ' + JSON.stringify(colors)); console.info('wallpaperXTS ===> testOnCallback colors : ' + JSON.stringify(colors));
console.info('wallpaperXTS ===> testOnCallback wallpaperType : ' + JSON.stringify(wallpaperType)); console.info('wallpaperXTS ===> testOnCallback wallpaperType : ' + JSON.stringify(wallpaperType));
if ((colors != undefined) && (colors != null) && (colors != '')) { if ((colors != undefined) && (colors != null) && (colors != '')) {
...@@ -583,28 +586,50 @@ describe('WallpaperJsunitTest', function () { ...@@ -583,28 +586,50 @@ describe('WallpaperJsunitTest', function () {
if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) { if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) {
expect(true).assertTrue(); expect(true).assertTrue();
} }
};
await wallpaper.on('colorChange', listener)
await wallpaper.off('colorChange', listener)
done()
}) })
/*
* @tc.number testGetFileCallback101
* @tc.name Test getfiule() to the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it('testGetFileCallback101', 0, async function (done) {
wallpaper.getFile(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error(`failed to testGetFileCallback101 because: ` + JSON.stringify(error));
expect(error.code).assertEqual("801");
done(); done();
}
console.info(`success to getFile: ` + JSON.stringify(data));
});
}) })
/* /*
* @tc.number testOffCallback101
* @tc.name Test on_colorChange to registers a listener for wallpaper color changes to * @tc.number testGetFilePromise101
receive notifications about the changes. * @tc.name Test getfile() 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('testOffCallback101', 0, async function (done) { it('testGetFilePromise101', 0, async function (done) {
await wallpaper.off('colorChange', function (colors, wallpaperType) { await wallpaper.getFile(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.info('wallpaperXTS ===> testOffCallback colors : ' + JSON.stringify(colors)); console.info(`success to getFile: ` + JSON.stringify(data));
console.info('wallpaperXTS ===> testOffCallback wallpaperType : ' + JSON.stringify(wallpaperType));
if ((colors != undefined) && (colors != null) && (colors != '')) {
expect(true).assertTrue();
}
if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) {
expect(true).assertTrue(); expect(true).assertTrue();
}
})
done(); done();
}).catch((error) => {
console.error(`failed to testGetFilePromise101 because: ` + JSON.stringify(error));
console.info(typeof(error.code));
expect(error.code).assertEqual("801");
done();
});
}) })
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册