• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
18 #include "base/subwindow/subwindow_manager.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS::Ace {
24 namespace {
25     // SUB_WINDOW_MANAGER =
26 } // namespace
27 
28 class SubwindowManagerTest : public testing::Test {
29 public:
SetUp()30     void SetUp() override {};
TearDown()31     void TearDown() override {};
32 };
33 
34 /**
35  * @tc.name: SubwindowManagerTest_ShowPreviewNG001
36  * @tc.desc: Test frame node method ShowPreviewNG
37  * @tc.type: FUNC
38  */
39 HWTEST_F(SubwindowManagerTest, ShowPreviewNG001, TestSize.Level1)
40 {
41     /**
42      * @tc.steps: step1. get subwindowManager.
43      */
44     auto manager = SubwindowManager::GetInstance();
45     ASSERT_NE(manager, nullptr);
46 
47     /**
48      * @tc.steps: step2.
49      * @tc.expected: expect ShowPreviewNG return nullptr.
50      */
51     EXPECT_EQ(manager->ShowPreviewNG(), nullptr);
52 }
53 
54 /**
55  * @tc.name: SubwindowManagerTest_HidePreviewNG001
56  * @tc.desc: Test frame node method HidePreviewNG
57  * @tc.type: FUNC
58  */
59 HWTEST_F(SubwindowManagerTest, HidePreviewNG001, TestSize.Level1)
60 {
61     /**
62      * @tc.steps: step1. get subwindowManager, and initialize parameters.
63      */
64     auto manager = SubwindowManager::GetInstance();
65     ASSERT_NE(manager, nullptr);
66     auto subwindow = manager->ShowPreviewNG();
67     ASSERT_EQ(subwindow, nullptr);
68 
69     /**
70      * @tc.steps: step2. call HidePreviewNG.
71      * @tc.expected: HidePreviewNG return void.
72      */
73     manager->HidePreviewNG();
74 }
75 }