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

!5416 modify webp getfd

Merge pull request !5416 from caochuan/image/raw
...@@ -13,197 +13,197 @@ ...@@ -13,197 +13,197 @@
* limitations under the License. * limitations under the License.
*/ */
import image from '@ohos.multimedia.image' import image from "@ohos.multimedia.image";
import fileio from '@ohos.fileio' import fileio from "@ohos.fileio";
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from "@ohos.ability.featureAbility";
export default function imageWebp() { export default function imageWebp() {
describe('imageWebp', function () { describe("imageWebp", function () {
let filePath; let filePath;
let fdNumber; async function getFd(fileName) {
async function getFd(fileName) { let context = await featureAbility.getContext();
let context = await featureAbility.getContext(); await context.getFilesDir().then((data) => {
await context.getFilesDir().then((data) => { filePath = data + "/" + fileName;
filePath = data + '/' + fileName; console.info("image case filePath is " + filePath);
console.info('image case filePath is ' + filePath); });
}) }
await fileio.open(filePath).then((data) => {
fdNumber = data;
console.info("image case open fd success " + fdNumber);
}, (err) => {
console.info("image cese open fd fail" + err)
}).catch((err) => {
console.info("image case open fd err " + err);
})
}
beforeAll(async function () {
console.info('beforeAll case');
})
beforeEach(function () { beforeAll(async function () {
console.info('beforeEach case'); console.info("beforeAll case");
}) });
afterEach(async function () { beforeEach(function () {
await fileio.close(fdNumber).then(function(){ console.info("beforeEach case");
console.info("close file succeed");
}).catch(function(err){
console.info("close file failed with error:"+ err);
}); });
console.info('afterEach case');
})
afterAll(async function () { afterEach(async function () {
console.info('afterAll case'); console.info("afterEach case");
}) });
afterAll(async function () {
console.info("afterAll case");
});
async function createPixMapCbErr(done, testNum, arg) { async function createPixMapCbErr(done, testNum, arg) {
await getFd('test_large.webp'); await getFd("test_large.webp");
const imageSourceApi = image.createImageSource(fdNumber); let imageSourceApi = image.createImageSource(filePath);
if (imageSourceApi == undefined) { if (imageSourceApi == undefined) {
console.info(`${testNum} create image source failed`); console.info(`${testNum} create image source failed`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
imageSourceApi.createPixelMap(arg, (err, pixelmap) => { imageSourceApi.createPixelMap(arg, (err, pixelmap) => {
if (pixelmap == undefined) { if (pixelmap == undefined) {
expect(true).assertTrue(); expect(true).assertTrue();
console.info(`${testNum} success `); console.info(`${testNum} success `);
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}) });
}
} }
}
async function createPixMapCb(done, testNum, arg) {
async function createPixMapCb(done, testNum, arg) { await getFd("test_large.webp");
await getFd('test_large.webp'); let imageSourceApi = image.createImageSource(filePath);
const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) {
if (imageSourceApi == undefined) { console.info(`${testNum} create image source failed`);
console.info(`${testNum} create image source failed`); expect(false).assertTrue();
expect(false).assertTrue(); done();
done(); } else {
} else { imageSourceApi.createPixelMap(arg, (err, pixelmap) => {
imageSourceApi.createPixelMap(arg, (err, pixelmap) => { if (err) {
if (err) { console.info(`${testNum} - fail ${err}`);
console.info(`${testNum} - fail `); expect(false).assertTrue();
expect(false).assertTrue();
done();
} else {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info(`${testNum} - success `);
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done(); done();
}).catch((err) => { } else {
console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); pixelmap
}) .getImageInfo()
} .then((imageInfo) => {
}) expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info(`${testNum} - success `);
console.info(
"imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width
);
done();
})
.catch((err) => {
console.info(`${testNum} getimageInfo err ` + JSON.stringify(err));
});
}
});
}
} }
} async function createPixMapPromiseErr(done, testNum, arg) {
async function createPixMapPromiseErr(done, testNum, arg) { await getFd("test_large.webp");
await getFd('test_large.webp'); let imageSourceApi = image.createImageSource(filePath);
const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) {
if (imageSourceApi == undefined) { console.info(`${testNum} create image source failed`);
console.info(`${testNum} create image source failed`); expect(false).assertTrue();
expect(false).assertTrue();
done();
} else {
imageSourceApi.createPixelMap(arg).then(pixelmap => {
console.log(`${testNum} failed`);
expect().assertFail();
done();
}).catch(error => {
console.log(`${testNum} success `);
expect(true).assertTrue();
done(); done();
}) } else {
imageSourceApi
.createPixelMap(arg)
.then((pixelmap) => {
console.log(`${testNum} failed`);
expect().assertFail();
done();
})
.catch((error) => {
console.log(`${testNum} success `);
expect(true).assertTrue();
done();
});
}
} }
} async function createPixMapPromise(done, testNum, arg) {
async function createPixMapPromise(done, testNum, arg) { await getFd("test_large.webp");
await getFd('test_large.webp'); let imageSourceApi = image.createImageSource(filePath);
const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) {
if (imageSourceApi == undefined) { console.info(`${testNum} create image source failed`);
console.info(`${testNum} create image source failed`); expect(false).assertTrue();
expect(false).assertTrue();
done();
} else {
imageSourceApi.createPixelMap(arg).then(pixelmap => {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info(`${testNum} - success `);
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done();
}).catch((err) => {
console.info(`${testNum} getimageInfo err ` + JSON.stringify(err));
})
}).catch(error => {
console.log(`${testNum} fail `);
expect(flase).assertTrue();
done(); done();
}) } else {
} imageSourceApi
} .createPixelMap(arg)
async function packingPromise(done, testNum, arg) { .then((pixelmap) => {
console.info(`${testNum} enter`); pixelmap
var height = 4 .getImageInfo()
var width = 6 .then((imageInfo) => {
var pixelSize = 4 expect(imageInfo.size.height == 2).assertTrue();
var widthSize = width * pixelSize expect(imageInfo.size.width == 1).assertTrue();
var bufferSize = height * widthSize console.info(`${testNum} - success `);
const color = new ArrayBuffer(bufferSize); console.info(
var colorArr = new Uint8Array(color); "imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width
for (var h = 0; h < height / 2; h++) { );
for (var w = 0; w < width / 2; w++) { done();
var pos = widthSize * h + pixelSize * w })
colorArr[pos + 0] = 255; // r .catch((err) => {
colorArr[pos + 1] = 0; console.info(`${testNum} getimageInfo err ` + JSON.stringify(err));
colorArr[pos + 2] = 0; });
colorArr[pos + 3] = 255; })
.catch((error) => {
console.log(`${testNum} fail `);
expect(flase).assertTrue();
done();
});
} }
} }
for (var h = 0; h < height / 2; h++) { async function packingPromise(done, testNum, arg) {
for (var w = width / 2; w < width; w++) { console.info(`${testNum} enter`);
var pos = widthSize * h + pixelSize * w var height = 4;
colorArr[pos + 0] = 0; var width = 6;
colorArr[pos + 1] = 255; // g var pixelSize = 4;
colorArr[pos + 2] = 0; var widthSize = width * pixelSize;
colorArr[pos + 3] = 255; var bufferSize = height * widthSize;
const color = new ArrayBuffer(bufferSize);
var colorArr = new Uint8Array(color);
for (var h = 0; h < height / 2; h++) {
for (var w = 0; w < width / 2; w++) {
var pos = widthSize * h + pixelSize * w;
colorArr[pos + 0] = 255; // r
colorArr[pos + 1] = 0;
colorArr[pos + 2] = 0;
colorArr[pos + 3] = 255;
}
} }
} for (var h = 0; h < height / 2; h++) {
for (var h = height / 2; h < height; h++) { for (var w = width / 2; w < width; w++) {
for (var w = 0; w < width / 2; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 255; // g
colorArr[pos + 1] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 2] = 255; // b colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = 0; w < width / 2; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 255; // b
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
}
for (var h = height / 2; h < height; h++) {
for (var w = width / 2; w < width; w++) {
var pos = widthSize * h + pixelSize * w;
colorArr[pos + 0] = 0;
colorArr[pos + 1] = 0;
colorArr[pos + 2] = 0;
colorArr[pos + 3] = 255;
}
} }
}
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } };
image.createPixelMap(color, opts) image.createPixelMap(color, opts).then((pixelmap) => {
.then(pixelmap => {
if (pixelmap == undefined) { if (pixelmap == undefined) {
console.info('${testNum} create pixelmap failed'); console.info("${testNum} create pixelmap failed");
expect(false).assertTrue() expect(false).assertTrue();
done(); done();
} else { } else {
const imagePackerApi = image.createImagePacker(); const imagePackerApi = image.createImagePacker();
...@@ -212,8 +212,9 @@ describe('imageWebp', function () { ...@@ -212,8 +212,9 @@ describe('imageWebp', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
imagePackerApi.packing(pixelmap, arg) imagePackerApi
.then(data => { .packing(pixelmap, arg)
.then((data) => {
console.info(`${testNum} success`); console.info(`${testNum} success`);
expect(data != undefined).assertTrue(); expect(data != undefined).assertTrue();
var dataArr = new Uint8Array(data); var dataArr = new Uint8Array(data);
...@@ -222,149 +223,151 @@ describe('imageWebp', function () { ...@@ -222,149 +223,151 @@ describe('imageWebp', function () {
console.info(`dataArr[` + i + `]=` + dataArr[i]); console.info(`dataArr[` + i + `]=` + dataArr[i]);
} }
done(); done();
}).catch(error => { })
.catch((error) => {
console.log(`${testNum} error: ` + error); console.log(`${testNum} error: ` + error);
expect(false).assertFail(); expect(false).assertFail();
done(); done();
}) });
} }
} }
}) });
console.info(`${testNum} leave`); console.info(`${testNum} leave`);
} }
async function packingCb(done, testNum, arg) { async function packingCb(done, testNum, arg) {
console.info(`${testNum} enter`); console.info(`${testNum} enter`);
var height = 4 var height = 4;
var width = 6 var width = 6;
var pixelSize = 4 var pixelSize = 4;
var widthSize = width * pixelSize var widthSize = width * pixelSize;
var bufferSize = height * widthSize var bufferSize = height * widthSize;
const color = new ArrayBuffer(bufferSize); const color = new ArrayBuffer(bufferSize);
var colorArr = new Uint8Array(color); var colorArr = new Uint8Array(color);
for (var h = 0; h < height / 2; h++) { for (var h = 0; h < height / 2; h++) {
for (var w = 0; w < width / 2; w++) { for (var w = 0; w < width / 2; w++) {
var pos = widthSize * h + pixelSize * w var pos = widthSize * h + pixelSize * w;
colorArr[pos + 0] = 255; // r colorArr[pos + 0] = 255; // r
colorArr[pos + 1] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 3] = 255; colorArr[pos + 3] = 255;
}
} }
} for (var h = 0; h < height / 2; h++) {
for (var h = 0; h < height / 2; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 255; // g
colorArr[pos + 1] = 255; // g colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = 0; w < width / 2; w++) {
for (var w = 0; w < width / 2; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 255; // b
colorArr[pos + 2] = 255; // b colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
}
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } };
image.createPixelMap(color, opts) image
.then(pixelmap => { .createPixelMap(color, opts)
if (pixelmap == undefined) { .then((pixelmap) => {
console.info('${testNum} create pixelmap failed'); if (pixelmap == undefined) {
expect(false).assertTrue() console.info("${testNum} create pixelmap failed");
done();
} else {
const imagePackerApi = image.createImagePacker();
if (imagePackerApi == undefined) {
console.info(`${testNum} create image packer failed`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
imagePackerApi.packing(pixelmap, arg, (err, data) => { const imagePackerApi = image.createImagePacker();
console.info(`${testNum} success`); if (imagePackerApi == undefined) {
expect(data != undefined).assertTrue(); console.info(`${testNum} create image packer failed`);
var dataArr = new Uint8Array(data); expect(false).assertTrue();
console.info(`${testNum} dataArr.length=` + dataArr.length);
for (var i = 0; i < dataArr.length; i++) {
console.info(`dataArr[` + i + `]=` + dataArr[i]);
}
done(); done();
}) } else {
imagePackerApi.packing(pixelmap, arg, (err, data) => {
console.info(`${testNum} success`);
expect(data != undefined).assertTrue();
var dataArr = new Uint8Array(data);
console.info(`${testNum} dataArr.length=` + dataArr.length);
for (var i = 0; i < dataArr.length; i++) {
console.info(`dataArr[` + i + `]=` + dataArr[i]);
}
done();
});
}
} }
} })
}).catch(error => { .catch((error) => {
console.log(`${testNum} error: ` + error); console.log(`${testNum} error: ` + error);
expect(false).assertFail(); expect(false).assertFail();
done(); done();
}) });
console.info(`${testNum} leave`); console.info(`${testNum} leave`);
} }
async function packingPromiseErr(done, testNum, arg) { async function packingPromiseErr(done, testNum, arg) {
console.info(`${testNum} enter`); console.info(`${testNum} enter`);
var height = 4 var height = 4;
var width = 6 var width = 6;
var pixelSize = 4 var pixelSize = 4;
var widthSize = width * pixelSize var widthSize = width * pixelSize;
var bufferSize = height * widthSize var bufferSize = height * widthSize;
const color = new ArrayBuffer(bufferSize); const color = new ArrayBuffer(bufferSize);
var colorArr = new Uint8Array(color); var colorArr = new Uint8Array(color);
for (var h = 0; h < height / 2; h++) { for (var h = 0; h < height / 2; h++) {
for (var w = 0; w < width / 2; w++) { for (var w = 0; w < width / 2; w++) {
var pos = widthSize * h + pixelSize * w var pos = widthSize * h + pixelSize * w;
colorArr[pos + 0] = 255; // r colorArr[pos + 0] = 255; // r
colorArr[pos + 1] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 3] = 255; colorArr[pos + 3] = 255;
}
} }
} for (var h = 0; h < height / 2; h++) {
for (var h = 0; h < height / 2; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 255; // g
colorArr[pos + 1] = 255; // g colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = 0; w < width / 2; w++) {
for (var w = 0; w < width / 2; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 255; // b
colorArr[pos + 2] = 255; // b colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
}
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } };
image.createPixelMap(color, opts) image.createPixelMap(color, opts).then((pixelmap) => {
.then(pixelmap => {
if (pixelmap == undefined) { if (pixelmap == undefined) {
console.info('${testNum} create pixelmap failed'); console.info("${testNum} create pixelmap failed");
expect(false).assertTrue() expect(false).assertTrue();
done(); done();
} else { } else {
const imagePackerApi = image.createImagePacker(); const imagePackerApi = image.createImagePacker();
...@@ -373,759 +376,761 @@ describe('imageWebp', function () { ...@@ -373,759 +376,761 @@ describe('imageWebp', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
imagePackerApi.packing(pixelmap, arg) imagePackerApi
.then(data => { .packing(pixelmap, arg)
.then((data) => {
expect(data == undefined).assertTrue(); expect(data == undefined).assertTrue();
done(); done();
}).catch(error => { })
.catch((error) => {
console.log(`${testNum} error: ` + error); console.log(`${testNum} error: ` + error);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}) });
} }
} }
}) });
console.info(`${testNum} leave`); console.info(`${testNum} leave`);
} }
async function packingCbErr(done, testNum, arg) { async function packingCbErr(done, testNum, arg) {
console.info(`${testNum} enter`); console.info(`${testNum} enter`);
var height = 4 var height = 4;
var width = 6 var width = 6;
var pixelSize = 4 var pixelSize = 4;
var widthSize = width * pixelSize var widthSize = width * pixelSize;
var bufferSize = height * widthSize var bufferSize = height * widthSize;
const color = new ArrayBuffer(bufferSize); const color = new ArrayBuffer(bufferSize);
var colorArr = new Uint8Array(color); var colorArr = new Uint8Array(color);
for (var h = 0; h < height / 2; h++) { for (var h = 0; h < height / 2; h++) {
for (var w = 0; w < width / 2; w++) { for (var w = 0; w < width / 2; w++) {
var pos = widthSize * h + pixelSize * w var pos = widthSize * h + pixelSize * w;
colorArr[pos + 0] = 255; // r colorArr[pos + 0] = 255; // r
colorArr[pos + 1] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 3] = 255; colorArr[pos + 3] = 255;
}
} }
} for (var h = 0; h < height / 2; h++) {
for (var h = 0; h < height / 2; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 255; // g
colorArr[pos + 1] = 255; // g colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = 0; w < width / 2; w++) {
for (var w = 0; w < width / 2; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 255; // b
colorArr[pos + 2] = 255; // b colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
} for (var h = height / 2; h < height; h++) {
for (var h = height / 2; h < height; h++) { for (var w = width / 2; w < width; w++) {
for (var w = width / 2; w < width; w++) { var pos = widthSize * h + pixelSize * w;
var pos = widthSize * h + pixelSize * w colorArr[pos + 0] = 0;
colorArr[pos + 0] = 0; colorArr[pos + 1] = 0;
colorArr[pos + 1] = 0; colorArr[pos + 2] = 0;
colorArr[pos + 2] = 0; colorArr[pos + 3] = 255;
colorArr[pos + 3] = 255; }
} }
}
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } };
image.createPixelMap(color, opts) image
.then(pixelmap => { .createPixelMap(color, opts)
if (pixelmap == undefined) { .then((pixelmap) => {
console.info('${testNum} create pixelmap failed'); if (pixelmap == undefined) {
expect(false).assertTrue() console.info("${testNum} create pixelmap failed");
done();
} else {
const imagePackerApi = image.createImagePacker();
if (imagePackerApi == undefined) {
console.info(`${testNum} create image packer failed`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
imagePackerApi.packing(pixelmap, arg, (err, data) => { const imagePackerApi = image.createImagePacker();
console.info(`${testNum} success`); if (imagePackerApi == undefined) {
expect(data == undefined).assertTrue(); console.info(`${testNum} create image packer failed`);
expect(false).assertTrue();
done(); done();
}) } else {
} imagePackerApi.packing(pixelmap, arg, (err, data) => {
} console.info(`${testNum} success`);
}).catch(error => { expect(data == undefined).assertTrue();
console.log(`${testNum} error: ` + error); done();
expect(true).assertTrue(); });
done(); }
})
console.info(`${testNum} leave`);
}
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100
* @tc.name : createPixelMap - promise-webp
* @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions
* 3.create PixelMap
* 4.return pixelmap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100', 0, async function (done) {
try {
await getFd('test_large.webp');
const imageSourceApi = image.createImageSource(fdNumber);
if (imageSourceApi == undefined) {
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 create image source failed');
expect(false).assertTrue();
done();
} else {
let decodingOptions = {
sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0
};
imageSourceApi.createPixelMap(decodingOptions).then(pixelmap => {
if (pixelmap != undefined) {
expect(true).assertTrue();
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 success ');
done();
} else {
expect(false).assertTrue();
done();
} }
}) })
} .catch((error) => {
} catch (error) { console.log(`${testNum} error: ` + error);
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 error: ' + error); expect(true).assertTrue();
expect(false).assertTrue(); done();
done(); });
console.info(`${testNum} leave`);
} }
}) /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100
* @tc.name : createPixelMap - promise-webp
* @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions
* 3.create PixelMap
* 4.return pixelmap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100", 0, async function (done) {
try {
await getFd("test_large.webp");
let imageSourceApi = image.createImageSource(filePath);
if (imageSourceApi == undefined) {
console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 create image source failed");
expect(false).assertTrue();
done();
} else {
let decodingOptions = {
sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0,
};
/** imageSourceApi.createPixelMap(decodingOptions).then((pixelmap) => {
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 if (pixelmap != undefined) {
* @tc.name : createPixelMap - callback-webp expect(true).assertTrue();
* @tc.desc : 1.create imagesource console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 success ");
* 2.set index and DecodeOptions done();
* 3.create PixelMap } else {
* 4.return pixelmap expect(false).assertTrue();
* @tc.size : MEDIUM done();
* @tc.type : Functional }
* @tc.level : Level 1 });
*/ }
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100', 0, async function (done) { } catch (error) {
try { console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 error: " + error);
await getFd('test_large.webp');
const imageSourceApi = image.createImageSource(fdNumber);
if (imageSourceApi == undefined) {
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 create image source failed');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else {
let decodingOptions = {
sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0
};
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
if (pixelmap != undefined) {
expect(true).assertTrue();
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 success ');
done();
} else {
expect(false).assertTrue();
done();
}
})
} }
} catch (error) { });
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 error: ' + error);
expect(false).assertTrue();
done();
}
}) /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100
* @tc.name : createPixelMap - callback-webp
* @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions
* 3.create PixelMap
* 4.return pixelmap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100", 0, async function (done) {
try {
await getFd("test_large.webp");
let imageSourceApi = image.createImageSource(filePath);
if (imageSourceApi == undefined) {
console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 create image source failed");
expect(false).assertTrue();
done();
} else {
let decodingOptions = {
sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0,
};
/** imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 if (pixelmap != undefined) {
* @tc.name : createPixelMap-promise-webp expect(true).assertTrue();
* @tc.desc : 1.create imagesource console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 success ");
* 2.set index and DecodeOptions done();
* 3.create PixelMap } else {
* 4.return pixelmap expect(false).assertTrue();
* @tc.size : MEDIUM done();
* @tc.type : Functional }
* @tc.level : Level 1 });
*/ }
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200', 0, async function (done) { } catch (error) {
try { console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 error: " + error);
await getFd('test_large.webp');
const imageSourceApi = image.createImageSource(fdNumber);
if (imageSourceApi == undefined) {
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 create image source failed');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else {
imageSourceApi.createPixelMap().then(pixelmap => {
expect(pixelmap != undefined).assertTrue();
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 success ');
done();
}).catch(error => {
console.log('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 error: ' + error);
expect().assertFail();
done();
})
} }
} catch (error) { });
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 err ' + error);
}
})
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200
* @tc.name : createPixelMap-callback-webp * @tc.name : createPixelMap-promise-webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap * 4.return pixelmap
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200", 0, async function (done) {
try { try {
await getFd('test_large.webp'); await getFd("test_large.webp");
const imageSourceApi = image.createImageSource(fdNumber); let imageSourceApi = image.createImageSource(filePath);
if (imageSourceApi == undefined) { if (imageSourceApi == undefined) {
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 create image source failed'); console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 create image source failed");
expect(false).assertTrue(); expect(false).assertTrue();
done();
} else {
imageSourceApi.createPixelMap((err, pixelmap) => {
expect(pixelmap != undefined).assertTrue();
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 success ');
done(); done();
}) } else {
imageSourceApi
.createPixelMap()
.then((pixelmap) => {
expect(pixelmap != undefined).assertTrue();
console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 success ");
done();
})
.catch((error) => {
console.log("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 error: " + error);
expect().assertFail();
done();
});
}
} catch (error) {
console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 err " + error);
} }
} catch (error) { });
console.info('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 err ' + error);
}
})
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
* @tc.name : createPixelMap-callback -{sampleSize: -1} -webp
* @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions
* 3.create PixelMap
* 4.return pixelmap undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300', 0, async function (done) {
let decodingOptions = {
sampleSize: -1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0
};
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300', decodingOptions)
})
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200
* @tc.name : createPixelMap-callback -{index: -1} -webp * @tc.name : createPixelMap-callback-webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200", 0, async function (done) {
let decodingOptions = { try {
sampleSize: 1, await getFd("test_large.webp");
editable: true, let imageSourceApi = image.createImageSource(filePath);
desiredSize: { width: 1, height: 2 }, if (imageSourceApi == undefined) {
rotate: 10, console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 create image source failed");
desiredPixelFormat: 0, expect(false).assertTrue();
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, done();
index: -1 } else {
}; imageSourceApi.createPixelMap((err, pixelmap) => {
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400', decodingOptions) expect(pixelmap != undefined).assertTrue();
}) console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 success ");
done();
});
}
} catch (error) {
console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 err " + error);
}
});
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
* @tc.name : createPixelMap-callback -{rotate: 500} -webp * @tc.name : createPixelMap-callback -{sampleSize: -1} -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: -1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 500, rotate: 10,
desiredPixelFormat: 3, desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
* @tc.name : createPixelMap-callback -{rotate: -10} -webp * @tc.name : createPixelMap-callback -{index: -1} -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: -10, rotate: 10,
desiredPixelFormat: 3, desiredPixelFormat: 0,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: -1,
}; };
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
* @tc.name : createPixelMap-callback editable: false -webp * @tc.name : createPixelMap-callback -{rotate: 500} -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: false, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 500,
desiredPixelFormat: 33, desiredPixelFormat: 3,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
* @tc.name : createPixelMap-callback -{ size: { height: 1, width: 2 }, x: -1, y: -1 }-webp * @tc.name : createPixelMap-callback -{rotate: -10} -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: -10,
desiredPixelFormat: 2, desiredPixelFormat: 3,
desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
* @tc.name : createPixelMap-callback -size: { height: 10000, width: 10000 } -webp * @tc.name : createPixelMap-callback editable: false -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: true, editable: false,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 10,
desiredPixelFormat: 3, desiredPixelFormat: 33,
desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapCb(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
* @tc.name : createPixelMap-callback - sampleSize: -1 -webp * @tc.name : createPixelMap-callback -{ size: { height: 1, width: 2 }, x: -1, y: -1 }-webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: -1, sampleSize: 1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 10,
desiredPixelFormat: 2, desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 },
index: 0 index: 0,
}; };
createPixMapPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000', decodingOptions) createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
* @tc.name : createPixelMap-callback - index: -1 -webp * @tc.name : createPixelMap-callback -size: { height: 10000, width: 10000 } -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 10,
desiredPixelFormat: 2, desiredPixelFormat: 3,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 },
index: -1 index: 0,
}; };
createPixMapPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100', decodingOptions) createPixMapCb(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
* @tc.name : createPixelMap-callback - desiredPixelFormat: 1 -webp * @tc.name : createPixelMap-callback - sampleSize: -1 -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 2, sampleSize: -1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 500, rotate: 10,
desiredPixelFormat: 1, desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200', decodingOptions) createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000", decodingOptions);
}) });
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
* @tc.name : createPixelMap-callback - index: -1 -webp
* @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions
* 3.create PixelMap
* 4.return pixelmap undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100", 0, async function (done) {
let decodingOptions = {
sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: -1,
};
createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100", decodingOptions);
});
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
* @tc.name : createPixelMap-callback - { size: { height: 1, width: 2 }, x: -1, y: -1 } -webp * @tc.name : createPixelMap-callback - desiredPixelFormat: 1 -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 2,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 500,
desiredPixelFormat: 3, desiredPixelFormat: 1,
desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
index: 0 index: 0,
}; };
createPixMapPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300', decodingOptions) createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
* @tc.name : createPixelMap-callback - size: { height: 10000, width:10000 } -webp * @tc.name : createPixelMap-callback - { size: { height: 1, width: 2 }, x: -1, y: -1 } -webp
* @tc.desc : 1.create imagesource * @tc.desc : 1.create imagesource
* 2.set index and DecodeOptions * 2.set index and DecodeOptions
* 3.create PixelMap * 3.create PixelMap
* 4.return pixelmap undefined * 4.return pixelmap undefined
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300", 0, async function (done) {
let decodingOptions = { let decodingOptions = {
sampleSize: 1, sampleSize: 1,
editable: true, editable: true,
desiredSize: { width: 1, height: 2 }, desiredSize: { width: 1, height: 2 },
rotate: 10, rotate: 10,
desiredPixelFormat: 2, desiredPixelFormat: 3,
desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 },
index: 0 index: 0,
}; };
createPixMapPromise(done, 'SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400', decodingOptions) createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300", decodingOptions);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
* @tc.name : packing - callback-webp * @tc.name : createPixelMap-callback - size: { height: 10000, width:10000 } -webp
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create imagesource
* 2.call packing * 2.set index and DecodeOptions
* 3.return array * 3.create PixelMap
* @tc.size : MEDIUM * 4.return pixelmap undefined
* @tc.type : Functional * @tc.size : MEDIUM
* @tc.level : Level 1 * @tc.type : Functional
*/ * @tc.level : Level 1
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100', 0, async function (done) { */
let packOpts = { format: ["image/webp"], quality: 90 } it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400", 0, async function (done) {
packingCb(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100', packOpts) let decodingOptions = {
}) sampleSize: 1,
editable: true,
desiredSize: { width: 1, height: 2 },
rotate: 10,
desiredPixelFormat: 2,
desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 },
index: 0,
};
createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400", decodingOptions);
});
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
* @tc.name : packing - promise-webp * @tc.name : packing - callback-webp
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100", 0, async function (done) {
let packOpts = { format: ["image/webp"], quality: 100 } let packOpts = { format: ["image/webp"], quality: 90 };
packingPromise(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100', packOpts) packingCb(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
* @tc.name : packing - promise-webp-wrong quality * @tc.name : packing - promise-webp
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100", 0, async function (done) {
let packOpts = { format: ["image/webp"], quality: 123 } let packOpts = { format: ["image/webp"], quality: 100 };
packingPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100', packOpts) packingPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
* @tc.name : packing - promise-webp * @tc.name : packing - promise-webp-wrong quality
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100", 0, async function (done) {
let packOpts = { format: ["image/gif"], quality: 90 } let packOpts = { format: ["image/webp"], quality: 123 };
packingPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200', packOpts) packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
* @tc.name : packing - promise-webp-no format * @tc.name : packing - promise-webp
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200", 0, async function (done) {
let packOpts = { quality: 90 } let packOpts = { format: ["image/gif"], quality: 90 };
packingPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300', packOpts) packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
* @tc.name : packing - promise-webp-no format * @tc.name : packing - promise-webp-no format
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300", 0, async function (done) {
let packOpts = { format: ["image/jpeg"] } let packOpts = { quality: 90 };
packingPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400', packOpts) packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
* @tc.name : packing - callback-webp-wrong format * @tc.name : packing - promise-webp-no format
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400", 0, async function (done) {
let packOpts = { format: ["image/gif"], quality: 100 } let packOpts = { format: ["image/jpeg"] };
packingCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100', packOpts) packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
* @tc.name : packing - callback-webp-wrong quality * @tc.name : packing - callback-webp-wrong format
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: 112 } let packOpts = { format: ["image/gif"], quality: 100 };
packingCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200', packOpts) packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
* @tc.name : packing - callback-webp-no quality * @tc.name : packing - callback-webp-wrong quality
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200", 0, async function (done) {
let packOpts = { format: ["image/jpeg"] } let packOpts = { format: ["image/jpeg"], quality: 112 };
packingCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300', packOpts) packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
* @tc.name : packing - callback-webp-no format * @tc.name : packing - callback-webp-no quality
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300", 0, async function (done) {
let packOpts = { quality: 90 } let packOpts = { format: ["image/jpeg"] };
packingCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400', packOpts) packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
* @tc.name : packing - callback-webp-quality -1 * @tc.name : packing - callback-webp-no format
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: -1 } let packOpts = { quality: 90 };
packingCbErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500', packOpts) packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
* @tc.name : packing - promise-webp-quality -1 * @tc.name : packing - callback-webp-quality -1
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: -1 } let packOpts = { format: ["image/jpeg"], quality: -1 };
packingPromiseErr(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500', packOpts) packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500", packOpts);
}) });
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
* @tc.name : packing - promise-webp-quality -1
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: -1 };
packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500", packOpts);
});
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
* @tc.name : packing - callback-webp-quality 0 * @tc.name : packing - callback-webp-quality 0
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: 0 } let packOpts = { format: ["image/jpeg"], quality: 0 };
packingCb(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200', packOpts) packingCb(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200", packOpts);
}) });
/** /**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200 * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
* @tc.name : packing - promise-webp-quality 0 * @tc.name : packing - promise-webp-quality 0
* @tc.desc : 1.create ImageSource * @tc.desc : 1.create ImageSource
* 2.call packing * 2.call packing
* 3.return array * 3.return array
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Functional * @tc.type : Functional
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it('SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200', 0, async function (done) { it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200", 0, async function (done) {
let packOpts = { format: ["image/jpeg"], quality: 0 } let packOpts = { format: ["image/jpeg"], quality: 0 };
packingPromise(done, 'SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200', packOpts) packingPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200", packOpts);
}) });
})} });
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册