• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 } 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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", 0, 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                expect(true).assertTrue();
421                done();
422            });
423    });
424
425    /**
426     * @tc.number    : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700
427     * @tc.name      : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: -1 })
428     * @tc.desc      : 1.create InitializationOptions object
429     *                 2.set editable,pixeFormat,size
430     *                 3.using color and opts create newPixelMap
431     *                 4.return newpixelmap empty
432     * @tc.size      : MEDIUM
433     * @tc.type      : Functional
434     * @tc.level     : Level 0
435     */
436    it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700", 0, async function (done) {
437        const Color = new ArrayBuffer(96);
438        let opts = { editable: true, pixelFormat: UNKNOWN, size: { height: 6, width: -1 } };
439        image
440            .createPixelMap(Color, opts)
441            .then((pixelmap) => {
442                expect(false).assertTrue();
443                console.info("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 failed");
444                done();
445            })
446            .catch((error) => {
447                console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 error: " + error);
448                expect(true).assertTrue();
449                done();
450            });
451    });
452
453    /**
454     * @tc.number    : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800
455     * @tc.name      : create pixelmap-promise (editable: true, pixelFormat: BGRA_8888,
456     *                                          size: { height: 4, width: 6 }, bytes = buffer)
457     * @tc.desc      : 1.create InitializationOptions object
458     *                 2.set editable,pixeFormat,size
459     *                 3.using color and opts create newPixelMap
460     *                 4.return newpixelmap not empty
461     * @tc.size      : MEDIUM
462     * @tc.type      : Functional
463     * @tc.level     : Level 0
464     */
465    it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800", 0, async function (done) {
466        const Color = new ArrayBuffer(96);
467        let opts = { editable: true, pixelFormat: BGRA_8888, size: { height: 4, width: 6 } };
468        image
469            .createPixelMap(Color, opts)
470            .then((pixelmap) => {
471                globalpixelmap = pixelmap;
472                console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 pixelFormat: BGRA_8888  ");
473                expect(pixelmap != undefined).assertTrue();
474                expect(pixelmap.isEditable == opts.editable).assertTrue();
475                done();
476            })
477            .catch((error) => {
478                console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 err: " + error);
479                expect(false).assertTrue();
480                done();
481            });
482    });
483
484    /**
485     * @tc.number    : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900
486     * @tc.name      : create pixelmap-promise (editable: true, pixelFormat: RGB_888 ,
487     *                                          size: { height: 4, width: 6 }, bytes = buffer)
488     * @tc.desc      : 1.create InitializationOptions object
489     *                 2.set editable,pixeFormat,size
490     *                 3.using color and opts create newPixelMap
491     *                 4.return newpixelmap not empty
492     * @tc.size      : MEDIUM
493     * @tc.type      : Functional
494     * @tc.level     : Level 0
495     */
496    it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900", 0, async function (done) {
497        const Color = new ArrayBuffer(96);
498        let opts = { editable: true, pixelFormat: RGB_888, size: { height: 4, width: 6 } };
499        image
500            .createPixelMap(Color, opts)
501            .then((pixelmap) => {
502                globalpixelmap = pixelmap;
503                expect(pixelmap != undefined).assertTrue();
504                expect(pixelmap.isEditable == opts.editable).assertTrue();
505                done();
506            })
507            .catch((error) => {
508                console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0900 err: " + error);
509                expect(false).assertTrue();
510                done();
511            });
512    });
513
514    /**
515     * @tc.number    : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800
516     * @tc.name      : create pixelmap-callback (editable: true, pixelFormat: BGRA_8888,
517     *                                           size: { height: 4, width: 6 },bytes = buffer)
518     * @tc.desc      : 1.create InitializationOptions object
519     *                 2.set editable,pixelFormat,size
520     *                 3.using color and opts create newPixelMap
521     *                 4.return newpixelmap not empty
522     * @tc.size      : MEDIUM
523     * @tc.type      : Functional
524     * @tc.level     : Level 0
525     */
526    it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800", 0, async function (done) {
527        const Color = new ArrayBuffer(96);
528        let opts = { editable: true, pixelFormat: BGRA_8888, size: { height: 4, width: 6 } };
529        image.createPixelMap(Color, opts, (err, pixelmap) => {
530            if (err != undefined) {
531                console.log("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 err: " + err);
532                expect(false).assertTrue();
533                done();
534                return;
535            }
536            globalpixelmap = pixelmap;
537            expect(pixelmap != undefined).assertTrue();
538            expect(pixelmap.isEditable == opts.editable).assertTrue();
539            done();
540        });
541    });
542
543    /**
544     * @tc.number    : SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0900
545     * @tc.name      : create pixelmap-callback (editable: true, pixelFormat: RGB_888,
546     *                                           size: { height: 4, width: 6 },bytes = buffer)
547     * @tc.desc      : 1.create InitializationOptions object
548     *                 2.set editable,pixelFormat,size
549     *                 3.using color and opts create newPixelMap
550     *                 4.return newpixelmap not empty
551     * @tc.size      : MEDIUM
552     * @tc.type      : Functional
553     * @tc.level     : Level 0
554     */
555    it("SUB_MULTIMEDIA_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0900", 0, async function (done) {
556        const Color = new ArrayBuffer(96);
557        let opts = { editable: true, pixelFormat: RGB_888, size: { height: 4, width: 6 } };
558        image.createPixelMap(Color, opts, (err, pixelmap) => {
559            if (err != undefined) {
560                expect(false).assertTrue();
561                done();
562                return;
563            }
564            globalpixelmap = pixelmap;
565            expect(pixelmap != undefined).assertTrue();
566            expect(pixelmap.isEditable == opts.editable).assertTrue();
567            done();
568        });
569    });
570});
571}