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 <cstdint>
17 #include <gtest/gtest.h>
18 #include "display_manager.h"
19 #include "window_agent.h"
20 #include "window_group_mgr.h"
21 #include "window_impl.h"
22 #include "window_property.h"
23 #include "window_root.h"
24 #include "wm_common.h"
25 #include "iremote_object_mocker.h"
26 #include "mock_rs_iwindow_animation_controller.h"
27 #include "remote_animation.h"
28 #include "starting_window.h"
29 #include "window_common_event.h"
30 #include "scene_board_judgement.h"
31 #include "vector"
32 
33 using namespace testing;
34 using namespace testing::ext;
35 
36 namespace OHOS {
37 namespace Rosen {
38 class WindowCommonEventTest : public testing::Test {
39 public:
40     static void SetUpTestCase();
41     static void TearDownTestCase();
42     void SetUp() override;
43     void TearDown() override;
44 };
45 
SetUpTestCase()46 void WindowCommonEventTest::SetUpTestCase()
47 {
48 }
TearDownTestCase()49 void WindowCommonEventTest::TearDownTestCase()
50 {
51 }
52 
SetUp()53 void WindowCommonEventTest::SetUp()
54 {
55 }
56 
TearDown()57 void WindowCommonEventTest::TearDown()
58 {
59 }
60 
61 namespace {
62 /**
63  * @tc.name: PreProcessWindowNode05
64  * @tc.desc:UpdateSplitRatioPoints
65  * @tc.type: FUNC
66  */
67 HWTEST_F(WindowCommonEventTest, SubscriberEventInner, Function | SmallTest | Level2)
68 {
69     sptr<WindowCommonEvent> windowCommonEvent_ = new WindowCommonEvent();
70     windowCommonEvent_->SubscriberEventInner(0);
71     std::vector<uint32_t> windowIds;
72     ASSERT_EQ(0, windowIds.size());
73 }
74 
75 /**
76  * @tc.name: UnSubscriberEvent
77  * @tc.desc: UnSubscriberEvent
78  * @tc.type: FUNC
79  */
80 HWTEST_F(WindowCommonEventTest, UnSubscriberEvent, Function | SmallTest | Level2)
81 {
82     sptr<WindowCommonEvent> windowCommonEvent_ = new WindowCommonEvent();
83     windowCommonEvent_->UnSubscriberEvent();
84     std::vector<uint32_t> windowIdsa;
85     ASSERT_EQ(0, windowIdsa.size());
86 }
87 
88 /**
89  * @tc.name: OnReceiveEvent
90  * @tc.desc: OnReceiveEvent
91  * @tc.type: FUNC
92  */
93 HWTEST_F(WindowCommonEventTest, OnReceiveEvent, Function | SmallTest | Level2)
94 {
95     sptr<WindowCommonEvent> windowCommonEvent_ = new WindowCommonEvent();
96     EventFwk::CommonEventData data;
97     windowCommonEvent_->OnReceiveEvent(data);
98     std::vector<uint32_t> windowIds;
99     ASSERT_EQ(0, windowIds.size());
100 }
101 
102 /**
103  * @tc.name: HandleAccountSwitched
104  * @tc.desc: HandleAccountSwitched
105  * @tc.type: FUNC
106  */
107 HWTEST_F(WindowCommonEventTest, HandleAccountSwitched, Function | SmallTest | Level2)
108 {
109     sptr<WindowCommonEvent> windowCommonEvent_ = new WindowCommonEvent();
110     EventFwk::CommonEventData data;
111     windowCommonEvent_->HandleAccountSwitched(data);
112     std::vector<uint32_t> windowIds;
113     ASSERT_EQ(0, windowIds.size());
114 }
115 }
116 }
117 }