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

!8539 change colorspace

Merge pull request !8539 from 冯泽悟/master
...@@ -72,37 +72,7 @@ export default function ImageP3() { ...@@ -72,37 +72,7 @@ export default function ImageP3() {
}, },
}; };
} }
async function setColor(done, testNum, imageSource, colorSpaceName) {
async function setColorCallBack(done, testNum, imageSource, colorSpaceName) {
let logger = Logger(testNum);
logger.log("ImageSource " + (imageSource != undefined));
if (imageSource != undefined) {
let pixelMap = await imageSource.createPixelMap();
logger.log("PixelMap " + pixelMap);
var csm = colorSpaceManager.create(colorSpaceName);
logger.log("colorSpaceManager.ColorSpace: " + colorSpaceName);
pixelMap.setColorSpace(csm, async (err) => {
if (err != undefined) {
expect(false).assertTrue();
logger.log("setColorSpace failed " + err);
done();
return;
}
var csm1 = await pixelMap.getColorSpace();
logger.log("getColorSpace " + csm1);
var csmn = csm1.getColorSpaceName();
logger.log("getColorSpaceName " + csmn);
expect(csmn == colorSpaceName).assertTrue();
done();
});
} else {
logger.log("createimageSource fail");
expect(false).assertTrue();
done();
}
}
async function setColorPromise(done, testNum, imageSource, colorSpaceName) {
let logger = Logger(testNum); let logger = Logger(testNum);
try { try {
logger.log("ImageSource " + (imageSource != undefined)); logger.log("ImageSource " + (imageSource != undefined));
...@@ -111,8 +81,8 @@ export default function ImageP3() { ...@@ -111,8 +81,8 @@ export default function ImageP3() {
logger.log("PixelMap " + pixelMap); logger.log("PixelMap " + pixelMap);
var csm = colorSpaceManager.create(colorSpaceName); var csm = colorSpaceManager.create(colorSpaceName);
logger.log("colorSpaceManager.ColorSpace: " + colorSpaceName); logger.log("colorSpaceManager.ColorSpace: " + colorSpaceName);
await pixelMap.setColorSpace(csm); pixelMap.setColorSpace(csm);
var csm1 = await pixelMap.getColorSpace(); var csm1 = pixelMap.getColorSpace();
logger.log("getColorSpace " + csm1); logger.log("getColorSpace " + csm1);
var csmn = csm1.getColorSpaceName(); var csmn = csm1.getColorSpaceName();
logger.log("getColorSpaceName " + csmn); logger.log("getColorSpaceName " + csmn);
...@@ -131,8 +101,8 @@ export default function ImageP3() { ...@@ -131,8 +101,8 @@ export default function ImageP3() {
} }
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_PROMISE_0100 * @tc.number : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_0100
* @tc.name : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_PROMISE_0100 * @tc.name : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_0100
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.createPixelMap * 2.createPixelMap
* 3.getColorSpace and getColorSpaceName * 3.getColorSpace and getColorSpaceName
...@@ -140,13 +110,13 @@ export default function ImageP3() { ...@@ -140,13 +110,13 @@ export default function ImageP3() {
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_PROMISE_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_0100", 0, async function (done) {
let logger = Logger("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_PROMISE_0100"); let logger = Logger("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_0100");
try { try {
let imageSource = GenPicSource(testImg); let imageSource = GenPicSource(testImg);
if (imageSource != undefined) { if (imageSource != undefined) {
let pixelMap = await imageSource.createPixelMap(); let pixelMap = await imageSource.createPixelMap();
var csm = await pixelMap.getColorSpace(); var csm = pixelMap.getColorSpace();
logger.log("getColorSpace csm " + csm); logger.log("getColorSpace csm " + csm);
var csmn = csm.getColorSpaceName(); var csmn = csm.getColorSpaceName();
logger.log("getColorSpaceName " + csmn); logger.log("getColorSpaceName " + csmn);
...@@ -165,38 +135,8 @@ export default function ImageP3() { ...@@ -165,38 +135,8 @@ export default function ImageP3() {
}); });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_CALLBACK_0100 * @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0100
* @tc.name : SUB_GRAPHIC_IMAGE_GETCOLORSPACE_CALLBACK_0100 * @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0100
* @tc.desc : 1.create imagesource
* 2.createPixelMap
* 3.getColorSpace and getColorSpaceName
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_CALLBACK_0100", 0, async function (done) {
let logger = Logger("SUB_GRAPHIC_IMAGE_GETCOLORSPACE_CALLBACK_0100");
let imageSource = GenPicSource(testImg);
if (imageSource != undefined) {
let pixelMap = await imageSource.createPixelMap();
pixelMap.getColorSpace((err, csm) => {
if (err != undefined) {
logger.log("getColorSpace failed " + err);
expect(false).assertTrue();
return;
}
logger.log("getColorSpace csm " + csm);
let csmn = csm.getColorSpaceName();
logger.log("getColorSpaceName " + csmn);
expect(csmn == COLORSPACENAME).assertTrue();
done();
});
}
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0100
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0100
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.createPixelMap * 2.createPixelMap
* 3.setColorSpace * 3.setColorSpace
...@@ -205,19 +145,19 @@ export default function ImageP3() { ...@@ -205,19 +145,19 @@ export default function ImageP3() {
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0100", 0, function (done) {
let imageSource = image.createImageSource(testP3.buffer); let imageSource = image.createImageSource(testP3.buffer);
setColorPromise( setColor(
done, done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0100", "SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0100",
imageSource, imageSource,
colorSpaceManager.ColorSpace.SRGB colorSpaceManager.ColorSpace.SRGB
); );
}); });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0200 * @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0200
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0200 * @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0200
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.createPixelMap * 2.createPixelMap
* 3.setColorSpace * 3.setColorSpace
...@@ -226,19 +166,19 @@ export default function ImageP3() { ...@@ -226,19 +166,19 @@ export default function ImageP3() {
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0200", 1, async function (done) { it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0200", 1, function (done) {
let imageSource = image.createImageSource(testImg.buffer); let imageSource = image.createImageSource(testImg.buffer);
setColorPromise( setColor(
done, done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0200", "SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0200",
imageSource, imageSource,
colorSpaceManager.ColorSpace.DISPLAY_P3 colorSpaceManager.ColorSpace.DISPLAY_P3
); );
}); });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0300 * @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0300
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0300 * @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0300
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.createPixelMap * 2.createPixelMap
* 3.setColorSpace * 3.setColorSpace
...@@ -247,20 +187,20 @@ export default function ImageP3() { ...@@ -247,20 +187,20 @@ export default function ImageP3() {
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0300", 1, async function (done) { it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0300", 1, async function (done) {
await getFd("colorspace.jpg"); await getFd("colorspace.jpg");
let imageSource = image.createImageSource(fdNumber); let imageSource = image.createImageSource(fdNumber);
setColorPromise( setColor(
done, done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0300", "SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0300",
imageSource, imageSource,
colorSpaceManager.ColorSpace.DISPLAY_P3 colorSpaceManager.ColorSpace.DISPLAY_P3
); );
}); });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0400 * @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0400
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0400 * @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0400
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.createPixelMap * 2.createPixelMap
* 3.setColorSpace * 3.setColorSpace
...@@ -269,101 +209,15 @@ export default function ImageP3() { ...@@ -269,101 +209,15 @@ export default function ImageP3() {
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0400", 1, async function (done) { it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0400", 1, async function (done) {
await getFd("DisplayP3.png"); await getFd("DisplayP3.png");
let imageSource = image.createImageSource(fdNumber); let imageSource = image.createImageSource(fdNumber);
setColorPromise( setColor(
done, done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_PROMISE_0400", "SUB_GRAPHIC_IMAGE_SETCOLORSPACE_0400",
imageSource, imageSource,
colorSpaceManager.ColorSpace.SRGB colorSpaceManager.ColorSpace.SRGB
); );
}); });
/**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0100
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0100
* @tc.desc : 1.create imagesource
* 2.createPixelMap
* 3.setColorSpace
* 4.getColorSpace and getColorSpaceName
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0100", 0, async function (done) {
let imageSource = image.createImageSource(testImg.buffer);
setColorCallBack(
done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0100",
imageSource,
colorSpaceManager.ColorSpace.DISPLAY_P3
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0200
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0200
* @tc.desc : 1.create imagesource
* 2.createPixelMap
* 3.setColorSpace
* 4.getColorSpace and getColorSpaceName
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0200", 1, async function (done) {
let imageSource = image.createImageSource(testP3.buffer);
setColorCallBack(
done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0200",
imageSource,
colorSpaceManager.ColorSpace.SRGB
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0300
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0300
* @tc.desc : 1.create imagesource
* 2.createPixelMap
* 3.setColorSpace
* 4.getColorSpace and getColorSpaceName
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0300", 1, async function (done) {
await getFd("DisplayP3.png");
let imageSource = image.createImageSource(fdNumber);
setColorCallBack(
done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0300",
imageSource,
colorSpaceManager.ColorSpace.SRGB
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0400
* @tc.name : SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0400
* @tc.desc : 1.create imagesource
* 2.createPixelMap
* 3.setColorSpace
* 4.getColorSpace and getColorSpaceName
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0400", 1, async function (done) {
await getFd("colorspace.jpg");
let imageSource = image.createImageSource(fdNumber);
setColorCallBack(
done,
"SUB_GRAPHIC_IMAGE_SETCOLORSPACE_CALLBACK_0400",
imageSource,
colorSpaceManager.ColorSpace.DISPLAY_P3
);
});
}); });
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册