1 /*
2  * Copyright (c) 2024 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 <limits>
18 #include <test_header.h>
19 
20 #include "hgm_screen_info.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace Rosen {
27 class HgmScreenInfoTest : public testing::Test {
28 public:
SetUpTestCase()29     static void SetUpTestCase() {}
TearDownTestCase()30     static void TearDownTestCase() {}
SetUp()31     void SetUp() {}
TearDown()32     void TearDown() {}
33 };
34 
35 /**
36  * @tc.name: GetScreenType
37  * @tc.desc: Verify the execution process of GetScreenType function
38  * @tc.type: FUNC
39  * @tc.require:
40  */
41 HWTEST_F(HgmScreenInfoTest, GetScreenType, Function | SmallTest | Level1)
42 {
43     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
44     ScreenId id = 0;
45     ASSERT_NO_FATAL_FAILURE({hgmScreenInfo.GetScreenType(id);});
46 }
47 
48 /**
49  * @tc.name: IsLtpoType001
50  * @tc.desc: Verify the result of IsLtpoType function
51  * @tc.type: FUNC
52  * @tc.require:
53  */
54 HWTEST_F(HgmScreenInfoTest, IsLtpoType001, Function | SmallTest | Level1)
55 {
56     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
57     HgmScreenType screenType = HgmScreenType::LTPO;
58     bool ret = hgmScreenInfo.IsLtpoType(screenType);
59     ASSERT_EQ(ret, true);
60 }
61 
62 /**
63  * @tc.name: IsLtpoType002
64  * @tc.desc: Verify the result of IsLtpoType function
65  * @tc.type: FUNC
66  * @tc.require:
67  */
68 HWTEST_F(HgmScreenInfoTest, IsLtpoType002, Function | SmallTest | Level1)
69 {
70     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
71     HgmScreenType screenType = HgmScreenType::LTPS;
72     bool ret = hgmScreenInfo.IsLtpoType(screenType);
73     ASSERT_NE(ret, true);
74 }
75 
76 /**
77  * @tc.name: Init
78  * @tc.desc: Verify the execution process of Init function
79  * @tc.type: FUNC
80  * @tc.require:
81  */
82 HWTEST_F(HgmScreenInfoTest, Init, Function | SmallTest | Level1)
83 {
84     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
85     ASSERT_NO_FATAL_FAILURE({hgmScreenInfo.Init();});
86 }
87 
88 /**
89  * @tc.name: GetPanelInfo
90  * @tc.desc: Verify the execution process of GetPanelInfo function
91  * @tc.type: FUNC
92  * @tc.require:
93  */
94 HWTEST_F(HgmScreenInfoTest, GetPanelInfo, Function | SmallTest | Level1)
95 {
96     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
97     std::string panelInfo;
98     ASSERT_NO_FATAL_FAILURE({hgmScreenInfo.GetPanelInfo(panelInfo);});
99 }
100 
101 /**
102  * @tc.name: InitPanelTypeMap
103  * @tc.desc: Verify the execution process of InitPanelTypeMap function
104  * @tc.type: FUNC
105  * @tc.require:
106  */
107 HWTEST_F(HgmScreenInfoTest, InitPanelTypeMap, Function | SmallTest | Level1)
108 {
109     auto& hgmScreenInfo = HgmScreenInfo::GetInstance();
110     std::string panelInfo;
111     ASSERT_NO_FATAL_FAILURE({hgmScreenInfo.InitPanelTypeMap(panelInfo);});
112 }
113 
114 } // namespace Rosen
115 } // namespace OHOS