mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 17:21:11 +00:00
animate_impl.cpp and dialog_model.cpp 补充测试用例
Signed-off-by: jiangzhijun8 <jiangzhijun7@huawei.com> Change-Id: Ie360b30d75da13d2b0fb528d909371926378cdd8
This commit is contained in:
parent
53f4a086a5
commit
24df6ddfe4
@ -615,10 +615,122 @@ ohos_unittest("node_transition_test") {
|
||||
]
|
||||
}
|
||||
|
||||
ohos_unittest("animate_impl_test") {
|
||||
module_out_path = interface_test_output_path
|
||||
|
||||
sources = [
|
||||
"$ace_root/adapter/ohos/osal/log_wrapper.cpp",
|
||||
"$ace_root/frameworks/core/components/common/properties/color.cpp",
|
||||
"$ace_root/interfaces/native/node/animate_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/dialog_model.cpp",
|
||||
"$ace_root/interfaces/native/node/event_converter.cpp",
|
||||
"$ace_root/interfaces/native/node/gesture_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/native_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/native_node_napi.cpp",
|
||||
"$ace_root/interfaces/native/node/node_animate.cpp",
|
||||
"$ace_root/interfaces/native/node/node_extened.cpp",
|
||||
"$ace_root/interfaces/native/node/node_model.cpp",
|
||||
"$ace_root/interfaces/native/node/node_transition.cpp",
|
||||
"$ace_root/interfaces/native/node/node_transition_imp.cpp",
|
||||
"$ace_root/interfaces/native/node/style_modifier.cpp",
|
||||
"$ace_root/test/mock/adapter/mock_log_wrapper.cpp",
|
||||
"animate_impl_test.cpp",
|
||||
]
|
||||
|
||||
configs = [
|
||||
"$ace_root/test/unittest:ace_unittest_config",
|
||||
":c_api_configs",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"$ace_root/frameworks/base/error",
|
||||
"$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",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_unittest("dialog_model_test") {
|
||||
module_out_path = interface_test_output_path
|
||||
|
||||
sources = [
|
||||
"$ace_root/adapter/ohos/osal/log_wrapper.cpp",
|
||||
"$ace_root/frameworks/core/components/common/properties/color.cpp",
|
||||
"$ace_root/interfaces/native/node/animate_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/dialog_model.cpp",
|
||||
"$ace_root/interfaces/native/node/event_converter.cpp",
|
||||
"$ace_root/interfaces/native/node/gesture_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/native_impl.cpp",
|
||||
"$ace_root/interfaces/native/node/native_node_napi.cpp",
|
||||
"$ace_root/interfaces/native/node/node_animate.cpp",
|
||||
"$ace_root/interfaces/native/node/node_extened.cpp",
|
||||
"$ace_root/interfaces/native/node/node_model.cpp",
|
||||
"$ace_root/interfaces/native/node/node_transition.cpp",
|
||||
"$ace_root/interfaces/native/node/node_transition_imp.cpp",
|
||||
"$ace_root/interfaces/native/node/style_modifier.cpp",
|
||||
"$ace_root/test/mock/adapter/mock_log_wrapper.cpp",
|
||||
"dialog_model_test.cpp",
|
||||
]
|
||||
|
||||
configs = [
|
||||
"$ace_root/test/unittest:ace_unittest_config",
|
||||
":c_api_configs",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"$ace_root/frameworks/base/error",
|
||||
"$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 = [
|
||||
":ace_forward_compatibility_test",
|
||||
":animate_impl_test",
|
||||
":dialog_model_test",
|
||||
":drawable_descriptor_test",
|
||||
":extension_custom_node_test_ng",
|
||||
":form_render_delegate_impl_test",
|
||||
|
663
test/unittest/interfaces/animate_impl_test.cpp
Normal file
663
test/unittest/interfaces/animate_impl_test.cpp
Normal file
@ -0,0 +1,663 @@
|
||||
/*
|
||||
* 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 "animate_impl.h"
|
||||
#include "core/interfaces/arkoala/arkoala_api.h"
|
||||
#include "error_code.h"
|
||||
#include "event_converter.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "native_animate.h"
|
||||
#include "native_interface.h"
|
||||
#include "native_node.h"
|
||||
#include "node_extened.h"
|
||||
#include "node_model.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::Ace::AnimateModel;
|
||||
|
||||
class AnimateImplTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase() {};
|
||||
static void TearDownTestCase() {};
|
||||
};
|
||||
|
||||
float InterpolateCallback(float fraction, void* userData)
|
||||
{
|
||||
return fraction;
|
||||
}
|
||||
|
||||
void AnimateCompleteCallback(void* userData) {}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest001
|
||||
* @tc.desc: Test InitCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest001, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = InitCurve(ArkUI_AnimationCurve::ARKUI_CURVE_EASE);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest002
|
||||
* @tc.desc: Test CubicBezierCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest002, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = CubicBezierCurve(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest003
|
||||
* @tc.desc: Test SpringCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest003, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = SpringCurve(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest004
|
||||
* @tc.desc: Test SpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest004, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = SpringMotion(0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest005
|
||||
* @tc.desc: Test InterpolatingSpring function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest005, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = InterpolatingSpring(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest006
|
||||
* @tc.desc: Test ResponsiveSpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest006, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = ResponsiveSpringMotion(0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest007
|
||||
* @tc.desc: Test CustomCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest007, TestSize.Level1)
|
||||
{
|
||||
ArkUI_CurveHandle curve = CustomCurve(nullptr, InterpolateCallback);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest008
|
||||
* @tc.desc: Test InitCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest008, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = InitCurve(ArkUI_AnimationCurve::ARKUI_CURVE_EASE);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest009
|
||||
* @tc.desc: Test StepsCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest009, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = StepsCurve(0, true);
|
||||
ASSERT_EQ(curve, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest010
|
||||
* @tc.desc: Test StepsCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest010, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = StepsCurve(1, true);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest011
|
||||
* @tc.desc: Test CubicBezierCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest011, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = CubicBezierCurve(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest012
|
||||
* @tc.desc: Test SpringCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest012, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = SpringCurve(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest013
|
||||
* @tc.desc: Test SpringCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest013, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = SpringCurve(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest014
|
||||
* @tc.desc: Test SpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest014, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = SpringMotion(0.5f, 0.5f, 0.5f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest015
|
||||
* @tc.desc: Test SpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest015, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = SpringMotion(-1.0f, -1.0f, -1.0f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest016
|
||||
* @tc.desc: Test ResponsiveSpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest016, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = ResponsiveSpringMotion(-1.0f, -1.0f, -1.0f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest017
|
||||
* @tc.desc: Test ResponsiveSpringMotion function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest017, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = ResponsiveSpringMotion(0.5f, 0.5f, 0.5f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest018
|
||||
* @tc.desc: Test InterpolatingSpring function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest018, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = InterpolatingSpring(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest019
|
||||
* @tc.desc: Test InterpolatingSpring function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest019, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = InterpolatingSpring(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest020
|
||||
* @tc.desc: Test CustomCurve function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest020, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_CurveHandle curve = CustomCurve(nullptr, InterpolateCallback);
|
||||
ASSERT_NE(curve, nullptr);
|
||||
|
||||
DisposeCurve(curve);
|
||||
curve = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest021
|
||||
* @tc.desc: Test CreateAnimator function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest021, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest022
|
||||
* @tc.desc: Test CreateAnimator function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest022, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(nullptr, nullptr);
|
||||
ASSERT_EQ(animatorHandle, nullptr);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest023
|
||||
* @tc.desc: Test AnimatorReset function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest023, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorReset(nullptr, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest024
|
||||
* @tc.desc: Test AnimatorReset function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest024, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorReset(animatorHandle, option);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest025
|
||||
* @tc.desc: Test AnimatorReset function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest025, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
struct ArkUI_Keyframe keyframe = {0.0f, 0.0f, nullptr};
|
||||
option->keyframes.push_back(keyframe);
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorReset(animatorHandle, option);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest026
|
||||
* @tc.desc: Test AnimatorPlay function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest026, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorPlay(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest027
|
||||
* @tc.desc: Test AnimatorPlay function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest027, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorPlay(animatorHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest028
|
||||
* @tc.desc: Test AnimatorFinish function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest028, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorFinish(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest029
|
||||
* @tc.desc: Test AnimatorFinish function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest029, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorFinish(animatorHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest030
|
||||
* @tc.desc: Test AnimatorPause function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest030, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorPause(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest031
|
||||
* @tc.desc: Test AnimatorPause function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest031, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorPause(animatorHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest032
|
||||
* @tc.desc: Test AnimatorCancel function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest032, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorCancel(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest033
|
||||
* @tc.desc: Test AnimatorCancel function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest033, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorCancel(animatorHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest034
|
||||
* @tc.desc: Test AnimatorReverse function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest034, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimatorReverse(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest035
|
||||
* @tc.desc: Test AnimatorReverse function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest035, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption();
|
||||
ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option);
|
||||
ASSERT_NE(animatorHandle, nullptr);
|
||||
ArkUIAnimatorHandle animator = new ArkUIAnimator();
|
||||
animatorHandle->animator = animator;
|
||||
int32_t ret = AnimatorReverse(animatorHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
|
||||
DisposeAnimator(animatorHandle);
|
||||
animatorHandle = nullptr;
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest036
|
||||
* @tc.desc: Test KeyframeAnimateTo function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest036, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = KeyframeAnimateTo(nullptr, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest037
|
||||
* @tc.desc: Test KeyframeAnimateTo function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest037, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_KeyframeAnimateOption* option = new ArkUI_KeyframeAnimateOption();
|
||||
struct ArkUI_KeyframeState keyframe = {0, nullptr, nullptr, nullptr};
|
||||
option->keyframes.push_back(keyframe);
|
||||
int32_t ret = KeyframeAnimateTo(&context, option);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
delete option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest038
|
||||
* @tc.desc: Test AnimateTo function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest038, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
int32_t ret = AnimateTo(nullptr, nullptr, nullptr, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest039
|
||||
* @tc.desc: Test AnimateTo function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest039, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimateOption* option = new ArkUI_AnimateOption();
|
||||
ArkUI_ContextCallback* update = new ArkUI_ContextCallback();
|
||||
update->callback = AnimateCompleteCallback;
|
||||
ArkUI_AnimateCompleteCallback* complete = new ArkUI_AnimateCompleteCallback();
|
||||
int32_t ret = AnimateTo(&context, option, update, complete);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
delete option;
|
||||
delete update;
|
||||
delete complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AnimateImplTest040
|
||||
* @tc.desc: Test AnimateTo function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AnimateImplTest, AnimateImplTest040, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
struct ArkUI_Context context= {1};
|
||||
ArkUI_AnimateOption* option = new ArkUI_AnimateOption();
|
||||
ArkUI_CurveHandle curve = new ArkUI_Curve();
|
||||
ArkUI_ExpectedFrameRateRange* expectedFrameRateRange = new ArkUI_ExpectedFrameRateRange();
|
||||
option->iCurve = curve;
|
||||
option->expectedFrameRateRange = expectedFrameRateRange;
|
||||
ArkUI_ContextCallback* update = new ArkUI_ContextCallback();
|
||||
update->callback = AnimateCompleteCallback;
|
||||
ArkUI_AnimateCompleteCallback* complete = new ArkUI_AnimateCompleteCallback();
|
||||
complete->type = ARKUI_FINISH_CALLBACK_LOGICALLY;
|
||||
complete->callback = AnimateCompleteCallback;
|
||||
int32_t userData = 0;
|
||||
complete->userData = (void *)userData;
|
||||
int32_t ret = AnimateTo(&context, option, update, complete);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
delete option;
|
||||
delete curve;
|
||||
delete update;
|
||||
delete complete;
|
||||
}
|
494
test/unittest/interfaces/dialog_model_test.cpp
Normal file
494
test/unittest/interfaces/dialog_model_test.cpp
Normal file
@ -0,0 +1,494 @@
|
||||
/*
|
||||
* 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 "animate_impl.h"
|
||||
#include "core/interfaces/arkoala/arkoala_api.h"
|
||||
#include "dialog_model.h"
|
||||
#include "error_code.h"
|
||||
#include "event_converter.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "native_animate.h"
|
||||
#include "native_interface.h"
|
||||
#include "native_node.h"
|
||||
#include "node_extened.h"
|
||||
#include "node_model.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::Ace::DialogModel;
|
||||
|
||||
class DialogModelTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase() {};
|
||||
static void TearDownTestCase() {};
|
||||
};
|
||||
|
||||
bool OnWillDismissEvent(int32_t reason)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest001
|
||||
* @tc.desc: Test Create function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest001, TestSize.Level1)
|
||||
{
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_EQ(nativeDialogHandle, nullptr);
|
||||
|
||||
Dispose(nativeDialogHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest002
|
||||
* @tc.desc: Test Create function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest002, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest003
|
||||
* @tc.desc: Test SetContent function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest003, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetContent(nullptr, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest004
|
||||
* @tc.desc: Test SetContent function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest004, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
ArkUI_NodeHandle nodeHandle = new ArkUI_Node();
|
||||
int32_t ret = SetContent(nativeDialogHandle, nodeHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
delete nodeHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest005
|
||||
* @tc.desc: Test RemoveContent function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest005, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = RemoveContent(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest006
|
||||
* @tc.desc: Test RemoveContent function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest006, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = RemoveContent(nativeDialogHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest007
|
||||
* @tc.desc: Test SetContentAlignment function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest007, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetContentAlignment(nullptr, 0, 0.0f, 0.0f);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest008
|
||||
* @tc.desc: Test SetContentAlignment function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest008, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetContentAlignment(nativeDialogHandle, 0, 0.0f, 0.0f);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest009
|
||||
* @tc.desc: Test ResetContentAlignment function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest009, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = ResetContentAlignment(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest010
|
||||
* @tc.desc: Test SetContentAlignment function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest010, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = ResetContentAlignment(nativeDialogHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest011
|
||||
* @tc.desc: Test SetModalMode function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest011, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetModalMode(nullptr, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest012
|
||||
* @tc.desc: Test SetModalMode function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest012, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetModalMode(nativeDialogHandle, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest013
|
||||
* @tc.desc: Test SetAutoCancel function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest013, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetAutoCancel(nullptr, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest014
|
||||
* @tc.desc: Test SetAutoCancel function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest014, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetAutoCancel(nativeDialogHandle, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest015
|
||||
* @tc.desc: Test SetMask function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest015, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetMask(nullptr, 0, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest016
|
||||
* @tc.desc: Test SetMask function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest016, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
ArkUI_Rect rect = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
int32_t ret = SetMask(nativeDialogHandle, 0, &rect);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest017
|
||||
* @tc.desc: Test SetMask function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest017, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetMask(nativeDialogHandle, 0, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest018
|
||||
* @tc.desc: Test SetBackgroundColor function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest018, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetBackgroundColor(nullptr, 0);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest019
|
||||
* @tc.desc: Test SetBackgroundColor function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest019, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetBackgroundColor(nativeDialogHandle, 0);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest020
|
||||
* @tc.desc: Test SetCornerRadius function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest020, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetCornerRadius(nullptr, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest021
|
||||
* @tc.desc: Test SetCornerRadius function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest021, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetCornerRadius(nativeDialogHandle, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest022
|
||||
* @tc.desc: Test SetGridColumnCount function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest022, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = SetGridColumnCount(nullptr, 0);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest023
|
||||
* @tc.desc: Test SetGridColumnCount function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest023, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = SetGridColumnCount(nativeDialogHandle, 0);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest024
|
||||
* @tc.desc: Test EnableCustomStyle function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest024, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = EnableCustomStyle(nullptr, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest025
|
||||
* @tc.desc: Test EnableCustomStyle function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest025, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = EnableCustomStyle(nativeDialogHandle, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest026
|
||||
* @tc.desc: Test EnableCustomAnimation function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest026, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = EnableCustomAnimation(nullptr, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest027
|
||||
* @tc.desc: Test EnableCustomAnimation function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest027, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = EnableCustomAnimation(nativeDialogHandle, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest028
|
||||
* @tc.desc: Test Show function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest028, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = Show(nullptr, true);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest029
|
||||
* @tc.desc: Test Show function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest029, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = Show(nativeDialogHandle, false);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest030
|
||||
* @tc.desc: Test Close function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest030, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = Close(nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest031
|
||||
* @tc.desc: Test Close function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest031, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
int32_t ret = Close(nativeDialogHandle);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest032
|
||||
* @tc.desc: Test RegisterOnWillDismiss function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest032, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = RegisterOnWillDismiss(nullptr, nullptr);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DialogModelTest033
|
||||
* @tc.desc: Test RegisterOnWillDismiss function.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DialogModelTest, DialogModelTest033, TestSize.Level1)
|
||||
{
|
||||
ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
|
||||
ArkUI_NativeDialogHandle nativeDialogHandle = Create();
|
||||
ASSERT_NE(nativeDialogHandle, nullptr);
|
||||
ArkUI_OnWillDismissEvent eventHandler = OnWillDismissEvent;
|
||||
int32_t ret = RegisterOnWillDismiss(nativeDialogHandle, eventHandler);
|
||||
ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
|
||||
Dispose(nativeDialogHandle);
|
||||
nativeDialogHandle = nullptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user