1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import image from "@ohos.multimedia.image"; 17import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, Level } from "@ohos/hypium"; 18 19export default function Image() { 20describe("Image", function () { 21 let globalpixelmap; 22 const { RGBA_F16, BGRA_8888, ALPHA_8, RGB_565, ARGB_8888, UNKNOWN, RGB_888 } = image.PixelMapFormat; 23 24 beforeAll(function () { 25 console.info("beforeAll case"); 26 }); 27 28 beforeEach(function () { 29 console.info("beforeEach case"); 30 }); 31 32 afterEach(async function () { 33 if (globalpixelmap != undefined) { 34 console.info("globalpixelmap release start"); 35 try { 36 await globalpixelmap.release(); 37 } catch (error) { 38 console.info("globalpixelmap release fail"); 39 } 40 } 41 console.info("afterEach case"); 42 }); 43 44 afterAll(function () { 45 console.info("afterAll case"); 46 }); 47 48 /** 49 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100 50 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_F16, 51 * size: { height: 4, width: 6 }, bytes = buffer) 52 * @tc.desc : 1.create InitializationOptions object 53 * 2.set editable,pixeFormat,size 54 * 3.using color and opts create newPixelMap 55 * 4.return newpixelmap not empty 56 * @tc.size : MEDIUM 57 * @tc.type : Functional 58 * @tc.level : Level 0 59 */ 60 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100", Level.LEVEL0, async function (done) { 61 const Color = new ArrayBuffer(96); 62 let opts = { editable: true, pixelFormat: RGBA_F16, size: { height: 4, width: 6 } }; 63 image 64 .createPixelMap(Color, opts) 65 .then((pixelmap) => { 66 globalpixelmap = pixelmap; 67 expect(pixelmap != undefined).assertTrue(); 68 expect(pixelmap.isEditable == opts.editable).assertTrue(); 69 done(); 70 }) 71 .catch((error) => { 72 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100 err" + error); 73 expect(false).assertTrue(); 74 done(); 75 }); 76 }); 77 78 /** 79 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100 80 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_F16, 81 * size: { height: 4, width: 6 },bytes = buffer) 82 * @tc.desc : 1.create InitializationOptions object 83 * 2.set editable,pixelFormat,size 84 * 3.using color and opts create newPixelMap 85 * 4.return newpixelmap not empty 86 * @tc.size : MEDIUM 87 * @tc.type : Functional 88 * @tc.level : Level 0 89 */ 90 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100", Level.LEVEL0, async function (done) { 91 const Color = new ArrayBuffer(96); 92 let opts = { editable: true, pixelFormat: RGBA_F16, size: { height: 4, width: 6 } }; 93 image.createPixelMap(Color, opts, (err, pixelmap) => { 94 if (err != undefined) { 95 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100 err: " + err); 96 expect(false).assertTrue(); 97 done(); 98 return; 99 } 100 globalpixelmap = pixelmap; 101 expect(pixelmap != undefined).assertTrue(); 102 expect(pixelmap.isEditable == opts.editable).assertTrue(); 103 done(); 104 }); 105 }); 106 107 /** 108 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200 109 * @tc.name : create pixelmap-promise (editable: false, pixelFormat: RGBA_F16, 110 * size: { height: 4, width: 6 }, bytes = buffer) 111 * @tc.desc : 1.create InitializationOptions object 112 * 2.set editable,pixeFormat,size 113 * 3.using color and opts create newPixelMap 114 * 4.return newpixelmap not empty 115 * @tc.size : MEDIUM 116 * @tc.type : Functional 117 * @tc.level : Level 0 118 */ 119 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200", Level.LEVEL0, async function (done) { 120 const Color = new ArrayBuffer(96); 121 let opts = { editable: false, pixelFormat: RGBA_F16, size: { height: 4, width: 6 } }; 122 image 123 .createPixelMap(Color, opts) 124 .then((pixelmap) => { 125 globalpixelmap = pixelmap; 126 expect(pixelmap != undefined).assertTrue(); 127 expect(pixelmap.isEditable == opts.editable).assertTrue(); 128 done(); 129 }) 130 .catch((error) => { 131 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200 err" + error); 132 expect(false).assertTrue(); 133 done(); 134 }); 135 }); 136 137 /** 138 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200 139 * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_F16, 140 * size: { height: 4, width: 6 },bytes = buffer) 141 * @tc.desc : 1.create InitializationOptions object 142 * 2.set editable,pixelFormat,size 143 * 3.using color and opts create newPixelMap 144 * 4.return newpixelmap not empty 145 * @tc.size : MEDIUM 146 * @tc.type : Functional 147 * @tc.level : Level 0 148 */ 149 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200", Level.LEVEL0, async function (done) { 150 const Color = new ArrayBuffer(96); 151 let opts = { editable: false, pixelFormat: RGBA_F16, size: { height: 4, width: 6 } }; 152 image.createPixelMap(Color, opts, (err, pixelmap) => { 153 if (err != undefined) { 154 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200 err: " + err); 155 expect(false).assertTrue(); 156 done(); 157 return; 158 } 159 globalpixelmap = pixelmap; 160 expect(pixelmap != undefined).assertTrue(); 161 expect(pixelmap.isEditable == opts.editable).assertTrue(); 162 done(); 163 }); 164 }); 165 166 /** 167 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0300 168 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ALPHA_8, 169 * size: { height: 4, width: 6 }, bytes = buffer) 170 * @tc.desc : 1.create InitializationOptions object 171 * 2.set editable,pixeFormat,size 172 * 3.using color and opts create newPixelMap 173 * 4.return newpixelmap not empty 174 * @tc.size : MEDIUM 175 * @tc.type : Functional 176 * @tc.level : Level 0 177 */ 178 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0300", Level.LEVEL0, async function (done) { 179 const Color = new ArrayBuffer(96); 180 let opts = { editable: true, pixelFormat: ALPHA_8, size: { height: 4, width: 6 } }; 181 image 182 .createPixelMap(Color, opts) 183 .then((pixelmap) => { 184 globalpixelmap = pixelmap; 185 expect(pixelmap != undefined).assertTrue(); 186 expect(pixelmap.isEditable == opts.editable).assertTrue(); 187 done(); 188 }) 189 .catch((error) => { 190 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0300 err" + error); 191 expect(false).assertTrue(); 192 done(); 193 }); 194 }); 195 196 /** 197 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400 198 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_565, 199 * size: { height: 4, width: 6 }, bytes = buffer) 200 * @tc.desc : 1.create InitializationOptions object 201 * 2.set editable,pixeFormat,size 202 * 3.using color and opts create newPixelMap 203 * 4.return newpixelmap not empty 204 * @tc.size : MEDIUM 205 * @tc.type : Functional 206 * @tc.level : Level 0 207 */ 208 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400", Level.LEVEL0, async function (done) { 209 const Color = new ArrayBuffer(96); 210 let opts = { editable: true, pixelFormat: RGB_565, size: { height: 4, width: 6 } }; 211 image 212 .createPixelMap(Color, opts) 213 .then((pixelmap) => { 214 globalpixelmap = pixelmap; 215 expect(pixelmap != undefined).assertTrue(); 216 expect(pixelmap.isEditable == opts.editable).assertTrue(); 217 done(); 218 }) 219 .catch((error) => { 220 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400 err" + error); 221 expect(false).assertTrue(); 222 done(); 223 }); 224 }); 225 226 /** 227 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500 228 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ARGB_8888, 229 * size: { height: 4, width: 6 }, bytes = buffer) 230 * @tc.desc : 1.create InitializationOptions object 231 * 2.set editable,pixeFormat,size 232 * 3.using color and opts create newPixelMap 233 * 4.return newpixelmap not empty 234 * @tc.size : MEDIUM 235 * @tc.type : Functional 236 * @tc.level : Level 0 237 */ 238 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500", Level.LEVEL0, async function (done) { 239 const Color = new ArrayBuffer(96); 240 let opts = { editable: true, pixelFormat: ARGB_8888, size: { height: 4, width: 6 } }; 241 image 242 .createPixelMap(Color, opts) 243 .then((pixelmap) => { 244 globalpixelmap = pixelmap; 245 expect(pixelmap != undefined).assertTrue(); 246 expect(pixelmap.isEditable == opts.editable).assertTrue(); 247 done(); 248 }) 249 .catch((error) => { 250 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500 err" + error); 251 expect(false).assertTrue(); 252 done(); 253 }); 254 }); 255 256 /** 257 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 258 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ALPHA_8, 259 * size: { height: 4, width: 6 },bytes = buffer) 260 * @tc.desc : 1.create InitializationOptions object 261 * 2.set editable,pixelFormat,size 262 * 3.using color and opts create newPixelMap 263 * 4.return newpixelmap not empty 264 * @tc.size : MEDIUM 265 * @tc.type : Functional 266 * @tc.level : Level 0 267 */ 268 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300", Level.LEVEL0, async function (done) { 269 const Color = new ArrayBuffer(96); 270 let opts = { editable: true, pixelFormat: ALPHA_8, size: { height: 4, width: 6 } }; 271 image.createPixelMap(Color, opts, (err, pixelmap) => { 272 if (err != undefined) { 273 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 err: " + err); 274 expect(false).assertTrue(); 275 done(); 276 return; 277 } 278 globalpixelmap = pixelmap; 279 expect(pixelmap != undefined).assertTrue(); 280 expect(pixelmap.isEditable == opts.editable).assertTrue(); 281 done(); 282 }); 283 }); 284 285 /** 286 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400 287 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGB_565, 288 * size: { height: 4, width: 6 },bytes = buffer) 289 * @tc.desc : 1.create InitializationOptions object 290 * 2.set editable,pixelFormat,size 291 * 3.using color and opts create newPixelMap 292 * 4.return newpixelmap not empty 293 * @tc.size : MEDIUM 294 * @tc.type : Functional 295 * @tc.level : Level 0 296 */ 297 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400", Level.LEVEL0, async function (done) { 298 const Color = new ArrayBuffer(96); 299 let opts = { editable: true, pixelFormat: RGB_565, size: { height: 4, width: 6 } }; 300 image.createPixelMap(Color, opts, (err, pixelmap) => { 301 if (err != undefined) { 302 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400 err: " + err); 303 expect(false).assertTrue(); 304 done(); 305 return; 306 } 307 globalpixelmap = pixelmap; 308 expect(pixelmap != undefined).assertTrue(); 309 expect(pixelmap.isEditable == opts.editable).assertTrue(); 310 done(); 311 }); 312 }); 313 314 /** 315 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500 316 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ARGB_8888, 317 * size: { height: 4, width: 6 },bytes = buffer) 318 * @tc.desc : 1.create InitializationOptions object 319 * 2.set editable,pixelFormat,size 320 * 3.using color and opts create newPixelMap 321 * 4.return newpixelmap not empty 322 * @tc.size : MEDIUM 323 * @tc.type : Functional 324 * @tc.level : Level 0 325 */ 326 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500", Level.LEVEL0, async function (done) { 327 const Color = new ArrayBuffer(96); 328 let opts = { editable: true, pixelFormat: ARGB_8888, size: { height: 4, width: 6 } }; 329 image.createPixelMap(Color, opts, (err, pixelmap) => { 330 if (err != undefined) { 331 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500 err: " + err); 332 expect(false).assertTrue(); 333 done(); 334 return; 335 } 336 globalpixelmap = pixelmap; 337 expect(pixelmap != undefined).assertTrue(); 338 expect(pixelmap.isEditable == opts.editable).assertTrue(); 339 done(); 340 }); 341 }); 342 343 /** 344 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 345 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) 346 * @tc.desc : 1.create InitializationOptions object 347 * 2.set editable,pixeFormat,size 348 * 3.using color and opts create newPixelMap 349 * 4.return newpixelmap empty 350 * @tc.size : MEDIUM 351 * @tc.type : Functional 352 * @tc.level : Level 0 353 */ 354 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600", Level.LEVEL0, async function (done) { 355 const Color = new ArrayBuffer(96); 356 let opts = { editable: true, pixelFormat: UNKNOWN, size: { height: -1, width: 8 } }; 357 image.createPixelMap(Color, opts, (err, pixelmap) => { 358 if (err) { 359 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 err: " + err); 360 expect(pixelmap == undefined).assertTrue(); 361 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 pass"); 362 done(); 363 } else { 364 expect(false).assertTrue(); 365 done(); 366 } 367 }); 368 }); 369 370 /** 371 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 372 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: ARGB_8888, size: { height: 6, width: -1 }) 373 * @tc.desc : 1.create InitializationOptions object 374 * 2.set editable,pixeFormat,size 375 * 3.using color and opts create newPixelMap 376 * 4.return newpixelmap empty 377 * @tc.size : MEDIUM 378 * @tc.type : Functional 379 * @tc.level : Level 0 380 */ 381 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700", Level.LEVEL0, async function (done) { 382 const Color = new ArrayBuffer(96); 383 let opts = { editable: true, pixelFormat: ARGB_8888, size: { height: 6, width: -1 } }; 384 image.createPixelMap(Color, opts, (err, pixelmap) => { 385 if (err) { 386 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 err: " + err); 387 expect(pixelmap == undefined).assertTrue(); 388 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 pass"); 389 done(); 390 } else { 391 expect(false).assertTrue(); 392 done(); 393 } 394 }); 395 }); 396 397 /** 398 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 399 * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) 400 * @tc.desc : 1.create InitializationOptions object 401 * 2.set editable,pixeFormat,size 402 * 3.using color and opts create newPixelMap 403 * 4.return newpixelmap empty 404 * @tc.size : MEDIUM 405 * @tc.type : Functional 406 * @tc.level : Level 0 407 */ 408 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600", Level.LEVEL0, async function (done) { 409 const Color = new ArrayBuffer(96); 410 let opts = { editable: true, pixelFormat: UNKNOWN, size: { height: -1, width: 8 } }; 411 image 412 .createPixelMap(Color, opts) 413 .then((pixelmap) => { 414 expect(false).assertTrue(); 415 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 failed"); 416 done(); 417 }) 418 .catch((error) => { 419 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 err: " + error); 420 done(); 421 }); 422 }); 423 424 /** 425 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 426 * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: -1 }) 427 * @tc.desc : 1.create InitializationOptions object 428 * 2.set editable,pixeFormat,size 429 * 3.using color and opts create newPixelMap 430 * 4.return newpixelmap empty 431 * @tc.size : MEDIUM 432 * @tc.type : Functional 433 * @tc.level : Level 0 434 */ 435 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700", Level.LEVEL0, async function (done) { 436 const Color = new ArrayBuffer(96); 437 let opts = { editable: true, pixelFormat: UNKNOWN, size: { height: 6, width: -1 } }; 438 image 439 .createPixelMap(Color, opts) 440 .then((pixelmap) => { 441 expect(false).assertTrue(); 442 console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 failed"); 443 done(); 444 }) 445 .catch((error) => { 446 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 error: " + error); 447 done(); 448 }); 449 }); 450 451 /** 452 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 453 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: BGRA_8888, 454 * size: { height: 4, width: 6 }, bytes = buffer) 455 * @tc.desc : 1.create InitializationOptions object 456 * 2.set editable,pixeFormat,size 457 * 3.using color and opts create newPixelMap 458 * 4.return newpixelmap not empty 459 * @tc.size : MEDIUM 460 * @tc.type : Functional 461 * @tc.level : Level 0 462 */ 463 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800", Level.LEVEL0, async function (done) { 464 const Color = new ArrayBuffer(96); 465 let opts = { editable: true, pixelFormat: BGRA_8888, size: { height: 4, width: 6 } }; 466 image 467 .createPixelMap(Color, opts) 468 .then((pixelmap) => { 469 globalpixelmap = pixelmap; 470 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 pixelFormat: BGRA_8888 "); 471 expect(pixelmap != undefined).assertTrue(); 472 expect(pixelmap.isEditable == opts.editable).assertTrue(); 473 done(); 474 }) 475 .catch((error) => { 476 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 err: " + error); 477 expect(false).assertTrue(); 478 done(); 479 }); 480 }); 481 482 /** 483 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900 484 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_888 , 485 * size: { height: 4, width: 6 }, bytes = buffer) 486 * @tc.desc : 1.create InitializationOptions object 487 * 2.set editable,pixeFormat,size 488 * 3.using color and opts create newPixelMap 489 * 4.return newpixelmap not empty 490 * @tc.size : MEDIUM 491 * @tc.type : Functional 492 * @tc.level : Level 0 493 */ 494 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900", Level.LEVEL0, async function (done) { 495 const Color = new ArrayBuffer(96); 496 let opts = { editable: true, pixelFormat: RGB_888, size: { height: 4, width: 6 } }; 497 image 498 .createPixelMap(Color, opts) 499 .then((pixelmap) => { 500 globalpixelmap = pixelmap; 501 expect(pixelmap != undefined).assertTrue(); 502 expect(pixelmap.isEditable == opts.editable).assertTrue(); 503 done(); 504 }) 505 .catch((error) => { 506 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900 err: " + error); 507 expect(false).assertTrue(); 508 done(); 509 }); 510 }); 511 512 /** 513 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 514 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: BGRA_8888, 515 * size: { height: 4, width: 6 },bytes = buffer) 516 * @tc.desc : 1.create InitializationOptions object 517 * 2.set editable,pixelFormat,size 518 * 3.using color and opts create newPixelMap 519 * 4.return newpixelmap not empty 520 * @tc.size : MEDIUM 521 * @tc.type : Functional 522 * @tc.level : Level 0 523 */ 524 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800", Level.LEVEL0, async function (done) { 525 const Color = new ArrayBuffer(96); 526 let opts = { editable: true, pixelFormat: BGRA_8888, size: { height: 4, width: 6 } }; 527 image.createPixelMap(Color, opts, (err, pixelmap) => { 528 if (err != undefined) { 529 console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 err: " + err); 530 expect(false).assertTrue(); 531 done(); 532 return; 533 } 534 globalpixelmap = pixelmap; 535 expect(pixelmap != undefined).assertTrue(); 536 expect(pixelmap.isEditable == opts.editable).assertTrue(); 537 done(); 538 }); 539 }); 540 541 /** 542 * @tc.number : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0900 543 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGB_888, 544 * size: { height: 4, width: 6 },bytes = buffer) 545 * @tc.desc : 1.create InitializationOptions object 546 * 2.set editable,pixelFormat,size 547 * 3.using color and opts create newPixelMap 548 * 4.return newpixelmap not empty 549 * @tc.size : MEDIUM 550 * @tc.type : Functional 551 * @tc.level : Level 0 552 */ 553 it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0900", Level.LEVEL0, async function (done) { 554 const Color = new ArrayBuffer(96); 555 let opts = { editable: true, pixelFormat: RGB_888, size: { height: 4, width: 6 } }; 556 image.createPixelMap(Color, opts, (err, pixelmap) => { 557 if (err != undefined) { 558 expect(false).assertTrue(); 559 done(); 560 return; 561 } 562 globalpixelmap = pixelmap; 563 expect(pixelmap != undefined).assertTrue(); 564 expect(pixelmap.isEditable == opts.editable).assertTrue(); 565 done(); 566 }); 567 }); 568}); 569}