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::NodeModel; 3023b3eb3cSopenharmony_ci 3123b3eb3cSopenharmony_ciclass NodeExtenedTest : public testing::Test { 3223b3eb3cSopenharmony_cipublic: 3323b3eb3cSopenharmony_ci static void SetUpTestCase() 3423b3eb3cSopenharmony_ci { 3523b3eb3cSopenharmony_ci InitialFullImpl(); 3623b3eb3cSopenharmony_ci }; 3723b3eb3cSopenharmony_ci static void TearDownTestCase() {}; 3823b3eb3cSopenharmony_ci}; 3923b3eb3cSopenharmony_ci 4023b3eb3cSopenharmony_civoid EventReceiverHandle(ArkUI_NodeCustomEvent* event) {} 4123b3eb3cSopenharmony_ci/** 4223b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest001 4323b3eb3cSopenharmony_ci * @tc.desc: Test NodeAddExtraData function. 4423b3eb3cSopenharmony_ci * @tc.type: FUNC 4523b3eb3cSopenharmony_ci */ 4623b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest001, TestSize.Level1) 4723b3eb3cSopenharmony_ci{ 4823b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 4923b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 5023b3eb3cSopenharmony_ci 5123b3eb3cSopenharmony_ci void* userData = nullptr; 5223b3eb3cSopenharmony_ci NodeAddExtraData(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 0, userData); 5323b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle->extraCustomData, nullptr); 5423b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 5523b3eb3cSopenharmony_ci nodeHandle = nullptr; 5623b3eb3cSopenharmony_ci} 5723b3eb3cSopenharmony_ci 5823b3eb3cSopenharmony_ci/** 5923b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest002 6023b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 6123b3eb3cSopenharmony_ci * @tc.type: FUNC 6223b3eb3cSopenharmony_ci */ 6323b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest002, TestSize.Level1) 6423b3eb3cSopenharmony_ci{ 6523b3eb3cSopenharmony_ci void* userData = nullptr; 6623b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nullptr, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 6723b3eb3cSopenharmony_ci 0, userData); 6823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 6923b3eb3cSopenharmony_ci} 7023b3eb3cSopenharmony_ci 7123b3eb3cSopenharmony_ci/** 7223b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest003 7323b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 7423b3eb3cSopenharmony_ci * @tc.type: FUNC 7523b3eb3cSopenharmony_ci */ 7623b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest003, TestSize.Level1) 7723b3eb3cSopenharmony_ci{ 7823b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 7923b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 8023b3eb3cSopenharmony_ci 8123b3eb3cSopenharmony_ci void* userData = nullptr; 8223b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, static_cast<ArkUI_NodeCustomEventType>(-1), 0, userData); 8323b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED); 8423b3eb3cSopenharmony_ci 8523b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 8623b3eb3cSopenharmony_ci nodeHandle = nullptr; 8723b3eb3cSopenharmony_ci} 8823b3eb3cSopenharmony_ci 8923b3eb3cSopenharmony_ci/** 9023b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest004 9123b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 9223b3eb3cSopenharmony_ci * @tc.type: FUNC 9323b3eb3cSopenharmony_ci */ 9423b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest004, TestSize.Level1) 9523b3eb3cSopenharmony_ci{ 9623b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 9723b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 9823b3eb3cSopenharmony_ci 9923b3eb3cSopenharmony_ci void* userData = nullptr; 10023b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 10123b3eb3cSopenharmony_ci 0, userData); 10223b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED); 10323b3eb3cSopenharmony_ci 10423b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 10523b3eb3cSopenharmony_ci nodeHandle = nullptr; 10623b3eb3cSopenharmony_ci} 10723b3eb3cSopenharmony_ci 10823b3eb3cSopenharmony_ci/** 10923b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest005 11023b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 11123b3eb3cSopenharmony_ci * @tc.type: FUNC 11223b3eb3cSopenharmony_ci */ 11323b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest005, TestSize.Level1) 11423b3eb3cSopenharmony_ci{ 11523b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 11623b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 11723b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 11823b3eb3cSopenharmony_ci void* userData = nullptr; 11923b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 12023b3eb3cSopenharmony_ci 0, userData); 12123b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 12223b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE); 12323b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 12423b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 12523b3eb3cSopenharmony_ci nodeHandle = nullptr; 12623b3eb3cSopenharmony_ci} 12723b3eb3cSopenharmony_ci 12823b3eb3cSopenharmony_ci/** 12923b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest006 13023b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 13123b3eb3cSopenharmony_ci * @tc.type: FUNC 13223b3eb3cSopenharmony_ci */ 13323b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest006, TestSize.Level1) 13423b3eb3cSopenharmony_ci{ 13523b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 13623b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 13723b3eb3cSopenharmony_ci 13823b3eb3cSopenharmony_ci void* userData = nullptr; 13923b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_LAYOUT, 14023b3eb3cSopenharmony_ci 0, userData); 14123b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED); 14223b3eb3cSopenharmony_ci 14323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 14423b3eb3cSopenharmony_ci nodeHandle = nullptr; 14523b3eb3cSopenharmony_ci} 14623b3eb3cSopenharmony_ci 14723b3eb3cSopenharmony_ci/** 14823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest007 14923b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 15023b3eb3cSopenharmony_ci * @tc.type: FUNC 15123b3eb3cSopenharmony_ci */ 15223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest007, TestSize.Level1) 15323b3eb3cSopenharmony_ci{ 15423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 15523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 15623b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 15723b3eb3cSopenharmony_ci void* userData = nullptr; 15823b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_LAYOUT, 15923b3eb3cSopenharmony_ci 0, userData); 16023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 16123b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_LAYOUT); 16223b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 16323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 16423b3eb3cSopenharmony_ci nodeHandle = nullptr; 16523b3eb3cSopenharmony_ci} 16623b3eb3cSopenharmony_ci 16723b3eb3cSopenharmony_ci/** 16823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest008 16923b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 17023b3eb3cSopenharmony_ci * @tc.type: FUNC 17123b3eb3cSopenharmony_ci */ 17223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest008, TestSize.Level1) 17323b3eb3cSopenharmony_ci{ 17423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 17523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 17623b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 17723b3eb3cSopenharmony_ci void* userData = nullptr; 17823b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_DRAW, 17923b3eb3cSopenharmony_ci 0, userData); 18023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 18123b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_DRAW); 18223b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 18323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 18423b3eb3cSopenharmony_ci nodeHandle = nullptr; 18523b3eb3cSopenharmony_ci} 18623b3eb3cSopenharmony_ci 18723b3eb3cSopenharmony_ci/** 18823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest009 18923b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 19023b3eb3cSopenharmony_ci * @tc.type: FUNC 19123b3eb3cSopenharmony_ci */ 19223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest009, TestSize.Level1) 19323b3eb3cSopenharmony_ci{ 19423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 19523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 19623b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 19723b3eb3cSopenharmony_ci void* userData = nullptr; 19823b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, 19923b3eb3cSopenharmony_ci ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW, 0, userData); 20023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 20123b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_FOREGROUND_DRAW); 20223b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 20323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 20423b3eb3cSopenharmony_ci nodeHandle = nullptr; 20523b3eb3cSopenharmony_ci} 20623b3eb3cSopenharmony_ci 20723b3eb3cSopenharmony_ci/** 20823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest010 20923b3eb3cSopenharmony_ci * @tc.desc: Test RegisterNodeCustomEvent function. 21023b3eb3cSopenharmony_ci * @tc.type: FUNC 21123b3eb3cSopenharmony_ci */ 21223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest010, TestSize.Level1) 21323b3eb3cSopenharmony_ci{ 21423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 21523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 21623b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 21723b3eb3cSopenharmony_ci void* userData = nullptr; 21823b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, 21923b3eb3cSopenharmony_ci ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW, 0, userData); 22023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 22123b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW); 22223b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 22323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 22423b3eb3cSopenharmony_ci nodeHandle = nullptr; 22523b3eb3cSopenharmony_ci} 22623b3eb3cSopenharmony_ci 22723b3eb3cSopenharmony_ci/** 22823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest011 22923b3eb3cSopenharmony_ci * @tc.desc: Test NodeRemoveExtraData function. 23023b3eb3cSopenharmony_ci * @tc.type: FUNC 23123b3eb3cSopenharmony_ci */ 23223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest011, TestSize.Level1) 23323b3eb3cSopenharmony_ci{ 23423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 23523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 23623b3eb3cSopenharmony_ci 23723b3eb3cSopenharmony_ci void* userData = nullptr; 23823b3eb3cSopenharmony_ci NodeAddExtraData(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 0, userData); 23923b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle->extraCustomData, nullptr); 24023b3eb3cSopenharmony_ci NodeRemoveExtraData(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE); 24123b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 24223b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 24323b3eb3cSopenharmony_ci nodeHandle = nullptr; 24423b3eb3cSopenharmony_ci} 24523b3eb3cSopenharmony_ci 24623b3eb3cSopenharmony_ci/** 24723b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest012 24823b3eb3cSopenharmony_ci * @tc.desc: Test NodeRemoveExtraData function. 24923b3eb3cSopenharmony_ci * @tc.type: FUNC 25023b3eb3cSopenharmony_ci */ 25123b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest012, TestSize.Level1) 25223b3eb3cSopenharmony_ci{ 25323b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 25423b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 25523b3eb3cSopenharmony_ci 25623b3eb3cSopenharmony_ci void* userData = nullptr; 25723b3eb3cSopenharmony_ci NodeAddExtraData(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 0, userData); 25823b3eb3cSopenharmony_ci NodeRemoveExtraData(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW); 25923b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle->extraCustomData, nullptr); 26023b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 26123b3eb3cSopenharmony_ci nodeHandle = nullptr; 26223b3eb3cSopenharmony_ci} 26323b3eb3cSopenharmony_ci 26423b3eb3cSopenharmony_ci/** 26523b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest013 26623b3eb3cSopenharmony_ci * @tc.desc: Test UnregisterNodeCustomEvent function. 26723b3eb3cSopenharmony_ci * @tc.type: FUNC 26823b3eb3cSopenharmony_ci */ 26923b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest013, TestSize.Level1) 27023b3eb3cSopenharmony_ci{ 27123b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nullptr, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE); 27223b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 27323b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 27423b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 27523b3eb3cSopenharmony_ci void* userData = nullptr; 27623b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 27723b3eb3cSopenharmony_ci 0, userData); 27823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 27923b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE); 28023b3eb3cSopenharmony_ci ASSERT_EQ(nodeHandle->extraCustomData, nullptr); 28123b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 28223b3eb3cSopenharmony_ci nodeHandle = nullptr; 28323b3eb3cSopenharmony_ci} 28423b3eb3cSopenharmony_ci 28523b3eb3cSopenharmony_ci/** 28623b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest014 28723b3eb3cSopenharmony_ci * @tc.desc: Test UnregisterNodeCustomEvent function. 28823b3eb3cSopenharmony_ci * @tc.type: FUNC 28923b3eb3cSopenharmony_ci */ 29023b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest014, TestSize.Level1) 29123b3eb3cSopenharmony_ci{ 29223b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 29323b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 29423b3eb3cSopenharmony_ci nodeHandle->type = ArkUI_NodeType::ARKUI_NODE_CUSTOM; 29523b3eb3cSopenharmony_ci void* userData = nullptr; 29623b3eb3cSopenharmony_ci int32_t ret = RegisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 29723b3eb3cSopenharmony_ci 0, userData); 29823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 29923b3eb3cSopenharmony_ci UnregisterNodeCustomEvent(nodeHandle, ArkUI_NodeCustomEventType::ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW); 30023b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle->extraCustomData, nullptr); 30123b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 30223b3eb3cSopenharmony_ci nodeHandle = nullptr; 30323b3eb3cSopenharmony_ci} 30423b3eb3cSopenharmony_ci 30523b3eb3cSopenharmony_ci/** 30623b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest015 30723b3eb3cSopenharmony_ci * @tc.desc: Test HandleCustomEvent function. 30823b3eb3cSopenharmony_ci * @tc.type: FUNC 30923b3eb3cSopenharmony_ci */ 31023b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest015, TestSize.Level1) 31123b3eb3cSopenharmony_ci{ 31223b3eb3cSopenharmony_ci HandleCustomEvent(nullptr); 31323b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 31423b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 31523b3eb3cSopenharmony_ci nodeHandle->customEventListeners = new std::set<void (*)(ArkUI_NodeCustomEvent*)>(); 31623b3eb3cSopenharmony_ci ArkUI_NodeCustomEvent event; 31723b3eb3cSopenharmony_ci event.node = nodeHandle; 31823b3eb3cSopenharmony_ci RegisterNodeCustomReceiver(EventReceiverHandle); 31923b3eb3cSopenharmony_ci HandleCustomEvent(&event); 32023b3eb3cSopenharmony_ci 32123b3eb3cSopenharmony_ci int32_t ret = SetMeasuredSize(nullptr, 0, 0); 32223b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 32323b3eb3cSopenharmony_ci ret = SetMeasuredSize(nodeHandle, 1, 1); 32423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 32523b3eb3cSopenharmony_ci ArkUI_IntSize size = GetMeasuredSize(nodeHandle); 32623b3eb3cSopenharmony_ci ASSERT_EQ(size.width, 1); 32723b3eb3cSopenharmony_ci ASSERT_EQ(size.height, 1); 32823b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 32923b3eb3cSopenharmony_ci nodeHandle = nullptr; 33023b3eb3cSopenharmony_ci} 33123b3eb3cSopenharmony_ci 33223b3eb3cSopenharmony_ci/** 33323b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest016 33423b3eb3cSopenharmony_ci * @tc.desc: Test HandleCustomEvent function. 33523b3eb3cSopenharmony_ci * @tc.type: FUNC 33623b3eb3cSopenharmony_ci */ 33723b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest016, TestSize.Level1) 33823b3eb3cSopenharmony_ci{ 33923b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 34023b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 34123b3eb3cSopenharmony_ci nodeHandle->customEventListeners = new std::set<void (*)(ArkUI_NodeCustomEvent*)>(); 34223b3eb3cSopenharmony_ci ArkUI_NodeCustomEvent event; 34323b3eb3cSopenharmony_ci event.node = nodeHandle; 34423b3eb3cSopenharmony_ci UnregisterNodeCustomEventReceiver(); 34523b3eb3cSopenharmony_ci HandleCustomEvent(&event); 34623b3eb3cSopenharmony_ci 34723b3eb3cSopenharmony_ci int32_t ret = SetLayoutPosition(nullptr, 0, 0); 34823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 34923b3eb3cSopenharmony_ci ret = SetLayoutPosition(nodeHandle, 1, 1); 35023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 35123b3eb3cSopenharmony_ci ArkUI_IntOffset offset = GetLayoutPosition(nodeHandle); 35223b3eb3cSopenharmony_ci ASSERT_EQ(offset.x, 1); 35323b3eb3cSopenharmony_ci ASSERT_EQ(offset.y, 1); 35423b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 35523b3eb3cSopenharmony_ci nodeHandle = nullptr; 35623b3eb3cSopenharmony_ci} 35723b3eb3cSopenharmony_ci 35823b3eb3cSopenharmony_ci/** 35923b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest017 36023b3eb3cSopenharmony_ci * @tc.desc: Test HandleInnerCustomEvent function. 36123b3eb3cSopenharmony_ci * @tc.type: FUNC 36223b3eb3cSopenharmony_ci */ 36323b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest017, TestSize.Level1) 36423b3eb3cSopenharmony_ci{ 36523b3eb3cSopenharmony_ci HandleInnerCustomEvent(nullptr); 36623b3eb3cSopenharmony_ci struct ArkUICustomNodeEvent* arkUICustomNodeEvent = new ArkUICustomNodeEvent(); 36723b3eb3cSopenharmony_ci ASSERT_NE(arkUICustomNodeEvent, nullptr); 36823b3eb3cSopenharmony_ci HandleInnerCustomEvent(arkUICustomNodeEvent); 36923b3eb3cSopenharmony_ci} 37023b3eb3cSopenharmony_ci 37123b3eb3cSopenharmony_ci/** 37223b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest018 37323b3eb3cSopenharmony_ci * @tc.desc: Test AddNodeCustomEventReceiver function. 37423b3eb3cSopenharmony_ci * @tc.type: FUNC 37523b3eb3cSopenharmony_ci */ 37623b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest018, TestSize.Level1) 37723b3eb3cSopenharmony_ci{ 37823b3eb3cSopenharmony_ci int32_t ret = AddNodeCustomEventReceiver(nullptr, nullptr); 37923b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 38023b3eb3cSopenharmony_ci} 38123b3eb3cSopenharmony_ci 38223b3eb3cSopenharmony_ci/** 38323b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest019 38423b3eb3cSopenharmony_ci * @tc.desc: Test AddNodeCustomEventReceiver function. 38523b3eb3cSopenharmony_ci * @tc.type: FUNC 38623b3eb3cSopenharmony_ci */ 38723b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest019, TestSize.Level1) 38823b3eb3cSopenharmony_ci{ 38923b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 39023b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 39123b3eb3cSopenharmony_ci int32_t ret = AddNodeCustomEventReceiver(nodeHandle, EventReceiverHandle); 39223b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 39323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 39423b3eb3cSopenharmony_ci nodeHandle = nullptr; 39523b3eb3cSopenharmony_ci} 39623b3eb3cSopenharmony_ci 39723b3eb3cSopenharmony_ci/** 39823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest020 39923b3eb3cSopenharmony_ci * @tc.desc: Test AddNodeCustomEventReceiver function. 40023b3eb3cSopenharmony_ci * @tc.type: FUNC 40123b3eb3cSopenharmony_ci */ 40223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest020, TestSize.Level1) 40323b3eb3cSopenharmony_ci{ 40423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 40523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 40623b3eb3cSopenharmony_ci nodeHandle->customEventListeners = new std::set<void (*)(ArkUI_NodeCustomEvent*)>(); 40723b3eb3cSopenharmony_ci int32_t ret = AddNodeCustomEventReceiver(nodeHandle, EventReceiverHandle); 40823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 40923b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 41023b3eb3cSopenharmony_ci nodeHandle = nullptr; 41123b3eb3cSopenharmony_ci} 41223b3eb3cSopenharmony_ci 41323b3eb3cSopenharmony_ci/** 41423b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest021 41523b3eb3cSopenharmony_ci * @tc.desc: Test RemoveNodeCustomEventReceiver function. 41623b3eb3cSopenharmony_ci * @tc.type: FUNC 41723b3eb3cSopenharmony_ci */ 41823b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest021, TestSize.Level1) 41923b3eb3cSopenharmony_ci{ 42023b3eb3cSopenharmony_ci int32_t ret = RemoveNodeCustomEventReceiver(nullptr, nullptr); 42123b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 42223b3eb3cSopenharmony_ci} 42323b3eb3cSopenharmony_ci 42423b3eb3cSopenharmony_ci/** 42523b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest022 42623b3eb3cSopenharmony_ci * @tc.desc: Test RemoveNodeCustomEventReceiver function. 42723b3eb3cSopenharmony_ci * @tc.type: FUNC 42823b3eb3cSopenharmony_ci */ 42923b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest022, TestSize.Level1) 43023b3eb3cSopenharmony_ci{ 43123b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 43223b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 43323b3eb3cSopenharmony_ci nodeHandle->customEventListeners = new std::set<void (*)(ArkUI_NodeCustomEvent*)>(); 43423b3eb3cSopenharmony_ci int32_t ret = RemoveNodeCustomEventReceiver(nodeHandle, EventReceiverHandle); 43523b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 43623b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 43723b3eb3cSopenharmony_ci nodeHandle = nullptr; 43823b3eb3cSopenharmony_ci} 43923b3eb3cSopenharmony_ci 44023b3eb3cSopenharmony_ci/** 44123b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest023 44223b3eb3cSopenharmony_ci * @tc.desc: Test GetLayoutConstraint function. 44323b3eb3cSopenharmony_ci * @tc.type: FUNC 44423b3eb3cSopenharmony_ci */ 44523b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest023, TestSize.Level1) 44623b3eb3cSopenharmony_ci{ 44723b3eb3cSopenharmony_ci int32_t ret = GetLayoutConstraint(nullptr, nullptr); 44823b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 44923b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 45023b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 45123b3eb3cSopenharmony_ci struct ArkUI_LayoutConstraint layoutConstraint = {0, 0, 0, 0, 0, 0}; 45223b3eb3cSopenharmony_ci ret = GetLayoutConstraint(nodeHandle, &layoutConstraint); 45323b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 45423b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 45523b3eb3cSopenharmony_ci nodeHandle = nullptr; 45623b3eb3cSopenharmony_ci} 45723b3eb3cSopenharmony_ci 45823b3eb3cSopenharmony_ci/** 45923b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest024 46023b3eb3cSopenharmony_ci * @tc.desc: Test MeasureNode function. 46123b3eb3cSopenharmony_ci * @tc.type: FUNC 46223b3eb3cSopenharmony_ci */ 46323b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest024, TestSize.Level1) 46423b3eb3cSopenharmony_ci{ 46523b3eb3cSopenharmony_ci int32_t ret = MeasureNode(nullptr, nullptr); 46623b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 46723b3eb3cSopenharmony_ci} 46823b3eb3cSopenharmony_ci 46923b3eb3cSopenharmony_ci/** 47023b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest025 47123b3eb3cSopenharmony_ci * @tc.desc: Test MeasureNode function. 47223b3eb3cSopenharmony_ci * @tc.type: FUNC 47323b3eb3cSopenharmony_ci */ 47423b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest025, TestSize.Level1) 47523b3eb3cSopenharmony_ci{ 47623b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 47723b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 47823b3eb3cSopenharmony_ci struct ArkUI_LayoutConstraint layoutConstraint = {0, 0, 0, 0, 0, 0}; 47923b3eb3cSopenharmony_ci int32_t ret = MeasureNode(nodeHandle, &layoutConstraint); 48023b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 48123b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 48223b3eb3cSopenharmony_ci nodeHandle = nullptr; 48323b3eb3cSopenharmony_ci} 48423b3eb3cSopenharmony_ci 48523b3eb3cSopenharmony_ci/** 48623b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest026 48723b3eb3cSopenharmony_ci * @tc.desc: Test LayoutNode function. 48823b3eb3cSopenharmony_ci * @tc.type: FUNC 48923b3eb3cSopenharmony_ci */ 49023b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest026, TestSize.Level1) 49123b3eb3cSopenharmony_ci{ 49223b3eb3cSopenharmony_ci int32_t ret = LayoutNode(nullptr, 0, 0); 49323b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID); 49423b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 49523b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 49623b3eb3cSopenharmony_ci ret = LayoutNode(nodeHandle, 0, 0); 49723b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 49823b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 49923b3eb3cSopenharmony_ci nodeHandle = nullptr; 50023b3eb3cSopenharmony_ci} 50123b3eb3cSopenharmony_ci 50223b3eb3cSopenharmony_ci/** 50323b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest027 50423b3eb3cSopenharmony_ci * @tc.desc: Test GetTotalChildCount function. 50523b3eb3cSopenharmony_ci * @tc.type: FUNC 50623b3eb3cSopenharmony_ci */ 50723b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest027, TestSize.Level1) 50823b3eb3cSopenharmony_ci{ 50923b3eb3cSopenharmony_ci int32_t ret = GetTotalChildCount(nullptr); 51023b3eb3cSopenharmony_ci ASSERT_EQ(ret, 0); 51123b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 51223b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 51323b3eb3cSopenharmony_ci ret = GetTotalChildCount(nodeHandle); 51423b3eb3cSopenharmony_ci ASSERT_EQ(ret, 0); 51523b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 51623b3eb3cSopenharmony_ci nodeHandle = nullptr; 51723b3eb3cSopenharmony_ci} 51823b3eb3cSopenharmony_ci 51923b3eb3cSopenharmony_ci/** 52023b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest028 52123b3eb3cSopenharmony_ci * @tc.desc: Test GetChildAt function. 52223b3eb3cSopenharmony_ci * @tc.type: FUNC 52323b3eb3cSopenharmony_ci */ 52423b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest028, TestSize.Level1) 52523b3eb3cSopenharmony_ci{ 52623b3eb3cSopenharmony_ci ArkUI_NodeHandle node = GetChildAt(nullptr, 0); 52723b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 52823b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 52923b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 53023b3eb3cSopenharmony_ci node = GetChildAt(nodeHandle, 0); 53123b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 53223b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 53323b3eb3cSopenharmony_ci nodeHandle = nullptr; 53423b3eb3cSopenharmony_ci} 53523b3eb3cSopenharmony_ci 53623b3eb3cSopenharmony_ci/** 53723b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest029 53823b3eb3cSopenharmony_ci * @tc.desc: Test GetFirstChild function. 53923b3eb3cSopenharmony_ci * @tc.type: FUNC 54023b3eb3cSopenharmony_ci */ 54123b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest029, TestSize.Level1) 54223b3eb3cSopenharmony_ci{ 54323b3eb3cSopenharmony_ci ArkUI_NodeHandle node = GetFirstChild(nullptr); 54423b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 54523b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 54623b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 54723b3eb3cSopenharmony_ci node = GetFirstChild(nodeHandle); 54823b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 54923b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 55023b3eb3cSopenharmony_ci nodeHandle = nullptr; 55123b3eb3cSopenharmony_ci} 55223b3eb3cSopenharmony_ci 55323b3eb3cSopenharmony_ci/** 55423b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest030 55523b3eb3cSopenharmony_ci * @tc.desc: Test GetLastChild function. 55623b3eb3cSopenharmony_ci * @tc.type: FUNC 55723b3eb3cSopenharmony_ci */ 55823b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest030, TestSize.Level1) 55923b3eb3cSopenharmony_ci{ 56023b3eb3cSopenharmony_ci ArkUI_NodeHandle node = GetLastChild(nullptr); 56123b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 56223b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 56323b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 56423b3eb3cSopenharmony_ci node = GetLastChild(nodeHandle); 56523b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 56623b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 56723b3eb3cSopenharmony_ci nodeHandle = nullptr; 56823b3eb3cSopenharmony_ci} 56923b3eb3cSopenharmony_ci 57023b3eb3cSopenharmony_ci/** 57123b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest031 57223b3eb3cSopenharmony_ci * @tc.desc: Test GetNextSibling function. 57323b3eb3cSopenharmony_ci * @tc.type: FUNC 57423b3eb3cSopenharmony_ci */ 57523b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest031, TestSize.Level1) 57623b3eb3cSopenharmony_ci{ 57723b3eb3cSopenharmony_ci ArkUI_NodeHandle node = GetNextSibling(nullptr); 57823b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 57923b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 58023b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 58123b3eb3cSopenharmony_ci node = GetNextSibling(nodeHandle); 58223b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 58323b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 58423b3eb3cSopenharmony_ci nodeHandle = nullptr; 58523b3eb3cSopenharmony_ci} 58623b3eb3cSopenharmony_ci 58723b3eb3cSopenharmony_ci/** 58823b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest032 58923b3eb3cSopenharmony_ci * @tc.desc: Test GetParent function. 59023b3eb3cSopenharmony_ci * @tc.type: FUNC 59123b3eb3cSopenharmony_ci */ 59223b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest032, TestSize.Level1) 59323b3eb3cSopenharmony_ci{ 59423b3eb3cSopenharmony_ci ArkUI_NodeHandle node = GetParent(nullptr); 59523b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 59623b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 59723b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 59823b3eb3cSopenharmony_ci node = GetParent(nodeHandle); 59923b3eb3cSopenharmony_ci ASSERT_EQ(node, nullptr); 60023b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 60123b3eb3cSopenharmony_ci nodeHandle = nullptr; 60223b3eb3cSopenharmony_ci} 60323b3eb3cSopenharmony_ci 60423b3eb3cSopenharmony_ci/** 60523b3eb3cSopenharmony_ci * @tc.name: NodeExtenedTest033 60623b3eb3cSopenharmony_ci * @tc.desc: Test GetParent function. 60723b3eb3cSopenharmony_ci * @tc.type: FUNC 60823b3eb3cSopenharmony_ci */ 60923b3eb3cSopenharmony_ciHWTEST_F(NodeExtenedTest, NodeExtenedTest033, TestSize.Level1) 61023b3eb3cSopenharmony_ci{ 61123b3eb3cSopenharmony_ci ArkUI_NodeHandle nodeHandle = CreateNode(ArkUI_NodeType::ARKUI_NODE_SWIPER); 61223b3eb3cSopenharmony_ci ASSERT_NE(nodeHandle, nullptr); 61323b3eb3cSopenharmony_ci int32_t ret = RemoveAllChildren(nodeHandle); 61423b3eb3cSopenharmony_ci ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR); 61523b3eb3cSopenharmony_ci DisposeNode(nodeHandle); 61623b3eb3cSopenharmony_ci nodeHandle = nullptr; 61723b3eb3cSopenharmony_ci}