1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #include "interfaces/include/ws_common.h"
18 #include "session_manager/include/scene_session_manager.h"
19 #include "session_info.h"
20 #include "session/host/include/scene_session.h"
21 #include "window_manager_agent.h"
22 #include "session_manager.h"
23 #include "screen_cutout_controller.h"
24 #include "zidl/window_manager_agent_interface.h"
25
26 using namespace testing;
27 using namespace testing::ext;
28
29 namespace OHOS {
30 namespace Rosen {
31 class ScreenCutoutControllerTest : public testing::Test {
32 public:
33 static void SetUpTestCase();
34 static void TearDownTestCase();
35 void SetUp() override;
36 void TearDown() override;
37 };
38
SetUpTestCase()39 void ScreenCutoutControllerTest::SetUpTestCase()
40 {
41 }
42
TearDownTestCase()43 void ScreenCutoutControllerTest::TearDownTestCase()
44 {
45 }
46
SetUp()47 void ScreenCutoutControllerTest::SetUp()
48 {
49 }
50
TearDown()51 void ScreenCutoutControllerTest::TearDown()
52 {
53 }
54
55 namespace {
56
57 /**
58 * @tc.name: CreateWaterfallRect
59 * @tc.desc: CreateWaterfallRect func
60 * @tc.type: FUNC
61 */
62 HWTEST_F(ScreenCutoutControllerTest, CreateWaterfallRect, Function | SmallTest | Level3)
63 {
64 DMRect emptyRect = {0, 0, 0, 0};
65 DMRect emptyRect_ = {1, 2, 3, 3};
66 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
67
68 DMRect result = controller->CreateWaterfallRect(0, 0, 0, 0);
69 ASSERT_EQ(result, emptyRect);
70 DMRect result_ = controller->CreateWaterfallRect(1, 2, 3, 3);
71 ASSERT_EQ(result_, emptyRect_);
72 }
73
74 /**
75 * @tc.name: GetScreenCutoutInfo
76 * @tc.desc: GetScreenCutoutInfo func
77 * @tc.type: FUNC
78 */
79 HWTEST_F(ScreenCutoutControllerTest, GetScreenCutoutInfo, Function | SmallTest | Level3)
80 {
81 sptr<ScreenCutoutController> controller = new ScreenCutoutController();
82 ASSERT_NE(nullptr, controller->GetScreenCutoutInfo());
83 }
84 }
85 } // namespace Rosen
86 } // namespace OHOS
87
88