1/* 2 * Copyright (c) 2021-2022 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// gtest 17#include <gtest/gtest.h> 18#include "display_test_utils.h" 19#include "display_manager_proxy.h" 20 21using namespace testing; 22using namespace testing::ext; 23 24namespace OHOS { 25namespace Rosen { 26class DisplayMinimalTest : public testing::Test { 27public: 28 static void SetUpTestCase(); 29 static void TearDownTestCase(); 30 virtual void SetUp() override; 31 virtual void TearDown() override; 32}; 33 34void DisplayMinimalTest::SetUpTestCase() 35{ 36} 37 38void DisplayMinimalTest::TearDownTestCase() 39{ 40} 41 42void DisplayMinimalTest::SetUp() 43{ 44} 45 46void DisplayMinimalTest::TearDown() 47{ 48} 49 50namespace { 51/** 52 * @tc.name: BasicDisplay 53 * @tc.desc: Check default display id is valid 54 * @tc.type: FUNC 55 */ 56HWTEST_F(DisplayMinimalTest, BasicDisplay01, Function | MediumTest | Level1) 57{ 58 ASSERT_NE(DISPLAY_ID_INVALID, DisplayManager::GetInstance().GetDefaultDisplayId()); 59} 60 61/** 62 * @tc.name: BasicDisplay 63 * @tc.desc: Check default display exists 64 * @tc.type: FUNC 65 */ 66HWTEST_F(DisplayMinimalTest, BasicDisplay02, Function | MediumTest | Level1) 67{ 68 const sptr<Display>& display = DisplayManager::GetInstance().GetDefaultDisplay(); 69 ASSERT_NE(nullptr, display); 70} 71 72/** 73 * @tc.name: BasicDisplay 74 * @tc.desc: Check all displays are valid 75 * @tc.type: FUNC 76 */ 77HWTEST_F(DisplayMinimalTest, BasicDisplay03, Function | MediumTest | Level1) 78{ 79 std::vector<DisplayId> ids = DisplayManager::GetInstance().GetAllDisplayIds(); 80 for (DisplayId id : ids) { 81 const sptr<Display>& display = DisplayManager::GetInstance().GetDisplayById(id); 82 ASSERT_NE(nullptr, display); 83 } 84} 85} 86} // namespace Rosen 87} // namespace OHOS 88