1 /*
2 * Copyright (c) 2025 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 "screen_manager_lite.cpp"
18
19 using namespace testing;
20 using namespace testing::ext;
21
22 namespace OHOS {
23 namespace Rosen {
24 class ScreenManagerLiteTest : public testing::Test {
25 public:
26 static void SetUpTestCase();
27 static void TearDownTestCase();
28 void SetUp() override;
29 void TearDown() override;
30 static ScreenManagerLite& sml_;
31 };
32 ScreenManagerLite& ScreenManagerLiteTest::sml_ = ScreenManagerLite::GetInstance();
33
SetUpTestCase()34 void ScreenManagerLiteTest::SetUpTestCase()
35 {
36 }
37
TearDownTestCase()38 void ScreenManagerLiteTest::TearDownTestCase()
39 {
40 }
41
SetUp()42 void ScreenManagerLiteTest::SetUp()
43 {
44 }
45
TearDown()46 void ScreenManagerLiteTest::TearDown()
47 {
48 }
49
50 namespace {
51 /**
52 * @tc.name: GetScreenInfoById
53 * @tc.desc: GetScreenInfoById
54 * @tc.type: FUNC
55 */
56 HWTEST_F(ScreenManagerLiteTest, GetScreenInfoById, TestSize.Level1)
57 {
58 auto ret = sml_.GetScreenInfoById(SCREEN_ID_INVALID);
59 ASSERT_EQ(ret, nullptr);
60 ret = sml_.GetScreenInfoById(0);
61 ASSERT_NE(ret, nullptr);
62 }
63
64 /**
65 * @tc.name: GetPhysicalScreenIds
66 * @tc.desc: GetPhysicalScreenIds
67 * @tc.type: FUNC
68 */
69 HWTEST_F(ScreenManagerLiteTest, GetPhysicalScreenIds, TestSize.Level1)
70 {
71 std::vector<ScreenId> screenIds;
72 auto ret = sml_.GetPhysicalScreenIds(screenIds);
73 EXPECT_EQ(ret, DMError::DM_OK);
74 }
75 }
76 } // namespace Rosen
77 } // namespace OHOS