• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "hdi_layer_info.h"
17 #include "surface_tunnel_handle.h"
18 #include "sync_fence.h"
19 
20 #include <gtest/gtest.h>
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace Rosen {
27 class HdiLayerInfoTest : public testing::Test {
28 public:
29     static void SetUpTestCase();
30     static void TearDownTestCase();
31 
32     static inline std::shared_ptr<HdiLayerInfo> hdiLayerInfo_;
33 };
34 
SetUpTestCase()35 void HdiLayerInfoTest::SetUpTestCase()
36 {
37     hdiLayerInfo_ = HdiLayerInfo::CreateHdiLayerInfo();
38 }
39 
TearDownTestCase()40 void HdiLayerInfoTest::TearDownTestCase() {}
41 
42 namespace {
43 /**
44  * @tc.name: GetZorder001
45  * @tc.desc: Verify the GetZorder of hdilayerinfo
46  * @tc.type:FUNC
47  * @tc.require:AR000GGP0P
48  * @tc.author:
49  */
50 HWTEST_F(HdiLayerInfoTest, GetZorder001, Function | MediumTest| Level3)
51 {
52     HdiLayerInfoTest::hdiLayerInfo_->SetZorder(1);
53     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetZorder(), 1u);
54 }
55 
56 /**
57  * @tc.name: GetSurface001
58  * @tc.desc: Verify the GetSurface of hdilayerinfo
59  * @tc.type:FUNC
60  * @tc.require:AR000GGP0P
61  * @tc.author:
62  */
63 HWTEST_F(HdiLayerInfoTest, GetSurface001, Function | MediumTest| Level3)
64 {
65     sptr<Surface> surface = nullptr;
66     HdiLayerInfoTest::hdiLayerInfo_->SetSurface(surface);
67     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetSurface(), nullptr);
68 }
69 
70 /**
71  * @tc.name: GetBuffer001
72  * @tc.desc: Verify the GetBuffer of hdilayerinfo
73  * @tc.type:FUNC
74  * @tc.require:AR000GGP0P
75  * @tc.author:
76  */
77 HWTEST_F(HdiLayerInfoTest, GetBuffer001, Function | MediumTest| Level3)
78 {
79     sptr<SyncFence> acquireFence = SyncFence::INVALID_FENCE;
80     sptr<SurfaceBuffer> sbuffer = nullptr;
81     HdiLayerInfoTest::hdiLayerInfo_->SetBuffer(sbuffer, acquireFence);
82     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetBuffer(), nullptr);
83 }
84 
85 /**
86  * @tc.name: GetAcquireFence001
87  * @tc.desc: Verify the GetAcquireFence of hdilayerinfo
88  * @tc.type:FUNC
89  * @tc.require:AR000GGP0P
90  * @tc.author:
91  */
92 HWTEST_F(HdiLayerInfoTest, GetAcquireFence001, Function | MediumTest| Level3)
93 {
94     ASSERT_NE(HdiLayerInfoTest::hdiLayerInfo_->GetAcquireFence(), nullptr);
95 }
96 
97 /**
98  * @tc.name: GetAlpha001
99  * @tc.desc: Verify the GetAlpha of hdilayerinfo
100  * @tc.type:FUNC
101  * @tc.require:AR000GGP0P
102  * @tc.author:
103  */
104 HWTEST_F(HdiLayerInfoTest, GetAlpha001, Function | MediumTest| Level3)
105 {
106     GraphicLayerAlpha layerAlpha = {
107         .enGlobalAlpha = true,
108         .enPixelAlpha = true,
109         .alpha0 = 0,
110         .alpha1 = 0,
111         .gAlpha = 0,
112     };
113     HdiLayerInfoTest::hdiLayerInfo_->SetAlpha(layerAlpha);
114     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetAlpha().enGlobalAlpha, layerAlpha.enGlobalAlpha);
115     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetAlpha().enPixelAlpha, layerAlpha.enPixelAlpha);
116     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetAlpha().alpha0, layerAlpha.alpha0);
117     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetAlpha().alpha1, layerAlpha.alpha1);
118     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetAlpha().gAlpha, layerAlpha.gAlpha);
119 }
120 
121 /**
122  * @tc.name: GetTransformType001
123  * @tc.desc: Verify the GetTransformType of hdilayerinfo
124  * @tc.type:FUNC
125  * @tc.require:AR000GGP0P
126  * @tc.author:
127  */
128 HWTEST_F(HdiLayerInfoTest, GetTransformType001, Function | MediumTest| Level3)
129 {
130     GraphicTransformType type = GraphicTransformType::GRAPHIC_ROTATE_90;
131     HdiLayerInfoTest::hdiLayerInfo_->SetTransform(type);
132     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTransformType(), GraphicTransformType::GRAPHIC_ROTATE_90);
133 
134     type = GraphicTransformType::GRAPHIC_ROTATE_180;
135     HdiLayerInfoTest::hdiLayerInfo_->SetTransform(type);
136     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTransformType(), GraphicTransformType::GRAPHIC_ROTATE_180);
137 
138     type = GraphicTransformType::GRAPHIC_ROTATE_270;
139     HdiLayerInfoTest::hdiLayerInfo_->SetTransform(type);
140     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTransformType(), GraphicTransformType::GRAPHIC_ROTATE_270);
141 }
142 
143 /**
144  * @tc.name: GetCompositionType001
145  * @tc.desc: Verify the GetCompositionType of hdilayerinfo
146  * @tc.type:FUNC
147  * @tc.require:AR000GGP0P
148  * @tc.author:
149  */
150 HWTEST_F(HdiLayerInfoTest, GetCompositionType001, Function | MediumTest| Level3)
151 {
152     GraphicCompositionType type = GRAPHIC_COMPOSITION_CLIENT;
153     HdiLayerInfoTest::hdiLayerInfo_->SetCompositionType(type);
154     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCompositionType(), GRAPHIC_COMPOSITION_CLIENT);
155 
156     type = GRAPHIC_COMPOSITION_DEVICE;
157     HdiLayerInfoTest::hdiLayerInfo_->SetCompositionType(type);
158     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCompositionType(), GRAPHIC_COMPOSITION_DEVICE);
159 
160     type = GRAPHIC_COMPOSITION_CURSOR;
161     HdiLayerInfoTest::hdiLayerInfo_->SetCompositionType(type);
162     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCompositionType(), GRAPHIC_COMPOSITION_CURSOR);
163 }
164 
165 /**
166  * @tc.name: GetVisibleNum001
167  * @tc.desc: Verify the GetVisibleNum of hdilayerinfo
168  * @tc.type:FUNC
169  * @tc.require:AR000GGP0P
170  * @tc.author:
171  */
172 HWTEST_F(HdiLayerInfoTest, GetVisibleNum001, Function | MediumTest| Level3)
173 {
174     IRect iRect = {
175         .x = 0,
176         .y = 0,
177         .w = 800,
178         .h = 600,
179     };
180     HdiLayerInfoTest::hdiLayerInfo_->SetVisibleRegion(1, iRect);
181     ASSERT_NE(HdiLayerInfoTest::hdiLayerInfo_->GetVisibleNum(), 0u);
182 }
183 
184 /**
185  * @tc.name: GetVisibleRegion001
186  * @tc.desc: Verify the GetVisibleRegion of hdilayerinfo
187  * @tc.type:FUNC
188  * @tc.require:AR000GGP0P
189  * @tc.author:
190  */
191 HWTEST_F(HdiLayerInfoTest, GetVisibleRegion001, Function | MediumTest| Level3)
192 {
193     IRect iRect = {
194         .x = 0,
195         .y = 0,
196         .w = 800,
197         .h = 600,
198     };
199     HdiLayerInfoTest::hdiLayerInfo_->SetVisibleRegion(1, iRect);
200     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetVisibleRegion().x, iRect.x);
201     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetVisibleRegion().y, iRect.y);
202     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetVisibleRegion().w, iRect.w);
203     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetVisibleRegion().h, iRect.h);
204 }
205 
206 /**
207  * @tc.name: GetDirtyRegion001
208  * @tc.desc: Verify the GetDirtyRegion of hdilayerinfo
209  * @tc.type:FUNC
210  * @tc.require:AR000GGP0P
211  * @tc.author:
212  */
213 HWTEST_F(HdiLayerInfoTest, GetDirtyRegion001, Function | MediumTest| Level3)
214 {
215     IRect iRect = {
216         .x = 0,
217         .y = 0,
218         .w = 800,
219         .h = 600,
220     };
221     HdiLayerInfoTest::hdiLayerInfo_->SetDirtyRegion(iRect);
222     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetDirtyRegion().x, iRect.x);
223     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetDirtyRegion().y, iRect.y);
224     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetDirtyRegion().w, iRect.w);
225     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetDirtyRegion().h, iRect.h);
226 }
227 
228 /**
229  * @tc.name: GetBlendType001
230  * @tc.desc: Verify the GetBlendType of hdilayerinfo
231  * @tc.type:FUNC
232  * @tc.require:AR000GGP0P
233  * @tc.author:
234  */
235 HWTEST_F(HdiLayerInfoTest, GetBlendType001, Function | MediumTest| Level3)
236 {
237     GraphicBlendType type = GraphicBlendType::GRAPHIC_BLEND_CLEAR;
238     HdiLayerInfoTest::hdiLayerInfo_->SetBlendType(type);
239     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetBlendType(), GraphicBlendType::GRAPHIC_BLEND_CLEAR);
240 
241     type = GraphicBlendType::GRAPHIC_BLEND_SRC;
242     HdiLayerInfoTest::hdiLayerInfo_->SetBlendType(type);
243     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetBlendType(), GraphicBlendType::GRAPHIC_BLEND_SRC);
244 
245     type = GraphicBlendType::GRAPHIC_BLEND_SRCOVER;
246     HdiLayerInfoTest::hdiLayerInfo_->SetBlendType(type);
247     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetBlendType(), GraphicBlendType::GRAPHIC_BLEND_SRCOVER);
248 }
249 
250 /**
251  * @tc.name: GetCropRect001
252  * @tc.desc: Verify the GetCropRect of hdilayerinfo
253  * @tc.type:FUNC
254  * @tc.require:AR000GGP0P
255  * @tc.author:
256  */
257 HWTEST_F(HdiLayerInfoTest, GetCropRect001, Function | MediumTest| Level3)
258 {
259     IRect iRect = {
260         .x = 0,
261         .y = 0,
262         .w = 800,
263         .h = 600,
264     };
265     HdiLayerInfoTest::hdiLayerInfo_->SetCropRect(iRect);
266     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCropRect().x, iRect.x);
267     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCropRect().y, iRect.y);
268     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCropRect().w, iRect.w);
269     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetCropRect().h, iRect.h);
270 }
271 
272 /**
273  * @tc.name: GetLayerSize001
274  * @tc.desc: Verify the GetLayerSize of hdilayerinfo
275  * @tc.type:FUNC
276  * @tc.require:AR000GGP0P
277  * @tc.author:
278  */
279 HWTEST_F(HdiLayerInfoTest, GetLayerSize001, Function | MediumTest| Level3)
280 {
281     IRect iRect = {
282         .x = 0,
283         .y = 0,
284         .w = 800,
285         .h = 600,
286     };
287     HdiLayerInfoTest::hdiLayerInfo_->SetLayerSize(iRect);
288     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetLayerSize().x, iRect.x);
289     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetLayerSize().y, iRect.y);
290     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetLayerSize().w, iRect.w);
291     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetLayerSize().h, iRect.h);
292 }
293 
294 /**
295  * @tc.name: IsPreMulti001
296  * @tc.desc: Verify the IsPreMulti of hdilayerinfo
297  * @tc.type:FUNC
298  * @tc.require:AR000GGP0P
299  * @tc.author:
300  */
301 HWTEST_F(HdiLayerInfoTest, IsPreMulti001, Function | MediumTest| Level3)
302 {
303     HdiLayerInfoTest::hdiLayerInfo_->SetPreMulti(true);
304     ASSERT_NE(HdiLayerInfoTest::hdiLayerInfo_->IsPreMulti(), false);
305 
306     HdiLayerInfoTest::hdiLayerInfo_->SetPreMulti(false);
307     ASSERT_NE(HdiLayerInfoTest::hdiLayerInfo_->IsPreMulti(), true);
308 }
309 
310 /*
311 * Function: SetTunnelHandleChange and GetTunnelHandleChange
312 * Type: Function
313 * Rank: Important(1)
314 * EnvConditions: N/A
315 * CaseDescription: 1. call GetTunnelHandleChange with default
316 *                  2. call SetTunnelHandleChange
317 *                  3. call GetTunnelHandleChange and check ret
318  */
319 HWTEST_F(HdiLayerInfoTest, TunnelHandleChange001, Function | MediumTest | Level1)
320 {
321     bool change = HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandleChange();
322     ASSERT_EQ(change, false);
323     HdiLayerInfoTest::hdiLayerInfo_->SetTunnelHandleChange(true);
324     change = HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandleChange();
325     ASSERT_EQ(change, true);
326 }
327 
328 /*
329 * Function: SetTunnelHandle and GetTunnelHandle
330 * Type: Function
331 * Rank: Important(1)
332 * EnvConditions: N/A
333 * CaseDescription: 1. call GetTunnelHandle with default
334 * @tc.require: issueI5GMZN issueI5IWHW
335  */
336 HWTEST_F(HdiLayerInfoTest, TunnelHandle001, Function | MediumTest | Level1)
337 {
338     sptr<SurfaceTunnelHandle> handle = HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandle();
339     ASSERT_EQ(handle, nullptr);
340 }
341 
342 /*
343 * Function: SetTunnelHandle and GetTunnelHandle
344 * Type: Function
345 * Rank: Important(1)
346 * EnvConditions: N/A
347 * CaseDescription: 1. call SetTunnelHandle
348 *                  2. call GetTunnelHandle and check ret
349 * @tc.require: issueI5GMZN issueI5IWHW
350  */
351 HWTEST_F(HdiLayerInfoTest, TunnelHandle002, Function | MediumTest | Level1)
352 {
353     sptr<SurfaceTunnelHandle> handle = HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandle();
354     ASSERT_EQ(handle, nullptr);
355 
356     sptr<SurfaceTunnelHandle> tunnelHandle = new SurfaceTunnelHandle;
357     size_t size = sizeof(GraphicExtDataHandle) + sizeof(int32_t) * 1;
358     GraphicExtDataHandle *handleSet = static_cast<GraphicExtDataHandle *>(malloc(size));
359     handleSet->fd = -1;
360     handleSet->reserveInts = 1;
361     handleSet->reserve[0] = 0;
362     ASSERT_EQ(tunnelHandle->SetHandle(handleSet), OHOS::GSERROR_OK);
363     ASSERT_NE(tunnelHandle, nullptr);
364     HdiLayerInfoTest::hdiLayerInfo_->SetTunnelHandle(tunnelHandle);
365     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandle()->GetHandle()->fd,
366               tunnelHandle->GetHandle()->fd);
367     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandle()->GetHandle()->reserveInts,
368               tunnelHandle->GetHandle()->reserveInts);
369     ASSERT_EQ(HdiLayerInfoTest::hdiLayerInfo_->GetTunnelHandle()->GetHandle()->reserve[0],
370               tunnelHandle->GetHandle()->reserve[0]);
371     free(handleSet);
372 }
373 
374 /*
375 * Function: SetColorTransform and GetColorTransform
376 * Type: Function
377 * Rank: Important(1)
378 * EnvConditions: N/A
379 * CaseDescription: 1. call GetColorTransform with default
380 * @tc.require: issueI5H317
381  */
382 HWTEST_F(HdiLayerInfoTest, ColorTransform001, Function | MediumTest | Level1)
383 {
384     float* transform = HdiLayerInfoTest::hdiLayerInfo_->GetColorTransform();
385     ASSERT_EQ(transform, nullptr);
386 }
387 
388 /*
389 * Function: SetColorTransform and GetColorTransform
390 * Type: Function
391 * Rank: Important(1)
392 * EnvConditions: N/A
393 * CaseDescription: 1. call SetColorTransform
394 *                  2. call GetColorTransform and check ret
395 * @tc.require: issueI5H317
396  */
397 HWTEST_F(HdiLayerInfoTest, ColorTransform002, Function | MediumTest | Level1)
398 {
399     float matrix[9] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
400     HdiLayerInfoTest::hdiLayerInfo_->SetColorTransform(matrix);
401     float* transform = HdiLayerInfoTest::hdiLayerInfo_->GetColorTransform();
402     ASSERT_NE(transform, nullptr);
403 }
404 
405 /*
406 * Function: SetColorDataSpace and GetColorDataSpace
407 * Type: Function
408 * Rank: Important(1)
409 * EnvConditions: N/A
410 * CaseDescription: 1. call GetColorDataSpace with default
411 * @tc.require: issueI5H317
412  */
413 HWTEST_F(HdiLayerInfoTest, ColorDataSpace001, Function | MediumTest | Level1)
414 {
415     GraphicColorDataSpace colorSpace = HdiLayerInfoTest::hdiLayerInfo_->GetColorDataSpace();
416     ASSERT_EQ(colorSpace, GraphicColorDataSpace::GRAPHIC_COLOR_DATA_SPACE_UNKNOWN);
417 }
418 
419 /*
420 * Function: SetColorDataSpace and GetColorDataSpace
421 * Type: Function
422 * Rank: Important(1)
423 * EnvConditions: N/A
424 * CaseDescription: 1. call SetColorDataSpace
425 *                  2. call GetColorDataSpace and check ret
426 * @tc.require: issueI5H317
427  */
428 HWTEST_F(HdiLayerInfoTest, ColorDataSpace002, Function | MediumTest | Level1)
429 {
430     GraphicColorDataSpace colorSpaceSet = GraphicColorDataSpace::GRAPHIC_GAMUT_DISPLAY_P3;
431     HdiLayerInfoTest::hdiLayerInfo_->SetColorDataSpace(colorSpaceSet);
432     GraphicColorDataSpace colorSpaceGet = HdiLayerInfoTest::hdiLayerInfo_->GetColorDataSpace();
433     ASSERT_EQ(colorSpaceSet, colorSpaceGet);
434 }
435 
436 /*
437 * Function: SetMetaData and GetMetaData
438 * Type: Function
439 * Rank: Important(1)
440 * EnvConditions: N/A
441 * CaseDescription: 1. call SetMetaData
442 *                  2. call GetMetaData and check ret
443 * @tc.require: issueI5H317
444  */
445 HWTEST_F(HdiLayerInfoTest, MetaData001, Function | MediumTest | Level1)
446 {
447     std::vector<GraphicHDRMetaData> metaData = {{GRAPHIC_MATAKEY_RED_PRIMARY_X, 1}};
448     HdiLayerInfoTest::hdiLayerInfo_->SetMetaData(metaData);
449     std::vector<GraphicHDRMetaData> metaDataGet = HdiLayerInfoTest::hdiLayerInfo_->GetMetaData();
450     ASSERT_EQ(metaData[0].key, metaDataGet[0].key);
451     ASSERT_EQ(metaData[0].value, metaDataGet[0].value);
452 }
453 
454 /*
455 * Function: SetMetaDataSet and GetMetaDataSet
456 * Type: Function
457 * Rank: Important(1)
458 * EnvConditions: N/A
459 * CaseDescription: 1. call SetMetaDataSet
460 *                  2. call GetMetaDataSet and check ret
461 * @tc.require: issueI5H317
462  */
463 HWTEST_F(HdiLayerInfoTest, MetaDataSet001, Function | MediumTest | Level1)
464 {
465     GraphicHDRMetaDataSet metaDataSet = {GraphicHDRMetadataKey::GRAPHIC_MATAKEY_RED_PRIMARY_X, {1, 2, 3}};
466     HdiLayerInfoTest::hdiLayerInfo_->SetMetaDataSet(metaDataSet);
467     GraphicHDRMetaDataSet metaDataSetGet = HdiLayerInfoTest::hdiLayerInfo_->GetMetaDataSet();
468     ASSERT_EQ(metaDataSet.key, metaDataSetGet.key);
469     ASSERT_EQ(metaDataSet.metaData[0], metaDataSetGet.metaData[0]);
470     ASSERT_EQ(metaDataSet.metaData[1], metaDataSetGet.metaData[1]);
471     ASSERT_EQ(metaDataSet.metaData[2], metaDataSetGet.metaData[2]);
472 }
473 
474 /*
475 * Function: SetIsSupportedPresentTimestamp and IsSupportedPresentTimestamp
476 * Type: Function
477 * Rank: Important(1)
478 * EnvConditions: N/A
479 * CaseDescription: 1. call IsSupportedPresentTimestamp with default
480 * @tc.require: issueI5I57K
481  */
482 HWTEST_F(HdiLayerInfoTest, IsSupportedPresentTimestamp001, Function | MediumTest | Level1)
483 {
484     bool isSupported = HdiLayerInfoTest::hdiLayerInfo_->IsSupportedPresentTimestamp();
485     ASSERT_EQ(isSupported, false);
486 }
487 
488 /*
489 * Function: SetIsSupportedPresentTimestamp and IsSupportedPresentTimestamp
490 * Type: Function
491 * Rank: Important(1)
492 * EnvConditions: N/A
493 * CaseDescription: 1. call SetIsSupportedPresentTimestamp
494 *                  2. call IsSupportedPresentTimestamp and check ret
495 * @tc.require: issueI5I57K
496  */
497 HWTEST_F(HdiLayerInfoTest, IsSupportedPresentTimestamp002, Function | MediumTest | Level1)
498 {
499     HdiLayerInfoTest::hdiLayerInfo_->SetIsSupportedPresentTimestamp(true);
500     bool isSupported = HdiLayerInfoTest::hdiLayerInfo_->IsSupportedPresentTimestamp();
501     ASSERT_EQ(isSupported, true);
502     HdiLayerInfoTest::hdiLayerInfo_->SetIsSupportedPresentTimestamp(false);
503     isSupported = HdiLayerInfoTest::hdiLayerInfo_->IsSupportedPresentTimestamp();
504     ASSERT_EQ(isSupported, false);
505 }
506 
507 /*
508 * Function: SetPresentTimestamp and GetPresentTimestamp
509 * Type: Function
510 * Rank: Important(1)
511 * EnvConditions: N/A
512 * CaseDescription: 1. call GetPresentTimestamp with default
513 * @tc.require: issueI5I57K
514  */
515 HWTEST_F(HdiLayerInfoTest, PresentTimestamp001, Function | MediumTest | Level1)
516 {
517     GraphicPresentTimestamp timestamp = HdiLayerInfoTest::hdiLayerInfo_->GetPresentTimestamp();
518     ASSERT_EQ(timestamp.type, GRAPHIC_DISPLAY_PTS_UNSUPPORTED);
519     ASSERT_EQ(timestamp.time, 0);
520 }
521 
522 /*
523 * Function: SetPresentTimestamp and GetPresentTimestamp
524 * Type: Function
525 * Rank: Important(1)
526 * EnvConditions: N/A
527 * CaseDescription: 1. call SetPresentTimestamp
528 *                  2. call GetPresentTimestamp and check ret
529 * @tc.require: issueI5I57K
530  */
531 HWTEST_F(HdiLayerInfoTest, PresentTimestamp002, Function | MediumTest | Level1)
532 {
533     GraphicPresentTimestamp timestampSet = {GRAPHIC_DISPLAY_PTS_DELAY, 1};  // mock data for test
534     HdiLayerInfoTest::hdiLayerInfo_->SetPresentTimestamp(timestampSet);
535     GraphicPresentTimestamp timestampGet = HdiLayerInfoTest::hdiLayerInfo_->GetPresentTimestamp();
536     ASSERT_EQ(timestampSet.type, timestampGet.type);
537     ASSERT_EQ(timestampSet.time, timestampGet.time);
538 }
539 
540 /*
541 * Function: SetPresentTimestamp and GetPresentTimestamp
542 * Type: Function
543 * Rank: Important(1)
544 * EnvConditions: N/A
545 * CaseDescription: 1. call SetPresentTimestamp
546 *                  2. call GetPresentTimestamp and check ret
547 * @tc.require: issueI5I57K
548  */
549 HWTEST_F(HdiLayerInfoTest, PresentTimestamp003, Function | MediumTest | Level1)
550 {
551     GraphicPresentTimestamp timestampSet = {GRAPHIC_DISPLAY_PTS_TIMESTAMP, 10};  // mock data for test
552     HdiLayerInfoTest::hdiLayerInfo_->SetPresentTimestamp(timestampSet);
553     GraphicPresentTimestamp timestampGet = HdiLayerInfoTest::hdiLayerInfo_->GetPresentTimestamp();
554     ASSERT_EQ(timestampSet.type, timestampGet.type);
555     ASSERT_EQ(timestampSet.time, timestampGet.time);
556 }
557 } // namespace
558 } // namespace Rosen
559 } // namespace OHOS