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 18#include "interfaces/inner_api/ace/navigation_controller.h" 19 20using namespace testing; 21using namespace testing::ext; 22 23namespace OHOS::Ace { 24namespace { 25constexpr int32_t VALUE = 0; 26} // namespace 27 28class NavigationControllerTest : public testing::Test { 29public: 30 static void SetUpTestCase() {} 31 static void TearDownTestCase() {} 32 void SetUp() {} 33 void TearDown() {} 34}; 35 36/** 37 * @tc.name: NavigationController001 38 * @tc.desc: Test IsNavDestinationInTopStack function. 39 * @tc.type: FUNC 40 */ 41HWTEST_F(NavigationControllerTest, NavigationController001, TestSize.Level1) 42{ 43 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 44 ASSERT_NE(navigationController, nullptr); 45 EXPECT_EQ(navigationController->IsNavDestinationInTopStack(), false); 46} 47 48/** 49 * @tc.name: NavigationController002 50 * @tc.desc: Test GetTopHandle function. 51 * @tc.type: FUNC 52 */ 53HWTEST_F(NavigationControllerTest, NavigationController002, TestSize.Level1) 54{ 55 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 56 ASSERT_NE(navigationController, nullptr); 57 EXPECT_EQ(navigationController->GetTopHandle(), VALUE); 58} 59 60/** 61 * @tc.name: NavigationController003 62 * @tc.desc: Test SetInPIPMode function. 63 * @tc.type: FUNC 64 */ 65HWTEST_F(NavigationControllerTest, NavigationController003, TestSize.Level1) 66{ 67 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 68 ASSERT_NE(navigationController, nullptr); 69 int32_t handle = 1; 70 navigationController->SetInPIPMode(handle); 71} 72 73/** 74 * @tc.name: NavigationController004 75 * @tc.desc: Test PopInPIP function. 76 * @tc.type: FUNC 77 */ 78HWTEST_F(NavigationControllerTest, NavigationController004, TestSize.Level1) 79{ 80 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 81 ASSERT_NE(navigationController, nullptr); 82 bool destroy = true; 83 navigationController->PopInPIP(destroy); 84} 85 86/** 87 * @tc.name: NavigationController005 88 * @tc.desc: Test PushInPIP function. 89 * @tc.type: FUNC 90 */ 91HWTEST_F(NavigationControllerTest, NavigationController005, TestSize.Level1) 92{ 93 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 94 ASSERT_NE(navigationController, nullptr); 95 int32_t handle = 1; 96 navigationController->PushInPIP(handle); 97} 98 99/** 100 * @tc.name: NavigationController006 101 * @tc.desc: Test DeletePIPMode function. 102 * @tc.type: FUNC 103 */ 104HWTEST_F(NavigationControllerTest, NavigationController006, TestSize.Level1) 105{ 106 std::shared_ptr<NavigationController> navigationController = std::make_shared<NavigationController>(); 107 ASSERT_NE(navigationController, nullptr); 108 int32_t handle = 1; 109 navigationController->DeletePIPMode(handle); 110} 111} // namespace OHOS::Ace