1/*
2 * Copyright (c) 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 <iremote_object.h>
17#include <gtest/gtest.h>
18#include "iremote_object_mocker.h"
19#include "window_root.h"
20#include "window_manager.h"
21#include "window_manager_service.h"
22#include "display_manager.h"
23
24using namespace testing;
25using namespace testing::ext;
26namespace OHOS {
27namespace Rosen {
28
29class WindowRootTest : public testing::Test {
30public:
31    static void SetUpTestCase();
32    static void TearDownTestCase();
33    void SetUp() override;
34    void TearDown() override;
35    static sptr<WindowRoot> windowRoot_;
36};
37
38sptr<WindowRoot> WindowRootTest::windowRoot_ = nullptr;
39
40void WindowRootTest::SetUpTestCase()
41{
42}
43
44void WindowRootTest::TearDownTestCase()
45{
46}
47
48void WindowRootTest::SetUp()
49{
50    windowRoot_ = new WindowRoot(nullptr);
51    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
52    ASSERT_TRUE((display != nullptr));
53    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
54    ASSERT_TRUE((displayInfo != nullptr));
55}
56
57void WindowRootTest::TearDown()
58{
59    windowRoot_ = nullptr;
60}
61
62namespace {
63/**
64 * @tc.name: WindowRootTest01
65 * @tc.desc: test WindowRoot GetTotalWindowNum
66 * @tc.type: FUNC
67 */
68HWTEST_F(WindowRootTest, WindowRootTest01, Function | SmallTest | Level2)
69{
70    uint32_t size = windowRoot_->GetTotalWindowNum();
71    ASSERT_EQ(size, 0);
72}
73
74/**
75 * @tc.name: WindowRootTest02
76 * @tc.desc: test WindowRoot GetWindowForDumpAceHelpInfo
77 * @tc.type: FUNC
78 */
79HWTEST_F(WindowRootTest, WindowRootTest02, Function | SmallTest | Level2)
80{
81    windowRoot_->GetWindowForDumpAceHelpInfo();
82    sptr<WindowProperty> property = new WindowProperty();
83    property->SetWindowType(WindowType::WINDOW_TYPE_DESKTOP);
84    sptr<WindowNode> windowNode;
85    windowRoot_->DestroyWindowInner(windowNode);
86    windowNode = new WindowNode(property);
87    windowRoot_->SaveWindow(windowNode);
88    sptr<WindowNode> node = windowRoot_->GetWindowForDumpAceHelpInfo();
89    ASSERT_NE(node, nullptr);
90    windowRoot_->DestroyWindowInner(windowNode);
91
92    property = new WindowProperty();
93    property->SetWindowType(WindowType::WINDOW_TYPE_NAVIGATION_BAR);
94    windowNode = new WindowNode(property);
95    windowRoot_->SaveWindow(windowNode);
96    node = windowRoot_->GetWindowForDumpAceHelpInfo();
97    ASSERT_NE(node, nullptr);
98    windowRoot_->DestroyWindowInner(windowNode);
99
100    property = new WindowProperty();
101    property->SetWindowType(WindowType::WINDOW_TYPE_STATUS_BAR);
102    windowNode = new WindowNode(property);
103    windowRoot_->SaveWindow(windowNode);
104    node = windowRoot_->GetWindowForDumpAceHelpInfo();
105    ASSERT_NE(node, nullptr);
106    windowRoot_->DestroyWindowInner(windowNode);
107
108    property = new WindowProperty();
109    property->SetWindowType(WindowType::WINDOW_TYPE_KEYGUARD);
110    windowNode = new WindowNode(property);
111    windowRoot_->SaveWindow(windowNode);
112    node = windowRoot_->GetWindowForDumpAceHelpInfo();
113    ASSERT_NE(node, nullptr);
114    windowRoot_->DestroyWindowInner(windowNode);
115    windowNode->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
116    windowRoot_->DestroyWindowInner(windowNode);
117}
118
119/**
120 * @tc.name: WindowRootTest03
121 * @tc.desc: test WindowRoot CreateWindowNodeContainer
122 * @tc.type: FUNC
123 */
124HWTEST_F(WindowRootTest, WindowRootTest03, Function | SmallTest | Level2)
125{
126    sptr<DisplayInfo> displayInfo = new DisplayInfo();
127
128    displayInfo->SetWidth(49);
129    auto container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
130    ASSERT_EQ(container, nullptr);
131
132    displayInfo->SetWidth(7681);
133    container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
134    ASSERT_EQ(container, nullptr);
135
136    displayInfo->SetWidth(50);
137    displayInfo->SetHeight(49);
138    container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
139    ASSERT_EQ(container, nullptr);
140
141    displayInfo->SetHeight(7681);
142    container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
143    ASSERT_EQ(container, nullptr);
144}
145
146/**
147 * @tc.name: WindowRootTest04
148 * @tc.desc: test WindowRoot GetWindowNodeContainer
149 * @tc.type: FUNC
150 */
151HWTEST_F(WindowRootTest, WindowRootTest04, Function | SmallTest | Level2)
152{
153    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
154    ASSERT_NE(display, nullptr);
155    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
156    ASSERT_NE(displayInfo, nullptr);
157    displayInfo->SetDisplayId(0);
158    displayInfo->SetScreenGroupId(SCREEN_ID_INVALID);
159    auto container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
160    ASSERT_NE(container, nullptr);
161
162    windowRoot_->GetWindowNodeContainer(DISPLAY_ID_INVALID);
163}
164
165/**
166 * @tc.name: WindowRootTest05
167 * @tc.desc: test WindowRoot GetBackgroundNodesByScreenId
168 * @tc.type: FUNC
169 */
170HWTEST_F(WindowRootTest, WindowRootTest05, Function | SmallTest | Level2)
171{
172    std::vector<sptr<WindowNode>> windowNodes;
173
174    sptr<WindowProperty> property = new WindowProperty();
175    property->SetDisplayId(DISPLAY_ID_INVALID);
176    sptr<WindowNode> windowNode1 = new WindowNode(property);
177    windowRoot_->SaveWindow(windowNode1);
178    property->SetDisplayId(0);
179    sptr<WindowNode> windowNode2 = new WindowNode(property);
180    windowRoot_->SaveWindow(windowNode2);
181
182    auto screenGroupId = DisplayManagerServiceInner::GetInstance().GetScreenGroupIdByDisplayId(DISPLAY_ID_INVALID);
183    windowRoot_->GetBackgroundNodesByScreenId(screenGroupId, windowNodes);
184    sptr<WindowNode> windowNode3 = new WindowNode();
185    windowRoot_->SaveWindow(windowNode3);
186    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode3->GetWindowId(), windowNode3));
187    windowNodes.push_back(windowNode1);
188    windowNodes.push_back(windowNode2);
189    windowNodes.push_back(windowNode3);
190    windowRoot_->GetBackgroundNodesByScreenId(screenGroupId, windowNodes);
191
192    windowRoot_->DestroyWindowInner(windowNode1);
193    windowRoot_->DestroyWindowInner(windowNode2);
194
195    ASSERT_EQ(true, true);
196}
197
198/**
199 * @tc.name: WindowRootTest06
200 * @tc.desc: test WindowRoot AddDeathRecipient
201 * @tc.type: FUNC
202 */
203HWTEST_F(WindowRootTest, WindowRootTest06, Function | SmallTest | Level2)
204{
205    windowRoot_->AddDeathRecipient(nullptr);
206
207    ASSERT_EQ(true, true);
208
209    sptr<WindowNode> windowNode = new WindowNode();
210    sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
211    sptr<IWindow> iWindow = iface_cast<IWindow>(iRemoteObjectMocker);
212    windowNode->SetWindowToken(iWindow);
213    windowRoot_->windowDeath_ = nullptr;
214    ASSERT_TRUE((windowRoot_ != nullptr));
215    windowRoot_->AddDeathRecipient(windowNode);
216}
217
218/**
219 * @tc.name: WindowRootTest07
220 * @tc.desc: test WindowRoot SaveWindow
221 * @tc.type: FUNC
222 */
223HWTEST_F(WindowRootTest, WindowRootTest07, Function | SmallTest | Level2)
224{
225    windowRoot_->SaveWindow(nullptr);
226
227    ASSERT_EQ(true, true);
228}
229
230/**
231 * @tc.name: WindowRootTest08
232 * @tc.desc: test WindowRoot MinimizeStructuredAppWindowsExceptSelf
233 * @tc.type: FUNC
234 */
235HWTEST_F(WindowRootTest, WindowRootTest08, Function | SmallTest | Level2)
236{
237    sptr<WindowProperty> property = new WindowProperty();
238    property->SetDisplayId(DISPLAY_ID_INVALID);
239    sptr<WindowNode> windowNode = new WindowNode(property);
240
241    WMError ret = windowRoot_->MinimizeStructuredAppWindowsExceptSelf(windowNode);
242
243    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
244}
245
246/**
247 * @tc.name: WindowRootTest09
248 * @tc.desc: test WindowRoot MinimizeTargetWindows
249 * @tc.type: FUNC
250 */
251HWTEST_F(WindowRootTest, WindowRootTest09, Function | SmallTest | Level2)
252{
253    std::vector<uint32_t> windowIds;
254
255    windowRoot_->MinimizeTargetWindows(windowIds);
256
257    windowIds.push_back(INVALID_WINDOW_ID);
258    windowRoot_->MinimizeTargetWindows(windowIds);
259
260    sptr<WindowProperty> property = new WindowProperty();
261    property->SetWindowId(1);
262    property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
263    auto windowNode = new WindowNode(property);
264    windowRoot_->SaveWindow(windowNode);
265    property = new WindowProperty();
266    property->SetWindowId(2);
267    property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
268    windowNode = new WindowNode(property);
269    windowRoot_->SaveWindow(windowNode);
270    windowIds.push_back(1);
271    windowIds.push_back(2);
272    windowRoot_->MinimizeTargetWindows(windowIds);
273
274    ASSERT_EQ(true, true);
275}
276
277/**
278 * @tc.name: WindowRootTest10
279 * @tc.desc: test WindowRoot GetSplitScreenWindowNodes
280 * @tc.type: FUNC
281 */
282HWTEST_F(WindowRootTest, WindowRootTest10, Function | SmallTest | Level2)
283{
284    std::vector<sptr<WindowNode>> windowNodes = windowRoot_->GetSplitScreenWindowNodes(DISPLAY_ID_INVALID);
285    ASSERT_EQ(windowNodes.empty(), true);
286    DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
287    windowNodes = windowRoot_->GetSplitScreenWindowNodes(defaultDisplayId);
288    ASSERT_EQ(windowNodes.empty(), true);
289}
290
291/**
292 * @tc.name: WindowRootTest11
293 * @tc.desc: test WindowRoot IsForbidDockSliceMove
294 * @tc.type: FUNC
295 */
296HWTEST_F(WindowRootTest, WindowRootTest11, Function | SmallTest | Level2)
297{
298    bool ret = windowRoot_->IsForbidDockSliceMove(DISPLAY_ID_INVALID);
299    ASSERT_EQ(ret, true);
300
301    ret = windowRoot_->IsForbidDockSliceMove(0);
302    ASSERT_EQ(ret, true);
303}
304
305/**
306 * @tc.name: WindowRootTest12
307 * @tc.desc: test WindowRoot IsDockSliceInExitSplitModeArea
308 * @tc.type: FUNC
309 */
310HWTEST_F(WindowRootTest, WindowRootTest12, Function | SmallTest | Level2)
311{
312    bool ret = windowRoot_->IsDockSliceInExitSplitModeArea(DISPLAY_ID_INVALID);
313    ASSERT_EQ(ret, false);
314
315    ret = windowRoot_->IsDockSliceInExitSplitModeArea(0);
316    ASSERT_EQ(ret, false);
317
318    DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
319    ret = windowRoot_->IsDockSliceInExitSplitModeArea(defaultDisplayId);
320    ASSERT_EQ(ret, false);
321}
322
323/**
324 * @tc.name: WindowRootTest13
325 * @tc.desc: test WindowRoot ExitSplitMode
326 * @tc.type: FUNC
327 */
328HWTEST_F(WindowRootTest, WindowRootTest13, Function | SmallTest | Level2)
329{
330    windowRoot_->ExitSplitMode(DISPLAY_ID_INVALID);
331
332    windowRoot_->ExitSplitMode(0);
333    ASSERT_EQ(true, true);
334    DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
335    ASSERT_TRUE((windowRoot_ != nullptr));
336    windowRoot_->ExitSplitMode(defaultDisplayId);
337}
338
339/**
340 * @tc.name: WindowRootTest14
341 * @tc.desc: test WindowRoot AddSurfaceNodeIdWindowNodePair
342 * @tc.type: FUNC
343 */
344HWTEST_F(WindowRootTest, WindowRootTest14, Function | SmallTest | Level2)
345{
346    windowRoot_->AddSurfaceNodeIdWindowNodePair(INVALID_WINDOW_ID, nullptr);
347
348    ASSERT_EQ(true, true);
349}
350
351/**
352 * @tc.name: WindowRootTest15
353 * @tc.desc: test WindowRoot GetVisibilityWindowInfo
354 * @tc.type: FUNC
355 */
356HWTEST_F(WindowRootTest, WindowRootTest15, Function | SmallTest | Level2)
357{
358    std::vector<sptr<WindowVisibilityInfo>> infos = {};
359
360    windowRoot_->GetVisibilityWindowInfo(infos);
361
362    ASSERT_EQ(true, true);
363
364    windowRoot_->lastVisibleData_.emplace_back(1, WINDOW_VISIBILITY_STATE_NO_OCCLUSION); // 1 is surafceId
365    windowRoot_->lastVisibleData_.emplace_back(2, WINDOW_VISIBILITY_STATE_NO_OCCLUSION); // 2 is surafceId
366    windowRoot_->lastVisibleData_.emplace_back(3, WINDOW_VISIBILITY_STATE_NO_OCCLUSION); // 3 is surafceId
367    windowRoot_->GetVisibilityWindowInfo(infos);
368}
369
370/**
371 * @tc.name: WindowRootTest16
372 * @tc.desc: test WindowRoot GetAvoidAreaByType
373 * @tc.type: FUNC
374 */
375HWTEST_F(WindowRootTest, WindowRootTest16, Function | SmallTest | Level2)
376{
377    AvoidArea emptyArea;
378    AvoidArea area;
379    sptr<WindowNode> node = new WindowNode();
380
381    area = windowRoot_->GetAvoidAreaByType(node->GetWindowId(), AvoidAreaType::TYPE_CUTOUT);
382    ASSERT_EQ(area, emptyArea);
383
384    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
385    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
386    ASSERT_TRUE((display != nullptr));
387    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
388    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
389    area = windowRoot_->GetAvoidAreaByType(node->GetWindowId(), AvoidAreaType::TYPE_CUTOUT);
390    ASSERT_EQ(area, emptyArea);
391}
392
393/**
394 * @tc.name: WindowRootTest17
395 * @tc.desc: test WindowRoot MinimizeAllAppWindows
396 * @tc.type: FUNC
397 */
398HWTEST_F(WindowRootTest, WindowRootTest17, Function | SmallTest | Level2)
399{
400    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
401    ASSERT_TRUE((display != nullptr));
402    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
403    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(DISPLAY_ID_INVALID, container));
404    windowRoot_->MinimizeAllAppWindows(DISPLAY_ID_INVALID);
405
406    ASSERT_EQ(true, true);
407}
408
409/**
410 * @tc.name: WindowRootTest18
411 * @tc.desc: test WindowRoot DestroyLeakStartingWindow
412 * @tc.type: FUNC
413 */
414HWTEST_F(WindowRootTest, WindowRootTest18, Function | SmallTest | Level2)
415{
416    windowRoot_->DestroyLeakStartingWindow();
417
418    ASSERT_EQ(true, true);
419    sptr<WindowNode> node = new WindowNode();
420    node->startingWindowShown_ = true;
421    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
422    ASSERT_TRUE((windowRoot_ != nullptr));
423    windowRoot_->DestroyLeakStartingWindow();
424}
425
426/**
427 * @tc.name: WindowRootTest20
428 * @tc.desc: test WindowRoot LayoutWhenAddWindowNode
429 * @tc.type: FUNC
430 */
431HWTEST_F(WindowRootTest, WindowRootTest20, Function | SmallTest | Level2)
432{
433    sptr<WindowNode> node = nullptr;
434    windowRoot_->LayoutWhenAddWindowNode(node, true);
435
436    node = new WindowNode();
437    windowRoot_->LayoutWhenAddWindowNode(node, true);
438
439    ASSERT_EQ(true, true);
440}
441
442/**
443 * @tc.name: WindowRootTest21
444 * @tc.desc: test WindowRoot AddWindowNode
445 * @tc.type: FUNC
446 */
447HWTEST_F(WindowRootTest, WindowRootTest21, Function | SmallTest | Level2)
448{
449    WMError ret;
450    sptr<WindowNode> node = nullptr;
451
452    ret = windowRoot_->AddWindowNode(INVALID_WINDOW_ID, node, true);
453    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
454}
455
456/**
457 * @tc.name: WindowRootTest22
458 * @tc.desc: test WindowRoot RemoveWindowNode
459 * @tc.type: FUNC
460 */
461HWTEST_F(WindowRootTest, WindowRootTest22, Function | SmallTest | Level2)
462{
463    WMError ret;
464    sptr<WindowNode> node = new WindowNode();
465
466    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
467    ret = windowRoot_->RemoveWindowNode(node->GetWindowId(), true);
468    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
469    sptr<WindowNode> node1 = new WindowNode();
470    node->children_.push_back(node1);
471    ret = windowRoot_->RemoveWindowNode(node->GetWindowId(), true);
472    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
473}
474
475/**
476 * @tc.name: WindowRootTest23
477 * @tc.desc: test WindowRoot UpdateWindowNode
478 * @tc.type: FUNC
479 */
480HWTEST_F(WindowRootTest, WindowRootTest23, Function | SmallTest | Level2)
481{
482    WMError ret;
483
484    ret = windowRoot_->UpdateWindowNode(INVALID_WINDOW_ID, WindowUpdateReason::UPDATE_MODE);
485    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
486
487    sptr<WindowNode> node = new WindowNode();
488    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
489    ret = windowRoot_->UpdateWindowNode(node->GetWindowId(), WindowUpdateReason::UPDATE_MODE);
490    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
491    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
492    ASSERT_TRUE((display != nullptr));
493    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
494    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
495    ret = windowRoot_->UpdateWindowNode(node->GetWindowId(), WindowUpdateReason::UPDATE_MODE);
496    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
497}
498
499/**
500 * @tc.name: WindowRootTest24
501 * @tc.desc: test WindowRoot UpdateSizeChangeReason
502 * @tc.type: FUNC
503 */
504HWTEST_F(WindowRootTest, WindowRootTest24, Function | SmallTest | Level2)
505{
506    WMError ret;
507
508    ret = windowRoot_->UpdateSizeChangeReason(INVALID_WINDOW_ID, WindowSizeChangeReason::UNDEFINED);
509    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
510
511    sptr<WindowNode> node = new WindowNode();
512    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
513    ret = windowRoot_->UpdateSizeChangeReason(node->GetWindowId(), WindowSizeChangeReason::UNDEFINED);
514    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
515    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
516    ASSERT_TRUE((display != nullptr));
517    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
518    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
519    ret = windowRoot_->UpdateSizeChangeReason(node->GetWindowId(), WindowSizeChangeReason::UNDEFINED);
520    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
521}
522
523/**
524 * @tc.name: WindowRootTest25
525 * @tc.desc: test WindowRoot SetBrightness
526 * @tc.type: FUNC
527 */
528HWTEST_F(WindowRootTest, WindowRootTest25, Function | SmallTest | Level2)
529{
530    windowRoot_->SetBrightness(INVALID_WINDOW_ID, 0);
531
532    sptr<WindowNode> node = new WindowNode();
533    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
534    windowRoot_->SetBrightness(node->GetWindowId(), 0);
535
536    ASSERT_EQ(true, true);
537}
538
539/**
540 * @tc.name: CheckAndNotifyWaterMarkChangedResult
541 * @tc.desc: test WindowRoot CheckAndNotifyWaterMarkChangedResult
542 * @tc.type: FUNC
543 */
544HWTEST_F(WindowRootTest, CheckAndNotifyWaterMarkChangedResult, Function | SmallTest | Level2)
545{
546    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
547    ASSERT_NE(display, nullptr);
548    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
549    auto container = windowRoot_->CreateWindowNodeContainer(display->GetId(), displayInfo);
550    ASSERT_NE(container, nullptr);
551
552    windowRoot_->lastWaterMarkShowStates_ = false;
553    windowRoot_->CheckAndNotifyWaterMarkChangedResult();
554    ASSERT_EQ(windowRoot_->lastWaterMarkShowStates_, false);
555
556    auto windowNode = new (std::nothrow)WindowNode();
557    ASSERT_NE(windowNode, nullptr);
558    windowNode->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
559    windowNode->SetDisplayId(displayInfo->GetDisplayId());
560    windowNode->property_->flags_ |= static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_WATER_MARK);
561    container->appWindowNode_->children_.push_back(windowNode);
562
563    windowRoot_->CheckAndNotifyWaterMarkChangedResult();
564    ASSERT_EQ(windowRoot_->lastWaterMarkShowStates_, true);
565
566    container->appWindowNode_->children_.clear();
567    windowRoot_->CheckAndNotifyWaterMarkChangedResult();
568    ASSERT_EQ(windowRoot_->lastWaterMarkShowStates_, false);
569}
570
571/**
572 * @tc.name: SetGestureNavigationEnabled
573 * @tc.desc: test WindowRoot SetGestureNavigationEnabled
574 * @tc.type: FUNC
575 */
576HWTEST_F(WindowRootTest, SetGestureNavigationEnabled, Function | SmallTest | Level2)
577{
578    windowRoot_->lastGestureNativeEnabled_ = false;
579    auto ret = windowRoot_->SetGestureNavigationEnabled(false);
580    ASSERT_EQ(ret, WMError::WM_DO_NOTHING);
581
582    ret = windowRoot_->SetGestureNavigationEnabled(true);
583    ASSERT_EQ(ret, WMError::WM_OK);
584
585    windowRoot_->lastGestureNativeEnabled_ = false;
586}
587
588/**
589 * @tc.name: GetWindowVisibilityChangeInfo
590 * @tc.desc: test WindowRoot GetWindowVisibilityChangeInfo
591 * @tc.type: FUNC
592 */
593HWTEST_F(WindowRootTest, GetWindowVisibilityChangeInfo, Function | SmallTest | Level2)
594{
595    std::shared_ptr<RSOcclusionData> occlusionData = std::make_shared<RSOcclusionData>();
596    ASSERT_NE(occlusionData, nullptr);
597    windowRoot_->GetWindowVisibilityChangeInfo(occlusionData);
598    occlusionData->visibleData_.emplace_back(4, ALL_VISIBLE); // 4 is surfaceid
599    occlusionData->visibleData_.emplace_back(5, ALL_VISIBLE); // 5 is surfaceid
600    occlusionData->visibleData_.emplace_back(6, ALL_VISIBLE); // 6 is surfaceid
601    ASSERT_TRUE((windowRoot_ != nullptr));
602    windowRoot_->GetWindowVisibilityChangeInfo(occlusionData);
603}
604
605/**
606 * @tc.name: NotifyWindowVisibilityChange
607 * @tc.desc: test WindowRoot NotifyWindowVisibilityChange
608 * @tc.type: FUNC
609 */
610HWTEST_F(WindowRootTest, NotifyWindowVisibilityChange, Function | SmallTest | Level2)
611{
612    std::shared_ptr<RSOcclusionData> occlusionData = std::make_shared<RSOcclusionData>();
613    ASSERT_NE(occlusionData, nullptr);
614    windowRoot_->NotifyWindowVisibilityChange(occlusionData);
615    occlusionData->visibleData_.emplace_back(4, ALL_VISIBLE); // 4 is surfaceid
616    occlusionData->visibleData_.emplace_back(5, ALL_VISIBLE); // 5 is surfaceid
617    occlusionData->visibleData_.emplace_back(6, ALL_VISIBLE); // 6 is surfaceid
618    ASSERT_TRUE((windowRoot_ != nullptr));
619    windowRoot_->NotifyWindowVisibilityChange(occlusionData);
620}
621
622/**
623 * @tc.name: ToggleShownStateForAllAppWindows
624 * @tc.desc: test WindowRoot ToggleShownStateForAllAppWindows
625 * @tc.type: FUNC
626 */
627HWTEST_F(WindowRootTest, ToggleShownStateForAllAppWindows, Function | SmallTest | Level2)
628{
629    ScreenId displayGroupId = 1;
630    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
631    ASSERT_TRUE((display != nullptr));
632    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
633    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
634    auto ret = windowRoot_->ToggleShownStateForAllAppWindows();
635    ASSERT_EQ(ret, WMError::WM_OK);
636}
637
638/**
639 * @tc.name: PostProcessAddWindowNode01
640 * @tc.desc: test WindowRoot PostProcessAddWindowNode01
641 * @tc.type: FUNC
642 */
643HWTEST_F(WindowRootTest, PostProcessAddWindowNode01, Function | SmallTest | Level2)
644{
645    sptr<WindowNode> node = new WindowNode();
646    sptr<WindowNode> parentNode = new WindowNode();
647    sptr<WindowNodeContainer> container;
648    auto ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
649    ASSERT_EQ(ret, WMError::WM_DO_NOTHING);
650    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
651    node->property_->SetWindowId(1);
652    ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
653    ASSERT_EQ(ret, WMError::WM_DO_NOTHING);
654}
655
656/**
657 * @tc.name: PostProcessAddWindowNode02
658 * @tc.desc: test WindowRoot PostProcessAddWindowNode02
659 * @tc.type: FUNC
660 */
661HWTEST_F(WindowRootTest, PostProcessAddWindowNode02, Function | SmallTest | Level2)
662{
663    sptr<WindowNode> node = new WindowNode();
664    sptr<WindowNode> parentNode = nullptr;
665    sptr<DisplayInfo> displayInfo = new DisplayInfo();
666    sptr<WindowNodeContainer> container;
667    node->currentVisibility_ = false;
668    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
669    auto ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
670    ASSERT_EQ(ret, WMError::WM_DO_NOTHING);
671}
672
673/**
674 * @tc.name: PostProcessAddWindowNode03
675 * @tc.desc: test WindowRoot PostProcessAddWindowNode03
676 * @tc.type: FUNC
677 */
678HWTEST_F(WindowRootTest, PostProcessAddWindowNode03, Function | SmallTest | Level2)
679{
680    sptr<WindowNode> node = new WindowNode();
681    sptr<WindowNode> parentNode = new WindowNode();
682    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
683    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
684    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
685    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
686    node->property_->SetWindowId(1);
687    node->property_->SetFocusable(true);
688    node->currentVisibility_ = true;
689    auto ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
690    ASSERT_EQ(ret, WMError::WM_OK);
691}
692
693/**
694 * @tc.name: PostProcessAddWindowNode04
695 * @tc.desc: test WindowRoot PostProcessAddWindowNode04
696 * @tc.type: FUNC
697 */
698HWTEST_F(WindowRootTest, PostProcessAddWindowNode04, Function | SmallTest | Level2)
699{
700    sptr<WindowNode> node = new WindowNode();
701    sptr<WindowNode> parentNode = new WindowNode();
702    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
703    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
704    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
705    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
706    node->property_->SetWindowId(1);
707    node->property_->SetFocusable(true);
708    node->currentVisibility_ = true;
709    sptr<WindowNode> node1 = new WindowNode();
710    node->children_.push_back(node1);
711    auto ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
712    ASSERT_EQ(ret, WMError::WM_OK);
713}
714
715/**
716 * @tc.name: BindDialogToParent01
717 * @tc.desc: test WindowRoot BindDialogToParent01
718 * @tc.type: FUNC
719 */
720HWTEST_F(WindowRootTest, BindDialogToParent01, Function | SmallTest | Level2)
721{
722    sptr<WindowNode> node = new WindowNode();
723    node->dialogTargetToken_ = nullptr;
724    sptr<WindowNode> parentNode = new WindowNode();
725    auto ret = windowRoot_->BindDialogToParent(node, parentNode);
726    ASSERT_EQ(ret, WMError::WM_OK);
727}
728
729/**
730 * @tc.name: BindDialogToParent02
731 * @tc.desc: test WindowRoot BindDialogToParent02
732 * @tc.type: FUNC
733 */
734HWTEST_F(WindowRootTest, BindDialogToParent02, Function | SmallTest | Level2)
735{
736    sptr<WindowNode> node = new WindowNode();
737    sptr<WindowNode> parentNode = new WindowNode();
738    node->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
739    node->dialogTargetToken_ = new (std::nothrow) IRemoteObjectMocker();
740    sptr<WindowNode> windowNode3 = new WindowNode();
741    windowNode3->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
742    windowNode3->abilityToken_ = node->dialogTargetToken_;
743    windowRoot_->SaveWindow(windowNode3);
744    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode3->GetWindowId(), windowNode3));
745    auto ret = windowRoot_->BindDialogToParent(node, parentNode);
746    ASSERT_EQ(ret, WMError::WM_OK);
747}
748
749/**
750 * @tc.name: UpdateFocusableProperty
751 * @tc.desc: test WindowRoot UpdateFocusableProperty
752 * @tc.type: FUNC
753 */
754HWTEST_F(WindowRootTest, UpdateFocusableProperty, Function | SmallTest | Level2)
755{
756    uint32_t windowId = 1;
757    windowRoot_->UpdateFocusableProperty(windowId);
758    auto node = windowRoot_->GetWindowNode(windowId);
759    ASSERT_EQ(node, nullptr);
760}
761
762/**
763 * @tc.name: SetWindowMode
764 * @tc.desc: test WindowRoot SetWindowMode
765 * @tc.type: FUNC
766 */
767HWTEST_F(WindowRootTest, SetWindowMode, Function | SmallTest | Level2)
768{
769    sptr<WindowNode> node = new WindowNode();
770    WindowMode dstMode = WindowMode::WINDOW_MODE_UNDEFINED;
771    auto ret = windowRoot_->SetWindowMode(node, dstMode);
772    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
773    dstMode = WindowMode::WINDOW_MODE_FULLSCREEN;
774    ret = windowRoot_->SetWindowMode(node, dstMode);
775    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
776}
777
778/**
779 * @tc.name: DestroyWindowSelf
780 * @tc.desc: test WindowRoot DestroyWindowSelf
781 * @tc.type: FUNC
782 */
783HWTEST_F(WindowRootTest, DestroyWindowSelf, Function | SmallTest | Level2)
784{
785    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
786    ASSERT_TRUE((display != nullptr));
787    sptr<WindowNode> node = new WindowNode();
788    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
789    auto ret = windowRoot_->DestroyWindowSelf(node, container);
790    ASSERT_EQ(ret, WMError::WM_OK);
791}
792
793/**
794 * @tc.name: IsVerticalDisplay
795 * @tc.desc: test WindowRoot IsVerticalDisplay
796 * @tc.type: FUNC
797 */
798HWTEST_F(WindowRootTest, IsVerticalDisplay, Function | SmallTest | Level2)
799{
800    sptr<WindowNode> node = new WindowNode();
801    ASSERT_EQ(false, windowRoot_->IsVerticalDisplay(node));
802}
803
804/**
805 * @tc.name: RequestFocus
806 * @tc.desc: test WindowRoot RequestFocus
807 * @tc.type: FUNC
808 */
809HWTEST_F(WindowRootTest, RequestFocus, Function | SmallTest | Level2)
810{
811    uint32_t windowId = 1;
812    auto ret = windowRoot_->RequestFocus(windowId);
813    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
814}
815
816/**
817 * @tc.name: RequestActiveWindow
818 * @tc.desc: test WindowRoot RequestActiveWindow
819 * @tc.type: FUNC
820 */
821HWTEST_F(WindowRootTest, RequestActiveWindow, Function | SmallTest | Level2)
822{
823    uint32_t windowId = 1;
824    auto ret = windowRoot_->RequestActiveWindow(windowId);
825    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
826}
827
828/**
829 * @tc.name: ProcessWindowStateChange
830 * @tc.desc: test WindowRoot ProcessWindowStateChange
831 * @tc.type: FUNC
832 */
833HWTEST_F(WindowRootTest, ProcessWindowStateChange, Function | SmallTest | Level2)
834{
835    WindowState state = WindowState::STATE_INITIAL;
836    WindowStateChangeReason reason = WindowStateChangeReason::NORMAL;
837    windowRoot_->ProcessWindowStateChange(state, reason);
838    ASSERT_EQ(reason, WindowStateChangeReason::NORMAL);
839}
840
841/**
842 * @tc.name: NotifySystemBarTints
843 * @tc.desc: test WindowRoot NotifySystemBarTints
844 * @tc.type: FUNC
845 */
846HWTEST_F(WindowRootTest, NotifySystemBarTints, Function | SmallTest | Level2)
847{
848    ScreenId displayGroupId = 1;
849    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
850    ASSERT_TRUE((display != nullptr));
851    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
852    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
853    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
854    DisplayId displayId = displayInfo->GetDisplayId();
855    std::vector<DisplayId> displayVec = { displayId };
856    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
857    windowRoot_->NotifySystemBarTints();
858}
859
860/**
861 * @tc.name: NotifyDesktopUnfrozen
862 * @tc.desc: test WindowRoot NotifyDesktopUnfrozen
863 * @tc.type: FUNC
864 */
865HWTEST_F(WindowRootTest, NotifyDesktopUnfrozen, Function | SmallTest | Level2)
866{
867    sptr<WindowNode> windowNode3 = new WindowNode();
868    windowRoot_->SaveWindow(windowNode3);
869    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode3->GetWindowId(), windowNode3));
870    auto ret = windowRoot_->NotifyDesktopUnfrozen();
871    ASSERT_EQ(WMError::WM_ERROR_INVALID_OPERATION, ret);
872}
873
874/**
875 * @tc.name: RaiseZOrderForAppWindow
876 * @tc.desc: test WindowRoot RaiseZOrderForAppWindow
877 * @tc.type: FUNC
878 */
879HWTEST_F(WindowRootTest, RaiseZOrderForAppWindow, Function | SmallTest | Level2)
880{
881    sptr<WindowNode> windowNode2 = nullptr;
882    auto ret = windowRoot_->RaiseZOrderForAppWindow(windowNode2);
883    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
884    sptr<WindowNode> windowNode3 = new WindowNode();
885    ret = windowRoot_->RaiseZOrderForAppWindow(windowNode3);
886    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
887}
888
889/**
890 * @tc.name: DispatchKeyEvent
891 * @tc.desc: test WindowRoot DispatchKeyEvent
892 * @tc.type: FUNC
893 */
894HWTEST_F(WindowRootTest, DispatchKeyEvent, Function | SmallTest | Level2)
895{
896    sptr<WindowNode> windowNode = new WindowNode();
897    std::shared_ptr<MMI::KeyEvent> event = nullptr;
898    ASSERT_TRUE((windowRoot_ != nullptr));
899    windowRoot_->DispatchKeyEvent(windowNode, event);
900}
901
902/**
903 * @tc.name: GetTopWindowId
904 * @tc.desc: test WindowRoot GetTopWindowId
905 * @tc.type: FUNC
906 */
907HWTEST_F(WindowRootTest, GetTopWindowId, Function | SmallTest | Level2)
908{
909    uint32_t mainWinId = 0;
910    uint32_t topWinId = 1;
911    auto ret = windowRoot_->GetTopWindowId(mainWinId, topWinId);
912    ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
913}
914
915/**
916 * @tc.name: SetWindowLayoutMode
917 * @tc.desc: test WindowRoot SetWindowLayoutMode
918 * @tc.type: FUNC
919 */
920HWTEST_F(WindowRootTest, SetWindowLayoutMode, Function | SmallTest | Level2)
921{
922    DisplayId displayId = 1;
923    WindowLayoutMode mode = WindowLayoutMode::BASE;
924    auto ret = windowRoot_->SetWindowLayoutMode(displayId, mode);
925    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
926}
927
928/**
929 * @tc.name: GetAllDisplayIds
930 * @tc.desc: test WindowRoot GetAllDisplayIds,RemoveSingleUserWindowNodes
931 * @tc.type: FUNC
932 */
933HWTEST_F(WindowRootTest, GetAllDisplayIds, Function | SmallTest | Level2)
934{
935    ScreenId displayGroupId = 1;
936    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
937    ASSERT_TRUE((display != nullptr));
938    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
939    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
940    windowRoot_->GetAllDisplayIds();
941    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
942    DisplayId displayId = displayInfo->GetDisplayId();
943    std::vector<DisplayId> displayVec = { displayId };
944    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
945    ASSERT_TRUE((windowRoot_ != nullptr));
946    windowRoot_->GetAllDisplayIds();
947    ASSERT_TRUE((windowRoot_ != nullptr));
948    windowRoot_->RemoveSingleUserWindowNodes(displayGroupId);
949}
950
951/**
952 * @tc.name: GenAllWindowsLogInfo
953 * @tc.desc: test WindowRoot GenAllWindowsLogInfo
954 * @tc.type: FUNC
955 */
956HWTEST_F(WindowRootTest, GenAllWindowsLogInfo, Function | SmallTest | Level2)
957{
958    ScreenId displayGroupId = 1;
959    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
960    ASSERT_TRUE((display != nullptr));
961    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
962    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
963    windowRoot_->GenAllWindowsLogInfo();
964    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
965    DisplayId displayId = displayInfo->GetDisplayId();
966    std::vector<DisplayId> displayVec = { displayId };
967    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
968    ASSERT_TRUE((windowRoot_ != nullptr));
969    windowRoot_->GenAllWindowsLogInfo();
970}
971
972/**
973 * @tc.name: FocusFaultDetection
974 * @tc.desc: test WindowRoot FocusFaultDetection
975 * @tc.type: FUNC
976 */
977HWTEST_F(WindowRootTest, FocusFaultDetection, Function | SmallTest | Level2)
978{
979    ScreenId displayGroupId = 1;
980    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
981    ASSERT_TRUE((display != nullptr));
982    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
983    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
984    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
985    DisplayId displayId = displayInfo->GetDisplayId();
986    std::vector<DisplayId> displayVec = { displayId };
987    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
988    windowRoot_->needCheckFocusWindow = false;
989    windowRoot_->FocusFaultDetection();
990    windowRoot_->needCheckFocusWindow = true;
991    ASSERT_TRUE((windowRoot_ != nullptr));
992    windowRoot_->FocusFaultDetection();
993}
994
995/**
996 * @tc.name: ProcessExpandDisplayCreate
997 * @tc.desc: test WindowRoot ProcessExpandDisplayCreate
998 * @tc.type: FUNC
999 */
1000HWTEST_F(WindowRootTest, ProcessExpandDisplayCreate, Function | SmallTest | Level2)
1001{
1002    ScreenId displayGroupId = 1;
1003    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1004    ASSERT_TRUE((display != nullptr));
1005    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1006    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
1007    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1008    DisplayId displayId = displayInfo->GetDisplayId();
1009    std::vector<DisplayId> displayVec = { displayId };
1010    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
1011    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1012    ASSERT_NE(display, nullptr);
1013    displayInfo->SetWidth(100);
1014    displayInfo->SetHeight(100);
1015    std::map<DisplayId, Rect> displayRectMap = {};
1016    windowRoot_->ProcessExpandDisplayCreate(defaultDisplayId, displayInfo, displayRectMap);
1017}
1018
1019/**
1020 * @tc.name: GetAllDisplayRectsByDisplayInfo
1021 * @tc.desc: test WindowRoot GetAllDisplayRectsByDisplayInfo
1022 * @tc.type: FUNC
1023 */
1024HWTEST_F(WindowRootTest, GetAllDisplayRectsByDisplayInfo, Function | SmallTest | Level2)
1025{
1026    std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
1027    ASSERT_TRUE((windowRoot_ != nullptr));
1028    windowRoot_->GetAllDisplayRectsByDisplayInfo(displayInfoMap);
1029}
1030
1031/**
1032 * @tc.name: ProcessDisplayCreate
1033 * @tc.desc: test WindowRoot ProcessDisplayCreate
1034 * @tc.type: FUNC
1035 */
1036HWTEST_F(WindowRootTest, ProcessDisplayCreate, Function | SmallTest | Level2)
1037{
1038    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1039    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1040    ASSERT_TRUE((display != nullptr));
1041    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1042    std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
1043    windowRoot_->ProcessDisplayCreate(defaultDisplayId, displayInfo, displayInfoMap);
1044}
1045
1046/**
1047 * @tc.name: MoveNotShowingWindowToDefaultDisplay
1048 * @tc.desc: test WindowRoot MoveNotShowingWindowToDefaultDisplay
1049 * @tc.type: FUNC
1050 */
1051HWTEST_F(WindowRootTest, MoveNotShowingWindowToDefaultDisplay, Function | SmallTest | Level2)
1052{
1053    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1054    ASSERT_TRUE((windowRoot_ != nullptr));
1055    DisplayId displayId = 1;
1056    sptr<WindowNode> node = new WindowNode();
1057    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
1058    windowRoot_->MoveNotShowingWindowToDefaultDisplay(defaultDisplayId, displayId);
1059}
1060
1061/**
1062 * @tc.name: ProcessDisplayDestroy
1063 * @tc.desc: test WindowRoot ProcessDisplayDestroy
1064 * @tc.type: FUNC
1065 */
1066HWTEST_F(WindowRootTest, ProcessDisplayDestroy, Function | SmallTest | Level2)
1067{
1068    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1069    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1070    ASSERT_TRUE((display != nullptr));
1071    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1072    std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
1073    windowRoot_->ProcessDisplayDestroy(defaultDisplayId, displayInfo, displayInfoMap);
1074}
1075
1076/**
1077 * @tc.name: ProcessDisplayChange
1078 * @tc.desc: test WindowRoot ProcessDisplayChange
1079 * @tc.type: FUNC
1080 */
1081HWTEST_F(WindowRootTest, ProcessDisplayChange, Function | SmallTest | Level2)
1082{
1083    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1084    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1085    ASSERT_TRUE((display != nullptr));
1086    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1087    std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
1088    DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
1089    windowRoot_->ProcessDisplayChange(defaultDisplayId, displayInfo, displayInfoMap, type);
1090    displayInfo = nullptr;
1091    ASSERT_TRUE((windowRoot_ != nullptr));
1092    windowRoot_->ProcessDisplayChange(defaultDisplayId, displayInfo, displayInfoMap, type);
1093}
1094
1095/**
1096 * @tc.name: GetDisplayGroupRect
1097 * @tc.desc: test WindowRoot GetDisplayGroupRect
1098 * @tc.type: FUNC
1099 */
1100HWTEST_F(WindowRootTest, GetDisplayGroupRect, Function | SmallTest | Level2)
1101{
1102    DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1103    ASSERT_TRUE((windowRoot_ != nullptr));
1104    windowRoot_->GetDisplayGroupRect(displayId);
1105}
1106
1107/**
1108 * @tc.name: RemoveSingleUserWindowNodes
1109 * @tc.desc: test WindowRoot RemoveSingleUserWindowNodes
1110 * @tc.type: FUNC
1111 */
1112HWTEST_F(WindowRootTest, RemoveSingleUserWindowNodes, Function | SmallTest | Level2)
1113{
1114    int accountId = 1;
1115    ASSERT_TRUE((windowRoot_ != nullptr));
1116    windowRoot_->RemoveSingleUserWindowNodes(accountId);
1117}
1118
1119/**
1120 * @tc.name: TakeWindowPairSnapshot
1121 * @tc.desc: test WindowRoot TakeWindowPairSnapshot
1122 * @tc.type: FUNC
1123 */
1124HWTEST_F(WindowRootTest, TakeWindowPairSnapshot, Function | SmallTest | Level2)
1125{
1126    DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1127    bool flag = windowRoot_->TakeWindowPairSnapshot(displayId);
1128    ASSERT_EQ(false, flag);
1129}
1130
1131/**
1132 * @tc.name: ClearWindowPairSnapshot
1133 * @tc.desc: test WindowRoot ClearWindowPairSnapshot
1134 * @tc.type: FUNC
1135 */
1136HWTEST_F(WindowRootTest, ClearWindowPairSnapshot, Function | SmallTest | Level2)
1137{
1138    DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1139    ASSERT_TRUE((windowRoot_ != nullptr));
1140    windowRoot_->ClearWindowPairSnapshot(displayId);
1141}
1142
1143/**
1144 * @tc.name: CheckAddingModeAndSize01
1145 * @tc.desc: test WindowRoot CheckAddingModeAndSize01
1146 * @tc.type: FUNC
1147 */
1148HWTEST_F(WindowRootTest, CheckAddingModeAndSize01, Function | SmallTest | Level2)
1149{
1150    sptr<WindowNode> node = new WindowNode();
1151    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
1152    sptr<WindowNodeContainer> container;
1153    ASSERT_TRUE((windowRoot_ != nullptr));
1154    windowRoot_->CheckAddingModeAndSize(node, container);
1155}
1156
1157/**
1158 * @tc.name: CheckAddingModeAndSize02
1159 * @tc.desc: test WindowRoot CheckAddingModeAndSize02
1160 * @tc.type: FUNC
1161 */
1162HWTEST_F(WindowRootTest, CheckAddingModeAndSize02, Function | SmallTest | Level2)
1163{
1164    sptr<WindowNode> node = new WindowNode();
1165    node->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1166    sptr<Display> defaultDisplay_ = DisplayManager::GetInstance().GetDefaultDisplay();
1167    sptr<WindowNodeContainer> container = new WindowNodeContainer(
1168        defaultDisplay_->GetDisplayInfo(), defaultDisplay_->GetScreenId());
1169    container->layoutMode_ = WindowLayoutMode::TILE;
1170    node->property_->SetModeSupportInfo(0);
1171    ASSERT_TRUE((windowRoot_ != nullptr));
1172    windowRoot_->CheckAddingModeAndSize(node, container);
1173}
1174
1175/**
1176 * @tc.name: CheckAddingModeAndSize03
1177 * @tc.desc: test WindowRoot CheckAddingModeAndSize03
1178 * @tc.type: FUNC
1179 */
1180HWTEST_F(WindowRootTest, CheckAddingModeAndSize03, Function | SmallTest | Level2)
1181{
1182    sptr<WindowNode> node = new WindowNode();
1183    node->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1184    sptr<Display> defaultDisplay_ = DisplayManager::GetInstance().GetDefaultDisplay();
1185    sptr<WindowNodeContainer> container = new WindowNodeContainer(
1186        defaultDisplay_->GetDisplayInfo(), defaultDisplay_->GetScreenId());
1187    ASSERT_TRUE((windowRoot_ != nullptr));
1188    windowRoot_->CheckAddingModeAndSize(node, container);
1189}
1190
1191/**
1192 * @tc.name: GetDisplayRectWithoutSystemBarAreas
1193 * @tc.desc: test WindowRoot GetDisplayRectWithoutSystemBarAreas
1194 * @tc.type: FUNC
1195 */
1196HWTEST_F(WindowRootTest, GetDisplayRectWithoutSystemBarAreas, Function | SmallTest | Level2)
1197{
1198    sptr<WindowNode> dstNode = new WindowNode();
1199    ASSERT_TRUE((windowRoot_ != nullptr));
1200    windowRoot_->GetDisplayRectWithoutSystemBarAreas(dstNode);
1201}
1202
1203/**
1204 * @tc.name: AddWindowNode01
1205 * @tc.desc: test WindowRoot AddWindowNode01
1206 * @tc.type: FUNC
1207 */
1208HWTEST_F(WindowRootTest, AddWindowNode01, Function | SmallTest | Level2)
1209{
1210    WMError ret;
1211    sptr<WindowNode> node = new WindowNode();
1212    node->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
1213
1214    ret = windowRoot_->AddWindowNode(INVALID_WINDOW_ID, node, true);
1215    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
1216}
1217
1218/**
1219 * @tc.name: RemoveWindowNode01
1220 * @tc.desc: test WindowRoot RemoveWindowNode01
1221 * @tc.type: FUNC
1222 */
1223HWTEST_F(WindowRootTest, RemoveWindowNode01, Function | SmallTest | Level2)
1224{
1225    uint32_t windowId = 10;
1226    WMError ret = windowRoot_->RemoveWindowNode(windowId, true);
1227    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
1228}
1229
1230/**
1231 * @tc.name: SetBrightness01
1232 * @tc.desc: test WindowRoot SetBrightness01
1233 * @tc.type: FUNC
1234 */
1235HWTEST_F(WindowRootTest, SetBrightness01, Function | SmallTest | Level2)
1236{
1237    windowRoot_->SetBrightness(INVALID_WINDOW_ID, 0);
1238    sptr<WindowNode> node = new WindowNode();
1239    node->SetDisplayId(0);
1240    node->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1241    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetDisplayId(), node));
1242    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1243    ASSERT_TRUE((display != nullptr));
1244    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1245    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
1246    ASSERT_TRUE((windowRoot_ != nullptr));
1247    windowRoot_->SetBrightness(node->GetDisplayId(), 0);
1248}
1249
1250/**
1251 * @tc.name: SetBrightness02
1252 * @tc.desc: test WindowRoot SetBrightness02
1253 * @tc.type: FUNC
1254 */
1255HWTEST_F(WindowRootTest, SetBrightness02, Function | SmallTest | Level2)
1256{
1257    windowRoot_->SetBrightness(INVALID_WINDOW_ID, 0);
1258    sptr<WindowNode> node = new WindowNode();
1259    node->SetDisplayId(0);
1260    node->property_->SetWindowType(WindowType::SYSTEM_WINDOW_BASE);
1261    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetDisplayId(), node));
1262    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1263    ASSERT_TRUE((display != nullptr));
1264    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1265    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
1266    ASSERT_TRUE((windowRoot_ != nullptr));
1267    windowRoot_->SetBrightness(node->GetDisplayId(), 0);
1268}
1269
1270/**
1271 * @tc.name: HandleKeepScreenOn01
1272 * @tc.desc: test WindowRoot HandleKeepScreenOn01
1273 * @tc.type: FUNC
1274 */
1275HWTEST_F(WindowRootTest, HandleKeepScreenOn01, Function | SmallTest | Level2)
1276{
1277    uint32_t windowId = 1;
1278    bool requireLock = false;
1279    ASSERT_TRUE((windowRoot_ != nullptr));
1280    windowRoot_->HandleKeepScreenOn(windowId, requireLock);
1281}
1282
1283/**
1284 * @tc.name: UpdateFocusableProperty01
1285 * @tc.desc: test WindowRoot UpdateFocusableProperty01
1286 * @tc.type: FUNC
1287 */
1288HWTEST_F(WindowRootTest, UpdateFocusableProperty01, Function | SmallTest | Level2)
1289{
1290    sptr<WindowNode> windowNode = new WindowNode();
1291    windowNode->SetDisplayId(0);
1292    windowNode->property_->SetWindowId(0);
1293    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetDisplayId(), windowNode));
1294    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1295    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1296    ASSERT_TRUE((display != nullptr));
1297    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1298    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1299    ASSERT_TRUE((windowRoot_ != nullptr));
1300    windowRoot_->UpdateFocusableProperty(windowNode->GetWindowId());
1301}
1302
1303/**
1304 * @tc.name: SetWindowMode01
1305 * @tc.desc: test WindowRoot SetWindowMode01
1306 * @tc.type: FUNC
1307 */
1308HWTEST_F(WindowRootTest, SetWindowMode01, Function | SmallTest | Level2)
1309{
1310    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1311    ASSERT_TRUE((display != nullptr));
1312    sptr<WindowNode> node = new WindowNode();
1313    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1314    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
1315    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1316    DisplayId displayId = displayInfo->GetDisplayId();
1317    std::vector<DisplayId> displayVec = { displayId };
1318    windowRoot_->displayIdMap_.insert(std::make_pair(node->GetDisplayId(), displayVec));
1319    WindowMode dstMode = WindowMode::WINDOW_MODE_UNDEFINED;
1320    auto ret = windowRoot_->SetWindowMode(node, dstMode);
1321    ASSERT_EQ(ret, WMError::WM_OK);
1322    node->SetWindowMode(dstMode);
1323    ret = windowRoot_->SetWindowMode(node, dstMode);
1324    ASSERT_EQ(ret, WMError::WM_OK);
1325}
1326
1327/**
1328 * @tc.name: DestroyWindowSelf01
1329 * @tc.desc: test WindowRoot DestroyWindowSelf01
1330 * @tc.type: FUNC
1331 */
1332HWTEST_F(WindowRootTest, DestroyWindowSelf01, Function | SmallTest | Level2)
1333{
1334    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1335    ASSERT_TRUE((display != nullptr));
1336    sptr<WindowNode> node = new WindowNode();
1337    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1338    node->property_->SetWindowId(0);
1339    sptr<WindowNode> node1 = new WindowNode();
1340    sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1341    sptr<IWindow> iWindow = iface_cast<IWindow>(iRemoteObjectMocker);
1342    node1->SetWindowToken(iWindow);
1343    node1->property_->SetWindowId(1);
1344    node->abilityToken_ = new (std::nothrow) IRemoteObjectMocker();
1345    node1->abilityToken_ = new (std::nothrow) IRemoteObjectMocker();
1346    node1->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1347    node->children_.push_back(node1);
1348    auto ret = windowRoot_->DestroyWindowSelf(node, container);
1349    ASSERT_EQ(ret, WMError::WM_OK);
1350}
1351
1352/**
1353 * @tc.name: DestroyWindow
1354 * @tc.desc: test WindowRoot DestroyWindow
1355 * @tc.type: FUNC
1356 */
1357HWTEST_F(WindowRootTest, DestroyWindow, Function | SmallTest | Level2)
1358{
1359    uint32_t windowId = 1;
1360    bool onlySelf = false;
1361    auto ret = windowRoot_->DestroyWindow(windowId, onlySelf);
1362    ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
1363}
1364
1365/**
1366 * @tc.name: UpdateFocusWindowWithWindowRemoved01
1367 * @tc.desc: test WindowRoot UpdateFocusWindowWithWindowRemoved01
1368 * @tc.type: FUNC
1369 */
1370HWTEST_F(WindowRootTest, UpdateFocusWindowWithWindowRemoved01, Function | SmallTest | Level2)
1371{
1372    sptr<WindowNode> node = nullptr;
1373    sptr<WindowNodeContainer> container = nullptr;
1374    ASSERT_TRUE((windowRoot_ != nullptr));
1375    windowRoot_->UpdateFocusWindowWithWindowRemoved(node, container);
1376}
1377
1378/**
1379 * @tc.name: UpdateFocusWindowWithWindowRemoved02
1380 * @tc.desc: test WindowRoot UpdateFocusWindowWithWindowRemoved02
1381 * @tc.type: FUNC
1382 */
1383HWTEST_F(WindowRootTest, UpdateFocusWindowWithWindowRemoved02, Function | SmallTest | Level2)
1384{
1385    sptr<WindowNode> node = new WindowNode();
1386    node->property_->SetWindowType(WindowType::WINDOW_TYPE_DOCK_SLICE);
1387    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1388    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1389    ASSERT_TRUE((windowRoot_ != nullptr));
1390    windowRoot_->UpdateFocusWindowWithWindowRemoved(node, container);
1391
1392    node->property_->SetWindowId(1);
1393    sptr<WindowNode> node1 = new WindowNode();
1394    node->children_.push_back(node1);
1395    container->SetFocusWindow(1);
1396    ASSERT_TRUE((windowRoot_ != nullptr));
1397    windowRoot_->UpdateFocusWindowWithWindowRemoved(node, container);
1398}
1399
1400/**
1401 * @tc.name: UpdateBrightnessWithWindowRemoved
1402 * @tc.desc: test WindowRoot UpdateBrightnessWithWindowRemoved
1403 * @tc.type: FUNC
1404 */
1405HWTEST_F(WindowRootTest, UpdateBrightnessWithWindowRemoved, Function | SmallTest | Level2)
1406{
1407    uint32_t windowId = 1;
1408    sptr<WindowNodeContainer> container;
1409    ASSERT_TRUE((windowRoot_ != nullptr));
1410    windowRoot_->UpdateBrightnessWithWindowRemoved(windowId, container);
1411    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1412    container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1413    container->SetBrightnessWindow(windowId);
1414    ASSERT_TRUE((windowRoot_ != nullptr));
1415    windowRoot_->UpdateBrightnessWithWindowRemoved(windowId, container);
1416}
1417
1418/**
1419 * @tc.name: IsVerticalDisplay01
1420 * @tc.desc: test WindowRoot IsVerticalDisplay01
1421 * @tc.type: FUNC
1422 */
1423HWTEST_F(WindowRootTest, IsVerticalDisplay01, Function | SmallTest | Level2)
1424{
1425    sptr<WindowNode> node = new WindowNode();
1426    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1427    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1428    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
1429    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1430    DisplayId displayId = displayInfo->GetDisplayId();
1431    std::vector<DisplayId> displayVec = { displayId };
1432    windowRoot_->displayIdMap_.insert(std::make_pair(node->GetDisplayId(), displayVec));
1433    ASSERT_EQ(true, windowRoot_->IsVerticalDisplay(node));
1434}
1435
1436/**
1437 * @tc.name: RequestFocus01
1438 * @tc.desc: test WindowRoot RequestFocus01
1439 * @tc.type: FUNC
1440 */
1441HWTEST_F(WindowRootTest, RequestFocus01, Function | SmallTest | Level2)
1442{
1443    sptr<WindowNode> windowNode = new WindowNode();
1444    windowNode->currentVisibility_ = true;
1445    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1446    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1447    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1448    windowNode->property_->SetFocusable(true);
1449    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1450    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1451    DisplayId displayId = displayInfo->GetDisplayId();
1452    std::vector<DisplayId> displayVec = { displayId };
1453    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1454    auto ret = windowRoot_->RequestFocus(windowNode->GetWindowId());
1455    ASSERT_EQ(WMError::WM_DO_NOTHING, ret);
1456    windowNode->property_->SetFocusable(false);
1457    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1458    ret = windowRoot_->RequestFocus(windowNode->GetWindowId());
1459    ASSERT_EQ(WMError::WM_ERROR_INVALID_OPERATION, ret);
1460}
1461
1462/**
1463 * @tc.name: RequestActiveWindow01
1464 * @tc.desc: test WindowRoot RequestActiveWindow01
1465 * @tc.type: FUNC
1466 */
1467HWTEST_F(WindowRootTest, RequestActiveWindow01, Function | SmallTest | Level2)
1468{
1469    sptr<WindowNode> windowNode = new WindowNode();
1470    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_STATUS_BAR);
1471    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1472    auto ret = windowRoot_->RequestActiveWindow(windowNode->GetWindowId());
1473    ASSERT_EQ(WMError::WM_ERROR_INVALID_TYPE, ret);
1474}
1475
1476/**
1477 * @tc.name: RequestActiveWindow02
1478 * @tc.desc: test WindowRoot RequestActiveWindow02
1479 * @tc.type: FUNC
1480 */
1481HWTEST_F(WindowRootTest, RequestActiveWindow02, Function | SmallTest | Level2)
1482{
1483    sptr<WindowNode> windowNode = new WindowNode();
1484    windowNode->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1485    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1486    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1487    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1488    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1489    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1490    DisplayId displayId = displayInfo->GetDisplayId();
1491    std::vector<DisplayId> displayVec = { displayId };
1492    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1493    auto ret = windowRoot_->RequestActiveWindow(windowNode->GetWindowId());
1494    ASSERT_EQ(WMError::WM_DO_NOTHING, ret);
1495}
1496
1497/**
1498 * @tc.name: ProcessWindowStateChange01
1499 * @tc.desc: test WindowRoot ProcessWindowStateChange01
1500 * @tc.type: FUNC
1501 */
1502HWTEST_F(WindowRootTest, ProcessWindowStateChange01, Function | SmallTest | Level2)
1503{
1504    sptr<WindowNode> windowNode = new WindowNode();
1505    WindowState state = WindowState::STATE_INITIAL;
1506    WindowStateChangeReason reason = WindowStateChangeReason::NORMAL;
1507    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1508    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1509    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1510    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1511    DisplayId displayId = displayInfo->GetDisplayId();
1512    std::vector<DisplayId> displayVec = { displayId };
1513    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1514    windowRoot_->ProcessWindowStateChange(state, reason);
1515    ASSERT_EQ(reason, WindowStateChangeReason::NORMAL);
1516}
1517
1518/**
1519 * @tc.name: FindWallpaperWindow
1520 * @tc.desc: test WindowRoot FindWallpaperWindow
1521 * @tc.type: FUNC
1522 */
1523HWTEST_F(WindowRootTest, FindWallpaperWindow, Function | SmallTest | Level2)
1524{
1525    sptr<WindowNode> windowNode = new WindowNode();
1526    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_WALLPAPER);
1527    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1528    ASSERT_TRUE((windowRoot_ != nullptr));
1529    windowRoot_->FindWallpaperWindow();
1530}
1531
1532/**
1533 * @tc.name: RaiseZOrderForAppWindow01
1534 * @tc.desc: test WindowRoot RaiseZOrderForAppWindow01
1535 * @tc.type: FUNC
1536 */
1537HWTEST_F(WindowRootTest, RaiseZOrderForAppWindow01, Function | SmallTest | Level2)
1538{
1539    sptr<WindowNode> windowNode = new WindowNode();
1540    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_DOCK_SLICE);
1541    auto ret = windowRoot_->RaiseZOrderForAppWindow(windowNode);
1542    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
1543    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1544    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1545    windowNode->property_->SetFocusable(true);
1546    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1547    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1548    DisplayId displayId = displayInfo->GetDisplayId();
1549    std::vector<DisplayId> displayVec = { displayId };
1550    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1551    ret = windowRoot_->RaiseZOrderForAppWindow(windowNode);
1552    ASSERT_EQ(WMError::WM_OK, ret);
1553}
1554
1555/**
1556 * @tc.name: RaiseZOrderForAppWindow02
1557 * @tc.desc: test WindowRoot RaiseZOrderForAppWindow02
1558 * @tc.type: FUNC
1559 */
1560HWTEST_F(WindowRootTest, RaiseZOrderForAppWindow02, Function | SmallTest | Level2)
1561{
1562    sptr<WindowNode> windowNode = new WindowNode();
1563    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1564    auto ret = windowRoot_->RaiseZOrderForAppWindow(windowNode);
1565    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
1566    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1567    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1568    windowNode->property_->SetFocusable(true);
1569    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1570    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1571    DisplayId displayId = displayInfo->GetDisplayId();
1572    std::vector<DisplayId> displayVec = { displayId };
1573    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1574    ret = windowRoot_->RaiseZOrderForAppWindow(windowNode);
1575    ASSERT_EQ(WMError::WM_OK, ret);
1576}
1577
1578/**
1579 * @tc.name: RaiseZOrderForAppWindow03
1580 * @tc.desc: test WindowRoot RaiseZOrderForAppWindow03
1581 * @tc.type: FUNC
1582 */
1583HWTEST_F(WindowRootTest, RaiseZOrderForAppWindow03, Function | SmallTest | Level2)
1584{
1585    sptr<WindowNode> windowNode = new WindowNode();
1586    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
1587    auto ret = windowRoot_->RaiseZOrderForAppWindow(windowNode);
1588    ASSERT_EQ(WMError::WM_ERROR_INVALID_TYPE, ret);
1589}
1590
1591/**
1592 * @tc.name: DispatchKeyEvent01
1593 * @tc.desc: test WindowRoot DispatchKeyEvent01
1594 * @tc.type: FUNC
1595 */
1596HWTEST_F(WindowRootTest, DispatchKeyEvent01, Function | SmallTest | Level2)
1597{
1598    sptr<WindowNode> windowNode = new WindowNode();
1599    std::shared_ptr<MMI::KeyEvent> event = nullptr;
1600    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1601    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1602    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1603    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1604    DisplayId displayId = displayInfo->GetDisplayId();
1605    std::vector<DisplayId> displayVec = { displayId };
1606    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1607    ASSERT_TRUE((windowRoot_ != nullptr));
1608    windowRoot_->DispatchKeyEvent(windowNode, event);
1609}
1610
1611/**
1612 * @tc.name: GetTopWindowId01
1613 * @tc.desc: test WindowRoot GetTopWindowId01
1614 * @tc.type: FUNC
1615 */
1616HWTEST_F(WindowRootTest, GetTopWindowId01, Function | SmallTest | Level2)
1617{
1618    sptr<WindowNode> windowNode1 = new WindowNode();
1619    windowNode1->currentVisibility_ = false;
1620    windowRoot_->SaveWindow(windowNode1);
1621    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode1->GetWindowId(), windowNode1));
1622    sptr<WindowNode> windowNode2 = new WindowNode();
1623    windowNode2->currentVisibility_ = true;
1624    windowRoot_->SaveWindow(windowNode2);
1625    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode2->GetWindowId(), windowNode2));
1626    sptr<WindowNode> windowNode3 = new WindowNode();
1627    windowNode3->currentVisibility_ = true;
1628    windowNode3->children_.push_back(windowNode2);
1629    windowRoot_->SaveWindow(windowNode3);
1630    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode3->GetWindowId(), windowNode3));
1631    uint32_t topWinId = windowNode1->GetWindowId();
1632    auto ret = windowRoot_->GetTopWindowId(windowNode3->GetWindowId(), topWinId);
1633    ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
1634    ret = windowRoot_->GetTopWindowId(windowNode1->GetWindowId(), topWinId);
1635    ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
1636    ret = windowRoot_->GetTopWindowId(windowNode2->GetWindowId(), topWinId);
1637    ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
1638}
1639
1640/**
1641 * @tc.name: SetWindowLayoutMode01
1642 * @tc.desc: test WindowRoot SetWindowLayoutMode01
1643 * @tc.type: FUNC
1644 */
1645HWTEST_F(WindowRootTest, SetWindowLayoutMode01, Function | SmallTest | Level2)
1646{
1647    WindowLayoutMode mode = WindowLayoutMode::BASE;
1648    sptr<WindowNode> windowNode = new WindowNode();
1649    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1650    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1651    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1652    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1653    DisplayId displayId = displayInfo->GetDisplayId();
1654    std::vector<DisplayId> displayVec = { displayId };
1655    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1656    auto ret = windowRoot_->SetWindowLayoutMode(windowNode->GetDisplayId(), mode);
1657    ASSERT_EQ(WMError::WM_OK, ret);
1658}
1659
1660/**
1661 * @tc.name: GetAllDisplayRectsByDMS
1662 * @tc.desc: test WindowRoot GetAllDisplayRectsByDMS
1663 * @tc.type: FUNC
1664 */
1665HWTEST_F(WindowRootTest, GetAllDisplayRectsByDMS, Function | SmallTest | Level2)
1666{
1667    ScreenId displayGroupId = 1;
1668    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1669    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1670    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
1671    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1672    DisplayId displayId = displayInfo->GetDisplayId();
1673    std::vector<DisplayId> displayVec = { displayId };
1674    windowRoot_->displayIdMap_.insert(std::make_pair(displayGroupId, displayVec));
1675    ASSERT_TRUE((windowRoot_ != nullptr));
1676    windowRoot_->GetAllDisplayRectsByDMS(displayInfo);
1677}
1678
1679/**
1680 * @tc.name: MoveNotShowingWindowToDefaultDisplay01
1681 * @tc.desc: test WindowRoot MoveNotShowingWindowToDefaultDisplay01
1682 * @tc.type: FUNC
1683 */
1684HWTEST_F(WindowRootTest, MoveNotShowingWindowToDefaultDisplay01, Function | SmallTest | Level2)
1685{
1686    DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
1687    ASSERT_TRUE((windowRoot_ != nullptr));
1688    sptr<WindowNode> node = new WindowNode();
1689    sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1690    sptr<IWindow> iWindow = iface_cast<IWindow>(iRemoteObjectMocker);
1691    node->SetWindowToken(iWindow);
1692    node->currentVisibility_ = false;
1693    windowRoot_->windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
1694    windowRoot_->MoveNotShowingWindowToDefaultDisplay(defaultDisplayId, node->GetDisplayId());
1695}
1696
1697/**
1698 * @tc.name: ProcessDisplayDestroy01
1699 * @tc.desc: test WindowRoot ProcessDisplayDestroy01
1700 * @tc.type: FUNC
1701 */
1702HWTEST_F(WindowRootTest, ProcessDisplayDestroy01, Function | SmallTest | Level2)
1703{
1704    sptr<WindowNode> windowNode = new WindowNode();
1705    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1706    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1707    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1708    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1709    DisplayId displayId = displayInfo->GetDisplayId();
1710    std::vector<DisplayId> displayVec = { displayId };
1711    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1712    ASSERT_TRUE((display != nullptr));
1713    std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
1714    displayInfoMap.insert(std::make_pair(windowNode->GetDisplayId(), display->GetDisplayInfo()));
1715    ASSERT_TRUE((windowRoot_ != nullptr));
1716    windowRoot_->ProcessDisplayDestroy(windowNode->GetDisplayId(), display->GetDisplayInfo(), displayInfoMap);
1717}
1718
1719/**
1720 * @tc.name: GetDisplayGroupRect
1721 * @tc.desc: test WindowRoot GetDisplayGroupRect,HasPrivateWindow,HasMainFullScreenWindowShown
1722 * @tc.type: FUNC
1723 */
1724HWTEST_F(WindowRootTest, GetDisplayGroupRect01, Function | SmallTest | Level2)
1725{
1726    sptr<WindowNode> windowNode = new WindowNode();
1727    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1728    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1729    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1730    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1731    DisplayId displayId = displayInfo->GetDisplayId();
1732    std::vector<DisplayId> displayVec = { displayId };
1733    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1734    ASSERT_TRUE((windowRoot_ != nullptr));
1735    windowRoot_->GetDisplayGroupRect(windowNode->GetDisplayId());
1736    ASSERT_TRUE((windowRoot_ != nullptr));
1737    windowRoot_->HasPrivateWindow(windowNode->GetDisplayId());
1738    ASSERT_TRUE((windowRoot_ != nullptr));
1739    windowRoot_->HasMainFullScreenWindowShown(windowNode->GetDisplayId());
1740}
1741
1742/**
1743 * @tc.name: UpdateRsTree
1744 * @tc.desc: test WindowRoot UpdateRsTree
1745 * @tc.type: FUNC
1746 */
1747HWTEST_F(WindowRootTest, UpdateRsTree, Function | SmallTest | Level2)
1748{
1749    sptr<WindowNode> windowNode = new WindowNode();
1750    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1751    ASSERT_TRUE((windowRoot_ != nullptr));
1752    auto res = windowRoot_->UpdateRsTree(windowNode->GetWindowId(), true);
1753    ASSERT_EQ(WMError::WM_ERROR_NULLPTR, res);
1754    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1755    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1756    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(windowNode->GetDisplayId(), container));
1757    sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
1758    DisplayId displayId = displayInfo->GetDisplayId();
1759    std::vector<DisplayId> displayVec = { displayId };
1760    windowRoot_->displayIdMap_.insert(std::make_pair(windowNode->GetDisplayId(), displayVec));
1761    res = windowRoot_->UpdateRsTree(windowNode->GetWindowId(), true);
1762    ASSERT_EQ(WMError::WM_OK, res);
1763}
1764
1765/**
1766 * @tc.name: CheckMultiDialogWindows
1767 * @tc.desc: test WindowRoot CheckMultiDialogWindows
1768 * @tc.type: FUNC
1769 */
1770HWTEST_F(WindowRootTest, CheckMultiDialogWindows, Function | SmallTest | Level2)
1771{
1772    sptr<WindowNode> windowNode = new WindowNode();
1773    windowNode->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1774    windowNode->abilityToken_ = new IRemoteObjectMocker();
1775    auto res = windowRoot_->CheckMultiDialogWindows(WindowType::WINDOW_TYPE_DIALOG, windowNode->abilityToken_);
1776    ASSERT_EQ(false, res);
1777    windowRoot_->windowNodeMap_.insert(std::make_pair(windowNode->GetWindowId(), windowNode));
1778    res = windowRoot_->CheckMultiDialogWindows(WindowType::WINDOW_TYPE_DIALOG, windowNode->abilityToken_);
1779    ASSERT_EQ(false, res);
1780}
1781
1782
1783/**
1784 * @tc.name: GetSplitScreenWindowNodes
1785 * @tc.desc: test WindowRoot GetSplitScreenWindowNodes
1786 * @tc.type: FUNC
1787 */
1788HWTEST_F(WindowRootTest, GetSplitScreenWindowNodes, Function | SmallTest | Level2)
1789{
1790    ScreenId displayGroupId = 1;
1791    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1792    ASSERT_TRUE((display != nullptr));
1793    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1794    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
1795    std::vector<sptr<WindowNode>> windowNodes = windowRoot_->GetSplitScreenWindowNodes(DISPLAY_ID_INVALID);
1796    ASSERT_EQ(windowNodes.empty(), true);
1797    windowNodes = windowRoot_->GetSplitScreenWindowNodes(displayGroupId);
1798    ASSERT_EQ(windowNodes.empty(), true);
1799}
1800
1801/**
1802 * @tc.name: IsForbidDockSliceMove01
1803 * @tc.desc: test WindowRoot IsForbidDockSliceMove01
1804 * @tc.type: FUNC
1805 */
1806HWTEST_F(WindowRootTest, IsForbidDockSliceMove01, Function | SmallTest | Level2)
1807{
1808    ScreenId displayGroupId = 1;
1809    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1810    ASSERT_TRUE((display != nullptr));
1811    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1812    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(displayGroupId, container));
1813    bool ret = windowRoot_->IsForbidDockSliceMove(displayGroupId);
1814    ASSERT_EQ(ret, true);
1815    ret = windowRoot_->IsDockSliceInExitSplitModeArea(displayGroupId);
1816    ASSERT_EQ(ret, false);
1817    windowRoot_->ExitSplitMode(displayGroupId);
1818}
1819
1820/**
1821 * @tc.name: GetVisibilityWindowInfo01
1822 * @tc.desc: test WindowRoot GetVisibilityWindowInfo01
1823 * @tc.type: FUNC
1824 */
1825HWTEST_F(WindowRootTest, GetVisibilityWindowInfo01, Function | SmallTest | Level2)
1826{
1827    sptr<WindowNode> node = new WindowNode();
1828    windowRoot_->AddSurfaceNodeIdWindowNodePair(node->GetDisplayId(), node);
1829    std::vector<sptr<WindowVisibilityInfo>> infos = {};
1830    windowRoot_->lastVisibleData_.clear();
1831    windowRoot_->lastVisibleData_.emplace_back(node->GetDisplayId(), WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
1832    ASSERT_TRUE((windowRoot_ != nullptr));
1833    windowRoot_->GetVisibilityWindowInfo(infos);
1834}
1835
1836/**
1837 * @tc.name: GetUnreliableWindowInfo
1838 * @tc.desc: test WindowRoot GetUnreliableWindowInfo
1839 * @tc.type: FUNC
1840 */
1841HWTEST_F(WindowRootTest, GetUnreliableWindowInfo, Function | SmallTest | Level2)
1842{
1843    int32_t windowId = 0;
1844    sptr<WindowNode> windowNode = new WindowNode();
1845    ASSERT_NE(windowNode, nullptr);
1846    windowId = windowNode->GetWindowId();
1847    windowRoot_->windowNodeMap_.insert(std::make_pair(windowId, windowNode));
1848    ASSERT_NE(windowRoot_, nullptr);
1849    std::vector<sptr<UnreliableWindowInfo>> infos;
1850    windowRoot_->GetUnreliableWindowInfo(windowId, infos);
1851}
1852
1853/**
1854 * @tc.name: AddWindowNode05
1855 * @tc.desc: test WindowRoot AddWindowNode05
1856 * @tc.type: FUNC
1857 */
1858HWTEST_F(WindowRootTest, AddWindowNode05, Function | SmallTest | Level2)
1859{
1860    WMError ret;
1861    sptr<WindowNode> node = new WindowNode();
1862    node->property_->SetWindowType(WindowType::SYSTEM_WINDOW_BASE);
1863    node->property_->SetModeSupportInfo(0);
1864
1865    ret = windowRoot_->AddWindowNode(INVALID_WINDOW_ID, node, false);
1866    ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_DISPLAY);
1867}
1868
1869/**
1870 * @tc.name: UpdateDisplayOrientationWhenHideWindow
1871 * @tc.desc: test WindowRoot UpdateDisplayOrientationWhenHideWindow
1872 * @tc.type: FUNC
1873 */
1874HWTEST_F(WindowRootTest, UpdateDisplayOrientationWhenHideWindow, Function | SmallTest | Level2)
1875{
1876    sptr<WindowNode> node = new WindowNode();
1877    auto display = DisplayManager::GetInstance().GetDefaultDisplay();
1878    ASSERT_TRUE((display != nullptr));
1879    sptr<WindowNodeContainer> container = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
1880    windowRoot_->windowNodeContainerMap_.insert(std::make_pair(node->GetDisplayId(), container));
1881    ASSERT_TRUE((windowRoot_ != nullptr));
1882    windowRoot_->UpdateDisplayOrientationWhenHideWindow(node);
1883}
1884}
1885}
1886}
1887