• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2025 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 
16 #include "hdi_composer_ut.h"
17 #include <chrono>
18 #include <cinttypes>
19 #include <algorithm>
20 #include "v1_2/include/idisplay_composer_interface.h"
21 #include "v1_2/include/idisplay_composer_interface.h"
22 #include "v1_1/display_composer_type.h"
23 #include "v1_0/display_buffer_type.h"
24 #include "display_test.h"
25 #include "display_test_utils.h"
26 #include "hdi_composition_check.h"
27 #include "hdi_test_device.h"
28 #include "hdi_test_device_common.h"
29 #include "hdi_test_display.h"
30 #include "hdi_test_render_utils.h"
31 
32 using namespace OHOS::HDI::Display::Buffer::V1_0;
33 using namespace OHOS::HDI::Display::Composer::V1_1;
34 using namespace OHOS::HDI::Display::TEST;
35 using namespace testing::ext;
36 
37 static sptr<Composer::V1_2::IDisplayComposerInterface> g_composerDevice = nullptr;
38 static std::shared_ptr<IDisplayBuffer> g_gralloc = nullptr;
39 static std::vector<uint32_t> g_displayIds;
40 
SetUpTestCase()41 void DeviceTestAdditional::SetUpTestCase()
42 {
43     int ret = HdiTestDevice::GetInstance().InitDevice();
44     ASSERT_TRUE(ret == DISPLAY_SUCCESS);
45 
46     g_composerDevice = HdiTestDevice::GetInstance().GetDeviceInterface();
47     ASSERT_TRUE(g_composerDevice != nullptr);
48 
49     g_gralloc.reset(IDisplayBuffer::Get());
50     ASSERT_TRUE(g_gralloc != nullptr);
51 
52     g_displayIds = HdiTestDevice::GetInstance().GetDevIds();
53     ASSERT_TRUE(g_displayIds.size() > 0);
54 }
55 
TearDownTestCase()56 void DeviceTestAdditional::TearDownTestCase()
57 {
58     HdiTestDevice::GetInstance().Clear();
59     HdiTestDevice::GetInstance().GetFirstDisplay()->ResetClientLayer();
60 }
61 
62 /**
63  * @tc.number : SUB_Driver_Display_ClientBufferCount_0100
64  * @tc.name   : testClientBufferCount001
65  * @tc.desc   : test cache count Max
66  */
67 HWTEST_F(DeviceTestAdditional, testClientBufferCount001, Function | MediumTest | Level1)
68 {
69     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
70     const uint32_t cacheCount = 20;
71     auto ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], cacheCount);
72     EXPECT_EQ(DISPLAY_SUCCESS, ret);
73 }
74 
75 /**
76  * @tc.number : SUB_Driver_Display_ClientBufferCount_0200
77  * @tc.name   : testClientBufferCount002
78  * @tc.desc   : test cache count Min
79  */
80 HWTEST_F(DeviceTestAdditional, testClientBufferCount002, Function | MediumTest | Level1)
81 {
82     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
83     const uint32_t cacheCount = 0;
84     auto ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], cacheCount);
85     EXPECT_EQ(DISPLAY_SUCCESS, ret);
86 }
87 
88 /**
89  * @tc.number : SUB_Driver_Display_ClientBufferCount_0300
90  * @tc.name   : testClientBufferCount003
91  * @tc.desc   : test cache count Random
92  */
93 HWTEST_F(DeviceTestAdditional, testClientBufferCount003, Function | MediumTest | Level1)
94 {
95     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
96     const uint32_t cacheCount = 15;
97     auto ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], cacheCount);
98     EXPECT_EQ(DISPLAY_SUCCESS, ret);
99 }
100 
101 /**
102  * @tc.number : SUB_Driver_Display_ClientBufferCount_0400
103  * @tc.name   : testClientBufferCount004
104  * @tc.desc   : test devId Max
105  */
106 HWTEST_F(DeviceTestAdditional, testClientBufferCount004, Function | MediumTest | Level2)
107 {
108     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
109     const uint32_t cacheCount = 5;
110     auto ret = g_composerDevice->SetClientBufferCacheCount(20, cacheCount);
111     EXPECT_EQ(DISPLAY_FAILURE, ret);
112 }
113 
114 /**
115  * @tc.number : SUB_Driver_Display_ClientBufferCount_0500
116  * @tc.name   : testClientBufferCount005
117  * @tc.desc   : test devId Min
118  */
119 HWTEST_F(DeviceTestAdditional, testClientBufferCount005, Function | MediumTest | Level1)
120 {
121     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
122     const uint32_t cacheCount = 5;
123     auto ret = g_composerDevice->SetClientBufferCacheCount(0, cacheCount);
124     EXPECT_EQ(DISPLAY_SUCCESS, ret);
125 }
126 
127 /**
128  * @tc.number : SUB_Driver_Display_ClientBufferCount_0600
129  * @tc.name   : testClientBufferCount006
130  * @tc.desc   : test devId Random
131  */
132 HWTEST_F(DeviceTestAdditional, testClientBufferCount006, Function | MediumTest | Level2)
133 {
134     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
135     const uint32_t cacheCount = 5;
136     auto ret = g_composerDevice->SetClientBufferCacheCount(15, cacheCount);
137     EXPECT_EQ(DISPLAY_FAILURE, ret);
138 }
139 
140 /**
141  * @tc.number : SUB_Driver_Display_ClientBufferCount_0700
142  * @tc.name   : testClientBufferCount007
143  * @tc.desc   : test devId Negative Number
144  */
145 HWTEST_F(DeviceTestAdditional, testClientBufferCount007, Function | MediumTest | Level2)
146 {
147     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
148     const uint32_t cacheCount = 5;
149     auto ret = g_composerDevice->SetClientBufferCacheCount(-1, cacheCount);
150     EXPECT_EQ(DISPLAY_FAILURE, ret);
151 }
152 
153 /**
154  * @tc.number : SUB_Driver_Display_ClientBufferCount_0800
155  * @tc.name   : testClientBufferCount008
156  * @tc.desc   : test devId Negative Number
157  */
158 HWTEST_F(DeviceTestAdditional, testClientBufferCount008, Function | MediumTest | Level1)
159 {
160     g_composerDevice->ClearClientBuffer(g_displayIds[0]);
161     const uint32_t cacheCount = -1;
162     auto ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], cacheCount);
163     EXPECT_EQ(DISPLAY_SUCCESS, ret);
164 }
165 
166 /**
167  * @tc.number : SUB_Driver_Display_Capability_0200
168  * @tc.name   : testCapability002
169  * @tc.desc   : test devId Min
170  */
171 HWTEST_F(DeviceTestAdditional, testCapability002, Function | MediumTest | Level1)
172 {
173     DisplayCapability info;
174     auto ret = g_composerDevice->GetDisplayCapability(0, info);
175     EXPECT_EQ(DISPLAY_SUCCESS, ret);
176 }
177 
178 /**
179  * @tc.number : SUB_Driver_Display_SupportedModes_0100
180  * @tc.name   : testSupportedModes001
181  * @tc.desc   : test devId Max
182  */
183 HWTEST_F(DeviceTestAdditional, testSupportedModes001, Function | MediumTest | Level2)
184 {
185     std::vector<DisplayModeInfo> modes;
186     auto ret = g_composerDevice->GetDisplaySupportedModes(20, modes);
187     EXPECT_EQ(DISPLAY_FAILURE, ret);
188 }
189 
190 /**
191  * @tc.number : SUB_Driver_Display_SupportedModes_0200
192  * @tc.name   : testSupportedModes002
193  * @tc.desc   : test devId Min
194  */
195 HWTEST_F(DeviceTestAdditional, testSupportedModes002, Function | MediumTest | Level1)
196 {
197     std::vector<DisplayModeInfo> modes;
198     auto ret = g_composerDevice->GetDisplaySupportedModes(0, modes);
199     EXPECT_EQ(DISPLAY_SUCCESS, ret);
200 }
201 
202 /**
203  * @tc.number : SUB_Driver_Display_SupportedModes_0400
204  * @tc.name   : testSupportedModes004
205  * @tc.desc   : test devId Negative Number
206  */
207 HWTEST_F(DeviceTestAdditional, testSupportedModes004, Function | MediumTest | Level2)
208 {
209     std::vector<DisplayModeInfo> modes;
210     auto ret = g_composerDevice->GetDisplaySupportedModes(-1, modes);
211     EXPECT_EQ(DISPLAY_FAILURE, ret);
212 }
213 
214 /**
215  * @tc.number : SUB_Driver_Display_GetDisplayMode_0100
216  * @tc.name   :	testGetDisplayMode001
217  * @tc.desc   : test devId Max
218  */
219 HWTEST_F(DeviceTestAdditional, testGetDisplayMode001, Function | MediumTest | Level2)
220 {
221     uint32_t mode = 0;
222     auto ret = g_composerDevice->GetDisplayMode(20, mode);
223     EXPECT_EQ(DISPLAY_FAILURE, ret);
224 }
225 
226 /**
227  * @tc.number : SUB_Driver_Display_GetDisplayMode_0200
228  * @tc.name   : testGetDisplayMode002
229  * @tc.desc   : test devId Min
230  */
231 HWTEST_F(DeviceTestAdditional, testGetDisplayMode002, Function | MediumTest | Level1)
232 {
233     uint32_t mode = 0;
234     auto ret = g_composerDevice->GetDisplayMode(0, mode);
235     EXPECT_EQ(DISPLAY_SUCCESS, ret);
236 }
237 
238 /**
239  * @tc.number : SUB_Driver_Display_GetDisplayMode_0300
240  * @tc.name   : testGetDisplayMode003
241  * @tc.desc   : test devId Random
242  */
243 HWTEST_F(DeviceTestAdditional, testGetDisplayMode003, Function | MediumTest | Level2)
244 {
245     uint32_t mode = 0;
246     auto ret = g_composerDevice->GetDisplayMode(15, mode);
247     EXPECT_EQ(DISPLAY_FAILURE, ret);
248 }
249 
250 /**
251  * @tc.number : SUB_Driver_Display_GetDisplayMode_0400
252  * @tc.name   : testGetDisplayMode004
253  * @tc.desc   : test devId Negative Number
254  */
255 HWTEST_F(DeviceTestAdditional, testGetDisplayMode004, Function | MediumTest | Level2)
256 {
257     uint32_t mode = 0;
258     auto ret = g_composerDevice->GetDisplayMode(-1, mode);
259     EXPECT_EQ(DISPLAY_FAILURE, ret);
260 }
261 
262 /**
263  * @tc.number : SUB_Driver_Display_SetDisplayMode_0100
264  * @tc.name   : testSetDisplayMode001
265  * @tc.desc   : test devId Max
266  */
267 HWTEST_F(DeviceTestAdditional, testSetDisplayMode001, Function | MediumTest | Level2)
268 {
269     const uint32_t mode = 0;
270     auto ret = g_composerDevice->SetDisplayMode(20, mode);
271     EXPECT_EQ(DISPLAY_FAILURE, ret);
272 }
273 
274 /**
275  * @tc.number : SUB_Driver_Display_SetDisplayMode_0200
276  * @tc.name   : testSetDisplayMode002
277  * @tc.desc   : test devId Min
278  */
279 HWTEST_F(DeviceTestAdditional, testSetDisplayMode002, Function | MediumTest | Level1)
280 {
281     const uint32_t mode = 0;
282     auto ret = g_composerDevice->SetDisplayMode(0, mode);
283     EXPECT_EQ(DISPLAY_SUCCESS, ret);
284 }
285 
286 /**
287  * @tc.number : SUB_Driver_Display_SetDisplayMode_0300
288  * @tc.name   : testSetDisplayMode003
289  * @tc.desc   : test devId Random
290  */
291 HWTEST_F(DeviceTestAdditional, testSetDisplayMode003, Function | MediumTest | Level2)
292 {
293     const uint32_t mode = 0;
294     auto ret = g_composerDevice->SetDisplayMode(15, mode);
295     EXPECT_EQ(DISPLAY_FAILURE, ret);
296 }
297 
298 /**
299  * @tc.number : SUB_Driver_Display_SetDisplayMode_0400
300  * @tc.name   : testSetDisplayMode004
301  * @tc.desc   : test devId Negative Number
302  */
303 HWTEST_F(DeviceTestAdditional, testSetDisplayMode004, Function | MediumTest | Level2)
304 {
305     const uint32_t mode = 0;
306     auto ret = g_composerDevice->SetDisplayMode(-1, mode);
307     EXPECT_EQ(DISPLAY_FAILURE, ret);
308 }
309 
310 #ifdef DISPLAY_COMMUNITY
311 /**
312  * @tc.number : SUB_Driver_Display_SetDisplayMode_0500
313  * @tc.name   : testSetDisplayMode005
314  * @tc.desc   : test ModeId Max
315  */
316 HWTEST_F(DeviceTestAdditional, testSetDisplayMode005, Function | MediumTest | Level2)
317 {
318     const uint32_t mode = 20;
319     auto ret = g_composerDevice->SetDisplayMode(g_displayIds[0], mode);
320     EXPECT_EQ(DISPLAY_FAILURE, ret);
321 }
322 
323 /**
324  * @tc.number : SUB_Driver_Display_SetDisplayMode_0600
325  * @tc.name   : testSetDisplayMode006
326  * @tc.desc   : test devId Boundary
327  */
328 HWTEST_F(DeviceTestAdditional, testSetDisplayMode006, Function | MediumTest | Level2)
329 {
330     const uint32_t mode = 8;
331     auto ret = g_composerDevice->SetDisplayMode(g_displayIds[0], mode);
332     EXPECT_EQ(DISPLAY_FAILURE, ret);
333 }
334 
335 /**
336  * @tc.number : SUB_Driver_Display_SetDisplayMode_0700
337  * @tc.name   : testSetDisplayMode007
338  * @tc.desc   : test devId Random
339  */
340 HWTEST_F(DeviceTestAdditional, testSetDisplayMode007, Function | MediumTest | Level2)
341 {
342     const uint32_t mode = 15;
343     auto ret = g_composerDevice->SetDisplayMode(g_displayIds[0], mode);
344     EXPECT_EQ(DISPLAY_FAILURE, ret);
345 }
346 
347 /**
348  * @tc.number : SUB_Driver_Display_SetDisplayMode_0800
349  * @tc.name   : testSetDisplayMode008
350  * @tc.desc   : test devId Random
351  */
352 HWTEST_F(DeviceTestAdditional, testSetDisplayMode008, Function | MediumTest | Level1)
353 {
354     const uint32_t mode = -1;
355     auto ret = g_composerDevice->SetDisplayMode(g_displayIds[0], mode);
356     EXPECT_EQ(DISPLAY_FAILURE, ret);
357 }
358 #endif
359 
360 /**
361  * @tc.number : SUB_Driver_Display_GetDisplayPowerStatus_0100
362  * @tc.name   : testGetDisplayPowerStatus001
363  * @tc.desc   : test devId Max
364  */
365 HWTEST_F(DeviceTestAdditional, testGetDisplayPowerStatus001, Function | MediumTest | Level2)
366 {
367     Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
368     auto ret = g_composerDevice->GetDisplayPowerStatus(20, powerStatus);
369 #ifdef DISPLAY_COMMUNITY
370     EXPECT_EQ(DISPLAY_FAILURE, ret);
371 #else
372     EXPECT_EQ(DISPLAY_SUCCESS, ret);
373 #endif
374 }
375 
376 /**
377  * @tc.number : SUB_Driver_Display_GetDisplayPowerStatus_0200
378  * @tc.name   : testGetDisplayPowerStatus002
379  * @tc.desc   : test devId Min
380  */
381 HWTEST_F(DeviceTestAdditional, testGetDisplayPowerStatus002, Function | MediumTest | Level1)
382 {
383     Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
384     auto ret = g_composerDevice->GetDisplayPowerStatus(0, powerStatus);
385     EXPECT_EQ(DISPLAY_SUCCESS, ret);
386 }
387 
388 /**
389  * @tc.number : SUB_Driver_Display_GetDisplayPowerStatus_0300
390  * @tc.name   : testGetDisplayPowerStatus003
391  * @tc.desc   : test devId Random
392  */
393 HWTEST_F(DeviceTestAdditional, testGetDisplayPowerStatus003, Function | MediumTest | Level2)
394 {
395     Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
396     auto ret = g_composerDevice->GetDisplayPowerStatus(15, powerStatus);
397 #ifdef DISPLAY_COMMUNITY
398     EXPECT_EQ(DISPLAY_FAILURE, ret);
399 #else
400     EXPECT_EQ(DISPLAY_SUCCESS, ret);
401 #endif
402 }
403 
404 /**
405  * @tc.number : SUB_Driver_Display_GetDisplayPowerStatus_0400
406  * @tc.name   : testGetDisplayPowerStatus004
407  * @tc.desc   : test devId Negative Number
408  */
409 HWTEST_F(DeviceTestAdditional, testGetDisplayPowerStatus004, Function | MediumTest | Level2)
410 {
411     Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
412     auto ret = g_composerDevice->GetDisplayPowerStatus(-1, powerStatus);
413 #ifdef DISPLAY_COMMUNITY
414     EXPECT_EQ(DISPLAY_FAILURE, ret);
415 #else
416     EXPECT_EQ(DISPLAY_SUCCESS, ret);
417 #endif
418 }
419 
420 /**
421  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0100
422  * @tc.name   : testSetDisplayPowerStatus001
423  * @tc.desc   : test devId Max
424  */
425 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus001, Function | MediumTest | Level2)
426 {
427     auto ret = g_composerDevice->SetDisplayPowerStatus(20, Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
428     EXPECT_EQ(DISPLAY_FAILURE, ret);
429 }
430 
431 
432 /**
433  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0200
434  * @tc.name   : testSetDisplayPowerStatus002
435  * @tc.desc   : test devId Min
436  */
437 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus002, Function | MediumTest | Level1)
438 {
439     auto ret = g_composerDevice->SetDisplayPowerStatus(0, Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
440     EXPECT_EQ(DISPLAY_SUCCESS, ret);
441 }
442 
443 /**
444  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0300
445  * @tc.name   : testSetDisplayPowerStatus003
446  * @tc.desc   : test devId Random
447  */
448 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus003, Function | MediumTest | Level2)
449 {
450     auto ret = g_composerDevice->SetDisplayPowerStatus(15, Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
451     EXPECT_EQ(DISPLAY_FAILURE, ret);
452 }
453 
454 /**
455  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0400
456  * @tc.name   : testSetDisplayPowerStatus004
457  * @tc.desc   : test devId Negative Number
458  */
459 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus004, Function | MediumTest | Level2)
460 {
461     auto ret = g_composerDevice->SetDisplayPowerStatus(-1, Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
462     EXPECT_EQ(DISPLAY_FAILURE, ret);
463 }
464 
465 /**
466  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0500
467  * @tc.name   : testSetDisplayPowerStatus005
468  * @tc.desc   : test devId Max when power status is POWER_STATUS_STANDBY
469  */
470 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus005, Function | MediumTest | Level2)
471 {
472     auto ret = g_composerDevice->SetDisplayPowerStatus(20, Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
473     EXPECT_EQ(DISPLAY_FAILURE, ret);
474 }
475 
476 /**
477  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0600
478  * @tc.name   : testSetDisplayPowerStatus006
479  * @tc.desc   : test devId Min when power status is POWER_STATUS_STANDBY
480  */
481 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus006, Function | MediumTest | Level1)
482 {
483     auto ret = g_composerDevice->SetDisplayPowerStatus(0, Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
484     EXPECT_EQ(DISPLAY_SUCCESS, ret);
485 }
486 
487 /**
488  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0700
489  * @tc.name   : testSetDisplayPowerStatus007
490  * @tc.desc   : test devId Random when power status is POWER_STATUS_STANDBY
491  */
492 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus007, Function | MediumTest | Level2)
493 {
494     auto ret = g_composerDevice->SetDisplayPowerStatus(15, Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
495     EXPECT_EQ(DISPLAY_FAILURE, ret);
496 }
497 
498 /**
499  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0800
500  * @tc.name   : testSetDisplayPowerStatus008
501  * @tc.desc   : test devId Negative Number when power status is POWER_STATUS_STANDBY
502  */
503 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus008, Function | MediumTest | Level2)
504 {
505     auto ret = g_composerDevice->SetDisplayPowerStatus(-1, Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
506     EXPECT_EQ(DISPLAY_FAILURE, ret);
507 }
508 
509 /**
510  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_0900
511  * @tc.name   : testSetDisplayPowerStatus009
512  * @tc.desc   : test power status is POWER_STATUS_SUSPEND
513  */
514 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus009, Function | MediumTest | Level1)
515 {
516     auto ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
517         Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
518     EXPECT_EQ(DISPLAY_SUCCESS, ret);
519 }
520 
521 /**
522  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_1000
523  * @tc.name   : testSetDisplayPowerStatus010
524  * @tc.desc   : test power status is POWER_STATUS_OFF
525  */
526 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus010, Function | MediumTest | Level1)
527 {
528     auto ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
529         Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF);
530     EXPECT_EQ(DISPLAY_SUCCESS, ret);
531 }
532 
533 #ifdef DISPLAY_COMMUNITY
534 /**
535  * @tc.number : SUB_Driver_Display_SetDisplayPowerStatus_1100
536  * @tc.name   : testSetDisplayPowerStatus011
537  * @tc.desc   : test power status is POWER_STATUS_BUTT
538  */
539 HWTEST_F(DeviceTestAdditional, testSetDisplayPowerStatus011, Function | MediumTest | Level2)
540 {
541     auto ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
542         Composer::V1_0::DispPowerStatus::POWER_STATUS_BUTT);
543     EXPECT_EQ(DISPLAY_FAILURE, ret);
544 }
545 #endif
546 
547 /**
548  * @tc.number : SUB_Driver_Display_GetDisplayBacklight_0100
549  * @tc.name   : testGetDisplayBacklight001
550  * @tc.desc   : test devId Max
551  */
552 HWTEST_F(DeviceTestAdditional, testGetDisplayBacklight001, Function | MediumTest | Level2)
553 {
554     uint32_t level;
555     auto ret = g_composerDevice->GetDisplayBacklight(20, level);
556 #ifdef DISPLAY_COMMUNITY
557     EXPECT_EQ(DISPLAY_FAILURE, ret);
558 #else
559     EXPECT_EQ(DISPLAY_SUCCESS, ret);
560 #endif
561 }
562 
563 /**
564  * @tc.number : SUB_Driver_Display_GetDisplayBacklight_0200
565  * @tc.name   : GetDisplayBacklight002
566  * @tc.desc   : test devId Min
567  */
568 HWTEST_F(DeviceTestAdditional, testGetDisplayBacklight002, Function | MediumTest | Level1)
569 {
570     uint32_t level;
571     auto ret = g_composerDevice->GetDisplayBacklight(0, level);
572     EXPECT_EQ(DISPLAY_SUCCESS, ret);
573 }
574 
575 /**
576  * @tc.number : SUB_Driver_Display_GetDisplayBacklight_0300
577  * @tc.name   : GetDisplayBacklight003
578  * @tc.desc   : test devId Random
579  */
580 HWTEST_F(DeviceTestAdditional, testGetDisplayBacklight003, Function | MediumTest | Level2)
581 {
582     uint32_t level;
583     auto ret = g_composerDevice->GetDisplayBacklight(15, level);
584 #ifdef DISPLAY_COMMUNITY
585     EXPECT_EQ(DISPLAY_FAILURE, ret);
586 #else
587     EXPECT_EQ(DISPLAY_SUCCESS, ret);
588 #endif
589 }
590 
591 /**
592  * @tc.number : SUB_Driver_Display_GetDisplayBacklight_0400
593  * @tc.name   : GetDisplayBacklight004
594  * @tc.desc   : test devId Negative Number
595  */
596 HWTEST_F(DeviceTestAdditional, testGetDisplayBacklight004, Function | MediumTest | Level2)
597 {
598     uint32_t level;
599     auto ret = g_composerDevice->GetDisplayBacklight(-1, level);
600 #ifdef DISPLAY_COMMUNITY
601     EXPECT_EQ(DISPLAY_FAILURE, ret);
602 #else
603     EXPECT_EQ(DISPLAY_SUCCESS, ret);
604 #endif
605 }
606 
607 /**
608  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0100
609  * @tc.name   : testSetDisplayBacklight001
610  * @tc.desc   : test devId Max
611  */
612 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight001, Function | MediumTest | Level2)
613 {
614     const uint32_t level = 10;
615     auto ret = g_composerDevice->SetDisplayBacklight(20, level);
616     EXPECT_EQ(DISPLAY_FAILURE, ret);
617 }
618 
619 /**
620  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0200
621  * @tc.name   : testSetDisplayBacklight002
622  * @tc.desc   : test devId Min
623  */
624 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight002, Function | MediumTest | Level1)
625 {
626     const uint32_t level = 10;
627     auto ret = g_composerDevice->SetDisplayBacklight(0, level);
628     EXPECT_EQ(DISPLAY_SUCCESS, ret);
629 }
630 
631 /**
632  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0300
633  * @tc.name   : testSetDisplayBacklight003
634  * @tc.desc   : test devId Random
635  */
636 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight003, Function | MediumTest | Level2)
637 {
638     const uint32_t level = 10;
639     auto ret = g_composerDevice->SetDisplayBacklight(15, level);
640     EXPECT_EQ(DISPLAY_FAILURE, ret);
641 }
642 
643 /**
644  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0400
645  * @tc.name   : testSetDisplayBacklight004
646  * @tc.desc   : test devId Negative Number
647  */
648 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight004, Function | MediumTest | Level2)
649 {
650     const uint32_t level = 10;
651     auto ret = g_composerDevice->SetDisplayBacklight(-1, level);
652     EXPECT_EQ(DISPLAY_FAILURE, ret);
653 }
654 
655 /**
656  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0500
657  * @tc.name   : testSetDisplayBacklight005
658  * @tc.desc   : test level Max
659  */
660 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight005, Function | MediumTest | Level1)
661 {
662     const uint32_t level = 20;
663     auto ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], level);
664     EXPECT_EQ(DISPLAY_SUCCESS, ret);
665 }
666 
667 /**
668  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0600
669  * @tc.name   : testSetDisplayBacklight006
670  * @tc.desc   : test level Min
671  */
672 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight006, Function | MediumTest | Level1)
673 {
674     const uint32_t level = 0;
675     auto ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], level);
676     EXPECT_EQ(DISPLAY_SUCCESS, ret);
677 }
678 
679 /**
680  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0700
681  * @tc.name   : testSetDisplayBacklight007
682  * @tc.desc   : test level Random
683  */
684 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight007, Function | MediumTest | Level1)
685 {
686     const uint32_t level = 15;
687     auto ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], level);
688     EXPECT_EQ(DISPLAY_SUCCESS, ret);
689 }
690 
691 #ifdef DISPLAY_COMMUNITY
692 /**
693  * @tc.number : SUB_Driver_Display_SetDisplayBacklight_0800
694  * @tc.name   : testSetDisplayBacklight008
695  * @tc.desc   : test level Negative Number
696  */
697 HWTEST_F(DeviceTestAdditional, testSetDisplayBacklight008, Function | MediumTest | Level1)
698 {
699     const uint32_t level = -1;
700     auto ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], level);
701     EXPECT_EQ(DISPLAY_SUCCESS, ret);
702 }
703 #endif
704 
705 /**
706  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0100
707  * @tc.name   : testGetDisplayProperty001
708  * @tc.desc   : test devId Max
709  */
710 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty001, Function | MediumTest | Level2)
711 {
712     const uint32_t propertyId = 1;
713     uint64_t propertyValue = 0;
714     auto ret = g_composerDevice->GetDisplayProperty(20, propertyId, propertyValue);
715 #ifdef DISPLAY_COMMUNITY
716     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
717 #else
718     if (ret == DISPLAY_NOT_SUPPORT) {
719         DISPLAY_TEST_LOGE("GetDisplayProperty not support");
720         return;
721     }
722     EXPECT_EQ(DISPLAY_SUCCESS, ret);
723 #endif
724 }
725 
726 /**
727  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0200
728  * @tc.name   : testGetDisplayProperty002
729  * @tc.desc   : test devId Min
730  */
731 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty002, Function | MediumTest | Level2)
732 {
733     const uint32_t propertyId = 1;
734     uint64_t propertyValue = 0;
735     auto ret = g_composerDevice->GetDisplayProperty(0, propertyId, propertyValue);
736 #ifdef DISPLAY_COMMUNITY
737     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
738 #else
739     if (ret == DISPLAY_NOT_SUPPORT) {
740         DISPLAY_TEST_LOGE("GetDisplayProperty not support");
741         return;
742     }
743     EXPECT_EQ(DISPLAY_SUCCESS, ret);
744 #endif
745 }
746 
747 /**
748  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0300
749  * @tc.name   : testGetDisplayProperty003
750  * @tc.desc   : test devId Random
751  */
752 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty003, Function | MediumTest | Level2)
753 {
754     const uint32_t propertyId = 1;
755     uint64_t propertyValue = 0;
756     auto ret = g_composerDevice->GetDisplayProperty(15, propertyId, propertyValue);
757 #ifdef DISPLAY_COMMUNITY
758     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
759 #else
760     if (ret == DISPLAY_NOT_SUPPORT) {
761         DISPLAY_TEST_LOGE("GetDisplayProperty not support");
762         return;
763     }
764     EXPECT_EQ(DISPLAY_SUCCESS, ret);
765 #endif
766 }
767 
768 /**
769  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0400
770  * @tc.name   : testGetDisplayProperty004
771  * @tc.desc   : test devId Negative Number
772  */
773 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty004, Function | MediumTest | Level2)
774 {
775     const uint32_t propertyId = 1;
776     uint64_t propertyValue = 0;
777     auto ret = g_composerDevice->GetDisplayProperty(-1, propertyId, propertyValue);
778 #ifdef DISPLAY_COMMUNITY
779     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
780 #else
781     if (ret == DISPLAY_NOT_SUPPORT) {
782         DISPLAY_TEST_LOGE("GetDisplayProperty not support");
783         return;
784     }
785     EXPECT_EQ(DISPLAY_SUCCESS, ret);
786 #endif
787 }
788 
789 /**
790  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0500
791  * @tc.name   : testGetDisplayProperty005
792  * @tc.desc   : test propertyId Max
793  */
794 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty005, Function | MediumTest | Level2)
795 {
796     const uint32_t propertyId = 20;
797     uint64_t propertyValue = 0;
798     auto ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
799     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
800 }
801 
802 /**
803  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0600
804  * @tc.name   : testGetDisplayProperty006
805  * @tc.desc   : test propertyId Min
806  */
807 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty006, Function | MediumTest | Level2)
808 {
809     const uint32_t propertyId = 0;
810     uint64_t propertyValue = 0;
811     auto ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
812     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
813 }
814 
815 /**
816  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0700
817  * @tc.name   : testGetDisplayProperty007
818  * @tc.desc   : test propertyId Random
819  */
820 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty007, Function | MediumTest | Level2)
821 {
822     const uint32_t propertyId = 15;
823     uint64_t propertyValue = 0;
824     auto ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
825     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
826 }
827 
828 /**
829  * @tc.number : SUB_Driver_Display_GetDisplayProperty_0800
830  * @tc.name   : testGetDisplayProperty008
831  * @tc.desc   : test propertyId Negative Number
832  */
833 HWTEST_F(DeviceTestAdditional, testGetDisplayProperty008, Function | MediumTest | Level2)
834 {
835     const uint32_t propertyId = -1;
836     uint64_t propertyValue = 0;
837     auto ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
838     EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
839 }
840 
841 /**
842  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0100
843  * @tc.name   : testSetDisplayProperty001
844  * @tc.desc   : test devid Max
845  */
846 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty001, Function | MediumTest | Level2)
847 {
848     const uint32_t propertyId = 1;
849     uint64_t propertyValue = 0;
850     auto ret = g_composerDevice->SetDisplayProperty(20, propertyId, propertyValue);
851     EXPECT_EQ(DISPLAY_FAILURE, ret);
852 }
853 
854 /**
855  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0200
856  * @tc.name   : testSetDisplayProperty002
857  * @tc.desc   : test devid Min
858  */
859 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty002, Function | MediumTest | Level2)
860 {
861     const uint32_t propertyId = 1;
862     uint64_t propertyValue = 0;
863     auto ret = g_composerDevice->SetDisplayProperty(0, propertyId, propertyValue);
864     EXPECT_EQ(DISPLAY_FAILURE, ret);
865 }
866 
867 /**
868  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0300
869  * @tc.name   : testSetDisplayProperty003
870  * @tc.desc   : test devid Random
871  */
872 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty003, Function | MediumTest | Level2)
873 {
874     const uint32_t propertyId = 1;
875     uint64_t propertyValue = 0;
876     auto ret = g_composerDevice->SetDisplayProperty(15, propertyId, propertyValue);
877     EXPECT_EQ(DISPLAY_FAILURE, ret);
878 }
879 
880 /**
881  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0400
882  * @tc.name   : testSetDisplayProperty004
883  * @tc.desc   : test devid Negative Number
884  */
885 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty004, Function | MediumTest | Level2)
886 {
887     const uint32_t propertyId = 1;
888     uint64_t propertyValue = 0;
889     auto ret = g_composerDevice->SetDisplayProperty(-1, propertyId, propertyValue);
890     EXPECT_EQ(DISPLAY_FAILURE, ret);
891 }
892 
893 /**
894  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0500
895  * @tc.name   : testSetDisplayProperty005
896  * @tc.desc   : test propertyId Random
897  */
898 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty005, Function | MediumTest | Level2)
899 {
900     const uint32_t propertyId = 20;
901     uint64_t propertyValue = 0;
902     auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
903     EXPECT_EQ(DISPLAY_FAILURE, ret);
904 }
905 
906 /**
907  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0600
908  * @tc.name   : testSetDisplayProperty006
909  * @tc.desc   : test propertyId Min
910  */
911 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty006, Function | MediumTest | Level2)
912 {
913     const uint32_t propertyId = 0;
914     uint64_t propertyValue = 0;
915     auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
916     EXPECT_EQ(DISPLAY_FAILURE, ret);
917 }
918 
919 /**
920  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0700
921  * @tc.name   : testSetDisplayProperty007
922  * @tc.desc   : test propertyId Negative Number
923  */
924 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty007, Function | MediumTest | Level2)
925 {
926     const uint32_t propertyId = -1;
927     uint64_t propertyValue = 0;
928     auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
929     EXPECT_EQ(DISPLAY_FAILURE, ret);
930 }
931 
932 /**
933  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0800
934  * @tc.name   : testSetDisplayProperty008
935  * @tc.desc   : test propertyValue Random
936  */
937 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty008, Function | MediumTest | Level2)
938 {
939     const uint32_t propertyId = 0;
940     uint64_t propertyValue = 20;
941     auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
942     EXPECT_EQ(DISPLAY_FAILURE, ret);
943 }
944 
945 /**
946  * @tc.number : SUB_Driver_Display_SetDisplayProperty_0900
947  * @tc.name   : testSetDisplayProperty009
948  * @tc.desc   : test propertyValue Negative Number
949  */
950 HWTEST_F(DeviceTestAdditional, testSetDisplayProperty009, Function | MediumTest | Level2)
951 {
952     const uint32_t propertyId = 0;
953     uint64_t propertyValue = -1;
954     auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], propertyId, propertyValue);
955     EXPECT_EQ(DISPLAY_FAILURE, ret);
956 }
957 
958 /**
959  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0100
960  * @tc.name   : testSetDisplayVsyncEnabled001
961  * @tc.desc   : test devid Max
962  */
963 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled001, Function | MediumTest | Level2)
964 {
965     auto ret = g_composerDevice->SetDisplayVsyncEnabled(20, true);
966     EXPECT_EQ(DISPLAY_FAILURE, ret);
967 }
968 
969 /**
970  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0200
971  * @tc.name   : testSetDisplayVsyncEnabled002
972  * @tc.desc   : test devid Min
973  */
974 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled002, Function | MediumTest | Level1)
975 {
976     auto ret = g_composerDevice->SetDisplayVsyncEnabled(0, true);
977     EXPECT_EQ(DISPLAY_SUCCESS, ret);
978 }
979 
980 /**
981  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0300
982  * @tc.name   : testSetDisplayVsyncEnabled003
983  * @tc.desc   : test devid Random
984  */
985 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled003, Function | MediumTest | Level2)
986 {
987     auto ret = g_composerDevice->SetDisplayVsyncEnabled(15, true);
988     EXPECT_EQ(DISPLAY_FAILURE, ret);
989 }
990 
991 /**
992  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0400
993  * @tc.name   : testSetDisplayVsyncEnabled004
994  * @tc.desc   : test devid Negative Number
995  */
996 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled004, Function | MediumTest | Level2)
997 {
998     auto ret = g_composerDevice->SetDisplayVsyncEnabled(-1, true);
999     EXPECT_EQ(DISPLAY_FAILURE, ret);
1000 }
1001 
1002 /**
1003  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0500
1004  * @tc.name   : testSetDisplayVsyncEnabled005
1005  * @tc.desc   : test enabled true
1006  */
1007 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled005, Function | MediumTest | Level1)
1008 {
1009     auto ret = g_composerDevice->SetDisplayVsyncEnabled(g_displayIds[0], true);
1010     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1011 }
1012 
1013 /**
1014  * @tc.number : SUB_Driver_Display_SetDisplayVsyncEnabled_0600
1015  * @tc.name   : testSetDisplayVsyncEnabled006
1016  * @tc.desc   : test enabled true
1017  */
1018 HWTEST_F(DeviceTestAdditional, testSetDisplayVsyncEnabled006, Function | MediumTest | Level1)
1019 {
1020     auto ret = g_composerDevice->SetDisplayVsyncEnabled(g_displayIds[0], false);
1021     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1022 }
1023 
1024 /**
1025  * @tc.number : SUB_Driver_Display_CreateLayer_0100
1026  * @tc.name   : testCreateLayer001
1027  * @tc.desc   : test devId Max
1028  */
1029 HWTEST_F(DeviceTestAdditional, testCreateLayer001, Function | MediumTest | Level2)
1030 {
1031     LayerInfo layerInfo;
1032     uint32_t count = 3;
1033     uint32_t layerId;
1034     auto ret = g_composerDevice->CreateLayer(20, layerInfo, count, layerId);
1035     EXPECT_EQ(DISPLAY_FAILURE, ret);
1036 }
1037 
1038 /**
1039  * @tc.number : SUB_Driver_Display_CreateLayer_0200
1040  * @tc.name   : testCreateLayer002
1041  * @tc.desc   : test devId Min
1042  */
1043 HWTEST_F(DeviceTestAdditional, testCreateLayer002, Function | MediumTest | Level1)
1044 {
1045     LayerInfo layerInfo;
1046     uint32_t count = 3;
1047     uint32_t layerId;
1048     auto ret = g_composerDevice->CreateLayer(0, layerInfo, count, layerId);
1049     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1050 }
1051 
1052 /**
1053  * @tc.number : SUB_Driver_Display_CreateLayer_0300
1054  * @tc.name   : testCreateLayer003
1055  * @tc.desc   : test devId Random
1056  */
1057 HWTEST_F(DeviceTestAdditional, testCreateLayer003, Function | MediumTest | Level2)
1058 {
1059     LayerInfo layerInfo;
1060     uint32_t count = 3;
1061     uint32_t layerId;
1062     auto ret = g_composerDevice->CreateLayer(15, layerInfo, count, layerId);
1063     EXPECT_EQ(DISPLAY_FAILURE, ret);
1064 }
1065 
1066 /**
1067  * @tc.number : SUB_Driver_Display_CreateLayer_0400
1068  * @tc.name   : testCreateLayer004
1069  * @tc.desc   : test devId Negative Number
1070  */
1071 HWTEST_F(DeviceTestAdditional, testCreateLayer004, Function | MediumTest | Level2)
1072 {
1073     LayerInfo layerInfo;
1074     uint32_t count = 3;
1075     uint32_t layerId;
1076     auto ret = g_composerDevice->CreateLayer(-1, layerInfo, count, layerId);
1077     EXPECT_EQ(DISPLAY_FAILURE, ret);
1078 }
1079 
1080 /**
1081  * @tc.number : SUB_Driver_Display_CreateLayer_0500
1082  * @tc.name   : testCreateLayer005
1083  * @tc.desc   : test cacheCount Max
1084  */
1085 HWTEST_F(DeviceTestAdditional, testCreateLayer005, Function | MediumTest | Level1)
1086 {
1087     LayerInfo layerInfo;
1088     uint32_t count = 20;
1089     uint32_t layerId;
1090     auto ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, count, layerId);
1091     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1092 }
1093 
1094 /**
1095  * @tc.number : SUB_Driver_Display_CreateLayer_0600
1096  * @tc.name   : testCreateLayer006
1097  * @tc.desc   : test devId Min
1098  */
1099 HWTEST_F(DeviceTestAdditional, testCreateLayer006, Function | MediumTest | Level1)
1100 {
1101     LayerInfo layerInfo;
1102     uint32_t count = 0;
1103     uint32_t layerId;
1104     auto ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, count, layerId);
1105     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1106 }
1107 
1108 /**
1109  * @tc.number : SUB_Driver_Display_CreateLayer_0700
1110  * @tc.name   : testCreateLayer007
1111  * @tc.desc   : test devId Random
1112  */
1113 HWTEST_F(DeviceTestAdditional, testCreateLayer007, Function | MediumTest | Level1)
1114 {
1115     LayerInfo layerInfo;
1116     uint32_t count = 15;
1117     uint32_t layerId;
1118     auto ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, count, layerId);
1119     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1120 }
1121 
1122 /**
1123  * @tc.number : SUB_Driver_Display_CreateLayer_0800
1124  * @tc.name   : testCreateLayer008
1125  * @tc.desc   : test devId Negative Number
1126  */
1127 HWTEST_F(DeviceTestAdditional, testCreateLayer008, Function | MediumTest | Level1)
1128 {
1129     LayerInfo layerInfo;
1130     uint32_t count = -1;
1131     uint32_t layerId;
1132     auto ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, count, layerId);
1133     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1134 }
1135 
1136 /**
1137  * @tc.number : SUB_Driver_Display_DestroyLayer_0100
1138  * @tc.name   : testDestroyLayer001
1139  * @tc.desc   : test devId Max
1140  */
1141 HWTEST_F(DeviceTestAdditional, testDestroyLayer001, Function | MediumTest | Level2)
1142 {
1143     uint32_t layerId = 1;
1144     auto ret = g_composerDevice->DestroyLayer(20, layerId);
1145     EXPECT_EQ(DISPLAY_FAILURE, ret);
1146 }
1147 
1148 /**
1149  * @tc.number : SUB_Driver_Display_DestroyLayer_0200
1150  * @tc.name   : testDestroyLayer002
1151  * @tc.desc   : test devId Min
1152  */
1153 HWTEST_F(DeviceTestAdditional, testDestroyLayer002, Function | MediumTest | Level2)
1154 {
1155     uint32_t layerId = 1;
1156     auto ret = g_composerDevice->DestroyLayer(0, layerId);
1157     EXPECT_EQ(DISPLAY_FAILURE, ret);
1158 }
1159 
1160 /**
1161  * @tc.number : SUB_Driver_Display_DestroyLayer_0300
1162  * @tc.name   : testDestroyLayer003
1163  * @tc.desc   : test devId Random
1164  */
1165 HWTEST_F(DeviceTestAdditional, testDestroyLayer003, Function | MediumTest | Level2)
1166 {
1167     uint32_t layerId = 1;
1168     auto ret = g_composerDevice->DestroyLayer(15, layerId);
1169     EXPECT_EQ(DISPLAY_FAILURE, ret);
1170 }
1171 
1172 /**
1173  * @tc.number : SUB_Driver_Display_DestroyLayer_0400
1174  * @tc.name   : testDestroyLayer004
1175  * @tc.desc   : test devId Negative Number
1176  */
1177 HWTEST_F(DeviceTestAdditional, testDestroyLayer004, Function | MediumTest | Level2)
1178 {
1179     uint32_t layerId = 1;
1180     auto ret = g_composerDevice->DestroyLayer(-1, layerId);
1181     EXPECT_EQ(DISPLAY_FAILURE, ret);
1182 }
1183 
1184 #ifdef DISPLAY_COMMUNITY
1185 /**
1186  * @tc.number : SUB_Driver_Display_DestroyLayer_0500
1187  * @tc.name   : testDestroyLayer005
1188  * @tc.desc   : test layerId Max
1189  */
1190 HWTEST_F(DeviceTestAdditional, testDestroyLayer005, Function | MediumTest | Level2)
1191 {
1192     uint32_t layerId = 20;
1193     auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
1194     EXPECT_EQ(DISPLAY_FAILURE, ret);
1195 }
1196 
1197 /**
1198  * @tc.number : SUB_Driver_Display_DestroyLayer_0600
1199  * @tc.name   : testDestroyLayer006
1200  * @tc.desc   : test layerId Min
1201  */
1202 HWTEST_F(DeviceTestAdditional, testDestroyLayer006, Function | MediumTest | Level2)
1203 {
1204     uint32_t layerId = 15;
1205     auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
1206     EXPECT_EQ(DISPLAY_FAILURE, ret);
1207 }
1208 #endif
1209 
1210 /**
1211  * @tc.number : SUB_Driver_Display_DestroyLayer_0700
1212  * @tc.name   : testDestroyLayer007
1213  * @tc.desc   : test layerId Random
1214  */
1215 HWTEST_F(DeviceTestAdditional, testDestroyLayer007, Function | MediumTest | Level2)
1216 {
1217     uint32_t layerId = 0;
1218     auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
1219     EXPECT_EQ(DISPLAY_FAILURE, ret);
1220 }
1221 
1222 
1223 /**
1224  * @tc.number : SUB_Driver_Display_DestroyLayer_0800
1225  * @tc.name   : testDestroyLayer008
1226  * @tc.desc   : test layerId Negative Number
1227  */
1228 HWTEST_F(DeviceTestAdditional, testDestroyLayer008, Function | MediumTest | Level2)
1229 {
1230     uint32_t layerId = -1;
1231     auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
1232     EXPECT_EQ(DISPLAY_FAILURE, ret);
1233 }
1234 
1235 /**
1236  * @tc.number : SUB_Driver_Display_SetDisplayClientCrop_0100
1237  * @tc.name   : testSetDisplayClientCrop001
1238  * @tc.desc   : test layerId Max
1239  */
1240 HWTEST_F(DeviceTestAdditional, testSetDisplayClientCrop001, Function | MediumTest | Level2)
1241 {
1242     const int32_t width = 1920;
1243     const int32_t height = 1080;
1244     IRect rect = {0, 0, width, height};
1245     auto ret = g_composerDevice->SetDisplayClientCrop(20, rect);
1246     EXPECT_EQ(DISPLAY_FAILURE, ret);
1247 }
1248 
1249 /**
1250  * @tc.number : SUB_Driver_Display_SetDisplayClientCrop_0200
1251  * @tc.name   : testSetDisplayClientCrop002
1252  * @tc.desc   : test layerId Min
1253  */
1254 HWTEST_F(DeviceTestAdditional, testSetDisplayClientCrop002, Function | MediumTest | Level2)
1255 {
1256     const int32_t width = 1920;
1257     const int32_t height = 1080;
1258     IRect rect = {0, 0, width, height};
1259     auto ret = g_composerDevice->SetDisplayClientCrop(0, rect);
1260     EXPECT_EQ(DISPLAY_FAILURE, ret);
1261 }
1262 
1263 /**
1264  * @tc.number : SUB_Driver_Display_SetDisplayClientCrop_0300
1265  * @tc.name   : testSetDisplayClientCrop003
1266  * @tc.desc   : test layerId Random
1267  */
1268 HWTEST_F(DeviceTestAdditional, testSetDisplayClientCrop003, Function | MediumTest | Level2)
1269 {
1270     const int32_t width = 1920;
1271     const int32_t height = 1080;
1272     IRect rect = {0, 0, width, height};
1273     auto ret = g_composerDevice->SetDisplayClientCrop(15, rect);
1274     EXPECT_EQ(DISPLAY_FAILURE, ret);
1275 }
1276 
1277 /**
1278  * @tc.number : SUB_Driver_Display_SetDisplayClientCrop_0400
1279  * @tc.name   : testSetDisplayClientCrop004
1280  * @tc.desc   : test layerId Negative Number
1281  */
1282 HWTEST_F(DeviceTestAdditional, testSetDisplayClientCrop004, Function | MediumTest | Level2)
1283 {
1284     const int32_t width = 1920;
1285     const int32_t height = 1080;
1286     IRect rect = {0, 0, width, height};
1287     auto ret = g_composerDevice->SetDisplayClientCrop(-1, rect);
1288     EXPECT_EQ(DISPLAY_FAILURE, ret);
1289 }
1290 
1291 
1292 /**
1293  * @tc.number : SUB_Driver_Display_GetDisplayReleaseFence_0100
1294  * @tc.name   : testGetDisplayReleaseFence001
1295  * @tc.desc   : test devId Max
1296  */
1297 HWTEST_F(DeviceTestAdditional, testGetDisplayReleaseFence001, Function | MediumTest | Level2)
1298 {
1299     std::vector<uint32_t> layers{};
1300     std::vector<int32_t> fences{};
1301     auto ret = g_composerDevice->GetDisplayReleaseFence(20, layers, fences);
1302 #ifdef DISPLAY_COMMUNITY
1303     EXPECT_EQ(DISPLAY_FAILURE, ret);
1304 #else
1305     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1306 #endif
1307 }
1308 
1309 /**
1310  * @tc.number : SUB_Driver_Display_GetDisplayReleaseFence_0200
1311  * @tc.name   : testGetDisplayReleaseFence002
1312  * @tc.desc   : test devId Min
1313  */
1314 HWTEST_F(DeviceTestAdditional, testGetDisplayReleaseFence002, Function | MediumTest | Level1)
1315 {
1316     std::vector<uint32_t> layers{};
1317     std::vector<int32_t> fences{};
1318     auto ret = g_composerDevice->GetDisplayReleaseFence(0, layers, fences);
1319     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1320 }
1321 
1322 /**
1323  * @tc.number : SUB_Driver_Display_GetDisplayReleaseFence_0300
1324  * @tc.name   : testGetDisplayReleaseFence003
1325  * @tc.desc   : test devId Random
1326  */
1327 HWTEST_F(DeviceTestAdditional, testGetDisplayReleaseFence003, Function | MediumTest | Level2)
1328 {
1329     std::vector<uint32_t> layers{};
1330     std::vector<int32_t> fences{};
1331     auto ret = g_composerDevice->GetDisplayReleaseFence(15, layers, fences);
1332 #ifdef DISPLAY_COMMUNITY
1333     EXPECT_EQ(DISPLAY_FAILURE, ret);
1334 #else
1335     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1336 #endif
1337 }
1338 
1339 /**
1340  * @tc.number : SUB_Driver_Display_GetDisplayReleaseFence_0400
1341  * @tc.name   : testGetDisplayReleaseFence004
1342  * @tc.desc   : test devId Negative Number
1343  */
1344 HWTEST_F(DeviceTestAdditional, testGetDisplayReleaseFence004, Function | MediumTest | Level2)
1345 {
1346     std::vector<uint32_t> layers{};
1347     std::vector<int32_t> fences{};
1348     auto ret = g_composerDevice->GetDisplayReleaseFence(-1, layers, fences);
1349 #ifdef DISPLAY_COMMUNITY
1350     EXPECT_EQ(DISPLAY_FAILURE, ret);
1351 #else
1352     EXPECT_EQ(DISPLAY_PARAM_ERR, ret);
1353 #endif
1354 }
1355 
1356 /**
1357  * @tc.number : SUB_Driver_Display_CreateVirtualDisplay_0100
1358  * @tc.name   : testCreateVirtualDisplay001
1359  * @tc.desc   : test width Min
1360  */
1361 HWTEST_F(DeviceTestAdditional, testCreateVirtualDisplay001, Function | MediumTest | Level2)
1362 {
1363     uint32_t width = 0;
1364     uint32_t height = 1080;
1365     int32_t format = 0;
1366     uint32_t devId = 0;
1367     auto ret = g_composerDevice->CreateVirtualDisplay(width, height, format, devId);
1368     EXPECT_EQ(DISPLAY_FAILURE, ret);
1369 }
1370 
1371 /**
1372  * @tc.number : SUB_Driver_Display_CreateVirtualDisplay_0200
1373  * @tc.name   : testCreateVirtualDisplay002
1374  * @tc.desc   : test width Random
1375  */
1376 HWTEST_F(DeviceTestAdditional, testCreateVirtualDisplay002, Function | MediumTest | Level2)
1377 {
1378     uint32_t width = 2560;
1379     uint32_t height = 1080;
1380     int32_t format = 0;
1381     uint32_t devId = 0;
1382     auto ret = g_composerDevice->CreateVirtualDisplay(width, height, format, devId);
1383     EXPECT_EQ(DISPLAY_FAILURE, ret);
1384 }
1385 
1386 /**
1387  * @tc.number : SUB_Driver_Display_CreateVirtualDisplay_0300
1388  * @tc.name   : testCreateVirtualDisplay003
1389  * @tc.desc   : test height Min
1390  */
1391 HWTEST_F(DeviceTestAdditional, testCreateVirtualDisplay003, Function | MediumTest | Level2)
1392 {
1393     uint32_t width = 1920;
1394     uint32_t height = 0;
1395     int32_t format = 0;
1396     uint32_t devId = 0;
1397     auto ret = g_composerDevice->CreateVirtualDisplay(width, height, format, devId);
1398     EXPECT_EQ(DISPLAY_FAILURE, ret);
1399 }
1400 
1401 /**
1402  * @tc.number : SUB_Driver_Display_CreateVirtualDisplay_0400
1403  * @tc.name   : testCreateVirtualDisplay004
1404  * @tc.desc   : test height Random
1405  */
1406 HWTEST_F(DeviceTestAdditional, testCreateVirtualDisplay004, Function | MediumTest | Level2)
1407 {
1408     uint32_t width = 1920;
1409     uint32_t height = 1440;
1410     int32_t format = 0;
1411     uint32_t devId = 0;
1412     auto ret = g_composerDevice->CreateVirtualDisplay(width, height, format, devId);
1413     EXPECT_EQ(DISPLAY_FAILURE, ret);
1414 }
1415 
1416 /**
1417  * @tc.number : SUB_Driver_Display_DestroyVirtualDisplay_0100
1418  * @tc.name   : testDestroyVirtualDisplay001
1419  * @tc.desc   : test devId Max
1420  */
1421 HWTEST_F(DeviceTestAdditional, testDestroyVirtualDisplay001, Function | MediumTest | Level2)
1422 {
1423     uint32_t devId = 20;
1424     auto ret = g_composerDevice->DestroyVirtualDisplay(devId);
1425     EXPECT_EQ(DISPLAY_FAILURE, ret);
1426 }
1427 
1428 /**
1429  * @tc.number : SUB_Driver_Display_DestroyVirtualDisplay_0200
1430  * @tc.name   : testDestroyVirtualDisplay002
1431  * @tc.desc   : test devId 1
1432  */
1433 HWTEST_F(DeviceTestAdditional, testDestroyVirtualDisplay002, Function | MediumTest | Level2)
1434 {
1435     uint32_t devId = 1;
1436     auto ret = g_composerDevice->DestroyVirtualDisplay(devId);
1437     EXPECT_EQ(DISPLAY_FAILURE, ret);
1438 }
1439 
1440 /**
1441  * @tc.number : SUB_Driver_Display_DestroyVirtualDisplay_0300
1442  * @tc.name   : testDestroyVirtualDisplay003
1443  * @tc.desc   : test devId Random
1444  */
1445 HWTEST_F(DeviceTestAdditional, testDestroyVirtualDisplay003, Function | MediumTest | Level2)
1446 {
1447     uint32_t devId = 15;
1448     auto ret = g_composerDevice->DestroyVirtualDisplay(devId);
1449     EXPECT_EQ(DISPLAY_FAILURE, ret);
1450 }
1451 
1452 /**
1453  * @tc.number : SUB_Driver_Display_DestroyVirtualDisplay_0300
1454  * @tc.name   : testDestroyVirtualDisplay004
1455  * @tc.desc   : test devId Negative Number
1456  */
1457 HWTEST_F(DeviceTestAdditional, testDestroyVirtualDisplay004, Function | MediumTest | Level2)
1458 {
1459     uint32_t devId = -1;
1460     auto ret = g_composerDevice->DestroyVirtualDisplay(devId);
1461     EXPECT_EQ(DISPLAY_FAILURE, ret);
1462 }
1463 
1464 /**
1465  * @tc.number : SUB_Driver_Display_SetVirtualDisplayBuffer_0100
1466  * @tc.name   : testSetVirtualDisplayBuffer001
1467  * @tc.desc   : test devId Max
1468  */
1469 HWTEST_F(DeviceTestAdditional, testSetVirtualDisplayBuffer001, Function | MediumTest | Level2)
1470 {
1471     BufferHandle buffer;
1472     int32_t fence = 1;
1473     auto ret = g_composerDevice->SetVirtualDisplayBuffer(20, buffer, fence);
1474     EXPECT_EQ(DISPLAY_FAILURE, ret);
1475 }
1476 
1477 /**
1478  * @tc.number : SUB_Driver_Display_SetVirtualDisplayBuffer_0200
1479  * @tc.name   : testSetVirtualDisplayBuffer002
1480  * @tc.desc   : test devId Min
1481  */
1482 HWTEST_F(DeviceTestAdditional, testSetVirtualDisplayBuffer002, Function | MediumTest | Level2)
1483 {
1484     BufferHandle buffer;
1485     int32_t fence = 1;
1486     auto ret = g_composerDevice->SetVirtualDisplayBuffer(0, buffer, fence);
1487     EXPECT_EQ(DISPLAY_FAILURE, ret);
1488 }
1489 
1490 /**
1491  * @tc.number : SUB_Driver_Display_SetVirtualDisplayBuffer_0300
1492  * @tc.name   : testSetVirtualDisplayBuffer003
1493  * @tc.desc   : test devId Random
1494  */
1495 HWTEST_F(DeviceTestAdditional, testSetVirtualDisplayBuffer003, Function | MediumTest | Level2)
1496 {
1497     BufferHandle buffer;
1498     int32_t fence = 1;
1499     auto ret = g_composerDevice->SetVirtualDisplayBuffer(15, buffer, fence);
1500     EXPECT_EQ(DISPLAY_FAILURE, ret);
1501 }
1502 
1503 /**
1504  * @tc.number : SUB_Driver_Display_SetVirtualDisplayBuffer_0400
1505  * @tc.name   : testSetVirtualDisplayBuffer004
1506  * @tc.desc   : test devId Negative Number
1507  */
1508 HWTEST_F(DeviceTestAdditional, testSetVirtualDisplayBuffer004, Function | MediumTest | Level2)
1509 {
1510     BufferHandle buffer;
1511     int32_t fence = 1;
1512     auto ret = g_composerDevice->SetVirtualDisplayBuffer(-1, buffer, fence);
1513     EXPECT_EQ(DISPLAY_FAILURE, ret);
1514 }
1515 
1516 /**
1517  * @tc.number : SUB_Driver_Display_RegDisplayVBlankCallback_0100
1518  * @tc.name   : testRegDisplayVBlankCallback001
1519  * @tc.desc   : test RegDisplayVBlankCallback
1520  */
1521 HWTEST_F(DeviceTestAdditional, testRegDisplayVBlankCallback001, Function | MediumTest | Level1)
1522 {
1523     auto ret = g_composerDevice->RegDisplayVBlankCallback(g_displayIds[0], nullptr, nullptr);
1524     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1525 }
1526 
1527 /**
1528  * @tc.number : SUB_Driver_Display_RegHotPlugCallback_0100
1529  * @tc.name   : testRegHotPlugCallback001
1530  * @tc.desc   : test RegHotPlugCallback
1531  */
1532 HWTEST_F(DeviceTestAdditional, testRegHotPlugCallback001, Function | MediumTest | Level1)
1533 {
1534     auto ret = g_composerDevice->RegHotPlugCallback(nullptr, nullptr);
1535     EXPECT_EQ(DISPLAY_SUCCESS, ret);
1536 }
1537