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, Hardware
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
16 #include <gtest/gtest.h>
17
18 #include "EGL/egl_wrapper_display.h"
19
20 #include "egl_defs.h"
21 #include "thread_private_data_ctl.h"
22
23 using namespace testing;
24 using namespace testing::ext;
25
26 namespace OHOS::Rosen {
27 class EglWrapperDisplayTest : public testing::Test {
28 public:
SetUpTestCase()29 static void SetUpTestCase() {}
TearDownTestCase()30 static void TearDownTestCase() {}
SetUp()31 void SetUp() {}
TearDown()32 void TearDown() {}
33 };
34
35 /**
36 * @tc.name: GetWrapperDisplay001
37 * @tc.desc:
38 * @tc.type: FUNC
39 */
HWTEST_F(EglWrapperDisplayTest,GetWrapperDisplay001,Level1)40 HWTEST_F(EglWrapperDisplayTest, GetWrapperDisplay001, Level1)
41 {
42 auto result = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
43 ASSERT_NE(nullptr, result);
44 }
45
46 /**
47 * @tc.name: GetWrapperDisplay002
48 * @tc.desc:
49 * @tc.type: FUNC
50 */
HWTEST_F(EglWrapperDisplayTest,GetWrapperDisplay002,Level2)51 HWTEST_F(EglWrapperDisplayTest, GetWrapperDisplay002, Level2)
52 {
53 auto result = EglWrapperDisplay::GetWrapperDisplay(nullptr);
54 ASSERT_EQ(nullptr, result);
55 }
56
57 /**
58 * @tc.name: GetEglNativeDisplayEXT001
59 * @tc.desc:
60 * @tc.type: FUNC
61 */
HWTEST_F(EglWrapperDisplayTest,GetEglNativeDisplayEXT001,Level1)62 HWTEST_F(EglWrapperDisplayTest, GetEglNativeDisplayEXT001, Level1)
63 {
64 auto result = gWrapperHook.wrapper.eglGetPlatformDisplayEXT(0, nullptr, 0);
65 ASSERT_EQ(EGL_NO_DISPLAY, result);
66 }
67
68
69 /**
70 * @tc.name: MakeCurrent001
71 * @tc.desc:
72 * @tc.type: FUNC
73 */
HWTEST_F(EglWrapperDisplayTest,MakeCurrent001,Level1)74 HWTEST_F(EglWrapperDisplayTest, MakeCurrent001, Level1)
75 {
76 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
77 EGLSurface draw = EGL_NO_SURFACE;
78 EGLSurface read = EGL_NO_SURFACE;
79 EGLContext ctx = EGL_NO_CONTEXT;
80
81 auto result = eglWrapperDisplay->MakeCurrent(draw, read, ctx);
82 ASSERT_EQ(EGL_TRUE, result);
83 }
84
85 /**
86 * @tc.name: CreateEglContext001
87 * @tc.desc:
88 * @tc.type: FUNC
89 */
HWTEST_F(EglWrapperDisplayTest,CreateEglContext001,Level1)90 HWTEST_F(EglWrapperDisplayTest, CreateEglContext001, Level1)
91 {
92 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
93
94 auto temp = gWrapperHook.isLoad;
95 gWrapperHook.isLoad = false;
96
97 auto result = eglWrapperDisplay->CreateEglContext(nullptr, nullptr, 0);
98 ASSERT_EQ(EGL_NO_CONTEXT, result);
99 gWrapperHook.isLoad = temp;
100 }
101
102 /**
103 * @tc.name: CreateEglContext002
104 * @tc.desc:
105 * @tc.type: FUNC
106 */
HWTEST_F(EglWrapperDisplayTest,CreateEglContext002,Level2)107 HWTEST_F(EglWrapperDisplayTest, CreateEglContext002, Level2)
108 {
109 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
110
111 auto temp = gWrapperHook.isLoad;
112 gWrapperHook.isLoad = false;
113
114 auto result = eglWrapperDisplay->CreateEglContext(nullptr, EGL_NO_CONTEXT, 0);
115 ASSERT_EQ(EGL_NO_CONTEXT, result);
116 gWrapperHook.isLoad = temp;
117 }
118
119 /**
120 * @tc.name: CreateEglContext003
121 * @tc.desc:
122 * @tc.type: FUNC
123 */
HWTEST_F(EglWrapperDisplayTest,CreateEglContext003,Level1)124 HWTEST_F(EglWrapperDisplayTest, CreateEglContext003, Level1)
125 {
126 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
127
128 auto result = eglWrapperDisplay->CreateEglContext(nullptr, nullptr, 0);
129 ASSERT_EQ(EGL_NO_CONTEXT, result);
130 }
131
132 /**
133 * @tc.name: CreateEglSurface001
134 * @tc.desc:
135 * @tc.type: FUNC
136 */
HWTEST_F(EglWrapperDisplayTest,CreateEglSurface001,Level1)137 HWTEST_F(EglWrapperDisplayTest, CreateEglSurface001, Level1)
138 {
139 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
140
141 auto result = eglWrapperDisplay->CreateEglSurface(nullptr, 0, 0);
142 ASSERT_EQ(EGL_NO_SURFACE, result);
143 }
144
145 /**
146 * @tc.name: CreateEglSurface002
147 * @tc.desc:
148 * @tc.type: FUNC
149 */
HWTEST_F(EglWrapperDisplayTest,CreateEglSurface002,Level1)150 HWTEST_F(EglWrapperDisplayTest, CreateEglSurface002, Level1)
151 {
152 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
153
154 auto temp = gWrapperHook.isLoad;
155 gWrapperHook.isLoad = false;
156
157 NativeWindowType window = nullptr;
158 auto result = eglWrapperDisplay->CreateEglSurface(nullptr, window, 0);
159 ASSERT_EQ(EGL_NO_SURFACE, result);
160 gWrapperHook.isLoad = temp;
161 }
162
163 /**
164 * @tc.name: CreatePixmapSurface001
165 * @tc.desc:
166 * @tc.type: FUNC
167 */
HWTEST_F(EglWrapperDisplayTest,CreatePixmapSurface001,Level1)168 HWTEST_F(EglWrapperDisplayTest, CreatePixmapSurface001, Level1)
169 {
170 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
171
172 auto result = eglWrapperDisplay->CreatePixmapSurface(nullptr, 0, 0);
173 ASSERT_EQ(EGL_NO_SURFACE, result);
174 }
175
176 /**
177 * @tc.name: CreatePixmapSurface002
178 * @tc.desc:
179 * @tc.type: FUNC
180 */
HWTEST_F(EglWrapperDisplayTest,CreatePixmapSurface002,Level2)181 HWTEST_F(EglWrapperDisplayTest, CreatePixmapSurface002, Level2)
182 {
183 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
184
185 auto temp = gWrapperHook.isLoad;
186 gWrapperHook.isLoad = false;
187
188 EGLNativePixmapType window = nullptr;
189 auto result = eglWrapperDisplay->CreatePixmapSurface(nullptr, window, 0);
190 ASSERT_EQ(EGL_NO_SURFACE, result);
191 gWrapperHook.isLoad = temp;
192 }
193
194 /**
195 * @tc.name: QueryContext001
196 * @tc.desc:
197 * @tc.type: FUNC
198 */
HWTEST_F(EglWrapperDisplayTest,QueryContext001,Level1)199 HWTEST_F(EglWrapperDisplayTest, QueryContext001, Level1)
200 {
201 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
202
203 auto result = eglWrapperDisplay->QueryContext(nullptr, 0, 0);
204 ASSERT_EQ(EGL_FALSE, result);
205 }
206
207 /**
208 * @tc.name: QueryContext002
209 * @tc.desc:
210 * @tc.type: FUNC
211 */
HWTEST_F(EglWrapperDisplayTest,QueryContext002,Level1)212 HWTEST_F(EglWrapperDisplayTest, QueryContext002, Level1)
213 {
214 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
215
216 auto temp = gWrapperHook.isLoad;
217 gWrapperHook.isLoad = false;
218
219 auto result = eglWrapperDisplay->QueryContext(nullptr, 0, 0);
220 ASSERT_EQ(EGL_FALSE, result);
221 gWrapperHook.isLoad = temp;
222 }
223
224 /**
225 * @tc.name: QuerySurface001
226 * @tc.desc:
227 * @tc.type: FUNC
228 */
HWTEST_F(EglWrapperDisplayTest,QuerySurface001,Level1)229 HWTEST_F(EglWrapperDisplayTest, QuerySurface001, Level1)
230 {
231 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
232
233 auto result = eglWrapperDisplay->QuerySurface(nullptr, 0, 0);
234 ASSERT_EQ(EGL_FALSE, result);
235 }
236
237 /**
238 * @tc.name: QuerySurface002
239 * @tc.desc:
240 * @tc.type: FUNC
241 */
HWTEST_F(EglWrapperDisplayTest,QuerySurface002,Level1)242 HWTEST_F(EglWrapperDisplayTest, QuerySurface002, Level1)
243 {
244 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
245
246 auto temp = gWrapperHook.isLoad;
247 gWrapperHook.isLoad = false;
248
249 auto result = eglWrapperDisplay->QuerySurface(nullptr, 0, 0);
250 ASSERT_EQ(EGL_FALSE, result);
251 gWrapperHook.isLoad = temp;
252 }
253
254 /**
255 * @tc.name: BindTexImage001
256 * @tc.desc:
257 * @tc.type: FUNC
258 */
HWTEST_F(EglWrapperDisplayTest,BindTexImage001,Level1)259 HWTEST_F(EglWrapperDisplayTest, BindTexImage001, Level1)
260 {
261 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
262
263 auto result = eglWrapperDisplay->BindTexImage(nullptr, 0);
264 ASSERT_EQ(EGL_FALSE, result);
265 }
266
267 /**
268 * @tc.name: BindTexImage002
269 * @tc.desc:
270 * @tc.type: FUNC
271 */
HWTEST_F(EglWrapperDisplayTest,BindTexImage002,Level1)272 HWTEST_F(EglWrapperDisplayTest, BindTexImage002, Level1)
273 {
274 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
275
276 auto temp = gWrapperHook.isLoad;
277 gWrapperHook.isLoad = false;
278
279 auto result = eglWrapperDisplay->BindTexImage(nullptr, 0);
280 ASSERT_EQ(EGL_FALSE, result);
281 gWrapperHook.isLoad = temp;
282 }
283
284 /**
285 * @tc.name: ReleaseTexImage001
286 * @tc.desc:
287 * @tc.type: FUNC
288 */
HWTEST_F(EglWrapperDisplayTest,ReleaseTexImage001,Level1)289 HWTEST_F(EglWrapperDisplayTest, ReleaseTexImage001, Level1)
290 {
291 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
292
293 auto result = eglWrapperDisplay->ReleaseTexImage(nullptr, 0);
294 ASSERT_EQ(EGL_FALSE, result);
295 }
296
297 /**
298 * @tc.name: ReleaseTexImage002
299 * @tc.desc:
300 * @tc.type: FUNC
301 */
HWTEST_F(EglWrapperDisplayTest,ReleaseTexImage002,Level1)302 HWTEST_F(EglWrapperDisplayTest, ReleaseTexImage002, Level1)
303 {
304 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
305
306 auto temp = gWrapperHook.isLoad;
307 gWrapperHook.isLoad = false;
308
309 auto result = eglWrapperDisplay->ReleaseTexImage(nullptr, 0);
310 ASSERT_EQ(EGL_FALSE, result);
311 gWrapperHook.isLoad = temp;
312 }
313
314 /**
315 * @tc.name: SurfaceAttrib001
316 * @tc.desc:
317 * @tc.type: FUNC
318 */
HWTEST_F(EglWrapperDisplayTest,SurfaceAttrib001,Level1)319 HWTEST_F(EglWrapperDisplayTest, SurfaceAttrib001, Level1)
320 {
321 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
322
323 auto result = eglWrapperDisplay->SurfaceAttrib(nullptr, 0, 0);
324 ASSERT_EQ(EGL_FALSE, result);
325 }
326
327 /**
328 * @tc.name: SurfaceAttrib002
329 * @tc.desc:
330 * @tc.type: FUNC
331 */
HWTEST_F(EglWrapperDisplayTest,SurfaceAttrib002,Level1)332 HWTEST_F(EglWrapperDisplayTest, SurfaceAttrib002, Level1)
333 {
334 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
335
336 auto temp = gWrapperHook.isLoad;
337 gWrapperHook.isLoad = false;
338
339 auto result = eglWrapperDisplay->SurfaceAttrib(nullptr, 0, 0);
340 ASSERT_EQ(EGL_FALSE, result);
341 gWrapperHook.isLoad = temp;
342 }
343
344
345 /**
346 * @tc.name: CreatePbufferFromClientBuffer001
347 * @tc.desc:
348 * @tc.type: FUNC
349 */
HWTEST_F(EglWrapperDisplayTest,CreatePbufferFromClientBuffer001,Level1)350 HWTEST_F(EglWrapperDisplayTest, CreatePbufferFromClientBuffer001, Level1)
351 {
352 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
353
354 auto temp = gWrapperHook.isLoad;
355 gWrapperHook.isLoad = false;
356
357 auto result = eglWrapperDisplay->CreatePbufferFromClientBuffer(0, nullptr, nullptr, 0);
358 ASSERT_EQ(EGL_NO_SURFACE, result);
359 gWrapperHook.isLoad = temp;
360 }
361
362 /**
363 * @tc.name: CreatePbufferFromClientBuffer002
364 * @tc.desc:
365 * @tc.type: FUNC
366 */
HWTEST_F(EglWrapperDisplayTest,CreatePbufferFromClientBuffer002,Level1)367 HWTEST_F(EglWrapperDisplayTest, CreatePbufferFromClientBuffer002, Level1)
368 {
369 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
370
371 auto result = eglWrapperDisplay->CreatePbufferFromClientBuffer(0, nullptr, nullptr, 0);
372 ASSERT_EQ(EGL_NO_SURFACE, result);
373 }
374
375 /**
376 * @tc.name: CreateImage001
377 * @tc.desc:
378 * @tc.type: FUNC
379 */
HWTEST_F(EglWrapperDisplayTest,CreateImage001,Level1)380 HWTEST_F(EglWrapperDisplayTest, CreateImage001, Level1)
381 {
382 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
383
384 auto temp = gWrapperHook.isLoad;
385 gWrapperHook.isLoad = false;
386
387 auto result = eglWrapperDisplay->CreateImage(EGL_NO_CONTEXT, 0, nullptr, nullptr);
388 ASSERT_EQ(EGL_NO_IMAGE_KHR, result);
389 gWrapperHook.isLoad = temp;
390 }
391
392 /**
393 * @tc.name: CreateImage002
394 * @tc.desc:
395 * @tc.type: FUNC
396 */
HWTEST_F(EglWrapperDisplayTest,CreateImage002,Level1)397 HWTEST_F(EglWrapperDisplayTest, CreateImage002, Level1)
398 {
399 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
400
401 auto result = eglWrapperDisplay->CreateImage(nullptr, 0, nullptr, nullptr);
402 ASSERT_EQ(EGL_NO_IMAGE_KHR, result);
403 }
404
405 /**
406 * @tc.name: DestroyImage001
407 * @tc.desc:
408 * @tc.type: FUNC
409 */
HWTEST_F(EglWrapperDisplayTest,DestroyImage001,Level1)410 HWTEST_F(EglWrapperDisplayTest, DestroyImage001, Level1)
411 {
412 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
413
414 auto temp = gWrapperHook.isLoad;
415 gWrapperHook.isLoad = false;
416
417 auto result = eglWrapperDisplay->DestroyImage(nullptr);
418 ASSERT_EQ(EGL_FALSE, result);
419 gWrapperHook.isLoad = temp;
420 }
421
422 /**
423 * @tc.name: CreatePlatformWindowSurface001
424 * @tc.desc:
425 * @tc.type: FUNC
426 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformWindowSurface001,Level1)427 HWTEST_F(EglWrapperDisplayTest, CreatePlatformWindowSurface001, Level1)
428 {
429 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
430
431 auto result = eglWrapperDisplay->CreatePlatformWindowSurface(nullptr, nullptr, 0);
432 ASSERT_EQ(EGL_NO_SURFACE, result);
433 }
434
435 /**
436 * @tc.name: CreatePlatformWindowSurface002
437 * @tc.desc:
438 * @tc.type: FUNC
439 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformWindowSurface002,Level2)440 HWTEST_F(EglWrapperDisplayTest, CreatePlatformWindowSurface002, Level2)
441 {
442 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
443
444 auto temp = gWrapperHook.isLoad;
445 gWrapperHook.isLoad = false;
446
447 auto result = eglWrapperDisplay->CreatePlatformWindowSurface(nullptr, &gWrapperHook, 0);
448 ASSERT_EQ(EGL_NO_SURFACE, result);
449 gWrapperHook.isLoad = temp;
450 }
451
452 /**
453 * @tc.name: CreatePlatformPixmapSurface001
454 * @tc.desc:
455 * @tc.type: FUNC
456 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformPixmapSurface001,Level1)457 HWTEST_F(EglWrapperDisplayTest, CreatePlatformPixmapSurface001, Level1)
458 {
459 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
460
461 auto result = eglWrapperDisplay->CreatePlatformPixmapSurface(nullptr, nullptr, 0);
462 ASSERT_EQ(EGL_NO_SURFACE, result);
463 }
464
465 /**
466 * @tc.name: CreatePlatformPixmapSurface002
467 * @tc.desc:
468 * @tc.type: FUNC
469 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformPixmapSurface002,Level2)470 HWTEST_F(EglWrapperDisplayTest, CreatePlatformPixmapSurface002, Level2)
471 {
472 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
473
474 auto temp = gWrapperHook.isLoad;
475 gWrapperHook.isLoad = false;
476
477 auto result = eglWrapperDisplay->CreatePlatformPixmapSurface(nullptr, &gWrapperHook, 0);
478 ASSERT_EQ(EGL_NO_SURFACE, result);
479 gWrapperHook.isLoad = temp;
480 }
481
482 /**
483 * @tc.name: LockSurfaceKHR001
484 * @tc.desc:
485 * @tc.type: FUNC
486 */
HWTEST_F(EglWrapperDisplayTest,LockSurfaceKHR001,Level1)487 HWTEST_F(EglWrapperDisplayTest, LockSurfaceKHR001, Level1)
488 {
489 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
490
491 auto result = eglWrapperDisplay->LockSurfaceKHR(nullptr, 0);
492 ASSERT_EQ(EGL_FALSE, result);
493 }
494
495 /**
496 * @tc.name: LockSurfaceKHR002
497 * @tc.desc:
498 * @tc.type: FUNC
499 */
HWTEST_F(EglWrapperDisplayTest,LockSurfaceKHR002,Level1)500 HWTEST_F(EglWrapperDisplayTest, LockSurfaceKHR002, Level1)
501 {
502 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
503
504 auto temp = gWrapperHook.isLoad;
505 gWrapperHook.isLoad = false;
506
507 auto result = eglWrapperDisplay->LockSurfaceKHR(nullptr, 0);
508 ASSERT_EQ(EGL_FALSE, result);
509 gWrapperHook.isLoad = temp;
510 }
511
512
513 /**
514 * @tc.name: UnlockSurfaceKHR001
515 * @tc.desc:
516 * @tc.type: FUNC
517 */
HWTEST_F(EglWrapperDisplayTest,UnlockSurfaceKHR001,Level1)518 HWTEST_F(EglWrapperDisplayTest, UnlockSurfaceKHR001, Level1)
519 {
520 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
521
522 auto temp = gWrapperHook.isLoad;
523 gWrapperHook.isLoad = false;
524
525 auto result = eglWrapperDisplay->UnlockSurfaceKHR(nullptr);
526 ASSERT_EQ(EGL_FALSE, result);
527 gWrapperHook.isLoad = temp;
528 }
529
530 /**
531 * @tc.name: UnLockSurfaceKHR002
532 * @tc.desc:
533 * @tc.type: FUNC
534 */
HWTEST_F(EglWrapperDisplayTest,UnLockSurfaceKHR002,Level1)535 HWTEST_F(EglWrapperDisplayTest, UnLockSurfaceKHR002, Level1)
536 {
537 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
538
539 auto result = eglWrapperDisplay->UnlockSurfaceKHR(nullptr);
540 ASSERT_EQ(EGL_FALSE, result);
541 }
542
543 /**
544 * @tc.name: CreateImageKHR001
545 * @tc.desc:
546 * @tc.type: FUNC
547 */
HWTEST_F(EglWrapperDisplayTest,CreateImageKHR001,Level1)548 HWTEST_F(EglWrapperDisplayTest, CreateImageKHR001, Level1)
549 {
550 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
551
552 auto temp = gWrapperHook.isLoad;
553 gWrapperHook.isLoad = false;
554
555 auto result = eglWrapperDisplay->CreateImageKHR(EGL_NO_CONTEXT, 0, nullptr, nullptr);
556 ASSERT_EQ(EGL_NO_IMAGE_KHR, result);
557 gWrapperHook.isLoad = temp;
558 }
559
560 /**
561 * @tc.name: CreateImageKHR002
562 * @tc.desc:
563 * @tc.type: FUNC
564 */
HWTEST_F(EglWrapperDisplayTest,CreateImageKHR002,Level1)565 HWTEST_F(EglWrapperDisplayTest, CreateImageKHR002, Level1)
566 {
567 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
568
569 auto result = eglWrapperDisplay->CreateImageKHR(nullptr, 0, nullptr, nullptr);
570 ASSERT_EQ(EGL_NO_IMAGE_KHR, result);
571 }
572
573 /**
574 * @tc.name: DestroyImageKHR001
575 * @tc.desc:
576 * @tc.type: FUNC
577 */
HWTEST_F(EglWrapperDisplayTest,DestroyImageKHR001,Level1)578 HWTEST_F(EglWrapperDisplayTest, DestroyImageKHR001, Level1)
579 {
580 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
581
582 auto temp = gWrapperHook.isLoad;
583 gWrapperHook.isLoad = false;
584
585 auto result = eglWrapperDisplay->DestroyImageKHR(nullptr);
586 ASSERT_EQ(EGL_FALSE, result);
587 gWrapperHook.isLoad = temp;
588 }
589
590 /**
591 * @tc.name: CreateStreamProducerSurfaceKHR001
592 * @tc.desc:
593 * @tc.type: FUNC
594 */
HWTEST_F(EglWrapperDisplayTest,CreateStreamProducerSurfaceKHR001,Level1)595 HWTEST_F(EglWrapperDisplayTest, CreateStreamProducerSurfaceKHR001, Level1)
596 {
597 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
598
599 auto temp = gWrapperHook.isLoad;
600 gWrapperHook.isLoad = false;
601
602 auto result = eglWrapperDisplay->CreateStreamProducerSurfaceKHR(nullptr, nullptr, 0);
603 ASSERT_EQ(EGL_NO_SURFACE, result);
604 gWrapperHook.isLoad = temp;
605 }
606
607 /**
608 * @tc.name: SwapBuffersWithDamageKHR001
609 * @tc.desc:
610 * @tc.type: FUNC
611 */
HWTEST_F(EglWrapperDisplayTest,SwapBuffersWithDamageKHR001,Level1)612 HWTEST_F(EglWrapperDisplayTest, SwapBuffersWithDamageKHR001, Level1)
613 {
614 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
615
616 auto result = eglWrapperDisplay->SwapBuffersWithDamageKHR(nullptr, 0, 0);
617 ASSERT_EQ(EGL_FALSE, result);
618 }
619
620 /**
621 * @tc.name: SwapBuffersWithDamageKHR002
622 * @tc.desc:
623 * @tc.type: FUNC
624 */
HWTEST_F(EglWrapperDisplayTest,SwapBuffersWithDamageKHR002,Level1)625 HWTEST_F(EglWrapperDisplayTest, SwapBuffersWithDamageKHR002, Level1)
626 {
627 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
628
629 auto temp = gWrapperHook.isLoad;
630 gWrapperHook.isLoad = false;
631
632 auto result = eglWrapperDisplay->SwapBuffersWithDamageKHR(nullptr, 0, 0);
633 ASSERT_EQ(EGL_FALSE, result);
634 gWrapperHook.isLoad = temp;
635 }
636
637 /**
638 * @tc.name: SwapBuffersWithDamageKHR003
639 * @tc.desc:
640 * @tc.type: FUNC
641 */
HWTEST_F(EglWrapperDisplayTest,SwapBuffersWithDamageKHR003,Level1)642 HWTEST_F(EglWrapperDisplayTest, SwapBuffersWithDamageKHR003, Level1)
643 {
644 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
645
646 auto result = eglWrapperDisplay->SwapBuffersWithDamageKHR(nullptr, 0, -1);
647 ASSERT_EQ(EGL_FALSE, result);
648 }
649
650 /**
651 * @tc.name: SetDamageRegionKHR001
652 * @tc.desc:
653 * @tc.type: FUNC
654 */
HWTEST_F(EglWrapperDisplayTest,SetDamageRegionKHR001,Level1)655 HWTEST_F(EglWrapperDisplayTest, SetDamageRegionKHR001, Level1)
656 {
657 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
658
659 auto result = eglWrapperDisplay->SetDamageRegionKHR(nullptr, 0, 0);
660 ASSERT_EQ(EGL_FALSE, result);
661 }
662
663 /**
664 * @tc.name: SetDamageRegionKHR002
665 * @tc.desc:
666 * @tc.type: FUNC
667 */
HWTEST_F(EglWrapperDisplayTest,SetDamageRegionKHR002,Level1)668 HWTEST_F(EglWrapperDisplayTest, SetDamageRegionKHR002, Level1)
669 {
670 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
671
672 auto result = eglWrapperDisplay->SetDamageRegionKHR(nullptr, 0, -1);
673 ASSERT_EQ(EGL_FALSE, result);
674 }
675
676 /**
677 * @tc.name: SetDamageRegionKHR003
678 * @tc.desc:
679 * @tc.type: FUNC
680 */
HWTEST_F(EglWrapperDisplayTest,SetDamageRegionKHR003,Level1)681 HWTEST_F(EglWrapperDisplayTest, SetDamageRegionKHR003, Level1)
682 {
683 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
684
685 auto temp = gWrapperHook.isLoad;
686 gWrapperHook.isLoad = false;
687
688 auto result = eglWrapperDisplay->SetDamageRegionKHR(nullptr, 0, 0);
689 ASSERT_EQ(EGL_FALSE, result);
690 gWrapperHook.isLoad = temp;
691 }
692
693 /**
694 * @tc.name: GetCompositorTimingSupportedANDROID001
695 * @tc.desc:
696 * @tc.type: FUNC
697 */
HWTEST_F(EglWrapperDisplayTest,GetCompositorTimingSupportedANDROID001,Level1)698 HWTEST_F(EglWrapperDisplayTest, GetCompositorTimingSupportedANDROID001, Level1)
699 {
700 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
701
702 auto result = eglWrapperDisplay->GetCompositorTimingSupportedANDROID(nullptr, 0);
703 ASSERT_EQ(EGL_FALSE, result);
704 }
705
706 /**
707 * @tc.name: GetCompositorTimingSupportedANDROID002
708 * @tc.desc:
709 * @tc.type: FUNC
710 */
HWTEST_F(EglWrapperDisplayTest,GetCompositorTimingSupportedANDROID002,Level1)711 HWTEST_F(EglWrapperDisplayTest, GetCompositorTimingSupportedANDROID002, Level1)
712 {
713 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
714
715 auto temp = gWrapperHook.isLoad;
716 gWrapperHook.isLoad = false;
717
718 auto result = eglWrapperDisplay->GetCompositorTimingSupportedANDROID(nullptr, 0);
719 ASSERT_EQ(EGL_FALSE, result);
720 gWrapperHook.isLoad = temp;
721 }
722
723 /**
724 * @tc.name: GetFrameTimestampSupportedANDROID001
725 * @tc.desc:
726 * @tc.type: FUNC
727 */
HWTEST_F(EglWrapperDisplayTest,GetFrameTimestampSupportedANDROID001,Level1)728 HWTEST_F(EglWrapperDisplayTest, GetFrameTimestampSupportedANDROID001, Level1)
729 {
730 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
731
732 auto result = eglWrapperDisplay->GetFrameTimestampSupportedANDROID(nullptr, 0);
733 ASSERT_EQ(EGL_FALSE, result);
734 }
735
736 /**
737 * @tc.name: PresentationTimeANDROID001
738 * @tc.desc:
739 * @tc.type: FUNC
740 */
HWTEST_F(EglWrapperDisplayTest,PresentationTimeANDROID001,Level1)741 HWTEST_F(EglWrapperDisplayTest, PresentationTimeANDROID001, Level1)
742 {
743 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
744
745 auto result = eglWrapperDisplay->PresentationTimeANDROID(nullptr, 0);
746 ASSERT_EQ(EGL_FALSE, result);
747 }
748
749 /**
750 * @tc.name: CreatePlatformWindowSurfaceEXT001
751 * @tc.desc:
752 * @tc.type: FUNC
753 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformWindowSurfaceEXT001,Level1)754 HWTEST_F(EglWrapperDisplayTest, CreatePlatformWindowSurfaceEXT001, Level1)
755 {
756 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
757
758 auto result = eglWrapperDisplay->CreatePlatformWindowSurfaceEXT(nullptr, nullptr, nullptr);
759 ASSERT_EQ(EGL_NO_SURFACE, result);
760 }
761
762 /**
763 * @tc.name: CreatePlatformWindowSurfaceEXT002
764 * @tc.desc:
765 * @tc.type: FUNC
766 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformWindowSurfaceEXT002,Level1)767 HWTEST_F(EglWrapperDisplayTest, CreatePlatformWindowSurfaceEXT002, Level1)
768 {
769 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
770
771 auto temp = gWrapperHook.isLoad;
772 gWrapperHook.isLoad = false;
773
774 auto result = eglWrapperDisplay->CreatePlatformWindowSurfaceEXT(nullptr, nullptr, nullptr);
775 ASSERT_EQ(EGL_NO_SURFACE, result);
776 gWrapperHook.isLoad = temp;
777 }
778
779 /**
780 * @tc.name: CreatePlatformPixmapSurfaceEXT001
781 * @tc.desc:
782 * @tc.type: FUNC
783 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformPixmapSurfaceEXT001,Level1)784 HWTEST_F(EglWrapperDisplayTest, CreatePlatformPixmapSurfaceEXT001, Level1)
785 {
786 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
787
788 auto result = eglWrapperDisplay->CreatePlatformPixmapSurfaceEXT(nullptr, nullptr, nullptr);
789 ASSERT_EQ(EGL_NO_SURFACE, result);
790 }
791
792 /**
793 * @tc.name: CreatePlatformPixmapSurfaceEXT002
794 * @tc.desc:
795 * @tc.type: FUNC
796 */
HWTEST_F(EglWrapperDisplayTest,CreatePlatformPixmapSurfaceEXT002,Level1)797 HWTEST_F(EglWrapperDisplayTest, CreatePlatformPixmapSurfaceEXT002, Level1)
798 {
799 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
800
801 auto temp = gWrapperHook.isLoad;
802 gWrapperHook.isLoad = false;
803
804 auto result = eglWrapperDisplay->CreatePlatformPixmapSurfaceEXT(nullptr, nullptr, nullptr);
805 ASSERT_EQ(EGL_NO_SURFACE, result);
806 gWrapperHook.isLoad = temp;
807 }
808
809 /**
810 * @tc.name: SwapBuffersWithDamageEXT001
811 * @tc.desc:
812 * @tc.type: FUNC
813 */
HWTEST_F(EglWrapperDisplayTest,SwapBuffersWithDamageEXT001,Level1)814 HWTEST_F(EglWrapperDisplayTest, SwapBuffersWithDamageEXT001, Level1)
815 {
816 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
817
818 auto result = eglWrapperDisplay->SwapBuffersWithDamageEXT(nullptr, nullptr, 0);
819 ASSERT_EQ(EGL_FALSE, result);
820 }
821
822 /**
823 * @tc.name: SwapBuffersWithDamageEXT002
824 * @tc.desc:
825 * @tc.type: FUNC
826 */
HWTEST_F(EglWrapperDisplayTest,SwapBuffersWithDamageEXT002,Level1)827 HWTEST_F(EglWrapperDisplayTest, SwapBuffersWithDamageEXT002, Level1)
828 {
829 auto eglWrapperDisplay = EglWrapperDisplay::GetWrapperDisplay((EGLDisplay)&EglWrapperDisplay::wrapperDisp_);
830
831 auto result = eglWrapperDisplay->SetDamageRegionKHR(nullptr, nullptr, -1);
832 ASSERT_EQ(EGL_FALSE, result);
833 }
834
835 } // OHOS::Rosen