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 "modal_system_ui_extension.h" 19 #include "scene_board_judgement.h" 20 #include "wm_common.h" 21 22 using namespace testing; 23 using namespace testing::ext; 24 25 namespace OHOS { 26 namespace Rosen { 27 class ModalSystemUiExtensionTest : public testing::Test { 28 public: 29 static void SetUpTestCase(); 30 static void TearDownTestCase(); 31 void SetUp() override; 32 void TearDown() override; 33 }; 34 SetUpTestCase()35void ModalSystemUiExtensionTest::SetUpTestCase() 36 { 37 } 38 TearDownTestCase()39void ModalSystemUiExtensionTest::TearDownTestCase() 40 { 41 } 42 SetUp()43void ModalSystemUiExtensionTest::SetUp() 44 { 45 } 46 TearDown()47void ModalSystemUiExtensionTest::TearDown() 48 { 49 } 50 51 namespace { 52 /** 53 * @tc.name: ModalSystemUiExtensionConnection01 54 * @tc.desc: connect modal system ui_extension 55 * @tc.type: FUNC 56 */ 57 HWTEST_F(ModalSystemUiExtensionTest, ModalSystemUiExtensionConnection01, Function | SmallTest | Level2) 58 { 59 auto connection = new(std::nothrow)ModalSystemUiExtension(); 60 if (connection == nullptr) { 61 return; 62 } 63 OHOS::AAFwk::Want want; 64 if (!SceneBoardJudgement::IsSceneBoardEnabled()) { 65 ASSERT_FALSE(connection->CreateModalUIExtension(want)); 66 } else { 67 ASSERT_TRUE(connection->CreateModalUIExtension(want)); 68 } 69 delete connection; 70 } 71 } 72 } // Rosen 73 } // OHOS