• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include <gtest/gtest.h>
16 #include <iservice_registry.h>
17 #include <native_image.h>
18 #include <EGL/egl.h>
19 #include <EGL/eglext.h>
20 #include "graphic_common_c.h"
21 #include "surface_type.h"
22 #include "window.h"
23 #include "GLES/gl.h"
24 #include "buffer_log.h"
25 
26 using namespace testing;
27 using namespace testing::ext;
28 using namespace std;
29 
30 namespace OHOS::Rosen {
31 using GetPlatformDisplayExt = PFNEGLGETPLATFORMDISPLAYEXTPROC;
32 constexpr const char* EGL_EXT_PLATFORM_WAYLAND = "EGL_EXT_platform_wayland";
33 constexpr const char* EGL_KHR_PLATFORM_WAYLAND = "EGL_KHR_platform_wayland";
34 constexpr int32_t EGL_CONTEXT_CLIENT_VERSION_NUM = 2;
35 constexpr char CHARACTER_WHITESPACE = ' ';
36 constexpr const char* CHARACTER_STRING_WHITESPACE = " ";
37 constexpr const char* EGL_GET_PLATFORM_DISPLAY_EXT = "eglGetPlatformDisplayEXT";
38 
39 struct TEST_IMAGE {
40     int a;
41     bool b;
42 };
43 
CheckEglExtension(const char * extensions,const char * extension)44 static bool CheckEglExtension(const char* extensions, const char* extension)
45 {
46     size_t extlen = strlen(extension);
47     const char* end = extensions + strlen(extensions);
48 
49     while (extensions < end) {
50         size_t n = 0;
51         /* Skip whitespaces, if any */
52         if (*extensions == CHARACTER_WHITESPACE) {
53             extensions++;
54             continue;
55         }
56         n = strcspn(extensions, CHARACTER_STRING_WHITESPACE);
57         /* Compare strings */
58         if (n == extlen && strncmp(extension, extensions, n) == 0) {
59             return true; /* Found */
60         }
61         extensions += n;
62     }
63     /* Not found */
64     return false;
65 }
66 
GetPlatformEglDisplay(EGLenum platform,void * native_display,const EGLint * attrib_list)67 static EGLDisplay GetPlatformEglDisplay(EGLenum platform, void* native_display, const EGLint* attrib_list)
68 {
69     static GetPlatformDisplayExt eglGetPlatformDisplayExt = NULL;
70 
71     if (!eglGetPlatformDisplayExt) {
72         const char* extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
73         if (extensions &&
74             (CheckEglExtension(extensions, EGL_EXT_PLATFORM_WAYLAND) ||
75                 CheckEglExtension(extensions, EGL_KHR_PLATFORM_WAYLAND))) {
76             eglGetPlatformDisplayExt = (GetPlatformDisplayExt)eglGetProcAddress(EGL_GET_PLATFORM_DISPLAY_EXT);
77         }
78     }
79 
80     if (eglGetPlatformDisplayExt) {
81         return eglGetPlatformDisplayExt(platform, native_display, attrib_list);
82     }
83 
84     return eglGetDisplay((EGLNativeDisplayType)native_display);
85 }
86 
87 class NativeImageTest : public testing::Test {
88 public:
89     static void SetUpTestCase();
90     static void TearDownTestCase();
91 
92     static void InitEglContext();
93     static void Deinit();
94 
95     static inline OH_NativeImage* image = nullptr;
96     static inline OHNativeWindow* nativeWindow = nullptr;
97     static inline GLuint textureId = 0;
98     static inline GLuint textureId2 = 0;
99     static inline EGLDisplay eglDisplay_ = EGL_NO_DISPLAY;
100     static inline EGLContext eglContext_ = EGL_NO_CONTEXT;
101     static inline EGLConfig config_;;
102 };
103 
SetUpTestCase()104 void NativeImageTest::SetUpTestCase()
105 {
106     image = nullptr;
107     nativeWindow = nullptr;
108     glGenTextures(1, &textureId);
109     glGenTextures(1, &textureId2);
110 }
111 
TearDownTestCase()112 void NativeImageTest::TearDownTestCase()
113 {
114     image = nullptr;
115     nativeWindow = nullptr;
116     Deinit();
117 }
118 
InitEglContext()119 void NativeImageTest::InitEglContext()
120 {
121     if (eglContext_ != EGL_NO_DISPLAY) {
122         return;
123     }
124 
125     BLOGI("Creating EGLContext!!!");
126     eglDisplay_ = GetPlatformEglDisplay(EGL_PLATFORM_OHOS_KHR, EGL_DEFAULT_DISPLAY, NULL);
127     if (eglDisplay_ == EGL_NO_DISPLAY) {
128         BLOGW("Failed to create EGLDisplay gl errno : %{public}x", eglGetError());
129         return;
130     }
131 
132     EGLint major = 0;
133     EGLint minor = 0;
134     if (eglInitialize(eglDisplay_, &major, &minor) == EGL_FALSE) {
135         BLOGE("Failed to initialize EGLDisplay");
136         return;
137     }
138 
139     if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
140         BLOGE("Failed to bind OpenGL ES API");
141         return;
142     }
143 
144     unsigned int ret;
145     EGLint count;
146     EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
147         EGL_ALPHA_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, EGL_NONE };
148 
149     ret = eglChooseConfig(eglDisplay_, config_attribs, &config_, 1, &count);
150     if (!(ret && static_cast<unsigned int>(count) >= 1)) {
151         BLOGE("Failed to eglChooseConfig");
152         return;
153     }
154 
155     static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, EGL_CONTEXT_CLIENT_VERSION_NUM, EGL_NONE };
156 
157     eglContext_ = eglCreateContext(eglDisplay_, config_, EGL_NO_CONTEXT, context_attribs);
158     if (eglContext_ == EGL_NO_CONTEXT) {
159         BLOGE("Failed to create egl context %{public}x", eglGetError());
160         return;
161     }
162 
163     eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, eglContext_);
164 
165     BLOGW("Create EGL context successfully, version %{public}d.%{public}d", major, minor);
166 }
167 
Deinit()168 void NativeImageTest::Deinit()
169 {
170     if (eglDisplay_ == EGL_NO_DISPLAY) {
171         return;
172     }
173     eglDestroyContext(eglDisplay_, eglContext_);
174     eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
175     eglTerminate(eglDisplay_);
176     eglReleaseThread();
177 
178     eglDisplay_ = EGL_NO_DISPLAY;
179     eglContext_ = EGL_NO_CONTEXT;
180 }
181 
182 /*
183 * Function: OH_NativeImage_Create
184 * Type: Function
185 * Rank: Important(1)
186 * EnvConditions: N/A
187 * CaseDescription: 1. call OH_NativeImage_Create
188 *                  2. check ret
189 * @tc.require: issueI5KG61
190 */
191 HWTEST_F(NativeImageTest, OHNativeImageCreate001, Function | MediumTest | Level1)
192 {
193     image = OH_NativeImage_Create(textureId, GL_TEXTURE_2D);
194     ASSERT_NE(image, nullptr);
195 }
196 
197 /*
198 * Function: OH_NativeImage_AcquireNativeWindow
199 * Type: Function
200 * Rank: Important(2)
201 * EnvConditions: N/A
202 * CaseDescription: 1. call OH_NativeImage_AcquireNativeWindow by abnormal input
203 *                  2. check ret
204 * @tc.require: issueI5KG61
205 */
206 HWTEST_F(NativeImageTest, OHNativeImageAcquireNativeWindow001, Function | MediumTest | Level2)
207 {
208     nativeWindow = OH_NativeImage_AcquireNativeWindow(nullptr);
209     ASSERT_EQ(nativeWindow, nullptr);
210 }
211 
212 /*
213 * Function: OH_NativeImage_AcquireNativeWindow
214 * Type: Function
215 * Rank: Important(1)
216 * EnvConditions: N/A
217 * CaseDescription: 1. call OH_NativeImage_AcquireNativeWindow
218 *                  2. check ret
219 * @tc.require: issueI5KG61
220 */
221 HWTEST_F(NativeImageTest, OHNativeImageAcquireNativeWindow002, Function | MediumTest | Level1)
222 {
223     nativeWindow = OH_NativeImage_AcquireNativeWindow(image);
224     ASSERT_NE(nativeWindow, nullptr);
225 }
226 
227 /*
228 * Function: OH_NativeImage_AttachContext
229 * Type: Function
230 * Rank: Important(2)
231 * EnvConditions: N/A
232 * CaseDescription: 1. call OH_NativeImage_AttachContext by abnormal input
233 *                  2. check ret
234 * @tc.require: issueI5KG61
235 */
236 HWTEST_F(NativeImageTest, OHNativeImageAttachContext001, Function | MediumTest | Level2)
237 {
238     int32_t ret = OH_NativeImage_AttachContext(nullptr, textureId);
239     ASSERT_NE(ret, SURFACE_ERROR_OK);
240 }
241 
242 /*
243 * Function: OH_NativeImage_DetachContext
244 * Type: Function
245 * Rank: Important(2)
246 * EnvConditions: N/A
247 * CaseDescription: 1. call OH_NativeImage_DetachContext by abnormal input
248 *                  2. check ret
249 * @tc.require: issueI5KG61
250 */
251 HWTEST_F(NativeImageTest, OHNativeImageDetachContext001, Function | MediumTest | Level2)
252 {
253     int32_t ret = OH_NativeImage_DetachContext(nullptr);
254     ASSERT_NE(ret, SURFACE_ERROR_OK);
255 }
256 
257 /*
258 * Function: OH_NativeImage_DetachContext
259 * Type: Function
260 * Rank: Important(1)
261 * EnvConditions: N/A
262 * CaseDescription: 1. call OH_NativeImage_DetachContext
263 *                  2. check ret
264 * @tc.require: issueI5KG61
265 */
266 HWTEST_F(NativeImageTest, OHNativeImageDetachContext002, Function | MediumTest | Level1)
267 {
268     int32_t ret = OH_NativeImage_DetachContext(image);
269     ASSERT_EQ(ret, SURFACE_ERROR_INIT);
270 }
271 
272 /*
273 * Function: OH_NativeImage_DetachContext
274 * Type: Function
275 * Rank: Important(1)
276 * EnvConditions: N/A
277 * CaseDescription: 1. call OH_NativeImage_DetachContext
278 *                  2. check ret
279 * @tc.require: issueI5KG61
280 */
281 HWTEST_F(NativeImageTest, OHNativeImageDetachContext003, Function | MediumTest | Level1)
282 {
283     InitEglContext();
284     int32_t ret = OH_NativeImage_DetachContext(image);
285     ASSERT_EQ(ret, SURFACE_ERROR_ERROR);
286 }
287 
288 /*
289 * Function: OH_NativeImage_AttachContext
290 * Type: Function
291 * Rank: Important(1)
292 * EnvConditions: N/A
293 * CaseDescription: 1. call OH_NativeImage_AttachContext
294 *                  2. check ret
295 * @tc.require: issueI5KG61
296 */
297 HWTEST_F(NativeImageTest, OHNativeImageAttachContext002, Function | MediumTest | Level1)
298 {
299     int32_t ret = OH_NativeImage_AttachContext(image, textureId);
300     ASSERT_EQ(ret, SURFACE_ERROR_OK);
301 }
302 
303 /*
304 * Function: OH_NativeImage_UpdateSurfaceImage
305 * Type: Function
306 * Rank: Important(2)
307 * EnvConditions: N/A
308 * CaseDescription: 1. call OH_NativeImage_UpdateSurfaceImage by abnormal input
309 *                  2. check ret
310 * @tc.require: issueI5KG61
311 */
312 HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage001, Function | MediumTest | Level2)
313 {
314     int32_t ret = OH_NativeImage_UpdateSurfaceImage(nullptr);
315     ASSERT_NE(ret, SURFACE_ERROR_OK);
316 }
317 
318 /*
319 * Function: OH_NativeImage_UpdateSurfaceImage
320 * Type: Function
321 * Rank: Important(1)
322 * EnvConditions: N/A
323 * CaseDescription: 1. call OH_NativeImage_UpdateSurfaceImage
324 *                  2. check ret
325 * @tc.require: issueI5KG61
326 */
327 HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage002, Function | MediumTest | Level1)
328 {
329     int32_t ret = OH_NativeImage_UpdateSurfaceImage(image);
330     ASSERT_NE(ret, SURFACE_ERROR_OK);
331 }
332 
333 /*
334 * Function: OH_NativeImage_UpdateSurfaceImage
335 * Type: Function
336 * Rank: Important(1)
337 * EnvConditions: N/A
338 * CaseDescription: 1. call OH_NativeWindow_NativeWindowRequestBuffer
339 *                  2. call OH_NativeWindow_NativeWindowFlushBuffer
340 *                  3. OH_NativeImage_UpdateSurfaceImage
341 *                  4. check ret
342 * @tc.require: issueI5KG61
343 */
344 HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage003, Function | MediumTest | Level1)
345 {
346     int code = SET_USAGE;
347     uint64_t usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA;
348     int32_t ret = NativeWindowHandleOpt(nativeWindow, code, usage);
349     if (ret != GSERROR_OK) {
350         std::cout << "NativeWindowHandleOpt SET_USAGE faile" << std::endl;
351     }
352     code = SET_BUFFER_GEOMETRY;
353     int32_t width = 0x100;
354     int32_t height = 0x100;
355     ret = NativeWindowHandleOpt(nativeWindow, code, width, height);
356     if (ret != GSERROR_OK) {
357         std::cout << "NativeWindowHandleOpt SET_BUFFER_GEOMETRY failed" << std::endl;
358     }
359     code = SET_STRIDE;
360     int32_t stride = 0x8;
361     ret = NativeWindowHandleOpt(nativeWindow, code, stride);
362     if (ret != GSERROR_OK) {
363         std::cout << "NativeWindowHandleOpt SET_STRIDE failed" << std::endl;
364     }
365     code = SET_FORMAT;
366     int32_t format = GRAPHIC_PIXEL_FMT_RGBA_8888;
367     ret = NativeWindowHandleOpt(nativeWindow, code, format);
368     if (ret != GSERROR_OK) {
369         std::cout << "NativeWindowHandleOpt SET_FORMAT failed" << std::endl;
370     }
371 
372     NativeWindowBuffer* nativeWindowBuffer = nullptr;
373     int fenceFd = -1;
374     ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd);
375     ASSERT_EQ(ret, GSERROR_OK);
376 
377     struct Region *region = new Region();
378     struct Region::Rect *rect = new Region::Rect();
379     rect->x = 0x100;
380     rect->y = 0x100;
381     rect->w = 0x100;
382     rect->h = 0x100;
383     region->rects = rect;
384     ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region);
385     ASSERT_EQ(ret, GSERROR_OK);
386     delete region;
387 
388     ret = OH_NativeImage_UpdateSurfaceImage(image);
389     ASSERT_EQ(ret, SURFACE_ERROR_OK);
390 }
391 
392 /*
393 * Function: OH_NativeImage_GetTimestamp
394 * Type: Function
395 * Rank: Important(2)
396 * EnvConditions: N/A
397 * CaseDescription: 1. call OH_NativeImage_GetTimestamp by abnormal input
398 *                  2. check ret
399 * @tc.require: issueI5KG61
400 */
401 HWTEST_F(NativeImageTest, OHNativeImageGetTimestamp001, Function | MediumTest | Level2)
402 {
403     int64_t timeStamp = OH_NativeImage_GetTimestamp(nullptr);
404     ASSERT_EQ(timeStamp, SURFACE_ERROR_ERROR);
405 }
406 
407 /*
408 * Function: OH_NativeImage_GetTimestamp
409 * Type: Function
410 * Rank: Important(1)
411 * EnvConditions: N/A
412 * CaseDescription: 1. call OH_NativeImage_GetTimestamp
413 *                  2. check ret
414 * @tc.require: issueI5KG61
415 */
416 HWTEST_F(NativeImageTest, OHNativeImageGetTimestamp002, Function | MediumTest | Level1)
417 {
418     int64_t timeStamp = OH_NativeImage_GetTimestamp(image);
419     ASSERT_NE(timeStamp, SURFACE_ERROR_ERROR);
420 }
421 
422 /*
423 * Function: OH_NativeImage_GetTransformMatrix
424 * Type: Function
425 * Rank: Important(2)
426 * EnvConditions: N/A
427 * CaseDescription: 1. call OH_NativeImage_GetTransformMatrix by abnormal input
428 *                  2. check ret
429 * @tc.require: issueI5KG61
430 */
431 HWTEST_F(NativeImageTest, OHNativeImageGetTransformMatrix001, Function | MediumTest | Level2)
432 {
433     float matrix[16];
434     int32_t ret = OH_NativeImage_GetTransformMatrix(nullptr, matrix);
435     ASSERT_NE(ret, SURFACE_ERROR_OK);
436 }
437 
438 /*
439 * Function: OH_NativeImage_GetTransformMatrix
440 * Type: Function
441 * Rank: Important(1)
442 * EnvConditions: N/A
443 * CaseDescription: 1. call OH_NativeImage_GetTransformMatrix
444 *                  2. check ret
445 * @tc.require: issueI5KG61
446 */
447 HWTEST_F(NativeImageTest, OHNativeImageGetTransformMatrix002, Function | MediumTest | Level1)
448 {
449     float matrix[16];
450     int32_t ret = OH_NativeImage_GetTransformMatrix(image, matrix);
451     ASSERT_EQ(ret, SURFACE_ERROR_OK);
452 }
453 
454 /*
455 * Function: OH_NativeImage_AttachContext
456 * Type: Function
457 * Rank: Important(1)
458 * EnvConditions: N/A
459 * CaseDescription: 1. call OH_NativeImage_AttachContext with another texture
460 *                  2. check ret
461 * @tc.require: issueI5KG61
462 */
463 HWTEST_F(NativeImageTest, OHNativeImageAttachContext003, Function | MediumTest | Level1)
464 {
465     int32_t ret = OH_NativeImage_AttachContext(image, textureId2);
466     ASSERT_EQ(ret, SURFACE_ERROR_OK);
467 }
468 
469 /*
470 * Function: OH_NativeImage_UpdateSurfaceImage
471 * Type: Function
472 * Rank: Important(1)
473 * EnvConditions: N/A
474 * CaseDescription: 1. call OH_NativeWindow_NativeWindowRequestBuffer
475 *                  2. call OH_NativeWindow_NativeWindowFlushBuffer
476 *                  3. OH_NativeImage_UpdateSurfaceImage after the bound OPENGL ES texture changed
477 *                  4. check ret
478 * @tc.require: issueI5KG61
479 */
480 HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage004, Function | MediumTest | Level1)
481 {
482     NativeWindowBuffer* nativeWindowBuffer = nullptr;
483     int fenceFd = -1;
484     int32_t ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd);
485     ASSERT_EQ(ret, GSERROR_OK);
486 
487     struct Region *region = new Region();
488     struct Region::Rect *rect = new Region::Rect();
489     rect->x = 0x100;
490     rect->y = 0x100;
491     rect->w = 0x100;
492     rect->h = 0x100;
493     region->rects = rect;
494     ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region);
495     ASSERT_EQ(ret, GSERROR_OK);
496     delete region;
497 
498     ret = OH_NativeImage_UpdateSurfaceImage(image);
499     ASSERT_EQ(ret, SURFACE_ERROR_OK);
500 }
501 
502 /*
503 * Function: OH_NativeImage_DetachContext
504 * Type: Function
505 * Rank: Important(1)
506 * EnvConditions: N/A
507 * CaseDescription: 1. call OH_NativeImage_DetachContext
508 *                  2. check ret
509 * @tc.require: issueI5KG61
510 */
511 HWTEST_F(NativeImageTest, OHNativeImageDetachContext004, Function | MediumTest | Level1)
512 {
513     int32_t ret = OH_NativeImage_DetachContext(image);
514     ASSERT_EQ(ret, SURFACE_ERROR_OK);
515 }
516 
517 /*
518 * Function: OH_NativeImage_AttachContext
519 * Type: Function
520 * Rank: Important(1)
521 * EnvConditions: N/A
522 * CaseDescription: 1. call OH_NativeImage_AttachContext after OH_NativeImage_DetachContext
523 *                  2. check ret
524 * @tc.require: issueI5KG61
525 */
526 HWTEST_F(NativeImageTest, OHNativeImageAttachContext004, Function | MediumTest | Level1)
527 {
528     int32_t ret = OH_NativeImage_AttachContext(image, textureId2);
529     ASSERT_EQ(ret, SURFACE_ERROR_OK);
530 }
531 
532 /*
533 * Function: OH_NativeImage_UpdateSurfaceImage
534 * Type: Function
535 * Rank: Important(1)
536 * EnvConditions: N/A
537 * CaseDescription: 1. call OH_NativeWindow_NativeWindowRequestBuffer
538 *                  2. call OH_NativeWindow_NativeWindowFlushBuffer
539 *                  3. OH_NativeImage_UpdateSurfaceImage again
540 *                  4. check ret
541 * @tc.require: issueI5KG61
542 */
543 HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage005, Function | MediumTest | Level1)
544 {
545     NativeWindowBuffer* nativeWindowBuffer = nullptr;
546     int fenceFd = -1;
547     int32_t ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd);
548     ASSERT_EQ(ret, GSERROR_OK);
549 
550     struct Region *region = new Region();
551     struct Region::Rect *rect = new Region::Rect();
552     rect->x = 0x100;
553     rect->y = 0x100;
554     rect->w = 0x100;
555     rect->h = 0x100;
556     region->rects = rect;
557     ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region);
558     ASSERT_EQ(ret, GSERROR_OK);
559     delete region;
560 
561     ret = OH_NativeImage_UpdateSurfaceImage(image);
562     ASSERT_EQ(ret, SURFACE_ERROR_OK);
563 }
564 
565 /*
566 * Function: OH_NativeImage_Destroy
567 * Type: Function
568 * Rank: Important(2)
569 * EnvConditions: N/A
570 * CaseDescription: 1. call OH_NativeImage_Destroy by abnormal input
571 *                  2. check ret
572 * @tc.require: issueI5KG61
573 */
574 HWTEST_F(NativeImageTest, OHNativeImageDestroy001, Function | MediumTest | Level2)
575 {
576     OH_NativeImage_Destroy(nullptr);
577     ASSERT_NE(image, nullptr);
578 }
579 
580 /*
581 * Function: OH_NativeImage_Destroy
582 * Type: Function
583 * Rank: Important(1)
584 * EnvConditions: N/A
585 * CaseDescription: 1. call OH_NativeImage_Destroy
586 *                  2. check ret
587 * @tc.require: issueI5KG61
588 */
589 HWTEST_F(NativeImageTest, OHNativeImageDestroy002, Function | MediumTest | Level1)
590 {
591     OH_NativeImage_Destroy(&image);
592     ASSERT_EQ(image, nullptr);
593 }
594 }