• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, 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 "display_manager_adapter.h"
18 #include "display_manager_proxy.h"
19 #include "window_scene.h"
20 #include "scene_board_judgement.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace Rosen {
27 class DisplayManagerAdapterTest : public testing::Test {
28 public:
29     static void SetUpTestCase();
30     static void TearDownTestCase();
31     void SetUp() override;
32     void TearDown() override;
33 };
34 
SetUpTestCase()35 void DisplayManagerAdapterTest::SetUpTestCase()
36 {
37 }
38 
TearDownTestCase()39 void DisplayManagerAdapterTest::TearDownTestCase()
40 {
41 }
42 
SetUp()43 void DisplayManagerAdapterTest::SetUp()
44 {
45 }
46 
TearDown()47 void DisplayManagerAdapterTest::TearDown()
48 {
49 }
50 
51 namespace {
52 /**
53  * @tc.name: GetDisplayInfo
54  * @tc.desc: test nullptr
55  * @tc.type: FUNC
56  */
57 HWTEST_F(DisplayManagerAdapterTest, GetDisplayInfo, Function | SmallTest | Level2)
58 {
59     sptr<DisplayInfo> info = SingletonContainer::Get<DisplayManagerAdapter>().GetDisplayInfo(DISPLAY_ID_INVALID);
60     ASSERT_EQ(info, nullptr);
61 }
62 
63 /**
64  * @tc.name: GetCutoutInfo
65  * @tc.desc: test nullptr
66  * @tc.type: FUNC
67  */
68 HWTEST_F(DisplayManagerAdapterTest, GetCutoutInfo, Function | SmallTest | Level2)
69 {
70     sptr<CutoutInfo> info = SingletonContainer::Get<DisplayManagerAdapter>().GetCutoutInfo(DISPLAY_ID_INVALID);
71     ASSERT_EQ(info, nullptr);
72 }
73 
74 /**
75  * @tc.name: GetScreenSupportedColorGamuts
76  * @tc.desc: test success
77  * @tc.type: FUNC
78  */
79 HWTEST_F(DisplayManagerAdapterTest, GetScreenSupportedColorGamuts, Function | SmallTest | Level2)
80 {
81     std::vector<ScreenColorGamut> colorGamuts;
82     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenSupportedColorGamuts(0, colorGamuts);
83     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
84         ASSERT_EQ(err, DMError::DM_ERROR_RENDER_SERVICE_FAILED);
85     } else {
86         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
87     }
88 }
89 
90 /**
91  * @tc.name: SetScreenColorGamut
92  * @tc.desc: test success
93  * @tc.type: FUNC
94  */
95 HWTEST_F(DisplayManagerAdapterTest, SetScreenColorGamut, Function | SmallTest | Level2)
96 {
97     std::vector<ScreenColorGamut> colorGamuts;
98     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenColorGamut(0, -1);
99     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
100         ASSERT_EQ(err, DMError::DM_ERROR_RENDER_SERVICE_FAILED);
101     } else {
102         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
103     }
104 }
105 
106 /**
107  * @tc.name: GetScreenColorGamut
108  * @tc.desc: test success
109  * @tc.type: FUNC
110  */
111 HWTEST_F(DisplayManagerAdapterTest, GetScreenColorGamut, Function | SmallTest | Level2)
112 {
113     ScreenColorGamut colorGamut;
114     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenColorGamut(0, colorGamut);
115     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
116         ASSERT_EQ(err, DMError::DM_ERROR_RENDER_SERVICE_FAILED);
117     } else {
118         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
119     }
120 }
121 
122 /**
123  * @tc.name: GetScreenGamutMap
124  * @tc.desc: test success
125  * @tc.type: FUNC
126  */
127 HWTEST_F(DisplayManagerAdapterTest, GetScreenGamutMap, Function | SmallTest | Level2)
128 {
129     ScreenGamutMap gamutMap;
130     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenGamutMap(0, gamutMap);
131     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
132         ASSERT_EQ(err, DMError::DM_ERROR_RENDER_SERVICE_FAILED);
133     } else {
134         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
135     }
136 }
137 
138 /**
139  * @tc.name: SetScreenGamutMap
140  * @tc.desc: test success
141  * @tc.type: FUNC
142  */
143 HWTEST_F(DisplayManagerAdapterTest, SetScreenGamutMap, Function | SmallTest | Level2)
144 {
145     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenGamutMap(0, GAMUT_MAP_CONSTANT);
146     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
147         ASSERT_EQ(err, DMError::DM_ERROR_RENDER_SERVICE_FAILED);
148     } else {
149         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
150     }
151 }
152 
153 /**
154  * @tc.name: SetScreenColorTransform
155  * @tc.desc: test success
156  * @tc.type: FUNC
157  */
158 HWTEST_F(DisplayManagerAdapterTest, SetScreenColorTransform, Function | SmallTest | Level2)
159 {
160     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenColorTransform(0);
161     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
162         ASSERT_EQ(err, DMError::DM_OK);
163     } else {
164         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
165     }
166 }
167 
168 /**
169  * @tc.name: SetFreeze
170  * @tc.desc: test success
171  * @tc.type: FUNC
172  */
173 HWTEST_F(DisplayManagerAdapterTest, SetFreeze, Function | SmallTest | Level2)
174 {
175     std::vector<DisplayId> displayIds;
176     bool ret = SingletonContainer::Get<DisplayManagerAdapter>().SetFreeze(displayIds, false);
177     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
178         ASSERT_TRUE(ret);
179     } else {
180         ASSERT_FALSE(ret);
181     }
182 }
183 
184 /**
185  * @tc.name: GetScreenGroupInfoById
186  * @tc.desc: test nullptr
187  * @tc.type: FUNC
188  */
189 HWTEST_F(DisplayManagerAdapterTest, GetScreenGroupInfoById, Function | SmallTest | Level2)
190 {
191     auto info = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenGroupInfoById(SCREEN_ID_INVALID);
192     ASSERT_EQ(info, nullptr);
193 }
194 
195 /**
196  * @tc.name: GetScreenInfo
197  * @tc.desc: test nullptr
198  * @tc.type: FUNC
199  */
200 HWTEST_F(DisplayManagerAdapterTest, GetScreenInfo, Function | SmallTest | Level2)
201 {
202     sptr<ScreenInfo> info = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenInfo(SCREEN_ID_INVALID);
203     ASSERT_EQ(info, nullptr);
204 }
205 
206 /**
207  * @tc.name: OnRemoteDied
208  * @tc.desc: test nullptr
209  * @tc.type: FUNC
210  */
211 HWTEST_F(DisplayManagerAdapterTest, OnRemoteDied, Function | SmallTest | Level2)
212 {
213     sptr<IRemoteObject::DeathRecipient> dmsDeath_ = nullptr;
214     dmsDeath_ = new(std::nothrow) DMSDeathRecipient(SingletonContainer::Get<ScreenManagerAdapter>());
215     dmsDeath_->OnRemoteDied(nullptr);
216     EXPECT_NE(nullptr, dmsDeath_);
217 }
218 
219 /**
220  * @tc.name: OnRemoteDied01
221  * @tc.desc: test nullptr
222  * @tc.type: FUNC
223  */
224 HWTEST_F(DisplayManagerAdapterTest, OnRemoteDied01, Function | SmallTest | Level2)
225 {
226     sptr<IRemoteObject::DeathRecipient> dmsDeath_ = nullptr;
227     dmsDeath_ = new(std::nothrow) DMSDeathRecipient(SingletonContainer::Get<ScreenManagerAdapter>());
228     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
229     sptr<IRemoteObject> obj = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
230     wptr<IRemoteObject> wptrDeath = obj;
231     dmsDeath_->OnRemoteDied(wptrDeath);
232     EXPECT_NE(nullptr, dmsDeath_);
233 }
234 
235 /**
236  * @tc.name: Clear
237  * @tc.desc: test success
238  * @tc.type: FUNC
239  */
240 HWTEST_F(DisplayManagerAdapterTest, Clear, Function | SmallTest | Level2)
241 {
242     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
243     SingletonContainer::Get<ScreenManagerAdapter>().Clear();
244     ASSERT_FALSE(SingletonContainer::Get<ScreenManagerAdapter>().isProxyValid_);
245 }
246 
247 /**
248  * @tc.name: Clear01
249  * @tc.desc: test success
250  * @tc.type: FUNC
251  */
252 HWTEST_F(DisplayManagerAdapterTest, Clear01, Function | SmallTest | Level2)
253 {
254     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
255     SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_ = nullptr;
256     SingletonContainer::Get<ScreenManagerAdapter>().Clear();
257     ASSERT_FALSE(SingletonContainer::Get<ScreenManagerAdapter>().isProxyValid_);
258 }
259 
260 /**
261  * @tc.name: DisableMirror
262  * @tc.desc: DisableMirror test
263  * @tc.type: FUNC
264  */
265 HWTEST_F(DisplayManagerAdapterTest, DisableMirror, Function | SmallTest | Level2)
266 {
267     DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().DisableMirror(false);
268     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
269         ASSERT_EQ(DMError::DM_OK, ret);
270     } else {
271         ASSERT_NE(DMError::DM_OK, ret);
272     }
273 }
274 
275 /**
276  * @tc.name: HasImmersiveWindow
277  * @tc.desc: test HasImmersiveWindow
278  * @tc.type: FUNC
279  */
280 HWTEST_F(DisplayManagerAdapterTest, HasImmersiveWindow, Function | SmallTest | Level2)
281 {
282     bool immersive = false;
283     DMError ret = SingletonContainer::Get<DisplayManagerAdapter>().HasImmersiveWindow(immersive);
284     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
285         ASSERT_EQ(ret, DMError::DM_ERROR_DEVICE_NOT_SUPPORT);
286     } else {
287         ASSERT_EQ(ret, DMError::DM_OK);
288     }
289 }
290 
291 /**
292  * @tc.name: GetPixelFormat
293  * @tc.desc: test success
294  * @tc.type: FUNC
295  */
296 HWTEST_F(DisplayManagerAdapterTest, GetPixelFormat, Function | SmallTest | Level2)
297 {
298     GraphicPixelFormat pixelFormat = GraphicPixelFormat{GRAPHIC_PIXEL_FMT_CLUT8};
299     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetPixelFormat(0, pixelFormat);
300     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
301         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
302     } else {
303         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
304     }
305 }
306 
307 /**
308  * @tc.name: SetPixelFormat
309  * @tc.desc: test success
310  * @tc.type: FUNC
311  */
312 HWTEST_F(DisplayManagerAdapterTest, SetPixelFormat, Function | SmallTest | Level2)
313 {
314     GraphicPixelFormat pixelFormat = GraphicPixelFormat{GRAPHIC_PIXEL_FMT_CLUT8};
315     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetPixelFormat(0, pixelFormat);
316     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
317         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
318     } else {
319         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
320     }
321 }
322 
323 /**
324  * @tc.name: GetSupportedHDRFormats
325  * @tc.desc: test success
326  * @tc.type: FUNC
327  */
328 HWTEST_F(DisplayManagerAdapterTest, GetSupportedHDRFormats, Function | SmallTest | Level2)
329 {
330     std::vector<ScreenHDRFormat> hdrFormats;
331     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetSupportedHDRFormats(0, hdrFormats);
332     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
333         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
334     } else {
335         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
336     }
337 }
338 
339 /**
340  * @tc.name: GetScreenHDRFormat
341  * @tc.desc: test success
342  * @tc.type: FUNC
343  */
344 HWTEST_F(DisplayManagerAdapterTest, GetScreenHDRFormat, Function | SmallTest | Level2)
345 {
346     ScreenHDRFormat hdrFormat = ScreenHDRFormat{NOT_SUPPORT_HDR};
347     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenHDRFormat(0, hdrFormat);
348     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
349         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
350     } else {
351         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
352     }
353 }
354 
355 /**
356  * @tc.name: SetScreenHDRFormat
357  * @tc.desc: test success
358  * @tc.type: FUNC
359  */
360 HWTEST_F(DisplayManagerAdapterTest, SetScreenHDRFormat, Function | SmallTest | Level2)
361 {
362     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenHDRFormat(0, 0);
363     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
364         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
365     } else {
366         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
367     }
368 }
369 
370 /**
371  * @tc.name: GetSupportedColorSpaces
372  * @tc.desc: test success
373  * @tc.type: FUNC
374  */
375 HWTEST_F(DisplayManagerAdapterTest, GetSupportedColorSpaces, Function | SmallTest | Level2)
376 {
377     std::vector<GraphicCM_ColorSpaceType> colorSpaces;
378     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetSupportedColorSpaces(0, colorSpaces);
379     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
380         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
381     } else {
382         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
383     }
384 }
385 
386 /**
387  * @tc.name: GetScreenColorSpace
388  * @tc.desc: test success
389  * @tc.type: FUNC
390  */
391 HWTEST_F(DisplayManagerAdapterTest, GetScreenColorSpace, Function | SmallTest | Level2)
392 {
393     GraphicCM_ColorSpaceType colorSpace = GraphicCM_ColorSpaceType{GRAPHIC_CM_COLORSPACE_NONE};
394     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().GetScreenColorSpace(0, colorSpace);
395     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
396         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
397     } else {
398         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
399     }
400 }
401 
402 /**
403  * @tc.name: SetScreenColorSpace
404  * @tc.desc: test success
405  * @tc.type: FUNC
406  */
407 HWTEST_F(DisplayManagerAdapterTest, SetScreenColorSpace, Function | SmallTest | Level2)
408 {
409     GraphicCM_ColorSpaceType colorSpace = GraphicCM_ColorSpaceType{GRAPHIC_CM_COLORSPACE_NONE};
410     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenColorSpace(0, colorSpace);
411     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
412         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
413     } else {
414         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
415     }
416 }
417 
418 /**
419  * @tc.name: DestroyVirtualScreen
420  * @tc.desc: test success
421  * @tc.type: FUNC
422  */
423 HWTEST_F(DisplayManagerAdapterTest, DestroyVirtualScreen, Function | SmallTest | Level2)
424 {
425     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().DestroyVirtualScreen(0);
426     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
427         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_CALLING);
428     } else {
429         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
430     }
431 }
432 
433 /**
434  * @tc.name: SetVirtualMirrorScreenCanvasRotation
435  * @tc.desc: test SetVirtualMirrorScreenCanvasRotation
436  * @tc.type: FUNC
437  */
438 HWTEST_F(DisplayManagerAdapterTest, SetVirtualMirrorScreenCanvasRotation, Function | SmallTest | Level2)
439 {
440     bool canvasRotation = false;
441     DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().
442                     SetVirtualMirrorScreenCanvasRotation(0, canvasRotation);
443     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
444         ASSERT_EQ(ret, DMError::DM_OK);
445     } else {
446         ASSERT_EQ(ret, DMError::DM_ERROR_INVALID_PARAM);
447     }
448 }
449 
450 /**
451  * @tc.name: SetScreenRotationLocked
452  * @tc.desc: test SetScreenRotationLocked
453  * @tc.type: FUNC
454  */
455 HWTEST_F(DisplayManagerAdapterTest, SetScreenRotationLocked, Function | SmallTest | Level2)
456 {
457     bool isLocked = false;
458     DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenRotationLocked(isLocked);
459     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
460         ASSERT_EQ(ret, DMError::DM_OK);
461     } else {
462         ASSERT_EQ(ret, DMError::DM_ERROR_INVALID_PARAM);
463     }
464 }
465 
466 /**
467  * @tc.name: IsScreenRotationLocked
468  * @tc.desc: test IsScreenRotationLocked
469  * @tc.type: FUNC
470  */
471 HWTEST_F(DisplayManagerAdapterTest, IsScreenRotationLocked, Function | SmallTest | Level2)
472 {
473     bool isLocked = false;
474     DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().IsScreenRotationLocked(isLocked);
475     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
476         ASSERT_EQ(ret, DMError::DM_OK);
477     } else {
478         ASSERT_EQ(ret, DMError::DM_ERROR_INVALID_PARAM);
479     }
480 }
481 
482 /**
483  * @tc.name: SetSpecifiedScreenPower
484  * @tc.desc: test SetSpecifiedScreenPower
485  * @tc.type: FUNC
486  */
487 HWTEST_F(DisplayManagerAdapterTest, SetSpecifiedScreenPower, Function | SmallTest | Level2)
488 {
489     ScreenPowerState state = ScreenPowerState{0};
490     PowerStateChangeReason reason = PowerStateChangeReason{0};
491     bool ret = SingletonContainer::Get<ScreenManagerAdapter>().SetSpecifiedScreenPower(0, state, reason);
492     ASSERT_FALSE(ret);
493 }
494 
495 /**
496  * @tc.name: SetOrientation
497  * @tc.desc: SetOrientation success
498  * @tc.type: FUNC
499  */
500 HWTEST_F(DisplayManagerAdapterTest, SetOrientation, Function | SmallTest | Level2)
501 {
502     Orientation orientation = Orientation{0};
503     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetOrientation(0, orientation);
504     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
505         ASSERT_EQ(err, DMError::DM_OK);
506     } else {
507         ASSERT_EQ(err, DMError::DM_ERROR_NULLPTR);
508     }
509 }
510 
511 /**
512  * @tc.name: WakeUpBegin
513  * @tc.desc: test WakeUpBegin
514  * @tc.type: FUNC
515  */
516 HWTEST_F(DisplayManagerAdapterTest, WakeUpBegin, Function | SmallTest | Level2)
517 {
518     PowerStateChangeReason reason = PowerStateChangeReason{0};
519     bool ret = SingletonContainer::Get<DisplayManagerAdapter>().WakeUpBegin(reason);
520     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
521         ASSERT_TRUE(ret);
522     } else {
523         ASSERT_FALSE(ret);
524     }
525 }
526 
527 /**
528  * @tc.name: WakeUpEnd
529  * @tc.desc: test WakeUpEnd
530  * @tc.type: FUNC
531  */
532 HWTEST_F(DisplayManagerAdapterTest, WakeUpEnd, Function | SmallTest | Level2)
533 {
534     bool ret = SingletonContainer::Get<DisplayManagerAdapter>().WakeUpEnd();
535     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
536         ASSERT_TRUE(ret);
537     } else {
538         ASSERT_FALSE(ret);
539     }
540 }
541 
542 /**
543  * @tc.name: SuspendBegin
544  * @tc.desc: test SuspendBegin
545  * @tc.type: FUNC
546  */
547 HWTEST_F(DisplayManagerAdapterTest, SuspendBegin, Function | SmallTest | Level2)
548 {
549     PowerStateChangeReason reason = PowerStateChangeReason{0};
550     bool ret = SingletonContainer::Get<DisplayManagerAdapter>().SuspendBegin(reason);
551     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
552         ASSERT_TRUE(ret);
553     } else {
554         ASSERT_FALSE(ret);
555     }
556 }
557 
558 /**
559  * @tc.name: SuspendEnd
560  * @tc.desc: test SuspendEnd
561  * @tc.type: FUNC
562  */
563 HWTEST_F(DisplayManagerAdapterTest, SuspendEnd, Function | SmallTest | Level2)
564 {
565     bool ret = SingletonContainer::Get<DisplayManagerAdapter>().SuspendEnd();
566     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
567         ASSERT_TRUE(ret);
568     } else {
569         ASSERT_FALSE(ret);
570     }
571 }
572 
573 /**
574  * @tc.name: MakeMirror
575  * @tc.desc: test success
576  * @tc.type: FUNC
577  */
578 HWTEST_F(DisplayManagerAdapterTest, MakeMirror, Function | SmallTest | Level2)
579 {
580     std::vector<ScreenId> mirrorScreenId;
581     ScreenId screenGroupId;
582     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().MakeMirror(0,
583         mirrorScreenId, screenGroupId);
584     ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
585 }
586 
587 /**
588  * @tc.name: StopMirror
589  * @tc.desc: test success
590  * @tc.type: FUNC
591  */
592 HWTEST_F(DisplayManagerAdapterTest, StopMirror, Function | SmallTest | Level2)
593 {
594     std::vector<ScreenId> mirrorScreenIds;
595     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().StopMirror(mirrorScreenIds);
596     ASSERT_EQ(err, DMError::DM_OK);
597 }
598 
599 /**
600  * @tc.name: HasPrivateWindow
601  * @tc.desc: test success
602  * @tc.type: FUNC
603  */
604 HWTEST_F(DisplayManagerAdapterTest, HasPrivateWindow, Function | SmallTest | Level2)
605 {
606     bool hasPrivateWindow = false;
607     DMError err = SingletonContainer::Get<DisplayManagerAdapter>().HasPrivateWindow(0,
608         hasPrivateWindow);
609     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
610         ASSERT_EQ(DMError::DM_OK, err);
611     } else {
612         ASSERT_EQ(DMError::DM_ERROR_INVALID_PARAM, err);
613     }
614 }
615 
616 /**
617  * @tc.name: AddSurfaceNodeToDisplay
618  * @tc.desc: test success
619  * @tc.type: FUNC
620  */
621 HWTEST_F(DisplayManagerAdapterTest, AddSurfaceNodeToDisplay, Function | SmallTest | Level2)
622 {
623     std::shared_ptr<class RSSurfaceNode> surfaceNode;
624     DMError err = SingletonContainer::Get<DisplayManagerAdapter>().AddSurfaceNodeToDisplay(0,
625         surfaceNode);
626     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
627         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED, err);
628     } else {
629         ASSERT_EQ(DMError::DM_OK, err);
630     }
631 }
632 
633 /**
634  * @tc.name: RemoveSurfaceNodeFromDisplay
635  * @tc.desc: test success
636  * @tc.type: FUNC
637  */
638 HWTEST_F(DisplayManagerAdapterTest, RemoveSurfaceNodeFromDisplay, Function | SmallTest | Level2)
639 {
640     std::shared_ptr<class RSSurfaceNode> surfaceNode;
641     DMError err = SingletonContainer::Get<DisplayManagerAdapter>().RemoveSurfaceNodeFromDisplay(0,
642         surfaceNode);
643     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
644         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED, err);
645     } else {
646         ASSERT_EQ(DMError::DM_OK, err);
647     }
648 }
649 
650 /**
651  * @tc.name: MakeExpand
652  * @tc.desc: test success
653  * @tc.type: FUNC
654  */
655 HWTEST_F(DisplayManagerAdapterTest, MakeExpand, Function | SmallTest | Level2)
656 {
657     std::vector<ScreenId> screenId;
658     std::vector<Point> startPoint;
659     ScreenId screenGroupId;
660     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().MakeExpand(screenId,
661         startPoint, screenGroupId);
662     ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
663 }
664 
665 /**
666  * @tc.name: StopExpand
667  * @tc.desc: test success
668  * @tc.type: FUNC
669  */
670 HWTEST_F(DisplayManagerAdapterTest, StopExpand, Function | SmallTest | Level2)
671 {
672     std::vector<ScreenId> expandScreenIds;
673     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().StopExpand(expandScreenIds);
674     ASSERT_EQ(err, DMError::DM_OK);
675 }
676 
677 /**
678  * @tc.name: RemoveVirtualScreenFromGroup
679  * @tc.desc: test success
680  * @tc.type: FUNC
681  */
682 HWTEST_F(DisplayManagerAdapterTest, RemoveVirtualScreenFromGroup, Function | SmallTest | Level2)
683 {
684     std::vector<ScreenId> screens;
685     int resultValue = 0;
__anon01f08e560202() 686     std::function<void()> func = [&]() {
687         SingletonContainer::Get<ScreenManagerAdapter>().RemoveVirtualScreenFromGroup(screens);
688         resultValue = 1;
689     };
690     func();
691     ASSERT_EQ(resultValue, 1);
692 }
693 
694 /**
695  * @tc.name: SetScreenActiveMode
696  * @tc.desc: test success
697  * @tc.type: FUNC
698  */
699 HWTEST_F(DisplayManagerAdapterTest, SetScreenActiveMode, Function | SmallTest | Level2)
700 {
701     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetScreenActiveMode(0, 100);
702     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
703         ASSERT_EQ(err, DMError::DM_OK);
704     } else {
705         ASSERT_EQ(err, DMError::DM_ERROR_NULLPTR);
706     }
707 }
708 
709 /**
710  * @tc.name: SetVirtualPixelRatio
711  * @tc.desc: test success
712  * @tc.type: FUNC
713  */
714 HWTEST_F(DisplayManagerAdapterTest, SetVirtualPixelRatio, Function | SmallTest | Level2)
715 {
716     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetVirtualPixelRatio(0, 0);
717     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
718         ASSERT_EQ(err, DMError::DM_OK);
719     } else {
720         ASSERT_EQ(err, DMError::DM_ERROR_UNKNOWN);
721     }
722 }
723 
724 /**
725  * @tc.name: SetResolution
726  * @tc.desc: test success
727  * @tc.type: FUNC
728  */
729 HWTEST_F(DisplayManagerAdapterTest, SetResolution, Function | SmallTest | Level2)
730 {
731     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().SetResolution(0, 70, 100, 50);
732     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
733         ASSERT_EQ(err, DMError::DM_ERROR_IPC_FAILED);
734     } else {
735         ASSERT_EQ(err, DMError::DM_ERROR_NULLPTR);
736     }
737 }
738 
739 /**
740  * @tc.name: ResizeVirtualScreen
741  * @tc.desc: test success
742  * @tc.type: FUNC
743  */
744 HWTEST_F(DisplayManagerAdapterTest, ResizeVirtualScreen, Function | SmallTest | Level2)
745 {
746     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().ResizeVirtualScreen(0, 70, 100);
747     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
748         ASSERT_EQ(err, DMError::DM_OK);
749     } else {
750         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
751     }
752 }
753 
754 /**
755  * @tc.name: MakeUniqueScreen
756  * @tc.desc: test success
757  * @tc.type: FUNC
758  */
759 HWTEST_F(DisplayManagerAdapterTest, MakeUniqueScreen, Function | SmallTest | Level2)
760 {
761     std::vector<ScreenId> screenIds;
762     DMError err = SingletonContainer::Get<ScreenManagerAdapter>().MakeUniqueScreen(screenIds);
763     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
764         ASSERT_EQ(err, DMError::DM_OK);
765     } else {
766         ASSERT_EQ(err, DMError::DM_ERROR_INVALID_PARAM);
767     }
768 }
769 
770 /**
771  * @tc.name: GetAvailableArea
772  * @tc.desc: test success
773  * @tc.type: FUNC
774  */
775 HWTEST_F(DisplayManagerAdapterTest, GetAvailableArea, Function | SmallTest | Level2)
776 {
777     DMRect area;
778     DMError err = SingletonContainer::Get<DisplayManagerAdapter>().GetAvailableArea(0, area);
779     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
780         ASSERT_EQ(err, DMError::DM_ERROR_DEVICE_NOT_SUPPORT);
781     } else {
782         ASSERT_EQ(err, DMError::DM_ERROR_NULLPTR);
783     }
784 }
785 }
786 }
787 }
788