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