123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#include "animate_impl.h" 1723b3eb3cSopenharmony_ci#include "core/interfaces/arkoala/arkoala_api.h" 1823b3eb3cSopenharmony_ci#include "error_code.h" 1923b3eb3cSopenharmony_ci#include "event_converter.h" 2023b3eb3cSopenharmony_ci#include "gtest/gtest.h" 2123b3eb3cSopenharmony_ci#include "native_animate.h" 2223b3eb3cSopenharmony_ci#include "native_interface.h" 2323b3eb3cSopenharmony_ci#include "native_node.h" 2423b3eb3cSopenharmony_ci#include "node_extened.h" 2523b3eb3cSopenharmony_ci#include "node_model.h" 2623b3eb3cSopenharmony_ci 2723b3eb3cSopenharmony_ciusing namespace testing; 2823b3eb3cSopenharmony_ciusing namespace testing::ext; 2923b3eb3cSopenharmony_ciusing namespace OHOS::Ace::AnimateModel; 3023b3eb3cSopenharmony_ci 3123b3eb3cSopenharmony_ciclass AnimateImplTest : public testing::Test { 3223b3eb3cSopenharmony_cipublic: 3323b3eb3cSopenharmony_ci static void SetUpTestCase() {}; 3423b3eb3cSopenharmony_ci static void TearDownTestCase() {}; 3523b3eb3cSopenharmony_ci}; 3623b3eb3cSopenharmony_ci 3723b3eb3cSopenharmony_cifloat InterpolateCallback(float fraction, void* userData) 3823b3eb3cSopenharmony_ci{ 3923b3eb3cSopenharmony_ci return fraction; 4023b3eb3cSopenharmony_ci} 4123b3eb3cSopenharmony_ci 4223b3eb3cSopenharmony_civoid AnimateCompleteCallback(void* userData) {} 4323b3eb3cSopenharmony_ci 4423b3eb3cSopenharmony_ci/** 4523b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest001 4623b3eb3cSopenharmony_ci * @tc.desc: Test InitCurve function. 4723b3eb3cSopenharmony_ci * @tc.type: FUNC 4823b3eb3cSopenharmony_ci */ 4923b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest001, TestSize.Level1) 5023b3eb3cSopenharmony_ci{ 5123b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = InitCurve(ArkUI_AnimationCurve::ARKUI_CURVE_EASE); 5223b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 5323b3eb3cSopenharmony_ci 5423b3eb3cSopenharmony_ci DisposeCurve(curve); 5523b3eb3cSopenharmony_ci} 5623b3eb3cSopenharmony_ci 5723b3eb3cSopenharmony_ci/** 5823b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest002 5923b3eb3cSopenharmony_ci * @tc.desc: Test CubicBezierCurve function. 6023b3eb3cSopenharmony_ci * @tc.type: FUNC 6123b3eb3cSopenharmony_ci */ 6223b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest002, TestSize.Level1) 6323b3eb3cSopenharmony_ci{ 6423b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = CubicBezierCurve(0.0f, 0.0f, 0.0f, 0.0f); 6523b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 6623b3eb3cSopenharmony_ci} 6723b3eb3cSopenharmony_ci 6823b3eb3cSopenharmony_ci/** 6923b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest003 7023b3eb3cSopenharmony_ci * @tc.desc: Test SpringCurve function. 7123b3eb3cSopenharmony_ci * @tc.type: FUNC 7223b3eb3cSopenharmony_ci */ 7323b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest003, TestSize.Level1) 7423b3eb3cSopenharmony_ci{ 7523b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringCurve(0.0f, 0.0f, 0.0f, 0.0f); 7623b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 7723b3eb3cSopenharmony_ci} 7823b3eb3cSopenharmony_ci 7923b3eb3cSopenharmony_ci/** 8023b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest004 8123b3eb3cSopenharmony_ci * @tc.desc: Test SpringMotion function. 8223b3eb3cSopenharmony_ci * @tc.type: FUNC 8323b3eb3cSopenharmony_ci */ 8423b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest004, TestSize.Level1) 8523b3eb3cSopenharmony_ci{ 8623b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringMotion(0.0f, 0.0f, 0.0f); 8723b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 8823b3eb3cSopenharmony_ci} 8923b3eb3cSopenharmony_ci 9023b3eb3cSopenharmony_ci/** 9123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest005 9223b3eb3cSopenharmony_ci * @tc.desc: Test InterpolatingSpring function. 9323b3eb3cSopenharmony_ci * @tc.type: FUNC 9423b3eb3cSopenharmony_ci */ 9523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest005, TestSize.Level1) 9623b3eb3cSopenharmony_ci{ 9723b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = InterpolatingSpring(0.0f, 0.0f, 0.0f, 0.0f); 9823b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 9923b3eb3cSopenharmony_ci} 10023b3eb3cSopenharmony_ci 10123b3eb3cSopenharmony_ci/** 10223b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest006 10323b3eb3cSopenharmony_ci * @tc.desc: Test ResponsiveSpringMotion function. 10423b3eb3cSopenharmony_ci * @tc.type: FUNC 10523b3eb3cSopenharmony_ci */ 10623b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest006, TestSize.Level1) 10723b3eb3cSopenharmony_ci{ 10823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = ResponsiveSpringMotion(0.0f, 0.0f, 0.0f); 10923b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 11023b3eb3cSopenharmony_ci} 11123b3eb3cSopenharmony_ci 11223b3eb3cSopenharmony_ci/** 11323b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest007 11423b3eb3cSopenharmony_ci * @tc.desc: Test CustomCurve function. 11523b3eb3cSopenharmony_ci * @tc.type: FUNC 11623b3eb3cSopenharmony_ci */ 11723b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest007, TestSize.Level1) 11823b3eb3cSopenharmony_ci{ 11923b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = CustomCurve(nullptr, InterpolateCallback); 12023b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 12123b3eb3cSopenharmony_ci} 12223b3eb3cSopenharmony_ci 12323b3eb3cSopenharmony_ci/** 12423b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest008 12523b3eb3cSopenharmony_ci * @tc.desc: Test InitCurve function. 12623b3eb3cSopenharmony_ci * @tc.type: FUNC 12723b3eb3cSopenharmony_ci */ 12823b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest008, TestSize.Level1) 12923b3eb3cSopenharmony_ci{ 13023b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 13123b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = InitCurve(ArkUI_AnimationCurve::ARKUI_CURVE_EASE); 13223b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 13323b3eb3cSopenharmony_ci 13423b3eb3cSopenharmony_ci DisposeCurve(curve); 13523b3eb3cSopenharmony_ci curve = nullptr; 13623b3eb3cSopenharmony_ci} 13723b3eb3cSopenharmony_ci 13823b3eb3cSopenharmony_ci/** 13923b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest009 14023b3eb3cSopenharmony_ci * @tc.desc: Test StepsCurve function. 14123b3eb3cSopenharmony_ci * @tc.type: FUNC 14223b3eb3cSopenharmony_ci */ 14323b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest009, TestSize.Level1) 14423b3eb3cSopenharmony_ci{ 14523b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 14623b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = StepsCurve(0, true); 14723b3eb3cSopenharmony_ci ASSERT_EQ(curve, nullptr); 14823b3eb3cSopenharmony_ci} 14923b3eb3cSopenharmony_ci 15023b3eb3cSopenharmony_ci/** 15123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest010 15223b3eb3cSopenharmony_ci * @tc.desc: Test StepsCurve function. 15323b3eb3cSopenharmony_ci * @tc.type: FUNC 15423b3eb3cSopenharmony_ci */ 15523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest010, TestSize.Level1) 15623b3eb3cSopenharmony_ci{ 15723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 15823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = StepsCurve(1, true); 15923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 16023b3eb3cSopenharmony_ci 16123b3eb3cSopenharmony_ci DisposeCurve(curve); 16223b3eb3cSopenharmony_ci curve = nullptr; 16323b3eb3cSopenharmony_ci} 16423b3eb3cSopenharmony_ci 16523b3eb3cSopenharmony_ci/** 16623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest011 16723b3eb3cSopenharmony_ci * @tc.desc: Test CubicBezierCurve function. 16823b3eb3cSopenharmony_ci * @tc.type: FUNC 16923b3eb3cSopenharmony_ci */ 17023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest011, TestSize.Level1) 17123b3eb3cSopenharmony_ci{ 17223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 17323b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = CubicBezierCurve(0.0f, 0.0f, 0.0f, 0.0f); 17423b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 17523b3eb3cSopenharmony_ci 17623b3eb3cSopenharmony_ci DisposeCurve(curve); 17723b3eb3cSopenharmony_ci curve = nullptr; 17823b3eb3cSopenharmony_ci} 17923b3eb3cSopenharmony_ci 18023b3eb3cSopenharmony_ci/** 18123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest012 18223b3eb3cSopenharmony_ci * @tc.desc: Test SpringCurve function. 18323b3eb3cSopenharmony_ci * @tc.type: FUNC 18423b3eb3cSopenharmony_ci */ 18523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest012, TestSize.Level1) 18623b3eb3cSopenharmony_ci{ 18723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 18823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringCurve(0.0f, 0.0f, 0.0f, 0.0f); 18923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 19023b3eb3cSopenharmony_ci 19123b3eb3cSopenharmony_ci DisposeCurve(curve); 19223b3eb3cSopenharmony_ci curve = nullptr; 19323b3eb3cSopenharmony_ci} 19423b3eb3cSopenharmony_ci 19523b3eb3cSopenharmony_ci/** 19623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest013 19723b3eb3cSopenharmony_ci * @tc.desc: Test SpringCurve function. 19823b3eb3cSopenharmony_ci * @tc.type: FUNC 19923b3eb3cSopenharmony_ci */ 20023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest013, TestSize.Level1) 20123b3eb3cSopenharmony_ci{ 20223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 20323b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringCurve(0.5f, 0.5f, 0.5f, 0.5f); 20423b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 20523b3eb3cSopenharmony_ci 20623b3eb3cSopenharmony_ci DisposeCurve(curve); 20723b3eb3cSopenharmony_ci curve = nullptr; 20823b3eb3cSopenharmony_ci} 20923b3eb3cSopenharmony_ci 21023b3eb3cSopenharmony_ci/** 21123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest014 21223b3eb3cSopenharmony_ci * @tc.desc: Test SpringMotion function. 21323b3eb3cSopenharmony_ci * @tc.type: FUNC 21423b3eb3cSopenharmony_ci */ 21523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest014, TestSize.Level1) 21623b3eb3cSopenharmony_ci{ 21723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 21823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringMotion(0.5f, 0.5f, 0.5f); 21923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 22023b3eb3cSopenharmony_ci 22123b3eb3cSopenharmony_ci DisposeCurve(curve); 22223b3eb3cSopenharmony_ci curve = nullptr; 22323b3eb3cSopenharmony_ci} 22423b3eb3cSopenharmony_ci 22523b3eb3cSopenharmony_ci/** 22623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest015 22723b3eb3cSopenharmony_ci * @tc.desc: Test SpringMotion function. 22823b3eb3cSopenharmony_ci * @tc.type: FUNC 22923b3eb3cSopenharmony_ci */ 23023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest015, TestSize.Level1) 23123b3eb3cSopenharmony_ci{ 23223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 23323b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = SpringMotion(-1.0f, -1.0f, -1.0f); 23423b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 23523b3eb3cSopenharmony_ci 23623b3eb3cSopenharmony_ci DisposeCurve(curve); 23723b3eb3cSopenharmony_ci curve = nullptr; 23823b3eb3cSopenharmony_ci} 23923b3eb3cSopenharmony_ci 24023b3eb3cSopenharmony_ci/** 24123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest016 24223b3eb3cSopenharmony_ci * @tc.desc: Test ResponsiveSpringMotion function. 24323b3eb3cSopenharmony_ci * @tc.type: FUNC 24423b3eb3cSopenharmony_ci */ 24523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest016, TestSize.Level1) 24623b3eb3cSopenharmony_ci{ 24723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 24823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = ResponsiveSpringMotion(-1.0f, -1.0f, -1.0f); 24923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 25023b3eb3cSopenharmony_ci 25123b3eb3cSopenharmony_ci DisposeCurve(curve); 25223b3eb3cSopenharmony_ci curve = nullptr; 25323b3eb3cSopenharmony_ci} 25423b3eb3cSopenharmony_ci 25523b3eb3cSopenharmony_ci/** 25623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest017 25723b3eb3cSopenharmony_ci * @tc.desc: Test ResponsiveSpringMotion function. 25823b3eb3cSopenharmony_ci * @tc.type: FUNC 25923b3eb3cSopenharmony_ci */ 26023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest017, TestSize.Level1) 26123b3eb3cSopenharmony_ci{ 26223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 26323b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = ResponsiveSpringMotion(0.5f, 0.5f, 0.5f); 26423b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 26523b3eb3cSopenharmony_ci 26623b3eb3cSopenharmony_ci DisposeCurve(curve); 26723b3eb3cSopenharmony_ci curve = nullptr; 26823b3eb3cSopenharmony_ci} 26923b3eb3cSopenharmony_ci 27023b3eb3cSopenharmony_ci/** 27123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest018 27223b3eb3cSopenharmony_ci * @tc.desc: Test InterpolatingSpring function. 27323b3eb3cSopenharmony_ci * @tc.type: FUNC 27423b3eb3cSopenharmony_ci */ 27523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest018, TestSize.Level1) 27623b3eb3cSopenharmony_ci{ 27723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 27823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = InterpolatingSpring(0.5f, 0.5f, 0.5f, 0.5f); 27923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 28023b3eb3cSopenharmony_ci 28123b3eb3cSopenharmony_ci DisposeCurve(curve); 28223b3eb3cSopenharmony_ci curve = nullptr; 28323b3eb3cSopenharmony_ci} 28423b3eb3cSopenharmony_ci 28523b3eb3cSopenharmony_ci/** 28623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest019 28723b3eb3cSopenharmony_ci * @tc.desc: Test InterpolatingSpring function. 28823b3eb3cSopenharmony_ci * @tc.type: FUNC 28923b3eb3cSopenharmony_ci */ 29023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest019, TestSize.Level1) 29123b3eb3cSopenharmony_ci{ 29223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 29323b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = InterpolatingSpring(0.0f, 0.0f, 0.0f, 0.0f); 29423b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 29523b3eb3cSopenharmony_ci 29623b3eb3cSopenharmony_ci DisposeCurve(curve); 29723b3eb3cSopenharmony_ci curve = nullptr; 29823b3eb3cSopenharmony_ci} 29923b3eb3cSopenharmony_ci 30023b3eb3cSopenharmony_ci/** 30123b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest020 30223b3eb3cSopenharmony_ci * @tc.desc: Test CustomCurve function. 30323b3eb3cSopenharmony_ci * @tc.type: FUNC 30423b3eb3cSopenharmony_ci */ 30523b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest020, TestSize.Level1) 30623b3eb3cSopenharmony_ci{ 30723b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 30823b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = CustomCurve(nullptr, InterpolateCallback); 30923b3eb3cSopenharmony_ci ASSERT_NE(curve, nullptr); 31023b3eb3cSopenharmony_ci 31123b3eb3cSopenharmony_ci DisposeCurve(curve); 31223b3eb3cSopenharmony_ci curve = nullptr; 31323b3eb3cSopenharmony_ci} 31423b3eb3cSopenharmony_ci 31523b3eb3cSopenharmony_ci/** 31623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest021 31723b3eb3cSopenharmony_ci * @tc.desc: Test CreateAnimator function. 31823b3eb3cSopenharmony_ci * @tc.type: FUNC 31923b3eb3cSopenharmony_ci */ 32023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest021, TestSize.Level1) 32123b3eb3cSopenharmony_ci{ 32223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 32323b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 32423b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 32523b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 32623b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 32723b3eb3cSopenharmony_ci 32823b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 32923b3eb3cSopenharmony_ci animatorHandle = nullptr; 33023b3eb3cSopenharmony_ci delete option; 33123b3eb3cSopenharmony_ci} 33223b3eb3cSopenharmony_ci 33323b3eb3cSopenharmony_ci/** 33423b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest022 33523b3eb3cSopenharmony_ci * @tc.desc: Test CreateAnimator function. 33623b3eb3cSopenharmony_ci * @tc.type: FUNC 33723b3eb3cSopenharmony_ci */ 33823b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest022, TestSize.Level1) 33923b3eb3cSopenharmony_ci{ 34023b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 34123b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(nullptr, nullptr); 34223b3eb3cSopenharmony_ci ASSERT_EQ(animatorHandle, nullptr); 34323b3eb3cSopenharmony_ci 34423b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 34523b3eb3cSopenharmony_ci} 34623b3eb3cSopenharmony_ci 34723b3eb3cSopenharmony_ci/** 34823b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest023 34923b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorReset function. 35023b3eb3cSopenharmony_ci * @tc.type: FUNC 35123b3eb3cSopenharmony_ci */ 35223b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest023, TestSize.Level1) 35323b3eb3cSopenharmony_ci{ 35423b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 35523b3eb3cSopenharmony_ci int32_t ret = AnimatorReset(nullptr, nullptr); 35623b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 35723b3eb3cSopenharmony_ci} 35823b3eb3cSopenharmony_ci 35923b3eb3cSopenharmony_ci/** 36023b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest024 36123b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorReset function. 36223b3eb3cSopenharmony_ci * @tc.type: FUNC 36323b3eb3cSopenharmony_ci */ 36423b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest024, TestSize.Level1) 36523b3eb3cSopenharmony_ci{ 36623b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 36723b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 36823b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 36923b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 37023b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 37123b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 37223b3eb3cSopenharmony_ci animatorHandle->animator = animator; 37323b3eb3cSopenharmony_ci int32_t ret = AnimatorReset(animatorHandle, option); 37423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 37523b3eb3cSopenharmony_ci 37623b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 37723b3eb3cSopenharmony_ci animatorHandle = nullptr; 37823b3eb3cSopenharmony_ci delete option; 37923b3eb3cSopenharmony_ci} 38023b3eb3cSopenharmony_ci 38123b3eb3cSopenharmony_ci/** 38223b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest025 38323b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorReset function. 38423b3eb3cSopenharmony_ci * @tc.type: FUNC 38523b3eb3cSopenharmony_ci */ 38623b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest025, TestSize.Level1) 38723b3eb3cSopenharmony_ci{ 38823b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 38923b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 39023b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 39123b3eb3cSopenharmony_ci struct ArkUI_Keyframe keyframe = {0.0f, 0.0f, nullptr}; 39223b3eb3cSopenharmony_ci option->keyframes.push_back(keyframe); 39323b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 39423b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 39523b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 39623b3eb3cSopenharmony_ci animatorHandle->animator = animator; 39723b3eb3cSopenharmony_ci int32_t ret = AnimatorReset(animatorHandle, option); 39823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 39923b3eb3cSopenharmony_ci 40023b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 40123b3eb3cSopenharmony_ci animatorHandle = nullptr; 40223b3eb3cSopenharmony_ci delete option; 40323b3eb3cSopenharmony_ci} 40423b3eb3cSopenharmony_ci 40523b3eb3cSopenharmony_ci/** 40623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest026 40723b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorPlay function. 40823b3eb3cSopenharmony_ci * @tc.type: FUNC 40923b3eb3cSopenharmony_ci */ 41023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest026, TestSize.Level1) 41123b3eb3cSopenharmony_ci{ 41223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 41323b3eb3cSopenharmony_ci int32_t ret = AnimatorPlay(nullptr); 41423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 41523b3eb3cSopenharmony_ci} 41623b3eb3cSopenharmony_ci 41723b3eb3cSopenharmony_ci/** 41823b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest027 41923b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorPlay function. 42023b3eb3cSopenharmony_ci * @tc.type: FUNC 42123b3eb3cSopenharmony_ci */ 42223b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest027, TestSize.Level1) 42323b3eb3cSopenharmony_ci{ 42423b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 42523b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 42623b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 42723b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 42823b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 42923b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 43023b3eb3cSopenharmony_ci animatorHandle->animator = animator; 43123b3eb3cSopenharmony_ci int32_t ret = AnimatorPlay(animatorHandle); 43223b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 43323b3eb3cSopenharmony_ci 43423b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 43523b3eb3cSopenharmony_ci animatorHandle = nullptr; 43623b3eb3cSopenharmony_ci delete option; 43723b3eb3cSopenharmony_ci} 43823b3eb3cSopenharmony_ci 43923b3eb3cSopenharmony_ci/** 44023b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest028 44123b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorFinish function. 44223b3eb3cSopenharmony_ci * @tc.type: FUNC 44323b3eb3cSopenharmony_ci */ 44423b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest028, TestSize.Level1) 44523b3eb3cSopenharmony_ci{ 44623b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 44723b3eb3cSopenharmony_ci int32_t ret = AnimatorFinish(nullptr); 44823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 44923b3eb3cSopenharmony_ci} 45023b3eb3cSopenharmony_ci 45123b3eb3cSopenharmony_ci/** 45223b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest029 45323b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorFinish function. 45423b3eb3cSopenharmony_ci * @tc.type: FUNC 45523b3eb3cSopenharmony_ci */ 45623b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest029, TestSize.Level1) 45723b3eb3cSopenharmony_ci{ 45823b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 45923b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 46023b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 46123b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 46223b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 46323b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 46423b3eb3cSopenharmony_ci animatorHandle->animator = animator; 46523b3eb3cSopenharmony_ci int32_t ret = AnimatorFinish(animatorHandle); 46623b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 46723b3eb3cSopenharmony_ci 46823b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 46923b3eb3cSopenharmony_ci animatorHandle = nullptr; 47023b3eb3cSopenharmony_ci delete option; 47123b3eb3cSopenharmony_ci} 47223b3eb3cSopenharmony_ci 47323b3eb3cSopenharmony_ci/** 47423b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest030 47523b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorPause function. 47623b3eb3cSopenharmony_ci * @tc.type: FUNC 47723b3eb3cSopenharmony_ci */ 47823b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest030, TestSize.Level1) 47923b3eb3cSopenharmony_ci{ 48023b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 48123b3eb3cSopenharmony_ci int32_t ret = AnimatorPause(nullptr); 48223b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 48323b3eb3cSopenharmony_ci} 48423b3eb3cSopenharmony_ci 48523b3eb3cSopenharmony_ci/** 48623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest031 48723b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorPause function. 48823b3eb3cSopenharmony_ci * @tc.type: FUNC 48923b3eb3cSopenharmony_ci */ 49023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest031, TestSize.Level1) 49123b3eb3cSopenharmony_ci{ 49223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 49323b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 49423b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 49523b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 49623b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 49723b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 49823b3eb3cSopenharmony_ci animatorHandle->animator = animator; 49923b3eb3cSopenharmony_ci int32_t ret = AnimatorPause(animatorHandle); 50023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 50123b3eb3cSopenharmony_ci 50223b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 50323b3eb3cSopenharmony_ci animatorHandle = nullptr; 50423b3eb3cSopenharmony_ci delete option; 50523b3eb3cSopenharmony_ci} 50623b3eb3cSopenharmony_ci 50723b3eb3cSopenharmony_ci/** 50823b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest032 50923b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorCancel function. 51023b3eb3cSopenharmony_ci * @tc.type: FUNC 51123b3eb3cSopenharmony_ci */ 51223b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest032, TestSize.Level1) 51323b3eb3cSopenharmony_ci{ 51423b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 51523b3eb3cSopenharmony_ci int32_t ret = AnimatorCancel(nullptr); 51623b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 51723b3eb3cSopenharmony_ci} 51823b3eb3cSopenharmony_ci 51923b3eb3cSopenharmony_ci/** 52023b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest033 52123b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorCancel function. 52223b3eb3cSopenharmony_ci * @tc.type: FUNC 52323b3eb3cSopenharmony_ci */ 52423b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest033, TestSize.Level1) 52523b3eb3cSopenharmony_ci{ 52623b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 52723b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 52823b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 52923b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 53023b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 53123b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 53223b3eb3cSopenharmony_ci animatorHandle->animator = animator; 53323b3eb3cSopenharmony_ci int32_t ret = AnimatorCancel(animatorHandle); 53423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 53523b3eb3cSopenharmony_ci 53623b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 53723b3eb3cSopenharmony_ci animatorHandle = nullptr; 53823b3eb3cSopenharmony_ci delete option; 53923b3eb3cSopenharmony_ci} 54023b3eb3cSopenharmony_ci 54123b3eb3cSopenharmony_ci/** 54223b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest034 54323b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorReverse function. 54423b3eb3cSopenharmony_ci * @tc.type: FUNC 54523b3eb3cSopenharmony_ci */ 54623b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest034, TestSize.Level1) 54723b3eb3cSopenharmony_ci{ 54823b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 54923b3eb3cSopenharmony_ci int32_t ret = AnimatorReverse(nullptr); 55023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 55123b3eb3cSopenharmony_ci} 55223b3eb3cSopenharmony_ci 55323b3eb3cSopenharmony_ci/** 55423b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest035 55523b3eb3cSopenharmony_ci * @tc.desc: Test AnimatorReverse function. 55623b3eb3cSopenharmony_ci * @tc.type: FUNC 55723b3eb3cSopenharmony_ci */ 55823b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest035, TestSize.Level1) 55923b3eb3cSopenharmony_ci{ 56023b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 56123b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 56223b3eb3cSopenharmony_ci ArkUI_AnimatorOption* option = new ArkUI_AnimatorOption(); 56323b3eb3cSopenharmony_ci ArkUI_AnimatorHandle animatorHandle = CreateAnimator(&context, option); 56423b3eb3cSopenharmony_ci ASSERT_NE(animatorHandle, nullptr); 56523b3eb3cSopenharmony_ci ArkUIAnimatorHandle animator = new ArkUIAnimator(); 56623b3eb3cSopenharmony_ci animatorHandle->animator = animator; 56723b3eb3cSopenharmony_ci int32_t ret = AnimatorReverse(animatorHandle); 56823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 56923b3eb3cSopenharmony_ci 57023b3eb3cSopenharmony_ci DisposeAnimator(animatorHandle); 57123b3eb3cSopenharmony_ci animatorHandle = nullptr; 57223b3eb3cSopenharmony_ci delete option; 57323b3eb3cSopenharmony_ci} 57423b3eb3cSopenharmony_ci 57523b3eb3cSopenharmony_ci/** 57623b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest036 57723b3eb3cSopenharmony_ci * @tc.desc: Test KeyframeAnimateTo function. 57823b3eb3cSopenharmony_ci * @tc.type: FUNC 57923b3eb3cSopenharmony_ci */ 58023b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest036, TestSize.Level1) 58123b3eb3cSopenharmony_ci{ 58223b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 58323b3eb3cSopenharmony_ci int32_t ret = KeyframeAnimateTo(nullptr, nullptr); 58423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 58523b3eb3cSopenharmony_ci} 58623b3eb3cSopenharmony_ci 58723b3eb3cSopenharmony_ci/** 58823b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest037 58923b3eb3cSopenharmony_ci * @tc.desc: Test KeyframeAnimateTo function. 59023b3eb3cSopenharmony_ci * @tc.type: FUNC 59123b3eb3cSopenharmony_ci */ 59223b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest037, TestSize.Level1) 59323b3eb3cSopenharmony_ci{ 59423b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 59523b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 59623b3eb3cSopenharmony_ci ArkUI_KeyframeAnimateOption* option = new ArkUI_KeyframeAnimateOption(); 59723b3eb3cSopenharmony_ci struct ArkUI_KeyframeState keyframe = {0, nullptr, nullptr, nullptr}; 59823b3eb3cSopenharmony_ci option->keyframes.push_back(keyframe); 59923b3eb3cSopenharmony_ci int32_t ret = KeyframeAnimateTo(&context, option); 60023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 60123b3eb3cSopenharmony_ci delete option; 60223b3eb3cSopenharmony_ci} 60323b3eb3cSopenharmony_ci 60423b3eb3cSopenharmony_ci/** 60523b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest038 60623b3eb3cSopenharmony_ci * @tc.desc: Test AnimateTo function. 60723b3eb3cSopenharmony_ci * @tc.type: FUNC 60823b3eb3cSopenharmony_ci */ 60923b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest038, TestSize.Level1) 61023b3eb3cSopenharmony_ci{ 61123b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 61223b3eb3cSopenharmony_ci int32_t ret = AnimateTo(nullptr, nullptr, nullptr, nullptr); 61323b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 61423b3eb3cSopenharmony_ci} 61523b3eb3cSopenharmony_ci 61623b3eb3cSopenharmony_ci/** 61723b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest039 61823b3eb3cSopenharmony_ci * @tc.desc: Test AnimateTo function. 61923b3eb3cSopenharmony_ci * @tc.type: FUNC 62023b3eb3cSopenharmony_ci */ 62123b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest039, TestSize.Level1) 62223b3eb3cSopenharmony_ci{ 62323b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 62423b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 62523b3eb3cSopenharmony_ci ArkUI_AnimateOption* option = new ArkUI_AnimateOption(); 62623b3eb3cSopenharmony_ci ArkUI_ContextCallback* update = new ArkUI_ContextCallback(); 62723b3eb3cSopenharmony_ci update->callback = AnimateCompleteCallback; 62823b3eb3cSopenharmony_ci ArkUI_AnimateCompleteCallback* complete = new ArkUI_AnimateCompleteCallback(); 62923b3eb3cSopenharmony_ci int32_t ret = AnimateTo(&context, option, update, complete); 63023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 63123b3eb3cSopenharmony_ci delete option; 63223b3eb3cSopenharmony_ci delete update; 63323b3eb3cSopenharmony_ci delete complete; 63423b3eb3cSopenharmony_ci} 63523b3eb3cSopenharmony_ci 63623b3eb3cSopenharmony_ci/** 63723b3eb3cSopenharmony_ci * @tc.name: AnimateImplTest040 63823b3eb3cSopenharmony_ci * @tc.desc: Test AnimateTo function. 63923b3eb3cSopenharmony_ci * @tc.type: FUNC 64023b3eb3cSopenharmony_ci */ 64123b3eb3cSopenharmony_ciHWTEST_F(AnimateImplTest, AnimateImplTest040, TestSize.Level1) 64223b3eb3cSopenharmony_ci{ 64323b3eb3cSopenharmony_ci ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl()); 64423b3eb3cSopenharmony_ci struct ArkUI_Context context= {1}; 64523b3eb3cSopenharmony_ci ArkUI_AnimateOption* option = new ArkUI_AnimateOption(); 64623b3eb3cSopenharmony_ci ArkUI_CurveHandle curve = new ArkUI_Curve(); 64723b3eb3cSopenharmony_ci ArkUI_ExpectedFrameRateRange* expectedFrameRateRange = new ArkUI_ExpectedFrameRateRange(); 64823b3eb3cSopenharmony_ci option->iCurve = curve; 64923b3eb3cSopenharmony_ci option->expectedFrameRateRange = expectedFrameRateRange; 65023b3eb3cSopenharmony_ci ArkUI_ContextCallback* update = new ArkUI_ContextCallback(); 65123b3eb3cSopenharmony_ci update->callback = AnimateCompleteCallback; 65223b3eb3cSopenharmony_ci ArkUI_AnimateCompleteCallback* complete = new ArkUI_AnimateCompleteCallback(); 65323b3eb3cSopenharmony_ci complete->type = ARKUI_FINISH_CALLBACK_LOGICALLY; 65423b3eb3cSopenharmony_ci complete->callback = AnimateCompleteCallback; 65523b3eb3cSopenharmony_ci void* userData = malloc(100); 65623b3eb3cSopenharmony_ci complete->userData = userData; 65723b3eb3cSopenharmony_ci int32_t ret = AnimateTo(&context, option, update, complete); 65823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 65923b3eb3cSopenharmony_ci free(userData); 66023b3eb3cSopenharmony_ci delete option; 66123b3eb3cSopenharmony_ci delete curve; 66223b3eb3cSopenharmony_ci delete update; 66323b3eb3cSopenharmony_ci delete complete; 66423b3eb3cSopenharmony_ci}