mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-01-08 09:53:20 +00:00
commit
384af9de6d
@ -309,6 +309,45 @@ ohos_unittest("navigation_controller_test") {
|
||||
]
|
||||
}
|
||||
|
||||
ohos_unittest("native_node_napi_test") {
|
||||
module_out_path = interface_test_output_path
|
||||
|
||||
sources = [
|
||||
"$ace_root/adapter/ohos/osal/log_wrapper.cpp",
|
||||
"$ace_root/interfaces/native/node/native_node_napi.cpp",
|
||||
"$ace_root/test/mock/adapter/mock_log_wrapper.cpp",
|
||||
"native_node_napi_test.cpp",
|
||||
]
|
||||
|
||||
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
|
||||
|
||||
include_dirs = [
|
||||
"$ace_root/frameworks/core/interfaces/arkoala",
|
||||
"$ace_root/frameworks/",
|
||||
"$ace_root/interfaces/native/",
|
||||
"$ace_root/interfaces/native/node",
|
||||
"$ace_root",
|
||||
"$ace_root/interfaces/inner_api/drawable_descriptor",
|
||||
]
|
||||
|
||||
deps = [ "//third_party/googletest:gmock_main" ]
|
||||
|
||||
public_deps = [
|
||||
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics",
|
||||
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"cJSON:cjson",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image",
|
||||
"image_framework:image_native",
|
||||
"napi:ace_napi",
|
||||
"resource_management:global_resmgr",
|
||||
]
|
||||
}
|
||||
|
||||
group("interfaces_unittest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
@ -317,6 +356,7 @@ group("interfaces_unittest") {
|
||||
":extension_custom_node_test_ng",
|
||||
":form_render_group_test",
|
||||
":form_render_test",
|
||||
":native_node_napi_test",
|
||||
":navigation_controller_test",
|
||||
":ui_content_test",
|
||||
":ui_event_test",
|
||||
|
55
test/unittest/interfaces/native_node_napi_test.cpp
Normal file
55
test/unittest/interfaces/native_node_napi_test.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "native_node_napi.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
class NativeNodeNapiTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase() {};
|
||||
static void TearDownTestCase() {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: NativeNodeNapiTest001
|
||||
* @tc.desc: Test OH_ArkUI_GetContextFromNapiValue function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(NativeNodeNapiTest, NativeNodeNapiTest001, TestSize.Level1)
|
||||
{
|
||||
napi_env__* env = nullptr;
|
||||
napi_value__* value = nullptr;
|
||||
ArkUI_ContextHandle* context = nullptr;
|
||||
int32_t code = OH_ArkUI_GetContextFromNapiValue(env, value, context);
|
||||
EXPECT_EQ(code, 401);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: NativeNodeNapiTest002
|
||||
* @tc.desc: Test OH_ArkUI_GetNodeContentFromNapiValue function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(NativeNodeNapiTest, NativeNodeNapiTest002, TestSize.Level1)
|
||||
{
|
||||
napi_env__* env = nullptr;
|
||||
napi_value__* value = nullptr;
|
||||
ArkUI_NodeContentHandle* context = nullptr;
|
||||
int32_t code = OH_ArkUI_GetNodeContentFromNapiValue(env, value, context);
|
||||
EXPECT_EQ(code, 401);
|
||||
}
|
Loading…
Reference in New Issue
Block a user