• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define LOG_TAG "ScreenManagerTest"
17 #include <gtest/gtest.h>
18 
19 #include "screen/screen_manager.h"
20 
21 using namespace testing::ext;
22 using namespace OHOS::DistributedData;
23 namespace OHOS::Test {
24 class ScreenManagerTest : public testing::Test {
25 public:
26     static void SetUpTestCase(void);
TearDownTestCase(void)27     static void TearDownTestCase(void){};
SetUp()28     void SetUp(){};
TearDown()29     void TearDown(){};
30 };
31 
SetUpTestCase()32 void ScreenManagerTest::SetUpTestCase()
33 {
34     ScreenManager::GetInstance()->BindExecutor(nullptr);
35 }
36 
37 /**
38 * @tc.name: IsLocked
39 * @tc.desc: test IsLocked function
40 * @tc.type: FUNC
41 * @tc.require:
42 * @tc.author:
43 */
44 HWTEST_F(ScreenManagerTest, IsLocked, TestSize.Level1)
45 {
46     EXPECT_NO_FATAL_FAILURE(ScreenManager::GetInstance()->Subscribe(nullptr));
47     EXPECT_NO_FATAL_FAILURE(ScreenManager::GetInstance()->Unsubscribe(nullptr));
48     EXPECT_NO_FATAL_FAILURE(ScreenManager::GetInstance()->SubscribeScreenEvent());
49     EXPECT_NO_FATAL_FAILURE(ScreenManager::GetInstance()->UnsubscribeScreenEvent());
50     ASSERT_FALSE(ScreenManager::GetInstance()->IsLocked());
51 }
52 } // namespace OHOS::Test
53