提交 8329ca49 编写于 作者: L lwx1121892

<liuxueqi3@huawei.com>

Signed-off-by: Nlwx1121892 <liuxueqi3@huawei.com>
上级 53660364
......@@ -17,7 +17,7 @@ import image from '@ohos.multimedia.image'
import fileio from '@ohos.fileio'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { testPng, testJpg } from './testImg'
import { tc_020Buf, tc_020_1Buf, tc_021Buf, tc_021_1Buf, tc_022Buf } from './testImg'
import { tcBuf020, tc_020_1Buf, tcBuf021, tcBuf021_1, tcBuf022 } from './testImg'
import featureAbility from '@ohos.ability.featureAbility'
export default function imageJsTest() {
......@@ -218,7 +218,7 @@ export default function imageJsTest() {
/**
* @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
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
......@@ -336,7 +336,7 @@ export default function imageJsTest() {
var bufferArr2 = new Uint8Array(readBuffer);
var res = true;
for (var i = 0; i < bufferArr2.length; i++) {
if (bufferArr2[i] != tc_020Buf[i]) {
if (bufferArr2[i] != tcBuf020[i]) {
res = false;
console.info('TC_20_buffer' + bufferArr2[i]);
console.info('TC_020 failed');
......@@ -498,7 +498,7 @@ export default function imageJsTest() {
var bufferArr2 = new Uint8Array(area.pixels);
var res = true;
for (var i = 0; i < bufferArr2.length; i++) {
if (bufferArr2[i] != tc_021Buf[i]) {
if (bufferArr2[i] != tcBuf021[i]) {
res = false;
console.info('TC_021 failed');
expect(false).assertTrue();
......@@ -556,7 +556,7 @@ export default function imageJsTest() {
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]) {
if (bufferArr[i] != tcBuf021_1[i]) {
res = false;
console.info('TC_021-1 failed');
expect(false).assertTrue();
......@@ -794,7 +794,7 @@ export default function imageJsTest() {
var readArr = new Uint8Array(readArea.pixels);
var res = true;
for (var i = 0; i < readArr.length; i++) {
if (readArr[i] != tc_022Buf[i]) {
if (readArr[i] != tcBuf022[i]) {
res = false;
console.info('TC_022 failed');
expect(false).assertTrue();
......@@ -816,6 +816,7 @@ export default function imageJsTest() {
done();
})
})
/**
* @tc.number : TC_022-1
* @tc.name : writePixels-callback
......@@ -859,7 +860,7 @@ export default function imageJsTest() {
var readArr = new Uint8Array(readArea.pixels);
var res = true;
for (var i = 0; i < readArr.length; i++) {
if (readArr[i] != tc_022Buf[i]) {
if (readArr[i] != tcBuf022[i]) {
res = false;
console.info('TC_022-1 failed');
expect(false).assertTrue();
......
......@@ -607,14 +607,14 @@ let testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1
2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160,
2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 15, 255, 217])
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 tcBuf020 = 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 tcBuf020_1 = 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 tcBuf021 = 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 tcBuf021_1 = new Uint8Array([0,0,0,4,0,0,0,8])
let tc_022Buf = new Uint8Array([0,0,0,4,0,0,0,8])
let tcBuf022 = new Uint8Array([0,0,0,4,0,0,0,8])
export { testPng, testJpg ,tc_020Buf, tc_020_1Buf, tc_021Buf, tc_021_1Buf, tc_022Buf}
\ No newline at end of file
export { testPng, testJpg ,tcBuf020, tcBuf020_1, tcBuf021, tcBuf021_1, tcBuf022}
\ No newline at end of file
......@@ -54,7 +54,7 @@ describe('imagePacking', function () {
console.info('afterAll case');
})
function packing_Promise(done, testNum, pixFormat, arg) {
function packingPromise(done, testNum, pixFormat, arg) {
let opts;
const Color = new ArrayBuffer(96);
if (pixFormat == 2) {
......@@ -100,7 +100,7 @@ describe('imagePacking', function () {
})
}
function packing_Cb(done, testNum, pixFormat, arg) {
function packingCb(done, testNum, pixFormat, arg) {
let opts;
const Color = new ArrayBuffer(96);
if (pixFormat == 2) {
......@@ -146,7 +146,7 @@ describe('imagePacking', function () {
})
}
function packing_Cb_Fail(done, testNum, pixFormat, arg) {
function packingCbFail(done, testNum, pixFormat, arg) {
const Color = new ArrayBuffer(96);
if (pixFormat == 2) {
var opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } }
......@@ -179,7 +179,7 @@ describe('imagePacking', function () {
})
}
function packing_Promise_Fail(done, testNum, pixFormat, arg) {
function packingPromiseFail(done, testNum, pixFormat, arg) {
const Color = new ArrayBuffer(96);
if (pixFormat == 2) {
var opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } }
......@@ -228,7 +228,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_001', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 99 }
packing_Promise(done, 'SUB_IMAGE_packing_P_001', 2, packOpts)
packingPromise(done, 'SUB_IMAGE_packing_P_001', 2, packOpts)
})
/**
......@@ -243,7 +243,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_002', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 123 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_002', 2, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_002', 2, packOpts)
})
/**
......@@ -258,7 +258,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_003', 0, async function (done) {
let packOpts = { format: "image/jpeg" }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_003', 2, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_003', 2, packOpts)
})
/**
......@@ -273,7 +273,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_004', 0, async function (done) {
let packOpts = { quality: 99 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_004', 2, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_004', 2, packOpts)
})
/**
......@@ -288,7 +288,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_005', 0, async function (done) {
let packOpts = { format: "image/png", quality: 99 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_005', 2, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_005', 2, packOpts)
})
/**
......@@ -303,7 +303,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_006', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 50 }
packing_Promise(done, 'SUB_IMAGE_packing_P_006', 5, packOpts)
packingPromise(done, 'SUB_IMAGE_packing_P_006', 5, packOpts)
})
/**
......@@ -318,7 +318,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_007', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 123 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_007', 5, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_007', 5, packOpts)
})
/**
......@@ -333,7 +333,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_008', 0, async function (done) {
let packOpts = { format: "image/jpeg" }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_008', 5, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_008', 5, packOpts)
})
/**
......@@ -348,7 +348,7 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_009', 0, async function (done) {
let packOpts = { quality: 99 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_009', 5, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_009', 5, packOpts)
})
/**
......@@ -363,12 +363,12 @@ describe('imagePacking', function () {
*/
it('SUB_IMAGE_packing_P_010', 0, async function (done) {
let packOpts = { format: "image/png", quality: 99 }
packing_Promise_Fail(done, 'SUB_IMAGE_packing_P_010', 5, packOpts)
packingPromiseFail(done, 'SUB_IMAGE_packing_P_010', 5, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_001
* @tc.name : SUB_IMAGE_packing_Cb_001
* @tc.number : SUB_IMAGE_packingCb_001
* @tc.name : SUB_IMAGE_packingCb_001
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -376,14 +376,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_001', 0, async function (done) {
it('SUB_IMAGE_packingCb_001', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 99 }
packing_Cb(done, 'SUB_IMAGE_packing_Cb_001', 2, packOpts)
packingCb(done, 'SUB_IMAGE_packingCb_001', 2, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_002
* @tc.name : SUB_IMAGE_packing_Cb_002 - callback - RGB565 quality 123
* @tc.number : SUB_IMAGE_packingCb_002
* @tc.name : SUB_IMAGE_packingCb_002 - callback - RGB565 quality 123
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -391,15 +391,15 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_002', 0, async function (done) {
it('SUB_IMAGE_packingCb_002', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 123 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_002', 2, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_002', 2, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_003
* @tc.name : SUB_IMAGE_packing_Cb_003 - callback - RGB565 quality null
* @tc.number : SUB_IMAGE_packingCb_003
* @tc.name : SUB_IMAGE_packingCb_003 - callback - RGB565 quality null
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -407,14 +407,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_003', 0, async function (done) {
it('SUB_IMAGE_packingCb_003', 0, async function (done) {
let packOpts = { format: "image/jpeg" }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_003', 2, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_003', 2, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_004
* @tc.name : SUB_IMAGE_packing_Cb_004 - callback - RGB565 format null
* @tc.number : SUB_IMAGE_packingCb_004
* @tc.name : SUB_IMAGE_packingCb_004 - callback - RGB565 format null
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -422,14 +422,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_004', 0, async function (done) {
it('SUB_IMAGE_packingCb_004', 0, async function (done) {
let packOpts = { quality: 99 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_004', 2, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_004', 2, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_005
* @tc.name : SUB_IMAGE_packing_Cb_005 - callback - RGB565 wrong format
* @tc.number : SUB_IMAGE_packingCb_005
* @tc.name : SUB_IMAGE_packingCb_005 - callback - RGB565 wrong format
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -437,14 +437,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_005', 0, async function (done) {
it('SUB_IMAGE_packingCb_005', 0, async function (done) {
let packOpts = { format: "image/png", quality: 99 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_005', 2, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_005', 2, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_006
* @tc.name : SUB_IMAGE_packing_Cb_006
* @tc.number : SUB_IMAGE_packingCb_006
* @tc.name : SUB_IMAGE_packingCb_006
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -452,14 +452,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_006', 0, async function (done) {
it('SUB_IMAGE_packingCb_006', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 50 }
packing_Cb(done, 'SUB_IMAGE_packing_Cb_006', 5, packOpts)
packingCb(done, 'SUB_IMAGE_packingCb_006', 5, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_007
* @tc.name : SUB_IMAGE_packing_Cb_007 - callback - RGB888 quality 123
* @tc.number : SUB_IMAGE_packingCb_007
* @tc.name : SUB_IMAGE_packingCb_007 - callback - RGB888 quality 123
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -467,15 +467,15 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_007', 0, async function (done) {
it('SUB_IMAGE_packingCb_007', 0, async function (done) {
let packOpts = { format: "image/jpeg", quality: 123 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_007', 5, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_007', 5, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_008
* @tc.name : SUB_IMAGE_packing_Cb_008 - callback - RGB888 quality null
* @tc.number : SUB_IMAGE_packingCb_008
* @tc.name : SUB_IMAGE_packingCb_008 - callback - RGB888 quality null
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -483,14 +483,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_008', 0, async function (done) {
it('SUB_IMAGE_packingCb_008', 0, async function (done) {
let packOpts = { format: "image/jpeg" }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_008', 5, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_008', 5, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_009
* @tc.name : SUB_IMAGE_packing_Cb_009 - callback - RGB888 format null
* @tc.number : SUB_IMAGE_packingCb_009
* @tc.name : SUB_IMAGE_packingCb_009 - callback - RGB888 format null
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -498,14 +498,14 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_009', 0, async function (done) {
it('SUB_IMAGE_packingCb_009', 0, async function (done) {
let packOpts = { quality: 99 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_009', 5, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_009', 5, packOpts)
})
/**
* @tc.number : SUB_IMAGE_packing_Cb_010
* @tc.name : SUB_IMAGE_packing_Cb_010 - callback - RGB888 wrong format
* @tc.number : SUB_IMAGE_packingCb_010
* @tc.name : SUB_IMAGE_packingCb_010 - callback - RGB888 wrong format
* @tc.desc : 1.create PixelMap
* 2.create ImagePacker
* 3.call packing
......@@ -513,9 +513,9 @@ describe('imagePacking', function () {
* @tc.type : Functional
* @tc.level : level 0
*/
it('SUB_IMAGE_packing_Cb_010', 0, async function (done) {
it('SUB_IMAGE_packingCb_010', 0, async function (done) {
let packOpts = { format: "image/png", quality: 99 }
packing_Cb_Fail(done, 'SUB_IMAGE_packing_Cb_010', 5, packOpts)
packingCbFail(done, 'SUB_IMAGE_packingCb_010', 5, packOpts)
})
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册