1 /*
2 * Copyright (c) 2023 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 <gtest/gtest.h>
17 #include "interfaces/include/ws_common.h"
18 #include "screen_scene_config.h"
19 #include "session_manager/include/scene_session_manager.h"
20 #include "session_info.h"
21 #include "session/host/include/scene_session.h"
22 #include "window_manager_agent.h"
23 #include "session_manager.h"
24 #include "screen_cutout_controller.h"
25 #include "zidl/window_manager_agent_interface.h"
26 #include "screen_session_manager/include/screen_session_manager.h"
27 #include "display_manager_agent_default.h"
28 #include "screen_scene_config.h"
29 #include "common_test_utils.h"
30
31 using namespace testing;
32 using namespace testing::ext;
33
34 namespace OHOS {
35 namespace Rosen {
36 namespace {
37 constexpr uint32_t SLEEP_TIME_US = 100000;
38 }
39
40 class ScreenCutoutControllerTest : public testing::Test {
41 public:
42 static void SetUpTestCase();
43 static void TearDownTestCase();
44 void SetUp() override;
45 void TearDown() override;
46 void SetAceessTokenPermission(const std::string processName);
47 };
48
SetUpTestCase()49 void ScreenCutoutControllerTest::SetUpTestCase()
50 {
51 CommonTestUtils::InjectTokenInfoByHapName(0, "com.ohos.systemui", 0);
52 const char** perms = new const char *[1];
53 perms[0] = "ohos.permission.CAPTURE_SCREEN";
54 CommonTestUtils::SetAceessTokenPermission("foundation", perms, 1);
55 }
56
TearDownTestCase()57 void ScreenCutoutControllerTest::TearDownTestCase()
58 {
59 }
60
SetUp()61 void ScreenCutoutControllerTest::SetUp()
62 {
63 }
64
TearDown()65 void ScreenCutoutControllerTest::TearDown()
66 {
67 usleep(SLEEP_TIME_US);
68 }
69
70 namespace {
71
72 /**
73 * @tc.name: CreateWaterfallRect
74 * @tc.desc: CreateWaterfallRect func
75 * @tc.type: FUNC
76 */
77 HWTEST_F(ScreenCutoutControllerTest, CreateWaterfallRect, Function | SmallTest | Level3)
78 {
79 DMRect emptyRect = {0, 0, 0, 0};
80 DMRect emptyRect_ = {1, 2, 3, 3};
81 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
82
83 DMRect result = controller->CreateWaterfallRect(0, 0, 0, 0);
84 ASSERT_EQ(result, emptyRect);
85 DMRect result_ = controller->CreateWaterfallRect(1, 2, 3, 3);
86 ASSERT_EQ(result_, emptyRect_);
87 }
88
89 /**
90 * @tc.name: GetScreenCutoutInfo01
91 * @tc.desc: GetScreenCutoutInfo func
92 * @tc.type: FUNC
93 */
94 HWTEST_F(ScreenCutoutControllerTest, GetScreenCutoutInfo01, Function | SmallTest | Level3)
95 {
96 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
97 DisplayId displayId = 0;
98 ASSERT_NE(nullptr, controller->GetScreenCutoutInfo(displayId));
99 }
100
101 /**
102 * @tc.name: GetScreenCutoutInfo02
103 * @tc.desc: GetScreenCutoutInfo func
104 * @tc.type: FUNC
105 */
106 HWTEST_F(ScreenCutoutControllerTest, GetScreenCutoutInfo02, Function | SmallTest | Level3)
107 {
108 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
109 DisplayId displayId = 1;
110 DMRect emptyRect = {0, 0, 0, 0};
111 DMRect emptyRect_ = {1, 2, 3, 3};
112 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
113 ASSERT_NE(nullptr, controller->GetScreenCutoutInfo(displayId));
114 }
115
116 /**
117 * @tc.name: ConvertBoundaryRectsByRotation
118 * @tc.desc: ScreenCutoutController convert boundary rects by rotation
119 * @tc.type: FUNC
120 */
121 HWTEST_F(ScreenCutoutControllerTest, ConvertBoundaryRectsByRotation01, Function | SmallTest | Level3)
122 {
123 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
124 DMRect emptyRect = {0, 0, 0, 0};
125 DMRect emptyRect_ = {1, 2, 3, 3};
126 DisplayId displayId = 0;
127 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
128 ASSERT_TRUE(controller != nullptr);
129 controller->ConvertBoundaryRectsByRotation(boundaryRects, displayId);
130 }
131
132 /**
133 * @tc.name: ConvertBoundaryRectsByRotation
134 * @tc.desc: ROTATION_0
135 * @tc.type: FUNC
136 */
137 HWTEST_F(ScreenCutoutControllerTest, ConvertBoundaryRectsByRotation02, Function | SmallTest | Level3)
138 {
139 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
140 DMRect emptyRect = {0, 0, 0, 0};
141 DMRect emptyRect_ = {1, 2, 3, 3};
142 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
143 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
144 VirtualScreenOption virtualOption;
145 virtualOption.name_ = "createVirtualOption";
146 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
147 virtualOption, displayManagerAgent->AsObject());
148 ScreenProperty screenProperty = ScreenSessionManager::GetInstance().GetScreenProperty(screenId);
149 ASSERT_NE(ScreenSessionManager::GetInstance().GetDisplayInfoById(screenId), nullptr);
150 ASSERT_TRUE(controller != nullptr);
151 EXPECT_EQ(screenProperty.GetScreenRotation(), Rotation::ROTATION_0);
152 controller->ConvertBoundaryRectsByRotation(boundaryRects, screenId);
153 ScreenSessionManager::GetInstance().DestroyVirtualScreen(screenId);
154 }
155
156 /**
157 * @tc.name: ConvertBoundaryRectsByRotation
158 * @tc.desc: ROTATION_90
159 * @tc.type: FUNC
160 */
161 HWTEST_F(ScreenCutoutControllerTest, ConvertBoundaryRectsByRotation03, Function | SmallTest | Level3)
162 {
163 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
164 DMRect emptyRect = {0, 0, 0, 0};
165 DMRect emptyRect_ = {1, 2, 3, 3};
166 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
167 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
168 VirtualScreenOption virtualOption;
169 virtualOption.name_ = "createVirtualOption";
170 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
171 virtualOption, displayManagerAgent->AsObject());
172 ASSERT_NE(ScreenSessionManager::GetInstance().GetDisplayInfoById(screenId), nullptr);
173 ASSERT_TRUE(controller != nullptr);
174 ScreenProperty screenProperty = ScreenSessionManager::GetInstance().GetScreenProperty(screenId);
175 Rotation rotation = Rotation::ROTATION_90;
176 screenProperty.UpdateScreenRotation(rotation);
177 ASSERT_NE(screenProperty.GetScreenRotation(), Rotation::ROTATION_0);
178 controller->ConvertBoundaryRectsByRotation(boundaryRects, screenId);
179 ScreenSessionManager::GetInstance().DestroyVirtualScreen(screenId);
180 }
181
182 /**
183 * @tc.name: ConvertBoundaryRectsByRotation
184 * @tc.desc: ROTATION_180
185 * @tc.type: FUNC
186 */
187 HWTEST_F(ScreenCutoutControllerTest, ConvertBoundaryRectsByRotation04, Function | SmallTest | Level3)
188 {
189 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
190 DMRect emptyRect = {0, 0, 0, 0};
191 DMRect emptyRect_ = {1, 2, 3, 3};
192 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
193 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
194 VirtualScreenOption virtualOption;
195 virtualOption.name_ = "createVirtualOption";
196 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
197 virtualOption, displayManagerAgent->AsObject());
198 ASSERT_NE(ScreenSessionManager::GetInstance().GetDisplayInfoById(screenId), nullptr);
199 ASSERT_TRUE(controller != nullptr);
200 ScreenProperty screenProperty = ScreenSessionManager::GetInstance().GetScreenProperty(screenId);
201 Rotation rotation = Rotation::ROTATION_180;
202 screenProperty.UpdateScreenRotation(rotation);
203 ASSERT_NE(screenProperty.GetScreenRotation(), Rotation::ROTATION_0);
204 controller->ConvertBoundaryRectsByRotation(boundaryRects, screenId);
205 ScreenSessionManager::GetInstance().DestroyVirtualScreen(screenId);
206 }
207
208 /**
209 * @tc.name: ConvertBoundaryRectsByRotation
210 * @tc.desc: ROTATION_270
211 * @tc.type: FUNC
212 */
213 HWTEST_F(ScreenCutoutControllerTest, ConvertBoundaryRectsByRotation05, Function | SmallTest | Level3)
214 {
215 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
216 DMRect emptyRect = {0, 0, 0, 0};
217 DMRect emptyRect_ = {1, 2, 3, 3};
218 std::vector<DMRect> boundaryRects = {emptyRect, emptyRect_};
219 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
220 VirtualScreenOption virtualOption;
221 virtualOption.name_ = "createVirtualOption";
222 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
223 virtualOption, displayManagerAgent->AsObject());
224 ASSERT_NE(ScreenSessionManager::GetInstance().GetDisplayInfoById(screenId), nullptr);
225 ASSERT_TRUE(controller != nullptr);
226 ScreenProperty screenProperty = ScreenSessionManager::GetInstance().GetScreenProperty(screenId);
227 Rotation rotation = Rotation::ROTATION_270;
228 screenProperty.UpdateScreenRotation(rotation);
229 ASSERT_NE(screenProperty.GetScreenRotation(), Rotation::ROTATION_0);
230 controller->ConvertBoundaryRectsByRotation(boundaryRects, screenId);
231 ScreenSessionManager::GetInstance().DestroyVirtualScreen(screenId);
232 }
233
234 /**
235 * @tc.name: CurrentRotation90
236 * @tc.desc: CurrentRotation90 func
237 * @tc.type: FUNC
238 */
239 HWTEST_F(ScreenCutoutControllerTest, CurrentRotation90, Function | SmallTest | Level3)
240 {
241 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
242 std::vector<DMRect> displayBoundaryRects;
243 DMRect emptyRect = {10, 10, 20, 20};
244 DMRect emptyRect_ = {30, 30, 40, 40};
245 displayBoundaryRects.push_back(emptyRect);
246 displayBoundaryRects.push_back(emptyRect_);
247
248 std::vector<DMRect> finalVector;
249 uint32_t displayWidth = 100;
250 controller->CurrentRotation90(displayBoundaryRects, finalVector, displayWidth);
251
252 ASSERT_EQ(finalVector.size(), 2);
253 ASSERT_EQ(finalVector[0].posX_, 70);
254 ASSERT_EQ(finalVector[0].posY_, 10);
255 ASSERT_EQ(finalVector[0].width_, 20);
256 ASSERT_EQ(finalVector[0].height_, 20);
257 }
258
259 /**
260 * @tc.name: CurrentRotation180
261 * @tc.desc: CurrentRotation180 func
262 * @tc.type: FUNC
263 */
264 HWTEST_F(ScreenCutoutControllerTest, CurrentRotation180, Function | SmallTest | Level3)
265 {
266 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
267 std::vector<DMRect> displayBoundaryRects;
268 DMRect emptyRect = {10, 10, 20, 20};
269 DMRect emptyRect_ = {30, 30, 40, 40};
270 displayBoundaryRects.push_back(emptyRect);
271 displayBoundaryRects.push_back(emptyRect_);
272
273 std::vector<DMRect> finalVector;
274 uint32_t displayWidth = 100;
275 uint32_t displayHeight = 200;
276 controller->CurrentRotation180(displayBoundaryRects, finalVector, displayWidth, displayHeight);
277
278 ASSERT_EQ(finalVector.size(), 2);
279 ASSERT_EQ(finalVector[0].posX_, 70);
280 ASSERT_EQ(finalVector[0].posY_, 170);
281 ASSERT_EQ(finalVector[0].width_, 20);
282 ASSERT_EQ(finalVector[0].height_, 20);
283 }
284
285 /**
286 * @tc.name: CurrentRotation270
287 * @tc.desc: CurrentRotation270 func
288 * @tc.type: FUNC
289 */
290 HWTEST_F(ScreenCutoutControllerTest, CurrentRotation270, Function | SmallTest | Level3)
291 {
292 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
293 std::vector<DMRect> displayBoundaryRects;
294 DMRect emptyRect = {10, 10, 20, 20};
295 DMRect emptyRect_ = {30, 30, 40, 40};
296 displayBoundaryRects.push_back(emptyRect);
297 displayBoundaryRects.push_back(emptyRect_);
298
299 std::vector<DMRect> finalVector;
300 uint32_t displayHeight = 200;
301 controller->CurrentRotation270(displayBoundaryRects, finalVector, displayHeight);
302
303 ASSERT_EQ(finalVector.size(), 2);
304 ASSERT_EQ(finalVector[0].posX_, 10);
305 ASSERT_EQ(finalVector[0].posY_, 170);
306 ASSERT_EQ(finalVector[0].width_, 20);
307 ASSERT_EQ(finalVector[0].height_, 20);
308 }
309
310 /**
311 * @tc.name: CheckBoundaryRects
312 * @tc.desc: ScreenCutoutController check boundary rects
313 * @tc.type: FUNC
314 */
315 HWTEST_F(ScreenCutoutControllerTest, CheckBoundaryRects, Function | SmallTest | Level3)
316 {
317 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
318 DMRect emptyRect = {-15, -15, 8, 8};
319 DMRect emptyRect_ = {21, 21, 3, 3};
320 std::vector<DMRect> boundaryRects = {emptyRect_, emptyRect};
321 ScreenProperty screenProperty;
322 auto screenBounds = RRect({ 0, 0, 35, 35 }, 0.0f, 0.0f);
323 screenProperty.SetBounds(screenBounds);
324 ASSERT_TRUE(controller != nullptr);
325 controller->CheckBoundaryRects(boundaryRects, screenProperty);
326 }
327
328 /**
329 * @tc.name: CalcWaterfallRects01
330 * @tc.desc: ScreenCutoutController calc waterfall rects
331 * @tc.type: FUNC
332 */
333 HWTEST_F(ScreenCutoutControllerTest, CalcWaterfallRects01, Function | SmallTest | Level3)
334 {
335 DisplayId displayId = 0;
336 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
337 ASSERT_TRUE(controller != nullptr);
338 controller->CalcWaterfallRects(displayId);
339 }
340
341 /**
342 * @tc.name: CalcWaterfallRects02
343 * @tc.desc: ScreenCutoutController calc waterfall rects
344 * @tc.type: FUNC
345 */
346 HWTEST_F(ScreenCutoutControllerTest, CalcWaterfallRects02, Function | SmallTest | Level3)
347 {
348 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
349 VirtualScreenOption virtualOption;
350 virtualOption.name_ = "createVirtualOption";
351 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
352 virtualOption, displayManagerAgent->AsObject());
353 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
354 ASSERT_NE(controller, nullptr);
355 EXPECT_FALSE(ScreenSceneConfig::IsWaterfallDisplay());
356 bool testWaterfallDisplay = ScreenSceneConfig::isWaterfallDisplay_;
357 ScreenSceneConfig::isWaterfallDisplay_ = true;
358 EXPECT_TRUE(ScreenSceneConfig::IsWaterfallDisplay());
359 controller->CalcWaterfallRects(screenId);
360 ScreenSceneConfig::isWaterfallDisplay_ = testWaterfallDisplay;
361 ScreenSessionManager::GetInstance().DestroyVirtualScreen(screenId);
362 }
363
364 /**
365 * @tc.name: CalcWaterfallRects03
366 * @tc.desc: ScreenCutoutController calc waterfall rects
367 * @tc.type: FUNC
368 */
369 HWTEST_F(ScreenCutoutControllerTest, CalcWaterfallRects03, Function | SmallTest | Level3)
370 {
371 DisplayId displayId = 1;
372 ScreenSceneConfig::GetCurvedScreenBoundaryConfig() = {0, 0, 0, 0};
373 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
374 ASSERT_TRUE(controller != nullptr);
375 controller->CalcWaterfallRects(displayId);
376 }
377
378 /**
379 * @tc.name: CalcWaterfallRects04
380 * @tc.desc: ScreenCutoutController calc waterfall rects
381 * @tc.type: FUNC
382 */
383 HWTEST_F(ScreenCutoutControllerTest, CalcWaterfallRects04, Function | SmallTest | Level3)
384 {
385 DisplayId displayId = 1;
386 ScreenSceneConfig::GetCurvedScreenBoundaryConfig() = {};
387 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
388 ASSERT_TRUE(controller != nullptr);
389 controller->CalcWaterfallRects(displayId);
390 }
391
392 /**
393 * @tc.name: CalcWaterfallRectsByRotation
394 * @tc.desc: ScreenCutoutController calc waterfall rects by rotation
395 * @tc.type: FUNC
396 */
397 HWTEST_F(ScreenCutoutControllerTest, CalcWaterfallRectsByRotation, Function | SmallTest | Level3)
398 {
399 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
400 Rotation rotation;
401 uint32_t displayHeight = 1024;
402 uint32_t displayWidth = 512;
403 std::vector<uint32_t> realNumVec = {16, 32, 8, 8};
404 rotation = Rotation::ROTATION_0;
405 ASSERT_TRUE(controller != nullptr);
406 controller->CalcWaterfallRectsByRotation(rotation, displayHeight, displayWidth, realNumVec);
407 rotation = Rotation::ROTATION_90;
408 controller->CalcWaterfallRectsByRotation(rotation, displayHeight, displayWidth, realNumVec);
409 rotation = Rotation::ROTATION_180;
410 controller->CalcWaterfallRectsByRotation(rotation, displayHeight, displayWidth, realNumVec);
411 rotation = Rotation::ROTATION_270;
412 controller->CalcWaterfallRectsByRotation(rotation, displayHeight, displayWidth, realNumVec);
413 }
414
415 /**
416 * @tc.name: CalculateCurvedCompression
417 * @tc.desc: ScreenCutoutController calculate curved compression
418 * @tc.type: FUNC
419 */
420 HWTEST_F(ScreenCutoutControllerTest, CalculateCurvedCompression, Function | SmallTest | Level3)
421 {
422 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
423 RectF finalRect = RectF(0, 0, 0, 0);
424 ScreenProperty screenProperty;
425 RectF result = controller->CalculateCurvedCompression(screenProperty);
426 ASSERT_EQ(finalRect.left_, result.left_);
427 ASSERT_EQ(finalRect.top_, result.top_);
428 ASSERT_EQ(finalRect.width_, result.width_);
429 ASSERT_EQ(finalRect.height_, result.height_);
430 }
431
432 /**
433 * @tc.name: IsDisplayRotationHorizontal
434 * @tc.desc: IsDisplayRotationHorizontal func
435 * @tc.type: FUNC
436 */
437 HWTEST_F(ScreenCutoutControllerTest, IsDisplayRotationHorizontal, Function | SmallTest | Level3)
438 {
439 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
440 ASSERT_EQ(false, controller->IsDisplayRotationHorizontal(Rotation::ROTATION_0));
441 ASSERT_EQ(false, controller->IsDisplayRotationHorizontal(Rotation::ROTATION_180));
442 ASSERT_EQ(true, controller->IsDisplayRotationHorizontal(Rotation::ROTATION_90));
443 ASSERT_EQ(true, controller->IsDisplayRotationHorizontal(Rotation::ROTATION_270));
444 }
445
446 /**
447 * @tc.name: ConvertDeviceToDisplayRotation01
448 * @tc.desc: ConvertDeviceToDisplayRotation func
449 * @tc.type: FUNC
450 */
451 HWTEST_F(ScreenCutoutControllerTest, ConvertDeviceToDisplayRotation01, Function | SmallTest | Level3)
452 {
453 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
454 ASSERT_EQ(Rotation::ROTATION_0, controller->ConvertDeviceToDisplayRotation(DeviceRotationValue::INVALID));
455 DeviceRotationValue deviceRotation;
456 deviceRotation = DeviceRotationValue::ROTATION_PORTRAIT;
457 Rotation result01 = controller->ConvertDeviceToDisplayRotation(deviceRotation);
458 ASSERT_EQ(result01, Rotation::ROTATION_0);
459 }
460
461 /**
462 * @tc.name: GetCurrentDisplayRotation01
463 * @tc.desc: GetCurrentDisplayRotation func
464 * @tc.type: FUNC
465 */
466 HWTEST_F(ScreenCutoutControllerTest, GetCurrentDisplayRotation01, Function | SmallTest | Level3)
467 {
468 DisplayId displayId = 2000;
469 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
470 controller->defaultDeviceRotation_ = 0;
471 ASSERT_EQ(Rotation::ROTATION_0, controller->GetCurrentDisplayRotation(displayId));
472 controller->defaultDeviceRotation_ = 1;
473 ASSERT_NE(Rotation::ROTATION_0, controller->GetCurrentDisplayRotation(displayId));
474 }
475
476 /**
477 * @tc.name: GetCurrentDisplayRotation
478 * @tc.desc: GetCurrentDisplayRotation func
479 * @tc.type: FUNC
480 */
481 HWTEST_F(ScreenCutoutControllerTest, GetCurrentDisplayRotation02, Function | SmallTest | Level3)
482 {
483 sptr<IDisplayManagerAgent> displayManagerAgent = new(std::nothrow) DisplayManagerAgentDefault();
484 VirtualScreenOption virtualOption;
485 virtualOption.name_ = "createVirtualOption";
486 auto screenId = ScreenSessionManager::GetInstance().CreateVirtualScreen(
487 virtualOption, displayManagerAgent->AsObject());
488 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
489 ASSERT_NE(controller, nullptr);
490 auto displayInfo = ScreenSessionManager::GetInstance().GetDisplayInfoById(screenId);
491 ASSERT_NE(displayInfo, nullptr);
492 ASSERT_EQ(displayInfo->GetRotation(), controller->GetCurrentDisplayRotation(screenId));
493 }
494
495 /**
496 * @tc.name: ProcessRotationMapping
497 * @tc.desc: ProcessRotationMapping func
498 * @tc.type: FUNC
499 */
500 HWTEST_F(ScreenCutoutControllerTest, ProcessRotationMapping, Function | SmallTest | Level3)
501 {
502 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
503 ASSERT_TRUE(controller != nullptr);
504 controller->ProcessRotationMapping();
505 }
506
507 /**
508 * @tc.name: GetOffsetY
509 * @tc.desc: GetOffsetY func
510 * @tc.type: FUNC
511 */
512 HWTEST_F(ScreenCutoutControllerTest, GetOffsetY, Function | SmallTest | Level3)
513 {
514 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
515 ASSERT_EQ(0, controller->GetOffsetY());
516 }
517 }
518 } // namespace Rosen
519 } // namespace OHOS
520
521