diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js old mode 100644 new mode 100755 index 7c58349630dbc7b6262cfdbf5629ac4a02b71003..1bce2c6eec9ec1bc2fd230ae666bf451fcc937a6 --- a/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -93,7 +93,7 @@ describe('AddImage', function () { /** * @tc.number : add_01_003 - * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 2, alphaType: 2) + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 2) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size * 3.using color and opts create newPixelMap @@ -103,13 +103,13 @@ describe('AddImage', function () { * @tc.level : Level 0 */ it('add_01_003', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 2, alphaType: 2 } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 2 } createPixMapPromise(done, 'add_01_003', opts); }) /** * @tc.number : add_01_004 - * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 2, alphaType: 3) + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 3) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size * 3.using color and opts create newPixelMap @@ -119,13 +119,13 @@ describe('AddImage', function () { * @tc.level : Level 0 */ it('add_01_004', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 2, alphaType: 3 } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 3 } createPixMapPromise(done, 'add_01_004', opts); }) /** * @tc.number : add_02_001 - * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 2, alphaType: 0) + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 0) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size * 3.using color and opts create newPixelMap @@ -135,13 +135,13 @@ describe('AddImage', function () { * @tc.level : Level 0 */ it('add_02_001', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 2, alphaType: 0 } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 0 } createPixMapCb(done, 'add_02_001', opts); }) /** * @tc.number : add_02_002 - * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 2, alphaType: 1) + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 1) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size * 3.using color and opts create newPixelMap @@ -151,7 +151,7 @@ describe('AddImage', function () { * @tc.level : Level 0 */ it('add_02_002', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 2, alphaType: 1 } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 1 } createPixMapCb(done, 'add_02_002', opts); }) diff --git a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js old mode 100644 new mode 100755 index bf4fd5dcfb1d26b21c110cc3b3a13a2003b7ea71..3253ac1474a0cec54276f5af9c2e3bea18f7a827 --- a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js +++ b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,10 +14,11 @@ */ import image from '@ohos.multimedia.image' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { base64Image, scale2x1, translate3x1, rotate90, flipH, testBmp, testGif, crop3x3, scale1x4, setAlpha8, translate1x3 } from './testImg2' import { testPng, testJpg} from '../../../../../image/src/main/js/test/testImg' -describe('Image', function () { +export default function Image_test() { +describe('Image_test', function () { beforeAll(async function () { console.info('beforeAll case'); }) @@ -33,7 +34,7 @@ describe('Image', function () { afterAll(async function () { console.info('afterAll case'); }) - + const ERROT_CODE = 62980115; function genPicSource() { var data = testPng.buffer; return image.createImageSource(data); @@ -173,6 +174,7 @@ describe('Image', function () { done(); } } + async function getDensityTest(done, testNum, imageData, decodingOptions) { let logger = loger(testNum) try { @@ -238,6 +240,142 @@ describe('Image', function () { } } + async function pixelMapModifySizeTestErr(done, testNum, type, pixelMapInterface, ...params) { + let logger = loger(testNum) + try { + var pixelMap = await genPixelMap(); + logger.log("pixelMap " + (pixelMap != undefined)); + if (pixelMap != undefined) { + if (type == 'callback') { + pixelMap[pixelMapInterface](...params, async (error) => { + expect(error == ERROT_CODE); + done(); + }) + } else { + try { + await pixelMap[pixelMapInterface](...params); + expect(false).assertTrue(); + done(); + } catch (error) { + expect(error == ERROT_CODE); + done(); + } + } + } else { + logger.log('create pixelMap fail '); + expect(false).assertTrue(); + done(); + } + } catch (error) { + logger.log('failed ' + error); + expect(false).assertTrue(); + done(); + } + } + + async function opacityErr(done, testNum, param, type) { + let logger = loger(testNum) + try { + var pixelMap = await genPixelMap() + logger.log("pixelMap " + (pixelMap != undefined)); + if (pixelMap != undefined) { + if (type == 'callback') { + pixelMap.opacity(param, (err) => { + expect(err == ERROT_CODE).assertTrue(); + done(); + }) + } else { + try { + await pixelMap.opacity(param) + expect(false).assertTrue(); + done(); + } catch (error) { + expect(error == ERROT_CODE).assertTrue(); + done(); + } + } + } else { + logger.log('creat pixelMap failed '); + expect(false).assertTrue(); + done(); + } + } catch (error) { + logger.log('failed ' + error); + expect(false).assertTrue(); + done(); + } + } + + async function setAlphaAbleErr(done, testNum, param) { + let logger = loger(testNum) + try { + let imageSource = genPicSource(); + logger.log("ImageSource " + (imageSource != undefined)); + if (imageSource != undefined) { + let pixelMap = await imageSource.createPixelMap(); + logger.log("PixelMap " + pixelMap); + if (pixelMap != undefined) { + try { + pixelMap.setAlphaAble(param); + expect(false).assertTrue(); + done(); + } catch (error) { + expect(error == ERROT_CODE); + done(); + } + } else { + logger.log('create pixelmap failed '); + expect(false).assertTrue(); + done(); + } + } else { + logger.log('create imagesource failed '); + expect(false).assertTrue(); + done(); + } + } catch (error) { + logger.log('failed ' + error); + expect(false).assertTrue(); + done(); + } + } + + async function setDensityErr(done, testNum, imageData, param) { + let logger = loger(testNum) + try { + var sourceOptions = { sourceDensity: 120 }; + let imageSource = image.createImageSource(imageData, sourceOptions); + logger.log("ImageSource " + (imageSource != undefined)); + if (imageSource != undefined) { + let pixelMap = await imageSource.createPixelMap(); + logger.log("PixelMap " + pixelMap); + if (pixelMap != undefined) { + try { + pixelMap.setDensity(param); + expect(false).assertTrue(); + done(); + } catch (error) { + expect(true).assertTrue(); + logger.log('err message: ' + error); + done(); + } + } else { + logger.log('creat pixelMap failed '); + expect(false).assertTrue(); + done(); + } + } else { + logger.log('creat imageSource failed '); + expect(false).assertTrue(); + done(); + } + } catch (error) { + logger.log('failed ' + error); + expect(false).assertTrue(); + done(); + } + } + async function dumpPixelmap(logger, pixelmap) { var imageInfo = await pixelmap.getImageInfo(); var pixelSize = pixelmap.getPixelBytesNumber(); @@ -254,7 +392,7 @@ describe('Image', function () { * : 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_001', 0, async function (done) { let logger = loger('frmwk_001') @@ -283,7 +421,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_002', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -305,7 +443,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_003', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -327,7 +465,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_004', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -349,7 +487,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_005', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -371,7 +509,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_006', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -393,7 +531,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_007', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -415,7 +553,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_008', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -437,7 +575,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_009', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -459,7 +597,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_010', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -481,7 +619,7 @@ describe('Image', function () { * : 4.read pixels to buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_011', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { @@ -503,7 +641,7 @@ describe('Image', function () { * : 4.call isSupportAlpha * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_012', 0, async function (done) { let logger = loger('frmwk_012') @@ -521,14 +659,21 @@ describe('Image', function () { logger.log("isSupportAlpha after " + supportAlpha1); expect(supportAlpha1 == false).assertTrue(); done(); + } else { + logger.log('create pixelmap failed '); + expect(false).assertTrue(); + done(); } + } else { + logger.log('create imagesource failed '); + expect(false).assertTrue(); + done(); } } catch (error) { logger.log('failed ' + error); expect(false).assertTrue(); done(); } - done(); }) /** * @tc.number : frmwk_013 @@ -539,7 +684,7 @@ describe('Image', function () { * : 4.call getImageInfo * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_013', 0, async function (done) { var imageData = testPng.buffer; @@ -555,7 +700,7 @@ describe('Image', function () { * : 4.call getImageInfo * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_014', 0, async function (done) { var imageData = testPng.buffer; @@ -571,7 +716,7 @@ describe('Image', function () { * : 4.call getImageInfo * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_015', 0, async function (done) { var imageData = testJpg.buffer; @@ -587,7 +732,7 @@ describe('Image', function () { * : 4.call getImageInfo * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_016', 0, async function (done) { var imageData = testBmp.buffer; @@ -603,7 +748,7 @@ describe('Image', function () { * : 4.call getImageInfo * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_017', 0, async function (done) { var imageData = testGif.buffer; @@ -619,7 +764,7 @@ describe('Image', function () { * : 4.read Pixels To Buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_018', 0, async function (done) { let logger = loger('frmwk_018') @@ -627,7 +772,7 @@ describe('Image', function () { var pixelMap = await genPixelMap() logger.log("pixelMap " + (pixelMap != undefined)); if (pixelMap != undefined) { - await pixelMap.setAlpha(0.8) + await pixelMap.opacity(0.8) var pixelSize = pixelMap.getPixelBytesNumber(); logger.log(`new pixel size ${pixelSize}`); var readBuffer = new ArrayBuffer(pixelSize); @@ -663,7 +808,7 @@ describe('Image', function () { * : 4.read Pixels To Buffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_019', 0, async function (done) { let logger = loger('frmwk_019') @@ -671,7 +816,7 @@ describe('Image', function () { var pixelMap = await genPixelMap() logger.log("pixelMap " + (pixelMap != undefined)); if (pixelMap != undefined) { - pixelMap.setAlpha(0.8, async (err) => { + pixelMap.opacity(0.8, async (err) => { var pixelSize = pixelMap.getPixelBytesNumber(); logger.log(`new pixel size ${pixelSize}`); var readBuffer = new ArrayBuffer(pixelSize); @@ -707,7 +852,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_020', 0, async function (done) { var imageData = testPng.buffer; @@ -722,7 +867,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_021', 0, async function (done) { var imageData = testPng.buffer; @@ -739,7 +884,7 @@ describe('Image', function () { * : 4.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_022', 0, async function (done) { var imageData = testPng.buffer; @@ -754,7 +899,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_023', 0, async function (done) { var imageData = testJpg.buffer; @@ -769,7 +914,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_024', 0, async function (done) { var imageData = testBmp.buffer; @@ -784,7 +929,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_025', 0, async function (done) { var imageData = testGif.buffer; @@ -799,7 +944,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_026', 0, async function (done) { var imageData = testJpg.buffer; @@ -815,7 +960,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_027', 0, async function (done) { var imageData = testBmp.buffer; @@ -831,7 +976,7 @@ describe('Image', function () { * : 3.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_028', 0, async function (done) { var imageData = testGif.buffer; @@ -848,7 +993,7 @@ describe('Image', function () { * : 4.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_029', 0, async function (done) { var imageData = testJpg.buffer; @@ -864,7 +1009,7 @@ describe('Image', function () { * : 4.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_030', 0, async function (done) { var imageData = testBmp.buffer; @@ -880,7 +1025,7 @@ describe('Image', function () { * : 4.getDensity * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_031', 0, async function (done) { var imageData = testGif.buffer; @@ -897,7 +1042,7 @@ describe('Image', function () { * : 5.readPixelsToBuffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_032', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: 1 }; @@ -922,7 +1067,7 @@ describe('Image', function () { * : 5.readPixelsToBuffer * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 0 */ it('frmwk_033', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: 1 }; @@ -937,4 +1082,777 @@ describe('Image', function () { await pixelMapModifySizeTest(done, 'frmwk_033', 'callback', 'crop', sizeCheck, crop3x3, region) }) -}) \ No newline at end of file + /** + * @tc.number : scaleErr_001 + * @tc.name : Pixelmap Scale-promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_001', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_001', 'promise', 'scale', { a: 10 }, 1.0) + }) + + /** + * @tc.number : scaleErr_002 + * @tc.name : Pixelmap Scale-promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_002', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_002', 'promise', 'scale', 'a', 1.0) + }) + + /** + * @tc.number : scaleErr_003 + * @tc.name : Pixelmap Scale-promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_003', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_003', 'promise', 'scale', 1.0, null) + + }) + + /** + * @tc.number : scaleErr_004 + * @tc.name : Pixelmap Scale-promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_004', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_004', 'promise', 'scale', 1.0, true) + + }) + + /** + * @tc.number : scaleErr_005 + * @tc.name : Pixelmap Scale-callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_005', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_005', 'callback', 'scale', { a: 10 }, 1.0) + }) + + /** + * @tc.number : scaleErr_006 + * @tc.name : Pixelmap Scale-callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_006', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_006', 'callback', 'scale', 'a', 1.0) + }) + + /** + * @tc.number : scaleErr_007 + * @tc.name : Pixelmap Scale-callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_007', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_007', 'callback', 'scale', 1.0, null) + }) + + /** + * @tc.number : scaleErr_008 + * @tc.name : Pixelmap Scale-callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call scale + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('scaleErr_008', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'scaleErr_008', 'callback', 'scale', 1.0, true) + }) + + /** + * @tc.number : translateErr_001 + * @tc.name : Pixelmap Translate -promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_001', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_001', 'promise', 'translate', { a: 10 }, 1.0) + }) + + /** + * @tc.number : translateErr_002 + * @tc.name : Pixelmap Translate -promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_002', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_002', 'promise', 'translate', 'a', 1.0) + }) + + /** + * @tc.number : translateErr_003 + * @tc.name : Pixelmap Translate -promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_003', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_003', 'promise', 'translate', 1.0, null) + }) + + /** + * @tc.number : translateErr_004 + * @tc.name : Pixelmap Translate -promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_004', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_004', 'promise', 'translate', 1.0, false) + }) + + /** + * @tc.number : translateErr_005 + * @tc.name : Pixelmap Translate -callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_005', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_005', 'callback', 'translate', { a: 10 }, 1.0) + }) + + /** + * @tc.number : translateErr_006 + * @tc.name : Pixelmap Translate -callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_006', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_006', 'callback', 'translate', 'a', 1.0) + }) + + /** + * @tc.number : translateErr_007 + * @tc.name : Pixelmap Translate -callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_007', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_007', 'callback', 'translate', 1.0, null) + }) + + /** + * @tc.number : translateErr_008 + * @tc.name : Pixelmap Translate -callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call translate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('translateErr_008', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'translateErr_008', 'callback', 'translate', 1.0, false) + }) + + /** + * @tc.number : rotateErr_001 + * @tc.name : Pixelmap Rotate-promise-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_001', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_001', 'promise', 'rotate', 'a') + }) + + /** + * @tc.number : rotateErr_002 + * @tc.name : Pixelmap Rotate-promise-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_002', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_002', 'promise', 'rotate', { a: 10 }) + }) + + /** + * @tc.number : rotateErr_003 + * @tc.name : Pixelmap Rotate-promise-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_003', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_003', 'promise', 'rotate', null) + }) + + /** + * @tc.number : rotateErr_004 + * @tc.name : Pixelmap Rotate-promise-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_004', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_004', 'promise', 'rotate', false) + }) + + /** + * @tc.number : rotateErr_005 + * @tc.name : Pixelmap Rotate-callback-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_005', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_005', 'callback', 'rotate', 'a') + }) + + /** + * @tc.number : rotateErr_006 + * @tc.name : Pixelmap Rotate-callback-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_006', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_006', 'callback', 'rotate', { a: 10 }) + }) + + /** + * @tc.number : rotateErr_007 + * @tc.name : Pixelmap Rotate-callback-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_007', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_007', 'callback', 'rotate', null) + }) + + /** + * @tc.number : rotateErr_008 + * @tc.name : Pixelmap Rotate-callback-wrong angle + * @tc.desc : 1.create pixelmap + * : 2.call rotate + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('rotateErr_008', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'rotateErr_008', 'callback', 'rotate', false) + }) + + /** + * @tc.number : flipErr_001 + * @tc.name : Pixelmap Flip-promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_001', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_001', 'promise', 'flip', 'false', true) + }) + + /** + * @tc.number : flipErr_002 + * @tc.name : Pixelmap Flip-promise-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_002', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_002', 'promise', 'flip', 1, true) + }) + + /** + * @tc.number : flipErr_003 + * @tc.name : Pixelmap Flip-promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_003', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_003', 'promise', 'flip', true, { a: 10 }) + }) + + /** + * @tc.number : flipErr_004 + * @tc.name : Pixelmap Flip-promise-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_004', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_004', 'promise', 'flip', true, null) + }) + + /** + * @tc.number : flipErr_005 + * @tc.name : Pixelmap Flip-callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_005', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_005', 'callback', 'flip', 'false', true) + }) + + /** + * @tc.number : flipErr_006 + * @tc.name : Pixelmap Flip-callback-wrong x + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_006', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_006', 'callback', 'flip', 1, true) + }) + + /** + * @tc.number : flipErr_007 + * @tc.name : Pixelmap Flip-callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_007', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_007', 'callback', 'flip', true, { a: 10 }) + }) + + /** + * @tc.number : flipErr_008 + * @tc.name : Pixelmap Flip-callback-wrong y + * @tc.desc : 1.create pixelmap + * : 2.call flip + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('flipErr_008', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'flipErr_008', 'callback', 'flip', true, null) + }) + + /** + * @tc.number : setAlphaAbleErr_001 + * @tc.name : SetSupportAlpha-wrong alpha + * @tc.desc : 1.create imagesource + * : 2.create pixelmap + * : 3.call setAlphaAble + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setAlphaAbleErr_001', 0, async function (done) { + setAlphaAbleErr(done, 'setAlphaAbleErr_001', 'a') + }) + + /** + * @tc.number : setAlphaAbleErr_002 + * @tc.name : SetSupportAlpha-wrong alpha + * @tc.desc : 1.create imagesource + * : 2.create pixelmap + * : 3.call setAlphaAble + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setAlphaAbleErr_002', 0, async function (done) { + setAlphaAbleErr(done, 'setAlphaAbleErr_002', { a: 1 }) + }) + + /** + * @tc.number : setAlphaAbleErr_003 + * @tc.name : SetSupportAlpha-wrong alpha + * @tc.desc : 1.create imagesource + * : 2.create pixelmap + * : 3.call setAlphaAble + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setAlphaAbleErr_003', 0, async function (done) { + setAlphaAbleErr(done, 'setAlphaAbleErr_003', null) + }) + + /** + * @tc.number : setAlphaAbleErr_004 + * @tc.name : SetSupportAlpha-wrong alpha + * @tc.desc : 1.create imagesource + * : 2.create pixelmap + * : 3.call setAlphaAble + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setAlphaAbleErr_004', 0, async function (done) { + setAlphaAbleErr(done, 'setAlphaAbleErr_004', 1) + }) + + /** + * @tc.number : cropErr_001 + * @tc.name : crop-promise- size: { height: 3, width: 3 }, x: -1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_001', 0, async function (done) { + var region = { size: { height: 3, width: 3 }, x: -1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_001', 'promise', 'crop', region) + }) + + /** + * @tc.number : cropErr_002 + * @tc.name : crop-promise-size: { height: 3, width: 3 }, x: 1, y: -1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_002', 0, async function (done) { + var region = { size: { height: 3, width: 3 }, x: 1, y: -1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_002', 'promise', 'crop', region) + }) + + /** + * @tc.number : cropErr_003 + * @tc.name : crop-promise-size: { height: 3, width: -3 }, x: 1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_003', 0, async function (done) { + var region = { size: { height: 3, width: -3 }, x: 1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_003', 'promise', 'crop', region) + }) + + /** + * @tc.number : cropErr_004 + * @tc.name : crop-promise-size: { height: -3, width: 3 }, x: 1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_004', 0, async function (done) { + var region = { size: { height: -3, width: 3 }, x: 1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_004', 'promise', 'crop', region) + }) + + /** + * @tc.number : cropErr_005 + * @tc.name : crop-callback-size: { height: 3, width: 3 }, x: -1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_005', 0, async function (done) { + var region = { size: { height: 3, width: 3 }, x: -1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_005', 'callback', 'crop', region) + }) + + /** + * @tc.number : cropErr_006 + * @tc.name : crop-callback-size: { height: 3, width: 3 }, x: 1, y: -1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_006', 0, async function (done) { + var region = { size: { height: 3, width: 3 }, x: 1, y: -1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_006', 'callback', 'crop', region) + }) + + /** + * @tc.number : cropErr_007 + * @tc.name : crop-callback-size: { height: 3, width: -3 }, x: 1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_007', 0, async function (done) { + var region = { size: { height: 3, width: -3 }, x: 1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_007', 'callback', 'crop', region) + }) + + /** + * @tc.number : cropErr_008 + * @tc.name : crop-callback-size: { height: -3, width: 3 }, x: 1, y: 1 + * @tc.desc : 1.create PixelMap + * : 2.crop + * : 3.getImageInfo + * : 4.getPixelBytesNumber + * : 5.readPixelsToBuffer + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('cropErr_008', 0, async function (done) { + var region = { size: { height: -3, width: 3 }, x: 1, y: 1 }; + await pixelMapModifySizeTestErr(done, 'cropErr_008', 'callback', 'crop', region) + }) + + /** + * @tc.number : setDensityErr_001 + * @tc.name : setDensity-gif-wrong density + * @tc.desc : 1.create ImageSource + * : 2.create PixelMap + * : 3.set Density + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setDensityErr_001', 0, async function (done) { + var imageData = testGif.buffer; + setDensityErr(done, 'setDensityErr_001', imageData, null) + }) + + /** + * @tc.number : setDensityErr_002 + * @tc.name : setDensity-gif-wrong density + * @tc.desc : 1.create ImageSource + * : 2.create PixelMap + * : 3.set Density + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setDensityErr_002', 0, async function (done) { + var imageData = testGif.buffer; + setDensityErr(done, 'setDensityErr_002', imageData, 'a') + }) + + /** + * @tc.number : setDensityErr_003 + * @tc.name : setDensity-gif-wrong density + * @tc.desc : 1.create ImageSource + * : 2.create PixelMap + * : 3.set Density + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setDensityErr_003', 0, async function (done) { + var imageData = testGif.buffer; + setDensityErr(done, 'setDensityErr_003', imageData, true) + }) + + /** + * @tc.number : setDensityErr_004 + * @tc.name : setDensity-gif-wrong density + * @tc.desc : 1.create ImageSource + * : 2.create PixelMap + * : 3.set Density + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('setDensityErr_004', 0, async function (done) { + var imageData = testGif.buffer; + setDensityErr(done, 'setDensityErr_004', imageData, { a: 1 }) + }) + + /** + * @tc.number : opacityErr_001 + * @tc.name : opacity-promise-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_001', 0, async function (done) { + opacityErr(done, 'opacityErr_001', { a: 1 }, 'Promise') + }) + + /** + * @tc.number : opacityErr_002 + * @tc.name : opacity-promise-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_002', 0, async function (done) { + opacityErr(done, 'opacityErr_002', 'a', 'Promise') + }) + + /** + * @tc.number : opacityErr_003 + * @tc.name : opacity-promise-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_003', 0, async function (done) { + opacityErr(done, 'opacityErr_003', null, 'Promise') + }) + + /** + * @tc.number : opacityErr_004 + * @tc.name : opacity-promise-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_004', 0, async function (done) { + opacityErr(done, 'opacityErr_004', 2, 'Promise') + }) + + /** + * @tc.number : opacityErr_005 + * @tc.name : opacity-callback-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_005', 0, async function (done) { + opacityErr(done, 'opacityErr_005', { a: 1 }, 'callback') + }) + + /** + * @tc.number : opacityErr_006 + * @tc.name : opacity-callback-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_006', 0, async function (done) { + opacityErr(done, 'opacityErr_006', 'a', 'callback') + }) + + /** + * @tc.number : opacityErr_007 + * @tc.name : opacityErr-callback-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacityErr + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_007', 0, async function (done) { + opacityErr(done, 'opacityErr_007', null, 'callback') + }) + + /** + * @tc.number : opacityErr_008 + * @tc.name : opacityErr-callback-wrong alpha + * @tc.desc : 1.create pixelmap + * : 2.opacity + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('opacityErr_008', 0, async function (done) { + opacityErr(done, 'opacityErr_008', 2, 'callback') + }) +})}