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/xcomponent_controller/xcomponent_controller.h" 19 20 using namespace testing; 21 using namespace testing::ext; 22 namespace OHOS::Ace { 23 class XComponentControllerTest : public testing::Test { 24 public: SetUpTestCase()25 static void SetUpTestCase() {}; TearDownTestCase()26 static void TearDownTestCase() {}; 27 }; 28 29 /** 30 * @tc.name: XComponentControllerTest001 31 * @tc.desc: Test XComponentController::GetXComponentControllerFromNapiValue function. 32 * @tc.type: FUNC 33 */ 34 HWTEST_F(XComponentControllerTest, XComponentControllerTest001, TestSize.Level1) 35 { 36 napi_env__* env = nullptr; 37 napi_value__* value = nullptr; 38 auto controller = XComponentController::GetXComponentControllerFromNapiValue(env, value); 39 EXPECT_EQ(controller, nullptr); 40 } 41 42 /** 43 * @tc.name: XComponentControllerTest002 44 * @tc.desc: Test XComponentController::SetSurfaceCallbackMode function. 45 * @tc.type: FUNC 46 */ 47 HWTEST_F(XComponentControllerTest, XComponentControllerTest002, TestSize.Level1) 48 { 49 napi_env__* env = nullptr; 50 napi_value__* value = nullptr; 51 SurfaceCallbackMode mode = SurfaceCallbackMode::DEFAULT; 52 uint32_t code = XComponentController::SetSurfaceCallbackMode(env, value, mode); 53 EXPECT_EQ(code, 1); 54 } 55 } // namespace OHOS::Ace 56