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