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
18 #include "session_manager/include/fold_screen_controller/fold_screen_controller.h"
19 #include "session_manager/include/screen_session_manager.h"
20
21 using namespace testing;
22 using namespace testing::ext;
23
24 namespace OHOS {
25 namespace Rosen {
26 class FoldScreenControllerTest : public testing::Test {
27 public:
28 static void SetUpTestCase();
29 static void TearDownTestCase();
30 void SetUp() override;
31 void TearDown() override;
32
33 static ScreenSessionManager& ssm_;
34 };
35
36 ScreenSessionManager& FoldScreenControllerTest::ssm_ = ScreenSessionManager::GetInstance();
37
SetUpTestCase()38 void FoldScreenControllerTest::SetUpTestCase()
39 {
40 }
41
TearDownTestCase()42 void FoldScreenControllerTest::TearDownTestCase()
43 {
44 }
45
SetUp()46 void FoldScreenControllerTest::SetUp()
47 {
48 }
49
TearDown()50 void FoldScreenControllerTest::TearDown()
51 {
52 }
53
54 namespace {
55
56 /**
57 * @tc.name: SetFoldDisplayMode
58 * @tc.desc: FoldScreenController set display mode
59 * @tc.type: FUNC
60 */
61 HWTEST_F(FoldScreenControllerTest, SetDisplayMode, Function | SmallTest | Level3)
62 {
63 ssm_.SetFoldDisplayMode(FoldDisplayMode::MAIN);
64 ASSERT_EQ(FoldDisplayMode::UNKNOWN, ssm_.GetFoldDisplayMode());
65
66 ssm_.SetFoldDisplayMode(FoldDisplayMode::FULL);
67 ASSERT_EQ(FoldDisplayMode::UNKNOWN, ssm_.GetFoldDisplayMode());
68 }
69
70 /**
71 * @tc.name: GetFoldDisplayMode
72 * @tc.desc: GetFoldDisplayMode get display mode
73 * @tc.type: FUNC
74 */
75 HWTEST_F(FoldScreenControllerTest, GetFoldDisplayMode, Function | SmallTest | Level3)
76 {
77 ssm_.SetFoldDisplayMode(FoldDisplayMode::MAIN);
78 ASSERT_EQ(FoldDisplayMode::UNKNOWN, ssm_.GetFoldDisplayMode());
79
80 ssm_.SetFoldDisplayMode(FoldDisplayMode::FULL);
81 ASSERT_EQ(FoldDisplayMode::UNKNOWN, ssm_.GetFoldDisplayMode());
82 }
83
84 /**
85 * @tc.name: IsFoldable
86 * @tc.desc: FoldScreenController whether is foldable device or not
87 * @tc.type: FUNC
88 */
89 HWTEST_F(FoldScreenControllerTest, IsFoldable, Function | SmallTest | Level3)
90 {
91 ASSERT_EQ(false, ssm_.IsFoldable());
92 }
93
94 /**
95 * @tc.name: GetFoldStatus
96 * @tc.desc: FoldScreenController get device fold status
97 * @tc.type: FUNC
98 */
99 HWTEST_F(FoldScreenControllerTest, GetFoldStatus, Function | SmallTest | Level3)
100 {
101 ssm_.SetFoldDisplayMode(FoldDisplayMode::MAIN);
102 ASSERT_EQ(FoldStatus::UNKNOWN, ssm_.GetFoldStatus());
103
104 ssm_.SetFoldDisplayMode(FoldDisplayMode::FULL);
105 ASSERT_EQ(FoldStatus::UNKNOWN, ssm_.GetFoldStatus());
106 }
107
108 /**
109 * @tc.name: GetCurrentFoldCreaseRegion
110 * @tc.desc: FoldScreenController get crease region
111 * @tc.type: FUNC
112 */
113 HWTEST_F(FoldScreenControllerTest, GetCurrentFoldCreaseRegion, Function | SmallTest | Level3)
114 {
115 ASSERT_EQ(nullptr, ssm_.GetCurrentFoldCreaseRegion());
116 }
117 }
118 } // namespace Rosen
119 } // namespace OHOS
120
121