From 6f77dcd1730cbf8a1185d6b2cffcf684f2c1def7 Mon Sep 17 00:00:00 2001 From: wangxiaokai Date: Tue, 22 Mar 2022 16:59:13 +0800 Subject: [PATCH] Fix xts privilege and add 2 args tests. Signed-off-by: wangxiaokai --- multimedia/image/image_js_standard/Test.json | 1 + .../src/main/js/test/image.test.js | 4374 +++++++++-------- .../src/main/js/test/testImg.js | 15 +- 3 files changed, 2396 insertions(+), 1994 deletions(-) diff --git a/multimedia/image/image_js_standard/Test.json b/multimedia/image/image_js_standard/Test.json index cf4cec398..23d9d30d5 100644 --- a/multimedia/image/image_js_standard/Test.json +++ b/multimedia/image/image_js_standard/Test.json @@ -37,6 +37,7 @@ "type": "ShellKit", "run-command": [ "chmod -R 666 /data/media/*", + "chmod -R 666 /data/local/*", "setenforce 0" ], "teardown-command":[ diff --git a/multimedia/image/image_js_standard/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/src/main/js/test/image.test.js index 7dd022335..0688c4459 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/src/main/js/test/image.test.js @@ -14,8 +14,9 @@ */ import image from '@ohos.multimedia.image' +import fileio from '@ohos.fileio' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -import { testPng, testJpg } from './testImg' +import {testPng, testJpg, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} from './testImg' describe('Image', function () { @@ -38,10 +39,10 @@ describe('Image', function () { /** * @tc.number : TC_001 - * @tc.name : create pixelmap object + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.using color,colorlength,offsetwidth and opts create newPixelMap + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional @@ -49,10 +50,10 @@ describe('Image', function () { */ it('TC_001', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 2, width: 3 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) .then( pixelmap => { - expect(pixelmap !== null).assertTrue(); + expect(pixelmap != undefined).assertTrue(); console.info('TC_001 success'); done(); }) @@ -62,65 +63,60 @@ describe('Image', function () { done(); }) }) - + /** * @tc.number : TC_001-1 - * @tc.name : create pixelmap object + * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.using color,colorlength, offset,width and opts create newPixelMap + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 - */ + */ it('TC_001-1', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); + let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); console.info('TC_001-1 success'); done(); }) - .catch(error => { - console.log('TC_001-1 error: ' + error); - expect().assertFail(); - done(); - }) }) - /** * @tc.number : TC_001-2 - * @tc.name : create pixelmap object + * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.usingcolor,colorlength, offset,width and opts create newPixelMap + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-2', 0, async function (done) { + it('TC_001-2', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 1, editable: true, pixelFormat: 0, scaleMode: 2, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_001-2 success'); - done(); - }) - .catch(error => { - console.log('TC_001-2 error: ' + error); - expect().assertFail(); - done(); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-2 success'); + done(); + }) + .catch(error => { + console.log('TC_001-2 error: ' + error); + expect().assertFail(); + done(); + }) }) - }) /** * @tc.number : TC_001-3 - * @tc.name : create pixelmap object + * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.usingcolor,colorlength,offset,width and opts create newPixelMap + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional @@ -128,77 +124,152 @@ describe('Image', function () { */ it('TC_001-3', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 2, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); + let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); console.info('TC_001-3 success'); done(); - }) - .catch(error => { - console.log('TC_001-3 error: ' + error); - expect().assertFail(); - done(); + }) }) - /** * @tc.number : TC_001-4 - * @tc.name : create pixelmap object + * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.usingcolor,colorlength,offset,width and opts create newPixelMap + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-4', 0, async function (done) { + it('TC_001-4', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 3, editable: false, pixelFormat: 2, scaleMode: 2, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_001-4 success'); + let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-4 success'); + done(); + }) + .catch(error => { + console.log('TC_001-4 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-5 + * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-5', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-5 success'); done(); }) - .catch(error => { - console.log('TC_001-4 error: ' + error); - expect().assertFail(); + }) + /** + * @tc.number : TC_001-6 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-6', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-6 success'); done(); }) }) /** - * @tc.number : TC_001-5 - * @tc.name : create pixelmap object + * @tc.number : TC_001-7 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) * @tc.desc : 1.create InitializationOptions object - * 2.set color,colorlength,offset,width,height,pixeFormat,alphyType - * 3.usingcolor,colorlength,offset,width and opts create newPixelMap + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap * 4.return newpixelmap not empty * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-5', 0, async function (done) { + it('TC_001-7', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 3, editable: true, pixelFormat: 2, scaleMode: 1, size: { height: -1, width: -1 } } - image.createPixelMap(Color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_001-5 success'); + let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-7 success'); done(); - }).catch(error => { - console.log('TC_001-4 error: ' + error); - expect().assertFail(); + }) + }) + + /** + * @tc.number : TC_001-8 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-8', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-8 success'); + done(); + }) + }) + + /** + * @tc.number : TC_001-9 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-9', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-9 success'); done(); }) }) /** * @tc.number : TC_020 - * @tc.name : read Pixels To Buffer + * @tc.name : readPixelsToBuffer-promise * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer * 2.call readPixelsToBuffer - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -211,52 +282,52 @@ describe('Image', function () { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) .then( pixelmap => { - console.info('TC_020 createPixelMap in'); - if (pixelmap == null) { + if (pixelmap == undefined) { console.info('TC_020 createPixelMap failed'); expect(false).assertTrue() done(); } - const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer).then(() => { - var bufferArr = new Uint8Array(readBuffer); + var bufferArr2 = new Uint8Array(readBuffer); var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_020buf[i]) { res = false; - console.info('TC_020 Success'); - expect(true).assertTrue(); + console.info('TC_20_buffer'+ bufferArr2[i]); + console.info('TC_020 failed'); + expect(false).assertTrue(); done(); break; } } - } if (res) { - console.info('TC_020 buffer is all empty'); - expect(false).assertTrue() + console.info('TC_020 success'); + expect(true).assertTrue() done(); } - }) - }) - .catch(error => { - console.log('TC_020 error: ' + error); - expect().assertFail(); - done(); + }).catch(error => { + console.log('TC_020 read error: ' + error); + expect().assertFail(); + done(); }) + }).catch(error => { + console.log('TC_020 error: ' + error); + expect().assertFail(); + done(); + }) }) /** * @tc.number : TC_020-1 - * @tc.name : read Pixels To Buffer + * @tc.name : readPixelsToBuffer-callback * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer * 2.call readPixelsToBuffer - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -269,49 +340,43 @@ describe('Image', function () { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (pixelmap) => { - console.info('TC_020-1 createPixelMap in'); - expect(pixelmap !== null).assertTrue(); - console.info('TC_020-1 success'); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); done(); - }) + }else{ const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer,() => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { - res = false; - console.info('TC_020-1 Success'); - expect(true).assertTrue(); - done(); - break; - } + if (bufferArr[i] != tc_020_1buf[i]) { + res = false; + console.info('TC_020-1 failed'); + expect(false).assertTrue(); + done(); + break; } } if (res) { - console.info('TC_020-1 buffer is all empty'); - expect(false).assertTrue() + console.info('TC_020-1 success'); + expect(true).assertTrue() done(); } }) - - .catch(error => { - console.log('TC_020-1 error: ' + error); - expect().assertFail(); - done(); - }) + } + }) }) /** * @tc.number : TC_020-2 - * @tc.name : read Pixels To Buffer + * @tc.name : readPixelsToBuffer-callback(buffer:0) * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer * 2.call readPixelsToBuffer - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -324,48 +389,43 @@ describe('Image', function () { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 2, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (pixelmap) => { - console.info('TC_020-2 createPixelMap in'); - expect(pixelmap !== null).assertTrue(); - console.info('TC_020-2 success'); - done(); - }) - const readBuffer = new ArrayBuffer(0); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { - res = false; - console.info('TC_020-2 Success'); - expect(true).assertTrue(); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-2 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const readBuffer = new ArrayBuffer(0); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_020-2 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020-2 success'); + expect(true).assertTrue() done(); - break; } - } - } - if (res) { - console.info('TC_020-2 buffer is all empty'); - expect(false).assertTrue() - done(); - } - }) - .catch(error => { - console.log('TC_020-2 error: ' + error); - expect().assertFail(); - done(); - }) + }) + } + }) }) /** * @tc.number : TC_021 - * @tc.name : read Pixels + * @tc.name : readPixels-promise * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -376,41 +436,36 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) .then( pixelmap => { - if (pixelmap == null) { + if (pixelmap == undefined) { console.info('TC_021 createPixelMap failed'); expect(false).assertTrue() done(); } - - const area = { pixels: new ArrayBuffer(20), + const area = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } pixelmap.readPixels(area).then(() => { - var bufferArr = new Uint8Array(area.pixels); + var bufferArr2 = new Uint8Array(area.pixels); var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021 buffer ' + bufferArr[i]); - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_021 Success'); - expect(true).assertTrue(); - done(); - break; - } + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_021buf[i]) { + res = false; + console.info('TC_021 failed'); + expect(false).assertTrue(); + done(); + break; } } if (res) { - console.info('TC_021 buffer is all empty'); - expect(false).assertTrue() + console.info('TC_021 success'); + expect(true).assertTrue() done(); } - }) }) .catch(error => { @@ -422,11 +477,11 @@ describe('Image', function () { /** * @tc.number : TC_021-1 - * @tc.name : read Pixels + * @tc.name : readPixels-callback * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -437,57 +492,47 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_021-1 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area,(data) => { - if(data !== null) { - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-1 buffer ' + bufferArr[i]); - if(res) { - if(bufferArr[i] == 0) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area, () => { + var bufferArr = new Uint8Array(area.pixels); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + console.info('TC_021-1 buffer ' + bufferArr[i]); + if(bufferArr[i] != tc_021_1buf[i]) { res = false; - console.info('TC_021-1 Success'); - expect(true).assertTrue(); + console.info('TC_021-1 failed'); + expect(false).assertTrue(); done(); break; - } + } } - } - if (res) { - console.info('TC_021-1 buffer is all empty'); - expect(false).assertTrue() - done(); - } - } else { - console.info('TC_021-1 fail'); - expect(false).assertTrue() - done(); + if (res) { + console.info('TC_021-1 success'); + expect(true).assertTrue() + done(); + } + }) } }) - .catch(error => { - console.log('TC_021-1 error: ' + error); - expect().assertFail(); - done(); - }) }) /** * @tc.number : TC_021-2 - * @tc.name : read Pixels + * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -498,53 +543,37 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_021-2 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: -1, y: 0 }} - pixelmap.readPixels(area,(data) => { - if(data !== null){ - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-2 buffer ' + bufferArr[i]); - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_021-2 Success'); - expect(true).assertTrue(); - done(); - break; - } - } - } - if (res) { - console.info('TC_021-2 buffer is all empty'); - expect(false).assertTrue() + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-2 create pixelmap fail'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(20), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-2 failed'); + expect(false).assertTrue(); done(); - } - } - }) - .catch(error => { - console.log('TC_021-2 error: ' + error); - expect().assertFail(); - done(); - }) + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-2 success'); + done(); + }) + } + }) }) /** * @tc.number : TC_021-3 - * @tc.name : read Pixels + * @tc.name : readPixels-promise(buffer:0) * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -555,53 +584,37 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_021-3 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(0), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area,(data) => { - if(data !== null){ - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-3 buffer ' + bufferArr[i]); - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_021-3 Success'); - expect(true).assertTrue(); - done(); - break; - } - } - } - if (res) { - console.info('TC_021-3 buffer is all empty'); - expect(false).assertTrue() - done(); - } - } - }) - .catch(error => { - console.log('TC_021-3 error: ' + error); - expect().assertFail(); - done(); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-3 create pixelmap success'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(0), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-3 failed'); + except(false).assertTrue(); + done(); + }).catch(()=>{ + except(true).assertTrue(); + console.info('TC_021-3 success'); + done(); + }) + } }) }) /** * @tc.number : TC_021-4 - * @tc.name : read Pixels + * @tc.name : readPixels-promise(offset > buffer) * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -612,53 +625,36 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_021-4 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(20), - offset: 21, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area,(data) => { - if(data !== null){ - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-4 buffer ' + bufferArr[i]); - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_021-4 Success'); - expect(true).assertTrue(); - done(); - break; - } - } - } - if (res) { - console.info('TC_021-4 buffer is all empty'); - expect(false).assertTrue() - done(); - } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-4 createPixelMap success'); + done(); } - }) - .catch(error => { - console.log('TC_021-4 error: ' + error); - expect().assertFail(); - done(); - }) + const area = { pixels: new ArrayBuffer(20), + offset: 21, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-4 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-4 success'); + done(); + }) + }) }) /** * @tc.number : TC_021-5 - * @tc.name : read Pixels + * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) * @tc.desc : 1.create PixelMap * 2.call readPixels * 3.promise return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -669,80 +665,63 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_021-5 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: -1, width:-1}, x: 0, y: 0 }} - pixelmap.readPixels(area,(data) => { - if(data !== null){ - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-5 buffer ' + bufferArr[i]); - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_021-5 Success'); - expect(true).assertTrue(); - done(); - break; - } - } - } - if (res) { - console.info('TC_021-5 buffer is all empty'); - expect(false).assertTrue() - done(); - } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-5 createPixelMap success'); + done(); } - }) - .catch(error => { - console.log('TC_021-5 error: ' + error); - expect().assertFail(); - done(); + const area = { pixels: new ArrayBuffer(20), + offset: 0, + stride: 8, + region: { size: { height: -1, width:-1}, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-5 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-5 success'); + done(); + }) }) }) /** * @tc.number : TC_022 - * @tc.name : write Pixels + * @tc.name : writePixels-promise * @tc.desc : 1.create PixelMap * 2.call writePixels - * 3.call return null - * 4.callbackcall return null + * 3.call return undefined + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_022', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) .then( pixelmap => { - if (pixelmap == null) { + if (pixelmap == undefined) { console.info('TC_022 createPixelMap failed'); expect(false).assertTrue() done(); } - const area = { pixels: new ArrayBuffer(20), + const area = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } var bufferArr = new Uint8Array(area.pixels); for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i; + bufferArr[i] = i + 1; } pixelmap.writePixels(area).then(() => { - const readArea = { pixels: new ArrayBuffer(20), + const readArea = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } @@ -751,22 +730,19 @@ describe('Image', function () { var readArr = new Uint8Array(readArea.pixels); var res = true; for (var i = 0; i < readArr.length; i++) { - if(res) { - if (readArr[i] !== 0) { - res = false; - console.info('TC_022 Success'); - expect(true).assertTrue(); - done(); - break; - } - } + if (readArr[i] != tc_022buf[i]) { + res = false; + console.info('TC_022 failed'); + expect(false).assertTrue(); + done(); + break; + } } if (res) { - console.info('TC_022 buffer is all empty'); - expect(false).assertTrue() + console.info('TC_022 success'); + expect(true).assertTrue() done(); } - }) }) }) @@ -779,57 +755,54 @@ describe('Image', function () { /** * @tc.number : TC_022-1 - * @tc.name : write Pixels + * @tc.name : writePixels-callback * @tc.desc : 1.create PixelMap * 2.call writePixels - * 3.call return null - * 4.callbackcall return null + * 3.call return undefined + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_022-1', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_022-1 success'); - done(); - }) - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - var bufferArr = new Uint8Array(area.pixels); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i; - } - pixelmap.writePixels(area,() => { - const readArea = { pixels: new ArrayBuffer(20), + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + const area = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } - pixelmap.readPixels(readArea,() => { - var readArr = new Uint8Array(readArea.pixels); - var res = true; - for (var i = 0; i < readArr.length; i++) { - if(res) { - if (readArr[i] !== 0) { + var bufferArr = new Uint8Array(area.pixels); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + pixelmap.writePixels(area, () => { + const readArea = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(readArea,() => { + var readArr = new Uint8Array(readArea.pixels); + var res = true; + for (var i = 0; i < readArr.length; i++) { + if (readArr[i] == 0) { res = false; - console.info('TC_022-1 Success'); - expect(true).assertTrue(); + console.info('TC_022-1 failed'); + expect(false).assertTrue(); done(); break; } } - } - if (res) { - console.info('TC_022-1 buffer is all empty'); - expect(false).assertTrue() - done(); - } + if (res) { + console.info('TC_022-1 success'); + expect(true).assertTrue() + done(); + } + }) }) }) .catch(error => { @@ -841,50 +814,48 @@ describe('Image', function () { /** * @tc.number : TC_023 - * @tc.name : write Buffer To Pixels + * @tc.name : writeBufferToPixels-promise * @tc.desc : 1.create PixelMap,buffer * 2.call writeBufferToPixels - * 3.call return null - * 4.callbackcall return null + * 3.call return undefined + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_023', 0, async function (done) { const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i; - } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 }} + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} image.createPixelMap(color, opts) .then( pixelmap => { - if (pixelmap == null) { + if (pixelmap == undefined) { console.info('TC_023 createPixelMap failed'); expect(false).assertTrue() done(); } const writeColor = new ArrayBuffer(96); + var bufferArr = new Uint8Array(writeColor); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } pixelmap.writeBufferToPixels(writeColor).then(() => { const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer).then(() => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== i) { - res = false; - console.info('TC_023 Success'); - expect(true).assertTrue() - done(); - break; - } + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023 failed'); + expect(false).assertTrue() + done(); + break; } } if (res) { - console.info('TC_023 no change after writeBuffer'); - expect(false).assertTrue(); + console.info('TC_023 success'); + expect(true).assertTrue(); done(); } }) @@ -899,11 +870,11 @@ describe('Image', function () { /** * @tc.number : TC_023-1 - * @tc.name : write Buffer To Pixels + * @tc.name : writeBufferToPixels-callback * @tc.desc : 1.create PixelMap,buffer * 2.call writeBufferToPixels - * 3.call return null - * 4.callbackcall return null + * 3.call return undefined + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 @@ -912,241 +883,247 @@ describe('Image', function () { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i; + bufferArr[i] = i + 1; } - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts,pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_023-1 success'); - done(); - }) - const writeColor = new ArrayBuffer(96); - pixelmap.writeBufferToPixels(writeColor,() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== i) { - res = false; - console.info('TC_023-1 Success'); - expect(true).assertTrue() - done(); - break; + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts).then( pixelmap => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_023-1 failed'); + done(); + } + const writeColor = new ArrayBuffer(96); + pixelmap.writeBufferToPixels(writeColor,() => { + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if(res) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023-1 Success'); + expect(true).assertTrue() + done(); + break; + } } } - } - if (res) { - console.info('TC_023-1 no change after writeBuffer'); - expect(false).assertTrue(); - done(); - } - }) - }) - .catch(error => { - console.log('TC_023-1 error: ' + error); - expect().assertFail(); - done(); + if (res) { + console.info('TC_023-1 no change after writeBuffer'); + expect(false).assertTrue(); + done(); + } + }) + }) }) }) /** * @tc.number : TC_024 - * @tc.name : get Image In fo + * @tc.name : getImageInfo-pixelmap-promise * @tc.desc : 1.create PixelMap,ImageInfo * 2.call getImageInfo * 3.call return imageinfo - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_024', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 2, scaleMode: 1, size: { height: 4, width: 6 } } + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == null) { - console.info('TC_024 createPixelMap failed'); + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_024 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.getImageInfo().then( imageInfo => { + if (imageInfo == undefined) { + console.info('TC_024 imageInfo is empty'); expect(false).assertTrue() done(); - } - pixelmap.getImageInfo().then( imageInfo => { - if (imageInfo !== null) { - console.info('TC_024 imageInfo is ready'); - expect(imageInfo.size.height == 4).assertTrue(); - expect(imageInfo.size.width == 6).assertTrue(); - expect(imageInfo.pixelFormat == 2).assertTrue(); - done(); - } else { - console.info('TC_024 imageInfo is empty'); - expect(false).assertTrue() - done(); - } - }) - }) - .catch(error => { - console.log('TC_024 error: ' + error); + } + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024 success '); + expect(true).assertTrue() + done(); + } + done(); + }).catch(error => { + console.log('TC_024 getimageinfo error: ' + error); expect().assertFail(); done(); }) + done(); + }) + .catch(error => { + console.log('TC_024 error: ' + error); + expect().assertFail(); + done(); + }) }) /** * @tc.number : TC_024-1 - * @tc.name : get Image In fo + * @tc.name : getImageInfo-pixelmap-callback * @tc.desc : 1.create PixelMap,ImageInfo * 2.call getImageInfo * 3.call return imageinfo - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_024-1', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_024-1 success'); - done(); - }) - pixelmap.getImageInfo( imageInfo => { - if (imageInfo !== null) { - console.info('TC_024-1 imageInfo is ready'); - expect(imageInfo.size.height == 4).assertTrue(); - expect(imageInfo.size.width == 6).assertTrue(); - expect(imageInfo.pixelFormat == 4).assertTrue(); - done(); - } else { - console.info('TC_024-1 imageInfo is empty'); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ expect(false).assertTrue() + console.info('TC_024-1 create pixelmap fail'); done(); } - }) - .catch(error => { - console.log('TC_024-1 error: ' + error); - expect().assertFail(); - done(); + pixelmap.getImageInfo( (err,imageInfo) => { + if (imageInfo == undefined) { + console.info('TC_024-1 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024-1 imageInfo success'); + expect(true).assertTrue() + done(); + } + done(); + }) }) }) /** * @tc.number : TC_025-1 - * @tc.name : get Bytes Number PerRow + * @tc.name : getBytesNumberPerRow * @tc.desc : 1.create PixelMap * 2.set PixelMap * 3.call getBytesNumberPerRow * 4. call return number - * 5.callback return null + * 5.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_025-1', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - const expectNum = opts.pixelFormat * opts.size.width; - image.createPixelMap(color, opts, pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_25-1 success'); - done(); - }) - pixelmap.getBytesNumberPerRow().then(num => { - console.info('TC_025-1 num is ' + num); - expect(num == expectNum).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_025-1 error: ' + error); - expect().assertFail(); - done(); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width; + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_25-1 create pixelmap fail'); + done(); + } else { + const num = pixelmap.getBytesNumberPerRow(); + console.info('TC_025-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_25-1 success'); + } else { + console.info('TC_25-1 fail'); + } + done(); + } }) }) /** * @tc.number : TC_026-1 - * @tc.name : get Pixel Bytes Number + * @tc.name : getPixelBytesNumber * @tc.desc : 1.create PixelMap * 2.set Pixel * 3.call getPixelBytesNumber * 4. call return number - * 5.callback return null + * 5.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_026-1', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - const expectNum = opts.pixelFormat * opts.size.width * opts.size.height; - image.createPixelMap(color, opts,pixelmap => { - expect(pixelmap !== null).assertTrue(); - console.info('TC_026-1 success'); - done(); - }) - pixelmap.getPixelBytesNumber().then(num => { - console.info('TC_026-1 num is ' + num); - expect(num == expectNum).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_026-1 error: ' + error); - expect().assertFail(); - done(); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width * opts.size.height; + image.createPixelMap(color, opts,(err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_026-1 create pixelmap fail'); + done(); + } else { + const num = pixelmap.getPixelBytesNumber(); + console.info('TC_026-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_026-1 success'); + } else { + console.info('TC_026-1 fail'); + } + done(); + } }) }) /** * @tc.number : TC_027 - * @tc.name : release + * @tc.name : release-pixelmap-promise * @tc.desc : 1.create PixelMap * 2.set Pixel * 3.call release - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_027', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts).then(pixelmap => { - if (pixelmap == null) { - console.info('TC_027 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.release().then(() => { - console.info('TC_027 success'); - expect(true).assertTrue(); - done(); - }) - .catch(error => { + if (pixelmap == undefined) { + console.info('TC_027 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.release().then(() => { + console.info('TC_027 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { console.log('TC_027 error: ' + error); expect().assertFail(); done(); }) + }).catch(error => { + console.log('TC_027 createPixelMap failed error: ' + error); + expect().assertFail(); + done(); }) }) /** * @tc.number : TC_027-1 - * @tc.name : release(callback) + * @tc.name : release-pixelmap-callback * @tc.desc : 1.create PixelMap * 2.set Pixel * 3.call release - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_027-1', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (error,pixelmap) => { - if (pixelmap == null) { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { console.info('TC_027-1 createPixelMap failed'); expect(false).assertTrue() done(); @@ -1161,7 +1138,7 @@ describe('Image', function () { /** * @tc.number : TC_041 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-jpg * @tc.desc : 1.set uri * 2.call createImageSource(uri) * 3.return imagesource @@ -1171,14 +1148,14 @@ describe('Image', function () { */ it('TC_041', 0, async function (done) { const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_041 finished'); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041 success'); done(); }) /** * @tc.number : TC_041-1 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-bmp * @tc.desc : 1.seturi * 2.call createImageSource(uri) * 3.return imagesource @@ -1188,14 +1165,14 @@ describe('Image', function () { */ it('TC_041-1', 0, async function (done) { const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_041-1 finished'); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-1 success'); done(); }) /** * @tc.number : TC_041-2 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-gif * @tc.desc : 1.seturi * 2.call createImageSource(uri) * 3.return imagesource @@ -1205,14 +1182,14 @@ describe('Image', function () { */ it('TC_041-2', 0, async function (done) { const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_041-2 finished'); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-2 success'); done(); }) /** * @tc.number : TC_041-3 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-png * @tc.desc : 1.seturi * 2.call createImageSource(uri) * 3.return imagesource @@ -1222,14 +1199,14 @@ describe('Image', function () { */ it('TC_041-3', 0, async function (done) { const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_041-3 finished'); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-3 success'); done(); }) /** * @tc.number : TC_041-4 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-wrong suffix file * @tc.desc : 1.call createImageSource(uri) * 2.Incoming wrong suffix file * 3.imagesource null @@ -1238,15 +1215,15 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.tif'); - expect(imageSourceApi == null).assertTrue(); - console.info('TC_041-4 finished'); + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.tif'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_041-4 success'); done(); }) /** * @tc.number : TC_041-5 - * @tc.name : create Image Source(uri) + * @tc.name : createImageSource(uri)-wrong uri * @tc.desc : 1.call createImageSource(uri) * 2.set wrong uri * 3.return null @@ -1255,15 +1232,15 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/multiedia/test.jpg'); - expect(imageSourceApi == null).assertTrue(); - console.info('TC_041-5 finished'); + const imageSourceApi = image.createImageSource('file:///multimedia/test.jpg'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_041-5 success'); done(); }) /** * @tc.number : TC_042 - * @tc.name : create Image Source(fd) + * @tc.name : createImageSource(fd) * @tc.desc : 1.call createImageSource * 2.set fd * 3.return imagesource @@ -1272,83 +1249,41 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_042', 0, async function (done) { - const imageSourceApi = image.createImageSource(29); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_042 finished'); - done(); - }) - - /** - * @tc.number : TC_042-1 - * @tc.name : create Image Source(fd) bmp - * @tc.desc : 1.call createImageSource - * 2.set fd - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_042-1', 0, async function (done) { - const imageSourceApi = image.createImageSource(30); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_042-1 finished'); - done(); - }) - - /** - * @tc.number : TC_042-2 - * @tc.name : create Image Source(fd) png - * @tc.desc : 1.call createImageSource - * 2.set fd - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_042-2', 0, async function (done) { - const imageSourceApi = image.createImageSource(28); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_042-2 finished'); - done(); - }) - - /** - * @tc.number : TC_042-3 - * @tc.name : create Image Source(fd) gif - * @tc.desc : 1.call createImageSource - * 2.set fd - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_042-3', 0, async function (done) { - const imageSourceApi = image.createImageSource(27); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_042-3 finished'); - done(); + let fd = fileio.openSync('/data/local/tmp/test.jpg'); + const imageSourceApi = image.createImageSource(fd); + if (imageSourceApi == undefined) { + console.info('TC_042 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + console.info('TC_042 success'); + expect(imageInfo != undefined).assertTrue(); + done(); + }) + } }) /** - * @tc.number : TC_042-4 - * @tc.name : create Image Source(fd) + * @tc.number : TC_042-1 + * @tc.name : createImageSource(fd) fd<0 * @tc.desc : 1.call createImageSource * 2.set wrong fd - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_042-4', 0, async function (done) { + it('TC_042-1', 0, async function (done) { const imageSourceApi = image.createImageSource(-2); - expect(imageSourceApi == null).assertTrue(); - console.info('TC_042-4 finished'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_042-1 success'); done(); }) /** * @tc.number : TC_043 - * @tc.name : create Image Source(data) + * @tc.name : createImageSource(data) * @tc.desc : 1.setdata * 2.createImageSource * 3.return imagesource @@ -1357,17 +1292,25 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_043', 0, async function (done) { - console.info('TC_043 start'); - const data = new ArrayBuffer(96); + console.info('TC_043 start'); + const data = testJpg.buffer; const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_043 finished'); - done(); + if (imageSourceApi == undefined) { + console.info('TC_043 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + console.info('TC_043 imageInfo'); + expect(imageInfo != undefined).assertTrue(); + done(); + }) + } }) /** * @tc.number : TC_043-1 - * @tc.name : create Image Source(data) bmp + * @tc.name : createImageSource(data) buffer:0 * @tc.desc : 1.setdata * 2.createImageSource * 3.return imagesource @@ -1376,94 +1319,37 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_043-1', 0, async function (done) { - console.info('TC_043-1 start'); - const data = new ArrayBuffer(104); - const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_043-1 finished'); - done(); - }) - - /** - * @tc.number : TC_043-2 - * @tc.name : create Image Source(data) png - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043-2', 0, async function (done) { - console.info('TC_043-2 start'); - const data = new ArrayBuffer(112); - const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_043-2 finished'); - done(); - }) - - /** - * @tc.number : TC_043-3 - * @tc.name : create Image Source(data) gif - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043-3', 0, async function (done) { - console.info('TC_043-3 start'); - const data = new ArrayBuffer(112); - const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi !== null).assertTrue(); - console.info('TC_043-3 finished'); - done(); - }) - - /** - * @tc.number : TC_043-4 - * @tc.name : create Image Source(data) - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043-4', 0, async function (done) { - console.info('TC_043-4 start'); + console.info('TC_043-1 start'); const data = new ArrayBuffer(0); const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi == null).assertTrue(); - console.info('TC_043-4 finished'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_043-1 success'); done(); }) /** * @tc.number : TC_044 - * @tc.name : release() + * @tc.name : release-imagesource-promise-jpg * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_044', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_044 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(()=>{ - console.info('TC_044 release'); + console.info('TC_044 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.info('TC_044 release'); + console.info('TC_044 error'); expect(false).assertTrue(); done(); }) @@ -1472,17 +1358,17 @@ describe('Image', function () { /** * @tc.number : TC_044-1 - * @tc.name : release() + * @tc.name : release-imagesource-callback-jpg * @tc.desc : 1.create ImageSource * 2.call release() - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_044-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_044-1 create image source failed'); expect(false).assertTrue(); done(); @@ -1497,26 +1383,26 @@ describe('Image', function () { /** * @tc.number : TC_045 - * @tc.name : get Image Info(ImageInfo) + * @tc.name : getImageInfo(callback: AsyncCallback)-jpg * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_045', 0, async function (done) { - console.info('TC_045'); - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_045 create image source failed'); expect(false).assertTrue(); done(); } else { - console.info('TC_045 suc'); - imageSourceApi.getImageInfo(imageInfo => { + imageSourceApi.getImageInfo((err,imageInfo) => { console.info('TC_045 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + expect(imageInfo != undefined).assertTrue(); done(); }) } @@ -1524,26 +1410,26 @@ describe('Image', function () { /** * @tc.number : TC_045-1 - * @tc.name : get Image Info(ImageInfo) + * @tc.name : getImageInfo(callback: AsyncCallback)-bmp * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_045-1', 0, async function (done) { - console.info('TC_045-1'); - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_045 create image source failed'); + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_045-1 create image source failed'); expect(false).assertTrue(); done(); } else { - console.info('TC_045-1 suc'); - imageSourceApi.getImageInfo(imageInfo => { + imageSourceApi.getImageInfo((err,imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_045-1 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1551,26 +1437,26 @@ describe('Image', function () { /** * @tc.number : TC_045-2 - * @tc.name : get Image Info(ImageInfo) + * @tc.name : getImageInfo(callback: AsyncCallback)-png * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_045-2', 0, async function (done) { - console.info('TC_045-2'); - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_045-2 create image source failed'); expect(false).assertTrue(); done(); } else { - console.info('TC_045-2 suc'); - imageSourceApi.getImageInfo(imageInfo => { + imageSourceApi.getImageInfo((err,imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_045-2 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1578,26 +1464,27 @@ describe('Image', function () { /** * @tc.number : TC_045-3 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(callback: AsyncCallback)-gif * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_045-3', 0, async function (done) { console.info('TC_045-3'); - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_045-3 create image source failed'); expect(false).assertTrue(); done(); } else { - console.info('TC_045-3 suc'); - imageSourceApi.getImageInfo(imageInfo => { + imageSourceApi.getImageInfo((err,imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_045-3 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1605,24 +1492,26 @@ describe('Image', function () { /** * @tc.number : TC_046 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-jpg * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_046 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(0,(error, imageInfo) => { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { console.info('TC_046 imageInfo'); - expect(imageInfo !== null).assertTrue(); + expect(imageInfo != undefined).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1630,24 +1519,26 @@ describe('Image', function () { /** * @tc.number : TC_046-1 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-bmp * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { console.info('TC_046-1 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(0,imageInfo => { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_046-1 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1655,24 +1546,26 @@ describe('Image', function () { /** * @tc.number: TC_046-2 - * @tc.name : getImageInfo(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-png * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_046-2 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(0,imageInfo => { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_046-2 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1680,24 +1573,26 @@ describe('Image', function () { /** * @tc.number: TC_046-3 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_046-3 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(0,imageInfo => { + imageSourceApi.getImageInfo(0,(err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_046-3 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); done(); }) } @@ -1705,49 +1600,52 @@ describe('Image', function () { /** * @tc.number: TC_046-4 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif(frame:1)-index:1 * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_046-4 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(1,imageInfo => { - console.info('TC_046-4 imageInfo'); - expect(imageInfo == null).assertTrue(); - done(); + imageSourceApi.getImageInfo(1, (err, imageInfo) => { + if(imageInfo == undefined) { + expect(true).assertTrue(); + done(); + } else { + expect(false).assertTrue(); + done(); + } }) } }) /** * @tc.number: TC_046-5 - * @tc.name : get Image Info(index, ImageInfo) + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif-index:-1 * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) - * 3.callback return null + * 3.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_046-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_046-5 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(-1,imageInfo => { - console.info('TC_046-5 imageInfo'); - expect(imageInfo == null).assertTrue(); + imageSourceApi.getImageInfo(-1, (err, imageInfo) => { + expect(imageInfo == undefined).assertTrue(); done(); }) } @@ -1755,7 +1653,7 @@ describe('Image', function () { /** * @tc.number : TC_047 - * @tc.name : get Image Info(index) return Image Info + * @tc.name : getImageInfo(index?: number): Promise-jpg * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) * 3.callbackcall ,return imageinfo @@ -1764,16 +1662,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_047', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_047 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_047 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047 error: ' + error); + expect().assertFail(); done(); }) } @@ -1781,7 +1685,7 @@ describe('Image', function () { /** * @tc.number : TC_047-1 - * @tc.name : get Image Info(index) return Image Info + * @tc.name : getImageInfo(index?: number): Promise-bmp * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) * 3.callbackcall ,return imageinfo @@ -1790,16 +1694,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_047-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { console.info('TC_047-1 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_047-1 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-1 error: ' + error); + expect().assertFail(); done(); }) } @@ -1807,7 +1717,7 @@ describe('Image', function () { /** * @tc.number : TC_047-2 - * @tc.name : get Image Info(index) return Image Info + * @tc.name : getImageInfo(index?: number): Promise-png * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) * 3.callbackcall ,return imageinfo @@ -1816,16 +1726,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_047-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_047-2 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_047-2 imageInfo'); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-2 error: ' + error); + expect().assertFail(); done(); }) } @@ -1833,7 +1749,7 @@ describe('Image', function () { /** * @tc.number : TC_047-3 - * @tc.name : get Image Info(index) return ImageInfo + * @tc.name : getImageInfo(index?: number): Promise-gif * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) * 3.callbackcall ,return imageinfo @@ -1842,16 +1758,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_047-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_047-3 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); console.info('TC_047-3 '); - expect(imageInfo !== null).assertTrue(); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-3 error: ' + error); + expect().assertFail(); done(); }) } @@ -1859,25 +1781,29 @@ describe('Image', function () { /** * @tc.number: TC_047-4 - * @tc.name : get Image Info(index) return ImageInfo + * @tc.name : getImageInfo(index?: number): Promise-gif(frame:1)-index:1 * @tc.desc : 1.create imagesource * 2.call getImageInfo(index=1) - * 3.callback return imageinfo null + * 3.callback return imageinfo undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_047-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_047-4 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(1) - .then((error,imageInfo) => { - expect(imageInfo == null).assertTrue(); - console.info('TC_047-4 suc'); + .then(() => { + console.log('TC_047-4 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-4 success'); + expect(true).assertTrue(); done(); }) } @@ -1885,25 +1811,29 @@ describe('Image', function () { /** * @tc.number : TC_047-5 - * @tc.name : get Image Info(index) return ImageInfo + * @tc.name : getImageInfo(index?: number): Promise-gif-index:-1 * @tc.desc : 1.create imagesource * 2.call getImageInfo(index=-1) - * 3.callback return imageinfo null + * 3.callback return imageinfo undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_047-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_047-5 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(-1) - .then((error,imageInfo) => { - expect(imageInfo == null).assertTrue(); - console.info('TC_047-5 success'); + .then(() => { + console.log('TC_047-5 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-5 success'); + expect(true).assertTrue(); done(); }) } @@ -1911,18 +1841,18 @@ describe('Image', function () { /** * @tc.number : TC_050 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050 create image source failed'); expect(false).assertTrue(); done(); @@ -1936,28 +1866,27 @@ describe('Image', function () { desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** * @tc.number : TC_050-1 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + it('TC_050-1', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-1 create image source failed'); expect(false).assertTrue(); done(); @@ -1967,21 +1896,20 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:0, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-1 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050-1 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) - /** * @tc.number : TC_050-2 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unknown-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -1990,9 +1918,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + it('TC_050-2', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-2 create image source failed'); expect(false).assertTrue(); done(); @@ -2004,65 +1932,69 @@ describe('Image', function () { rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-2 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050-2 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) - /** * @tc.number : TC_050-3 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions: index 1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-3 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { - sampleSize:-1, + sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-3 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_050-4 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:index -1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-4 create image source failed'); expect(false).assertTrue(); done(); @@ -2071,154 +2003,174 @@ describe('Image', function () { sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, + rotate:10, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:-1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-4 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.error('TC_050-4 success'); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } }) } }) /** * @tc.number : TC_050-5 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-5 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, + sampleSize:-1, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-5 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_050-6 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:rotate -10})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 1 */ it('TC_050-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-6 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, - desiredPixelFormat:11, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-6 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_050-7 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-7 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + rotate:10, + desiredPixelFormat:60, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-7 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_050-8 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:editable false})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : Level 1 */ it('TC_050-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-8 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: true, - desiredSize:{ width:400, height:400}, + editable: false, + desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-8 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_050-8 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } @@ -2226,18 +2178,18 @@ describe('Image', function () { /** * @tc.number : TC_050-9 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_050-9', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-9 create image source failed'); expect(false).assertTrue(); done(); @@ -2245,34 +2197,34 @@ describe('Image', function () { let decodingOptions = { sampleSize:1, editable: true, - desiredSize:{ width:1, height:2}, + desiredSize:{ width:500, height:500}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 400, width: 500 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-9 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_050-9 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) - + /** * @tc.number : TC_050-10 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_050-10', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-10 create image source failed'); expect(false).assertTrue(); done(); @@ -2282,112 +2234,176 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 500, width: 500 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-10 createPixelMap'); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) - + /** * @tc.number : TC_050-11 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_050-11', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_050-11 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_050-11 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_050-11 error: ' + error); - expect().assertFail(); - done(); - }) - } + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } }) - /** + /** * @tc.number : TC_050-12 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-12', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { - console.info('TC_050-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap(pixelmap => { - console.info('TC_050-12 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + it('TC_050-12', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { + console.info('TC_050-12 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: 500, y: 500 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_050-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-13', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { + console.info('TC_050-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) /** - * @tc.number : TC_050-13 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_050-14 + * @tc.name : createPixelMap-promise-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-13', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { - console.info('TC_050-13 create image source failed'); + it('TC_050-14', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { + console.info('TC_050-14 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: 400, y: 400 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-13 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_050-14 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_050-14 error: ' + error); + expect().assertFail(); done(); }) } }) /** - * @tc.number : TC_050-14 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_050-15 + * @tc.name : createPixelMap-callback-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -2396,25 +2412,16 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-14', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { - console.info('TC_050-14 create image source failed'); + it('TC_050-15', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { + console.info('TC_050-15 create image source failed'); expect(false).assertTrue(); done(); } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 400, y: 400 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_050-14 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_050-15 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } @@ -2422,7 +2429,7 @@ describe('Image', function () { /** * @tc.number : TC_053 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createIncrementalSource-updateData-png * @tc.desc : 1.create imagesource * 2.update data * 3.create pixelmap @@ -2461,13 +2468,12 @@ describe('Image', function () { }; incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { console.info('TC_053 0014' + pixelmap); - expect(pixelmap !== undefined ).assertTrue(); + expect(pixelmap != undefined ).assertTrue(); done(); }) } else { done(); } - done(); } catch (error) { console.info('TC_053 updateData failed ' + error); } @@ -2475,7 +2481,7 @@ describe('Image', function () { /** * @tc.number : TC_053-1 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createIncrementalSource-updateData-jpg * @tc.desc : 1.create imagesource * 2.update data * 3.create pixelmap @@ -2513,13 +2519,12 @@ describe('Image', function () { sampleSize:1 }; incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - expect(pixelmap !== undefined ).assertTrue(); + expect(pixelmap != undefined ).assertTrue(); done(); }) } else { done(); } - done(); } catch (error) { console.info('TC_053-1 updateData failed ' + error); } @@ -2527,68 +2532,71 @@ describe('Image', function () { /** * @tc.number : TC_062 - * @tc.name : packing + * @tc.name : packing ImageSource - promise * @tc.desc : 1.create ImageSource * 2.call packing * 3.return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + it('TC_062', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_062 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_062 create image packer failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:98 } + let packOpts = { format:["image/jpeg"], quality:99 } imagePackerApi.packing(imageSourceApi, packOpts) .then( data => { - console.info('TC_062 finished'); - expect(data !== null).assertTrue(); + console.info('TC_062 success'); + expect(data != undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062 error: ' + error); + expect(false).assertFail(); done(); }) - } } }) /** * @tc.number : TC_062-1 - * @tc.name : packing + * @tc.name : packing ImageSource - callback * @tc.desc : 1.create ImageSource * 2.call packing * 3.return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_062-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_062-1 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_062-1 create image packer failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:98 } - imagePackerApi.packing(imageSourceApi, packOpts, data => { - console.info('TC_062-1 finished'); - expect(data !== null).assertTrue(); + let packOpts = { format:["image/jpeg"], quality:1 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-1 success'); + expect(data != undefined).assertTrue(); done(); }) } @@ -2597,32 +2605,32 @@ describe('Image', function () { /** * @tc.number : TC_062-2 - * @tc.name : packing ImageSource + * @tc.name : packing ImageSource - callback - wrong format * @tc.desc : 1.create ImageSource * 2.call packing * 3.return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_062-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_062-2 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_062-2 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format:["image/gif"], quality:98 } - imagePackerApi.packing(imageSourceApi, packOpts, data => { - console.info('TC_062-2 finished'); - expect(data == null).assertTrue(); + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-2 success'); + expect(data == undefined).assertTrue(); console.info(data); done(); }) @@ -2632,32 +2640,32 @@ describe('Image', function () { /** * @tc.number : TC_062-3 - * @tc.name : packing ImageSource + * @tc.name : packing ImageSource - callback - wrong quality * @tc.desc : 1.create ImageSource * 2.call packing * 3.call return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_062-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_062-3 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_062-3 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format:["image/jpg"], quality:101 } - imagePackerApi.packing(imageSourceApi, packOpts, data => { - console.info('TC_062-3 finished'); - expect(data == null).assertTrue(); + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-3 success'); + expect(data == undefined).assertTrue(); console.info(data); done(); }) @@ -2667,24 +2675,24 @@ describe('Image', function () { /** * @tc.number : TC_062-4 - * @tc.name : packing + * @tc.name : createImagePacker * @tc.desc : 1.create ImageSource * 2.call packing * 3.return array - * 4.callbackcall return null + * 4.callbackcall return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_062-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_062-4 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_062-4 create image packer failed'); expect(false).assertTrue(); done(); @@ -2695,26 +2703,208 @@ describe('Image', function () { } } }) + + /** + * @tc.number : TC_062-5 + * @tc.name : packing ImageSource - promise - no quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.call return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-5', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_062-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-5 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpg"] } + imagePackerApi.packing(imageSourceApi, packOpts) + .then( data => { + console.info('TC_062-5 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-5 error: ' + error); + console.log('TC_062-5 success'); + expect(true).assertTrue(); + done(); + }) + } + } + }) + + /** + * @tc.number : TC_062-6 + * @tc.name : packing ImageSource - promise - no format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.call return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-6', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_062-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-6 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { quality:50 } + imagePackerApi.packing(imageSourceApi, packOpts) + .then( data => { + console.info('TC_062-6 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-6 error: ' + error); + console.log('TC_062-6 success'); + expect(true).assertTrue(); + done(); + }) + } + } + }) + + /** + * @tc.number : TC_062-7 + * @tc.name : packing ImageSource - callback - quality 100 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-7', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_062-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-7 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:100 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-7 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } + } + }) + + /** + * @tc.number : TC_062-8 + * @tc.name : packing ImageSource - callback - quality 0 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-8', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_062-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-8 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:0 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-8 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } + } + }) + + /** + * @tc.number : TC_062-9 + * @tc.name : packing ImageSource - callback - quality -1 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-9', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_062-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-9 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:-1 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-9 success'); + expect(data == undefined).assertTrue(); + done(); + }) + } + } + }) /** * @tc.number : TC_063 - * @tc.name : release ImagePacker + * @tc.name : release ImagePacker - promise * @tc.desc : 1.create ImagePacker * 2.call release - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_063', 0, async function (done) { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_063 create image packer failed'); expect(false).assertTrue(); done(); } else { imagePackerApi.release().then(()=>{ - console.info('TC_063 release'); + console.info('TC_063 success'); expect(true).assertTrue(); done(); }).catch(()=>{ @@ -2727,23 +2917,23 @@ describe('Image', function () { /** * @tc.number : TC_063-1 - * @tc.name : release ImagePacker + * @tc.name : release ImagePacker - callback * @tc.desc : 1.create ImagePacker * 2.call release - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_063-1', 0, async function (done) { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_063-1 create image packer failed'); expect(false).assertTrue(); done(); } else { imagePackerApi.release(()=>{ - console.info('TC_063-1 release'); + console.info('TC_063-1 success'); expect(true).assertTrue(); done(); }) @@ -2752,23 +2942,23 @@ describe('Image', function () { /** * @tc.number : TC_064 - * @tc.name : release() + * @tc.name : release ImageSource - promise - png * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_064', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_064 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(()=>{ - console.info('TC_064 release'); + console.info('TC_064 success'); expect(true).assertTrue(); done(); }).catch(error => { @@ -2781,17 +2971,17 @@ describe('Image', function () { /** * @tc.number : TC_064-1 - * @tc.name : release() + * @tc.name : release ImageSource - callback - png * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_064-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { console.info('TC_064-1 create image source failed'); expect(false).assertTrue(); done(); @@ -2806,23 +2996,23 @@ describe('Image', function () { /** * @tc.number : TC_065 - * @tc.name : release() + * @tc.name : release ImageSource - promise - bmp * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_065', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { console.info('TC_065 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(()=>{ - console.info('TC_065 release'); + console.info('TC_065 success'); expect(true).assertTrue(); done(); }).catch(error => { @@ -2835,17 +3025,17 @@ describe('Image', function () { /** * @tc.number : TC_065-1 - * @tc.name : release() + * @tc.name : release ImageSource - callback - bmp * @tc.desc : 1.create ImageSource * 2.create SourceStream - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_065-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { console.info('TC_065-1 create image source failed'); expect(false).assertTrue(); done(); @@ -2860,27 +3050,27 @@ describe('Image', function () { /** * @tc.number : TC_066 - * @tc.name : release() + * @tc.name : release ImageSource - promise - gif * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_066', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_066 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(()=>{ - console.info('TC_065 release'); + console.info('TC_066 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.log('TC_065 error: ' + error); + console.log('TC_066 error: ' + error); expect().assertFail(); done(); }) @@ -2889,17 +3079,17 @@ describe('Image', function () { /** * @tc.number : TC_066-1 - * @tc.name : release() + * @tc.name : release ImageSource - callback - gif * @tc.desc : 1.create ImageSource * 2.call release() - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_066-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.gif'); + if (imageSourceApi == undefined) { console.info('TC_066-1 create image source failed'); expect(false).assertTrue(); done(); @@ -2908,28 +3098,24 @@ describe('Image', function () { console.info('TC_066-1 Success'); expect(true).assertTrue(); done(); - }).catch(()=>{ - console.info('TC_066-1 release'); - expect(false).assertTrue(); - done(); }) } }) /** * @tc.number : TC_067 - * @tc.name : Decode the image to generate a bitmap gif + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_067', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067 create image source failed'); expect(false).assertTrue(); done(); @@ -2939,21 +3125,20 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, + desiredPixelFormat:3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { console.info('TC_067 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** * @tc.number : TC_067-1 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_565-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -2962,9 +3147,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + it('TC_067-1', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-1 create image source failed'); expect(false).assertTrue(); done(); @@ -2976,30 +3161,29 @@ describe('Image', function () { rotate:10, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-1 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + console.info('TC_067-1 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** * @tc.number : TC_067-2 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + it('TC_067-2', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-2 create image source failed'); expect(false).assertTrue(); done(); @@ -3011,19 +3195,18 @@ describe('Image', function () { rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-2 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + console.info('TC_067-2 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** * @tc.number : TC_067-3 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:index 1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -3031,34 +3214,34 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-3 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { - sampleSize:-1, + sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-3 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-3 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); }) } }) /** * @tc.number : TC_067-4 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:index -1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -3066,10 +3249,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-4 create image source failed'); expect(false).assertTrue(); done(); @@ -3078,173 +3261,192 @@ describe('Image', function () { sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, + rotate:10, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:-1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-4 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_067-5 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-5 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, + sampleSize:-1, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-5 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** * @tc.number : TC_067-6 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:rotate -10})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_067-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-6 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, - desiredPixelFormat:11, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-6 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } - }) + }) /** * @tc.number : TC_067-7 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_067-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-7 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + rotate:10, + desiredPixelFormat:60, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-7 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) - /** * @tc.number : TC_067-8 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:editable false})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info(' TC_067-8 create image source failed'); + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-8 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: true, - desiredSize:{ width:400, height:400}, + editable: false, + desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info(' TC_067-8 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-8 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } - }) + }) /** * @tc.number : TC_067-9 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-9', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { console.info('TC_067-9 create image source failed'); expect(false).assertTrue(); done(); @@ -3252,35 +3454,75 @@ describe('Image', function () { let decodingOptions = { sampleSize:1, editable: true, - desiredSize:{ width:1, height:2}, + desiredSize:{ width:500, height:500}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 400, width: 500 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-9 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-9 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); }) } - }) + }) /** * @tc.number : TC_067-10 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_067-10', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_067-10 create image source failed'); + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info(' TC_067-10 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: 500, width: 500 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-11', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-11 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3289,42 +3531,127 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-10 createPixelMap'); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-12', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-12 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: 500, y: 500 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) + + /** + * @tc.number : TC_067-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-13', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) /** - * @tc.number : TC_067-11 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_067-14 + * @tc.name : createPixelMap-promise-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-11', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_067-11 create image source failed'); + it('TC_067-14', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-14 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_067-11 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + console.info('TC_067-14 success '); + expect(pixelmap !== undefined ).assertTrue(); done(); }).catch(error => { - console.log('TC_067-11 error: ' + error); + console.log('TC_067-14 error: ' + error); expect().assertFail(); done(); }) @@ -3332,8 +3659,8 @@ describe('Image', function () { }) /** - * @tc.number : TC_067-12 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_067-15 + * @tc.name : createPixelMap-pcallback-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -3342,36 +3669,37 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-12', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_067-12 create image source failed'); + it('TC_067-15', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/moving_test.gif'); + if (imageSourceApi == undefined) { + console.info('TC_067-15 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.createPixelMap(pixelmap => { - console.info('TC_067-12 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_067-15 success '); + expect(pixelmap !== undefined ).assertTrue(); done(); }) } }) + /** - * @tc.number : TC_067-13 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-13', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_067-13 create image source failed'); + it('TC_068', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3380,33 +3708,32 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 400, y: 400 }, - index:0 + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-13 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_067-14 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-14', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_067-14 create image source failed'); + it('TC_068-1', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-1 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3414,34 +3741,33 @@ describe('Image', function () { sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, - rotate:500, + rotate:10, desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 400, y: 400 }, - index:0 + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_067-14 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-1 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_068 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068 create image source failed'); + it('TC_068-2', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-2 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3450,33 +3776,32 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-2 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_068-1 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-3 + * @tc.name : createPixelMap(decodingOptions: index 1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-1 create image source failed'); + it('TC_068-3', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-3 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3485,33 +3810,38 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-1 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-2 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-2 create image source failed'); + it('TC_068-4', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-4 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3524,29 +3854,34 @@ describe('Image', function () { desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:-1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-2 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-3 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-3 create image source failed'); + it('TC_068-5', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-5 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3557,31 +3892,36 @@ describe('Image', function () { rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-3 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-4 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-4 create image source failed'); + it('TC_068-6', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-6 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3592,66 +3932,76 @@ describe('Image', function () { rotate:-10, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-4 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-5 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-5 create image source failed'); + it('TC_068-7', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-7 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:60, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-5 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-6 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-6 create image source failed'); + it('TC_068-8', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-8 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3659,104 +4009,109 @@ describe('Image', function () { sampleSize:1, editable: false, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + rotate:10, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-6 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-8 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) /** - * @tc.number : TC_068-7 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.gif'); - if (imageSourceApi == null) { - console.info('TC_068-7 create image source failed'); + it('TC_068-9', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-9 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + editable: true, + desiredSize:{ width:500, height:500}, + rotate:10, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-7 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-9 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) /** - * @tc.number : TC_068-8 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info(' TC_068-8 create image source failed'); + it('TC_068-10', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info(' TC_068-10 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, editable: true, - desiredSize:{ width:400, height:400}, + desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 500, width: 500 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info(' TC_068-8 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-9 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-9', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-9 create image source failed'); + it('TC_068-11', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-11 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3765,33 +4120,38 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 400, width: 500 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-9 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_068-10 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-10', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-10 create image source failed'); + it('TC_068-12', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-12 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3800,42 +4160,85 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 500, y: 500 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-10 createPixelMap'); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) - /** - * @tc.number : TC_068-11 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-11', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-11 create image source failed'); + it('TC_068-13', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + /** + * @tc.number : TC_068-14 + * @tc.name : createPixelMap-promise-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-14', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-14 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_068-11 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + console.info('TC_068-14 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }).catch(error => { - console.log('TC_068-11 error: ' + error); + console.log('TC_068-14 error: ' + error); expect().assertFail(); done(); }) @@ -3843,116 +4246,113 @@ describe('Image', function () { }) /** - * @tc.number : TC_068-12 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_068-15 + * @tc.name : createPixelMap-callback-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-12', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-12 create image source failed'); + it('TC_068-15', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.bmp'); + if (imageSourceApi == undefined) { + console.info('TC_068-15 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.createPixelMap(pixelmap => { - console.info('TC_068-12 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_068-15 success '); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_068-13 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-13', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-13 create image source failed'); + it('TC_163', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 440, y:440 }, - index:0 + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-13 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_068-14 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-14', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.bmp'); - if (imageSourceApi == null) { - console.info('TC_068-14 create image source failed'); + it('TC_163-1', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-1 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { sampleSize:1, editable: true, desiredSize:{ width:1, height:2}, - rotate:550, + rotate:10, desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 440, y:440 }, - index:0 + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_068-14 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-1 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_163 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163 create image source failed'); + it('TC_163-2', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-2 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -3961,33 +4361,32 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:2, + desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163 createPixelMap'); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-2 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) - /** - * @tc.number : TC_163-1 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-3 + * @tc.name : createPixelMap(decodingOptions: index 1})-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-1 create image source failed'); + it('TC_163-3', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-3 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4000,30 +4399,35 @@ describe('Image', function () { desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-1 createPixelMap '); - expect(pixelmap !== null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-2 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-2 create image source failed'); + it('TC_163-4', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-4 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4036,30 +4440,35 @@ describe('Image', function () { desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:-1 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-2 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-3 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-3 create image source failed'); + it('TC_163-5', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-5 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4070,32 +4479,37 @@ describe('Image', function () { rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-3 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-4 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-4 create image source failed'); + it('TC_163-6', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-6 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4106,68 +4520,78 @@ describe('Image', function () { rotate:-10, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-4 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-5 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-5 create image source failed'); + it('TC_163-7', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-7 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, + desiredPixelFormat:60, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-5 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-6 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-6 create image source failed'); + it('TC_163-8', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-8 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4175,107 +4599,112 @@ describe('Image', function () { sampleSize:1, editable: false, desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + rotate:10, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-6 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-8 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) /** - * @tc.number : TC_163-7 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-7 create image source failed'); + it('TC_163-9', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-9 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:11, + editable: true, + desiredSize:{ width:500, height:500}, + rotate:10, + desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-7 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-9 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } }) /** - * @tc.number : TC_163-8 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info(' TC_163-8 create image source failed'); + it('TC_163-10', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info(' TC_163-10 create image source failed'); expect(false).assertTrue(); done(); } else { let decodingOptions = { sampleSize:1, editable: true, - desiredSize:{ width:400, height:400}, + desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 500, width: 500 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info(' TC_163-8 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-9 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-9', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-9 create image source failed'); + it('TC_163-11', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-11 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4284,34 +4713,39 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 400, width: 500 }, x: 0, y: 0 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-9 createPixelMap '); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) /** - * @tc.number : TC_163-10 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions * 3.call createPixelMap * 4.set index=-1,options - * 5.return null + * 5.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-10', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-10 create image source failed'); + it('TC_163-12', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-12 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -4320,112 +4754,94 @@ describe('Image', function () { editable: true, desiredSize:{ width:1, height:2}, rotate:10, - desiredPixelFormat:1, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 500, y: 500 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-10 createPixelMap'); - expect(pixelmap == null ).assertTrue(); - done(); - }) + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) } }) - /** - * @tc.number : TC_163-11 - * @tc.name : Decode the image to generate a bitmap - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-11', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-11 create image source failed'); + * @tc.number : TC_163-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-13', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-13 create image source failed'); expect(false).assertTrue(); done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_163-11 createPixelMap'); - expect(pixelmap !== null ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_163-11 error: ' + error); - expect().assertFail(); - done(); - }) - } + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } }) - /** - * @tc.number : TC_163-12 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-14 + * @tc.name : createPixelMap-promise-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-12', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-12 create image source failed'); + it('TC_163-14', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-14 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.createPixelMap(pixelmap => { - console.info('TC_163-12 createPixelMap'); - expect(pixelmap !== null ).assertTrue(); + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_163-14 success'); + expect(pixelmap != undefined ).assertTrue(); done(); - }) - } - }) - - /** - * @tc.number : TC_163-13 - * @tc.name : Decode the image to generate a bitmap - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-13', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-13 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: 500, y:500 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-13 createPixelMap'); - expect(pixelmap == null ).assertTrue(); + }).catch(error => { + console.log('TC_163-14 error: ' + error); + expect().assertFail(); done(); }) } }) /** - * @tc.number : TC_163-14 - * @tc.name : Decode the image to generate a bitmap + * @tc.number : TC_163-15 + * @tc.name : createPixelMap-callback-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -4434,33 +4850,23 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-14', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.png'); - if (imageSourceApi == null) { - console.info('TC_163-14 create image source failed'); + it('TC_163-15', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.png'); + if (imageSourceApi == undefined) { + console.info('TC_163-15 create image source failed'); expect(false).assertTrue(); done(); } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:400, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 500, y:500 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_163-14 createPixelMap'); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_163-15 success'); + expect(pixelmap != undefined ).assertTrue(); done(); }) } - }) - + }) /** * @tc.number : TC_164 - * @tc.name : supportedFormats + * @tc.name : imagesource supportedFormats * @tc.desc : 1.create imagesource * 2.call supportedFormats * @tc.size : MEDIUM @@ -4468,22 +4874,22 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_164', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_164 create image source failed'); expect(false).assertTrue(); done(); } else { - expect(imageSourceApi.supportedFormats != null).assertTrue(); + expect(imageSourceApi.supportedFormats != undefined).assertTrue(); console.info(imageSourceApi.supportedFormats); - console.info('TC_164 suc '); + console.info('TC_164 success '); done(); } }) /** * @tc.number : TC_166 - * @tc.name : supportedFormats + * @tc.name : imagepacker supportedFormats * @tc.desc : 1.create imagepacker * 2.call supportedFormats * @tc.size : MEDIUM @@ -4492,12 +4898,12 @@ describe('Image', function () { */ it('TC_166', 0, async function (done) { const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == null) { + if (imagePackerApi == undefined) { console.info('TC_166 create image packer failed'); expect(false).assertTrue(); done(); } else { - expect(imagePackerApi.supportedFormats != null).assertTrue(); + expect(imagePackerApi.supportedFormats != undefined).assertTrue(); console.info(imagePackerApi.supportedFormats); console.info('TC_166 success '); done(); @@ -4506,17 +4912,17 @@ describe('Image', function () { /** * @tc.number : TC_167 - * @tc.name : Decode the image to generate a bitmap + * @tc.name : createPixelMap-unsupported image format * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap - * 4.callback return null + * 4.callback return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_167', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.arw'); + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.arw'); let decodingOptions = { sampleSize:1, editable: true, @@ -4526,9 +4932,9 @@ describe('Image', function () { desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index:0 }; - imageSourceApi.createPixelMap(decodingOptions, pixelmap => { - console.info('TC_167 createPixelMap '); - expect(pixelmap == null ).assertTrue(); + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_167 success '); + expect(pixelmap == undefined ).assertTrue(); done(); }) }) @@ -4545,9 +4951,9 @@ describe('Image', function () { */ it('TC_168', 0, async function (done) { const Color = new ArrayBuffer(96); - let opts = { alphaType: 0, editable: true, pixelFormat: 3, scaleMode: 1, size: { height: 2, width: 3 } } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (error,pixelmap) => { - if(pixelmap == null){ + if(pixelmap == undefined){ console.info('TC_168 create pixelmap failed'); expect(false).assertTrue(); done(); @@ -4571,8 +4977,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_169', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.jpg'); + if (imageSourceApi == undefined) { console.info('TC_169 create image source failed'); expect(false).assertTrue(); done(); @@ -4587,10 +4993,9 @@ describe('Image', function () { index:0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_169 createPixelMap '); pixelmap.getImageInfo( (err,imageInfo) => { - if (imageInfo !== null) { - console.info('TC_169 imageInfo is ready'); + if (imageInfo != undefined) { + console.info('TC_169 success'); expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); done(); @@ -4606,17 +5011,17 @@ describe('Image', function () { /** * @tc.number : TC_174 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(BitsPerSample)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174 create image source failed'); expect(false).assertTrue(); done(); @@ -4644,17 +5049,17 @@ describe('Image', function () { /** * @tc.number : TC_174-1 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(Orientation)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-1 create image source failed'); expect(false).assertTrue(); done(); @@ -4680,17 +5085,17 @@ describe('Image', function () { /** * @tc.number : TC_174-2 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageLength)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-2 create image source failed'); expect(false).assertTrue(); done(); @@ -4716,17 +5121,17 @@ describe('Image', function () { /** * @tc.number : TC_174-3 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageWidth)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-3 create image source failed'); expect(false).assertTrue(); done(); @@ -4752,17 +5157,17 @@ describe('Image', function () { /** * @tc.number : TC_174-4 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitude)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-4 create image source failed'); expect(false).assertTrue(); done(); @@ -4787,17 +5192,17 @@ describe('Image', function () { /** * @tc.number : TC_174-5 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitude)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-5 create image source failed'); expect(false).assertTrue(); done(); @@ -4823,22 +5228,22 @@ describe('Image', function () { /** * @tc.number : TC_174-6 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-6 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'}; + let property = {index:0,defaultValue:'1'}; imageSourceApi.modifyImageProperty("GPSLatitudeRef","N",property).then(() => { imageSourceApi.getImageProperty("GPSLatitudeRef",property).then((value) => { console.info('TC_174-6 GPSLatitudeRef ' + value); @@ -4859,25 +5264,25 @@ describe('Image', function () { /** * @tc.number : TC_174-7 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_174-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_174-7 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'}; - imageSourceApi.modifyImageProperty("GPSLatitudeRef","W",property).then(() => { - imageSourceApi.getImageProperty("GPSLatitudeRef",property).then((value) => { - console.info('TC_174-7 GPSLatitudeRef ' + value); + let property = {index:0,defaultValue:'1'}; + imageSourceApi.modifyImageProperty("GPSLongitudeRef","W",property).then(() => { + imageSourceApi.getImageProperty("GPSLongitudeRef",property).then((value) => { + console.info('TC_174-7 GPSLongitudeRef ' + value); expect(value == 'W').assertTrue(); done(); }).catch((err)=>{ @@ -4895,17 +5300,17 @@ describe('Image', function () { /** * @tc.number : TC_175 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(BitsPerSample)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175 create image source failed'); expect(false).assertTrue(); done(); @@ -4922,17 +5327,17 @@ describe('Image', function () { /** * @tc.number : TC_175-1 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(Orientation)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-1 create image source failed'); expect(false).assertTrue(); done(); @@ -4949,17 +5354,17 @@ describe('Image', function () { /** * @tc.number : TC_175-2 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageLength)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-2 create image source failed'); expect(false).assertTrue(); done(); @@ -4976,17 +5381,17 @@ describe('Image', function () { /** * @tc.number : TC_175-3 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageWidth)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-3 create image source failed'); expect(false).assertTrue(); done(); @@ -5003,17 +5408,17 @@ describe('Image', function () { /** * @tc.number : TC_175-4 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitude)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-4 create image source failed'); expect(false).assertTrue(); done(); @@ -5030,17 +5435,17 @@ describe('Image', function () { /** * @tc.number : TC_175-5 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitude)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-5 create image source failed'); expect(false).assertTrue(); done(); @@ -5057,17 +5462,17 @@ describe('Image', function () { /** * @tc.number : TC_175-6 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-6 create image source failed'); expect(false).assertTrue(); done(); @@ -5084,17 +5489,17 @@ describe('Image', function () { /** * @tc.number : TC_175-7 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_175-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_175-7 create image source failed'); expect(false).assertTrue(); done(); @@ -5111,22 +5516,22 @@ describe('Image', function () { /** * @tc.number : TC_176 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(BitsPerSample,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("BitsPerSample","4",property,() => { imageSourceApi.getImageProperty("BitsPerSample",property,(error,value) => { console.info('TC_176 BitsPerSample ' + value); @@ -5139,22 +5544,22 @@ describe('Image', function () { /** * @tc.number : TC_176-1 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(Orientation,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-1 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("Orientation","2",property,() => { imageSourceApi.getImageProperty("Orientation",property,(error,value) => { console.info('TC_176-1 Orientation ' + value); @@ -5167,22 +5572,22 @@ describe('Image', function () { /** * @tc.number : TC_176-2 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageLength,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-2 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("ImageLength","200",property,() => { imageSourceApi.getImageProperty("ImageLength",property,(error,value) => { console.info('TC_176-2 ImageLength ' + value); @@ -5195,22 +5600,22 @@ describe('Image', function () { /** * @tc.number : TC_176-3 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(ImageWidth,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-3 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("ImageWidth","200",property,() => { imageSourceApi.getImageProperty("ImageWidth",property,(error,value) => { console.info('TC_176-3 ImageWidth ' + value); @@ -5223,22 +5628,22 @@ describe('Image', function () { /** * @tc.number : TC_176-4 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitude,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-4 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("GPSLatitude","114,3",property,() => { imageSourceApi.getImageProperty("GPSLatitude",property,(error,value) => { console.info('TC_176-4 GPSLatitude ' + value); @@ -5251,22 +5656,22 @@ describe('Image', function () { /** * @tc.number : TC_176-5 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitude,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-5 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("GPSLongitude","18,2",property,() => { imageSourceApi.getImageProperty("GPSLongitude",property,(error,value) => { console.info('TC_176-5 GPSLongitude ' + value); @@ -5279,22 +5684,22 @@ describe('Image', function () { /** * @tc.number : TC_176-6 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLatitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-6 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("GPSLatitudeRef","N",property,() => { imageSourceApi.getImageProperty("GPSLatitudeRef",property,(error,value) => { console.info('TC_176-6 GPSLatitudeRef ' + value); @@ -5307,22 +5712,22 @@ describe('Image', function () { /** * @tc.number : TC_176-7 - * @tc.name : modifyImageProperty + * @tc.name : modifyImageProperty(GPSLongitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.call modifyImageProperty(key,value,options) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_176-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_176-7 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:1,defaultValue:'1'} + let property = {index:0,defaultValue:'1'} imageSourceApi.modifyImageProperty("GPSLongitudeRef","W",property,() => { imageSourceApi.getImageProperty("GPSLongitudeRef",property,(error,value) => { console.info('TC_176-7 GPSLongitudeRef ' + value); @@ -5335,7 +5740,7 @@ describe('Image', function () { /** * @tc.number : TC_171 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(BitsPerSample)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(BitsPerSample) @@ -5345,8 +5750,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171 create image source failed'); expect(false).assertTrue(); done(); @@ -5354,7 +5759,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("BitsPerSample") .then(data => { console.info('TC_171 BitsPerSample ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5367,7 +5772,7 @@ describe('Image', function () { /** * @tc.number : TC_171-1 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(Orientation)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(Orientation) @@ -5377,8 +5782,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-1 create image source failed'); expect(false).assertTrue(); done(); @@ -5386,7 +5791,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("Orientation") .then(data => { console.info('TC_171-1 Orientation ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5399,7 +5804,7 @@ describe('Image', function () { /** * @tc.number : TC_171-2 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageLength)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(ImageLength) @@ -5409,8 +5814,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-2 create image source failed'); expect(false).assertTrue(); done(); @@ -5418,7 +5823,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("ImageLength") .then(data => { console.info('TC_171-2 ImageLength ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5431,7 +5836,7 @@ describe('Image', function () { /** * @tc.number : TC_171-3 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageWidth)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(ImageWidth) @@ -5441,8 +5846,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-3 create image source failed'); expect(false).assertTrue(); done(); @@ -5450,7 +5855,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("ImageWidth") .then(data => { console.info('TC_171-3 ImageWidth ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5463,7 +5868,7 @@ describe('Image', function () { /** * @tc.number : TC_171-4 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitude)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLatitude) @@ -5473,8 +5878,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-4 create image source failed'); expect(false).assertTrue(); done(); @@ -5482,7 +5887,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("GPSLatitude") .then(data => { console.info('TC_171-4 GPSLatitude ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5495,7 +5900,7 @@ describe('Image', function () { /** * @tc.number : TC_171-5 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitude)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLongitude) @@ -5505,8 +5910,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-5 create image source failed'); expect(false).assertTrue(); done(); @@ -5514,7 +5919,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("GPSLongitude") .then(data => { console.info('TC_171-5 GPSLongitude ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5527,7 +5932,7 @@ describe('Image', function () { /** * @tc.number : TC_171-6 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitudeRef)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLatitudeRef) @@ -5537,8 +5942,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-6 create image source failed'); expect(false).assertTrue(); done(); @@ -5546,7 +5951,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("GPSLatitudeRef") .then(data => { console.info('TC_171-6 GPSLatitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5559,7 +5964,7 @@ describe('Image', function () { /** * @tc.number : TC_171-7 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitudeRef)-promise * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLongitudeRef) @@ -5569,8 +5974,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-7 create image source failed'); expect(false).assertTrue(); done(); @@ -5578,7 +5983,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("GPSLongitudeRef") .then(data => { console.info('TC_171-7 GPSLongitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5591,7 +5996,7 @@ describe('Image', function () { /** * @tc.number : TC_171-8 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(DateTimeOriginal) * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(ImageLength) @@ -5601,8 +6006,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_171-8 create image source failed'); expect(false).assertTrue(); done(); @@ -5610,7 +6015,7 @@ describe('Image', function () { imageSourceApi.getImageProperty("DateTimeOriginal") .then(data => { console.info('TC_171-8 DateTimeOriginal ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) .catch(error => { @@ -5623,24 +6028,24 @@ describe('Image', function () { /** * @tc.number : TC_172 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(BitsPerSample)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(BitsPerSample) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("BitsPerSample",(error,data) => { console.info('TC_172 BitsPerSample ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5648,24 +6053,24 @@ describe('Image', function () { /** * @tc.number : TC_172-1 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(Orientation)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(Orientation) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-1 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("Orientation",(error,data) => { console.info('TC_172-1 Orientation ' + data); - expect(data !== undefined && data !== null && data !== '').assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); }) } @@ -5673,24 +6078,24 @@ describe('Image', function () { /** * @tc.number : TC_172-2 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageLength)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(ImageLength) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-2 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageLength",(error,data) => { console.info('TC_172-2 ImageLength ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5698,24 +6103,24 @@ describe('Image', function () { /** * @tc.number : TC_172-3 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageWidth)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(ImageWidth) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-3 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageWidth",(error,data) => { console.info('TC_172-3 ImageWidth ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5723,24 +6128,24 @@ describe('Image', function () { /** * @tc.number : TC_172-4 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitude)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLatitude) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-4 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitude",(error,data) => { console.info('TC_172-4 GPSLatitude ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5748,24 +6153,24 @@ describe('Image', function () { /** * @tc.number : TC_172-5 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitude)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLongitude) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-5 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitude",(error,data) => { console.info('TC_172-5 GPSLongitude ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5773,24 +6178,24 @@ describe('Image', function () { /** * @tc.number : TC_172-6 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLatitudeRef) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-6 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitudeRef",(error,data) => { console.info('TC_172-6 GPSLatitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5798,24 +6203,24 @@ describe('Image', function () { /** * @tc.number : TC_172-7 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLongitudeRef) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-7 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitudeRef",(error,data) => { console.info('TC_172-7 GPSLongitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5823,24 +6228,24 @@ describe('Image', function () { /** * @tc.number : TC_172-8 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(DateTimeOriginal)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(DateTimeOriginal) - * 3.return null + * 3.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_172-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_172-8 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("DateTimeOriginal",(error,data) => { console.info('TC_172-8 DateTimeOriginal ' + data); - expect(data !== null && data !== undefined && data !== '' ).assertTrue(); + expect(data != undefined && data != '' ).assertTrue(); done(); }) } @@ -5848,18 +6253,18 @@ describe('Image', function () { /** * @tc.number : TC_173 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(BitsPerSample,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(BitsPerSample,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173 create image source failed'); expect(false).assertTrue(); done(); @@ -5867,8 +6272,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => { console.info('TC_173 BitsPerSample ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -5876,18 +6280,18 @@ describe('Image', function () { /** * @tc.number : TC_173-1 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(Orientation,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(Orientation,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-1', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-1 create image source failed'); expect(false).assertTrue(); done(); @@ -5895,8 +6299,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("Orientation",property,(error,data) => { console.info('TC_173-1 Orientation ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -5904,18 +6307,18 @@ describe('Image', function () { /** * @tc.number : TC_173-2 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageLength,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(ImageLength,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-2', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-2 create image source failed'); expect(false).assertTrue(); done(); @@ -5923,8 +6326,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("ImageLength",property,(error,data) => { console.info('TC_173-2 ImageLength ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -5932,18 +6334,18 @@ describe('Image', function () { /** * @tc.number : TC_173-3 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(ImageWidth,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(ImageWidth,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-3', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-3 create image source failed'); expect(false).assertTrue(); done(); @@ -5951,8 +6353,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("ImageWidth",property,(error,data) => { console.info('TC_173-3 ImageWidth ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -5960,18 +6361,18 @@ describe('Image', function () { /** * @tc.number : TC_173-4 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitude,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLatitude,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-4 create image source failed'); expect(false).assertTrue(); done(); @@ -5979,8 +6380,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("GPSLatitude",property,(error,data) => { console.info('TC_173-4 GPSLatitude ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -5988,18 +6388,18 @@ describe('Image', function () { /** * @tc.number : TC_173-5 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitude,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLongitude,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-5 create image source failed'); expect(false).assertTrue(); done(); @@ -6007,8 +6407,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("GPSLongitude",property,(error,data) => { console.info('TC_173-5 GPSLongitude ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -6016,18 +6415,18 @@ describe('Image', function () { /** * @tc.number : TC_173-6 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLatitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLatitudeRef,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-6', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-6 create image source failed'); expect(false).assertTrue(); done(); @@ -6035,8 +6434,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("GPSLatitudeRef",property,(error,data) => { console.info('TC_173-6 GPSLatitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -6044,18 +6442,18 @@ describe('Image', function () { /** * @tc.number : TC_173-7 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(GPSLongitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(GPSLongitudeRef,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-7', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-7 create image source failed'); expect(false).assertTrue(); done(); @@ -6063,8 +6461,7 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("GPSLongitudeRef",property,(error,data) => { console.info('TC_173-7 GPSLongitudeRef ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } @@ -6072,18 +6469,18 @@ describe('Image', function () { /** * @tc.number : TC_173-8 - * @tc.name : getImageProperty + * @tc.name : getImageProperty(DateTimeOriginal,property)-callback * @tc.desc : 1.create imagesource * 2.set property * 3.call getImageProperty(DateTimeOriginal,property) - * 4.return null + * 4.return undefined * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ it('TC_173-8', 0, async function (done) { - const imageSourceApi = image.createImageSource('/data/local/tmp/test_exif.jpg'); - if (imageSourceApi == null) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test_exif.jpg'); + if (imageSourceApi == undefined) { console.info('TC_173-8 create image source failed'); expect(false).assertTrue(); done(); @@ -6091,10 +6488,9 @@ describe('Image', function () { let property = {index:0,defaultValue:'9999'} imageSourceApi.getImageProperty("DateTimeOriginal",property,(error,data) => { console.info('TC_173-8 DateTimeOriginal ' + data); - expect(data !== null && data !== undefined && data !== '').assertTrue(); - expect(data !== '9999').assertTrue(); + expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); }) } }) -}) \ No newline at end of file +}) diff --git a/multimedia/image/image_js_standard/src/main/js/test/testImg.js b/multimedia/image/image_js_standard/src/main/js/test/testImg.js index fcc392723..7527cec4b 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/testImg.js +++ b/multimedia/image/image_js_standard/src/main/js/test/testImg.js @@ -12,8 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, - 219, 0, 67, 0, 2, 1, 1, 2, 1, 1, 2, + +let tc_020buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) +let tc_020_1buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) +let tc_021buf = new Uint8Array([0,0,0,4,0,0,0,8]) +let tc_021_1buf = new Uint8Array([0,0,0,4,0,0,0,8]) +let tc_022buf = new Uint8Array([0,0,0,4,0,0,0,8]) + +let testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, 219, 0, 67, 0, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5, 3, 3, 3, 3, 3, 6, 4, 4, 3, 5, 7, 6, 7, 7, 7, 6, 7, 7, 8, 9, 11, 9, 8, 8, 10, 8, 7, 7, 10, 13, 10, 10, 11, 12, 12, 12, 12, 7, 9, 14, 15, 13, 12, 14, 11, 12, 12, 12, 255, 219, 0, 67, 1, 2, 2, 2, 3, 3, 3, 6, 3, 3, 6, 12, 8, 7, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, @@ -605,6 +611,5 @@ let testPng = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 19, 255, 28, 240, 23, 223, 64, 127, 237, 65, 62, 251, 233, 207, 228, 181, 27, 215, 87, 115, 206, 40, 125, 211, 16, 0, 0, 0, 35, 73, 68, 65, 84, 149, 164, 204, 8, 133, 132, 13, 22, 190, 173, 132, 22, 133, 166, 164, 186, 251, 158, 143, 248, 248, 248, 136, 103, 158, 125, 134, 127, 94, 252, 223, 160, 16, 125, 12, 251, 15, 241, 139, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]) - - - export {testPng, testJpg} \ No newline at end of file + + export {testPng, testJpg, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} \ No newline at end of file -- GitLab