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 } // namespace
26 
27 class SubwindowManagerTest : public testing::Test {
28 public:
SetUp()29     void SetUp() override {};
TearDown()30     void TearDown() override {};
31 };
32 
33 /**
34  * @tc.name: SubwindowManagerTest_ShowPreviewNG001
35  * @tc.desc: Test frame node method ShowPreviewNG
36  * @tc.type: FUNC
37  */
38 HWTEST_F(SubwindowManagerTest, ShowPreviewNG001, TestSize.Level1)
39 {
40     /**
41      * @tc.steps: step1. get subwindowManager.
42      */
43     auto manager = SubwindowManager::GetInstance();
44     ASSERT_NE(manager, nullptr);
45 
46     /**
47      * @tc.steps: step2.
48      * @tc.expected: expect ShowPreviewNG return nullptr.
49      */
50     EXPECT_EQ(manager->ShowPreviewNG(false), nullptr);
51 }
52 
53 /**
54  * @tc.name: SubwindowManagerTest_HidePreviewNG001
55  * @tc.desc: Test frame node method HidePreviewNG
56  * @tc.type: FUNC
57  */
58 HWTEST_F(SubwindowManagerTest, HidePreviewNG001, TestSize.Level1)
59 {
60     /**
61      * @tc.steps: step1. get subwindowManager, and initialize parameters.
62      */
63     auto manager = SubwindowManager::GetInstance();
64     ASSERT_NE(manager, nullptr);
65     auto subwindow = manager->ShowPreviewNG(false);
66     ASSERT_EQ(subwindow, nullptr);
67 
68     /**
69      * @tc.steps: step2. call HidePreviewNG.
70      * @tc.expected: HidePreviewNG return void.
71      */
72     manager->HidePreviewNG();
73 }
74 }