1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "test/unittest/core/event/drag_event_test_ng.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS::Ace::NG {
22 /**
23  * @tc.name: DragEventActuatorRestartDragTaskTest001
24  * @tc.desc: Test RestartDragTask function.
25  * @tc.type: FUNC
26  */
27 HWTEST_F(DragEventTestNg, DragEventActuatorRestartDragTaskTest001, TestSize.Level1)
28 {
29     /**
30      * @tc.steps: step1. Create DragEventActuator.
31      */
32     auto eventHub = AceType::MakeRefPtr<EventHub>();
33     ASSERT_NE(eventHub, nullptr);
34     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
35     ASSERT_NE(framenode, nullptr);
36     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
37     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
38     ASSERT_NE(gestureEventHub, nullptr);
39     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
40         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
41     ASSERT_NE(dragEventActuator, nullptr);
42 
43     /**
44      * @tc.steps: step2. Execute RestartDragTask when actionStart_ is null.
45      */
46     auto info = GestureEvent();
47     dragEventActuator->RestartDragTask(info);
48     ASSERT_EQ(dragEventActuator->actionStart_, nullptr);
49 
50     /**
51      * @tc.steps: step3. Execute RestartDragTask when actionStart_ is not null.
52      */
53 
54     int unknownPropertyValue = UNKNOWN;
__anon3bb4a1c20102(GestureEvent& gestureInfo) 55     dragEventActuator->actionStart_ = [&unknownPropertyValue](GestureEvent& gestureInfo) mutable {
56         unknownPropertyValue++;
57     };
58     dragEventActuator->RestartDragTask(info);
59     ASSERT_NE(unknownPropertyValue, UNKNOWN);
60 }
61 
62 /**
63  * @tc.name: DragEventActuatorDragingStatusTest001
64  * @tc.desc: Test IsGlobalStatusSuitableForDragging and IsCurrentCodeStatusSuitableForDragging function.
65  * @tc.type: FUNC
66  */
67 HWTEST_F(DragEventTestNg, DragEventActuatorDragingStatusTest001, TestSize.Level1)
68 {
69     /**
70      * @tc.steps: step1. Create DragEventActuator.
71      */
72     auto eventHub = AceType::MakeRefPtr<EventHub>();
73     ASSERT_NE(eventHub, nullptr);
74     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
75     ASSERT_NE(framenode, nullptr);
76     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
77     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
78     ASSERT_NE(gestureEventHub, nullptr);
79     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
80         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
81     ASSERT_NE(dragEventActuator, nullptr);
82 
83     /**
84      * @tc.steps: step2. Execute IsGlobalStatusSuitableForDragging.
85      */
86     auto pipeline = PipelineContext::GetCurrentContext();
87     CHECK_NULL_VOID(pipeline);
88     auto dragDropManager = pipeline->GetDragDropManager();
89     CHECK_NULL_VOID(dragDropManager);
90     dragDropManager->ResetDragging(DragDropMgrState::DRAGGING);
91     auto globalStatus = dragEventActuator->IsGlobalStatusSuitableForDragging();
92     ASSERT_EQ(globalStatus, false);
93 
94     /**
95      * @tc.steps: step3. Execute IsCurrentNodeStatusSuitableForDragging.
96      */
97     TouchRestrict dragTouchRestrict = { TouchRestrict::CLICK };
98     dragTouchRestrict.inputEventType = InputEventType::AXIS;
99     auto nodeStatus = dragEventActuator->IsCurrentNodeStatusSuitableForDragging(framenode, dragTouchRestrict);
100     ASSERT_EQ(nodeStatus, false);
101 }
102 
103 /**
104  * @tc.name: DragEventActuatorSetDragDampStartPointInfoTest001
105  * @tc.desc: Test SetDragDampStartPointInfo function.
106  * @tc.type: FUNC
107  */
108 HWTEST_F(DragEventTestNg, DragEventActuatorSetDragDampStartPointInfoTest001, TestSize.Level1)
109 {
110     /**
111      * @tc.steps: step1. Create DragEventActuator.
112      */
113     auto eventHub = AceType::MakeRefPtr<EventHub>();
114     ASSERT_NE(eventHub, nullptr);
115     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
116     ASSERT_NE(framenode, nullptr);
117     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
118     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
119     ASSERT_NE(gestureEventHub, nullptr);
120     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
121         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
122     ASSERT_NE(dragEventActuator, nullptr);
123 
124     /**
125      * @tc.steps: step2. Invoke SetDragDampStartPointInfo.
126      * @tc.expected: cover SetDragDampStartPointInfo.
127      */
128     GestureEvent info = GestureEvent();
129     dragEventActuator->SetDragDampStartPointInfo(info.GetGlobalPoint(), info.GetPointerId());
130     auto pipeline = PipelineContext::GetCurrentContext();
131     CHECK_NULL_VOID(pipeline);
132     auto dragDropManager = pipeline->GetDragDropManager();
133     CHECK_NULL_VOID(dragDropManager);
134     ASSERT_EQ(dragDropManager->currentPointerId_, info.GetPointerId());
135 }
136 
137 /**
138  * @tc.name: DragEventActuatorHandleDragDampingMoveTest001
139  * @tc.desc: Test HandleDragDampingMove function.
140  * @tc.type: FUNC
141  */
142 HWTEST_F(DragEventTestNg, DragEventActuatorHandleDragDampingMoveTest001, TestSize.Level1)
143 {
144     /**
145      * @tc.steps: step1. Create DragEventActuator.
146      */
147     auto eventHub = AceType::MakeRefPtr<EventHub>();
148     ASSERT_NE(eventHub, nullptr);
149     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
150     ASSERT_NE(framenode, nullptr);
151     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
152     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
153     ASSERT_NE(gestureEventHub, nullptr);
154     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
155         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
156     ASSERT_NE(dragEventActuator, nullptr);
157 
158     /**
159      * @tc.steps: step2. Invoke DragDampingMove with DragDropMgrState::IDLE and same Pointer.
160      * @tc.expected: cover DragDampingMove.
161      */
162     auto pipeline = PipelineContext::GetCurrentContext();
163     CHECK_NULL_VOID(pipeline);
164     auto dragDropManager = pipeline->GetDragDropManager();
165     CHECK_NULL_VOID(dragDropManager);
166     TouchEventInfo info(TOUCH_EVENT_INFO_TYPE);
167     auto point = Point(info.GetTouches().front().GetGlobalLocation().GetX(),
168                        info.GetTouches().front().GetGlobalLocation().GetY());
169     dragDropManager->SetDraggingPointer(info.GetTouches().front().GetFingerId());
170     dragDropManager->ResetDragging(DragDropMgrState::IDLE);
171     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId());
172     ASSERT_FALSE(dragDropManager->IsAboutToPreview());
173     ASSERT_FALSE(dragDropManager->IsDragging());
174     EXPECT_FALSE(!dragDropManager->IsSameDraggingPointer(info.GetTouches().front().GetFingerId()));
175 
176     /**
177      * @tc.steps: step3. Invoke DragDampingMove with DragDropMgrState::DRAGGING and same Pointer.
178      * @tc.expected: cover DragDampingMove.
179      */
180     dragDropManager->ResetDragging(DragDropMgrState::DRAGGING);
181     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId());
182     EXPECT_FALSE(dragDropManager->IsAboutToPreview());
183     EXPECT_TRUE(dragDropManager->IsDragging());
184     EXPECT_FALSE(!dragDropManager->IsSameDraggingPointer(info.GetTouches().front().GetFingerId()));
185 
186     /**
187      * @tc.steps: step4. Invoke DragDampingMove with DragDropMgrState::ABOUT_TO_PREVIEW and same Pointer.
188      * @tc.expected: cover DragDampingMove.
189      */
190     dragDropManager->ResetDragging(DragDropMgrState::ABOUT_TO_PREVIEW);
191     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId());
192     EXPECT_TRUE(dragDropManager->IsAboutToPreview());
193     EXPECT_FALSE(dragDropManager->IsDragging());
194     EXPECT_FALSE(!dragDropManager->IsSameDraggingPointer(info.GetTouches().front().GetFingerId()));
195 
196     /**
197      * @tc.steps: step5. Invoke DragDampingMove.
198      * @tc.expected: cover DragDampingMove.
199      */
200     dragDropManager->ResetDragging(DragDropMgrState::IDLE);
201     point.SetX(10.0);
202     point.SetY(10.0);
203     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId());
204     auto startPoint = dragDropManager->GetDragDampStartPoint();
205     auto delta = Point(point.GetX(), point.GetY()) - startPoint;
206     auto distance = SystemProperties::GetDragStartPanDistanceThreshold();
207     EXPECT_TRUE(delta.GetDistance() > Dimension(distance, DimensionUnit::VP).ConvertToPx());
208 
209     point.SetX(1.0);
210     point.SetY(1.0);
211     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId());
212     startPoint = dragDropManager->GetDragDampStartPoint();
213     delta = Point(point.GetX(), point.GetY()) - startPoint;
214     distance = SystemProperties::GetDragStartPanDistanceThreshold();
215     EXPECT_TRUE(delta.GetDistance() < Dimension(distance, DimensionUnit::VP).ConvertToPx());
216 }
217 
218 /**
219  * @tc.name: DragEventActuatorUpdatePreviewAttrTest001
220  * @tc.desc: Test UpdatePreviewAttr function.
221  * @tc.type: FUNC
222  */
223 HWTEST_F(DragEventTestNg, DragEventActuatorUpdatePreviewAttrTest001, TestSize.Level1)
224 {
225     /**
226      * @tc.steps: step1. Create DragEventActuator.
227      */
228     auto eventHub = AceType::MakeRefPtr<EventHub>();
229     ASSERT_NE(eventHub, nullptr);
230     auto frameNode = FrameNode::CreateFrameNode(V2::TEXT_ETS_TAG, 1, AceType::MakeRefPtr<Pattern>(), false);
231     ASSERT_NE(frameNode, nullptr);
232     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
233     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
234     ASSERT_NE(gestureEventHub, nullptr);
235     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
236         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
237     ASSERT_NE(dragEventActuator, nullptr);
238 
239     /**
240      * @tc.steps: step2. Invoke UpdatePreviewAttr.
241      * @tc.expected: cover UpdatePreviewAttr with TextDraggable true.
242      */
243     auto frameTag = frameNode->GetTag();
244     auto gestureHub = frameNode->GetOrCreateGestureEventHub();
245     EXPECT_NE(gestureHub, nullptr);
246     auto imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
__anon3bb4a1c20202() 247         []() { return AceType::MakeRefPtr<ImagePattern>(); });
248     EXPECT_NE(imageNode, nullptr);
249     gestureHub->SetTextDraggable(true);
250     dragEventActuator->UpdatePreviewAttr(frameNode, imageNode);
251     EXPECT_TRUE(gestureHub->IsTextCategoryComponent(frameTag));
252     EXPECT_TRUE(gestureHub->GetTextDraggable());
253 }
254 
255 /**
256  * @tc.name: DragEventActuatorSetPixelMapTest001
257  * @tc.desc: Test SetPixelMap function.
258  * @tc.type: FUNC
259  */
260 HWTEST_F(DragEventTestNg, DragEventActuatorSetPixelMapTest001, TestSize.Level1)
261 {
262     /**
263      * @tc.steps: step1. Create DragEventActuator.
264      */
265     auto eventHub = AceType::MakeRefPtr<EventHub>();
266     ASSERT_NE(eventHub, nullptr);
267     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
268     ASSERT_NE(framenode, nullptr);
269     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
270     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
271     ASSERT_NE(gestureEventHub, nullptr);
272     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
273         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
274     ASSERT_NE(dragEventActuator, nullptr);
275 
276     /**
277      * @tc.steps: step2. Invoke SetHasPixelMap.
278      * @tc.desc: GetHasPixelMap true.
279      */
280     auto pipelineContext = PipelineContext::GetCurrentContext();
281     ASSERT_NE(pipelineContext, nullptr);
282     auto manager = pipelineContext->GetOverlayManager();
283     ASSERT_NE(manager, nullptr);
284     manager->SetHasPixelMap(true);
285     dragEventActuator->SetPixelMap(dragEventActuator);
286     ASSERT_TRUE(manager->GetHasPixelMap());
287 }
288 
289 /**
290  * @tc.name: DragEventActuatorBrulStyleToEffectionTest001
291  * @tc.desc: Test BrulStyleToEffection function.
292  * @tc.type: FUNC
293  */
294 HWTEST_F(DragEventTestNg, DragEventActuatorBrulStyleToEffectionTest001, TestSize.Level1)
295 {
296     /**
297      * @tc.steps: step1. Create DragEventActuator.
298      */
299     auto eventHub = AceType::MakeRefPtr<EventHub>();
300     ASSERT_NE(eventHub, nullptr);
301     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
302     ASSERT_NE(frameNode, nullptr);
303     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
304     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
305     ASSERT_NE(gestureEventHub, nullptr);
306     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
307         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
308     ASSERT_NE(dragEventActuator, nullptr);
309 
310     /**
311      * @tc.steps: step2. Invoke BrulStyleToEffection.
312      */
313     auto imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
__anon3bb4a1c20302() 314         []() { return AceType::MakeRefPtr<ImagePattern>(); });
315     ASSERT_NE(imageNode, nullptr);
316     auto imageContext = imageNode->GetRenderContext();
317     ASSERT_NE(imageContext, nullptr);
318     auto blurstyletmp = imageContext->GetBackBlurStyle();
319     blurstyletmp->colorMode = ThemeColorMode::DARK;
320     dragEventActuator->BrulStyleToEffection(blurstyletmp);
321     ASSERT_NE(blurstyletmp->colorMode, ThemeColorMode::SYSTEM);
322 }
323 
324 /**
325  * @tc.name: DragEventActuatorHidePixelMapTest001
326  * @tc.desc: Test HidePixelMap function.
327  * @tc.type: FUNC
328  */
329 HWTEST_F(DragEventTestNg, DragEventActuatorHidePixelMapTest001, TestSize.Level1)
330 {
331     /**
332      * @tc.steps: step1. Create DragEventActuator.
333      */
334     auto eventHub = AceType::MakeRefPtr<EventHub>();
335     ASSERT_NE(eventHub, nullptr);
336     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
337     ASSERT_NE(frameNode, nullptr);
338     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
339     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
340     ASSERT_NE(gestureEventHub, nullptr);
341     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
342         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
343     ASSERT_NE(dragEventActuator, nullptr);
344 
345     /**
346      * @tc.steps: step2. Invoke HidePixelMap.
347      */
348     auto pipelineContext = PipelineContext::GetCurrentContext();
349     ASSERT_NE(pipelineContext, nullptr);
350     auto manager = pipelineContext->GetOverlayManager();
351     EXPECT_NE(manager, nullptr);
352     dragEventActuator->HidePixelMap(true, 0, 0, false);
353     EXPECT_FALSE(manager->hasPixelMap_);
354 }
355 
356 /**
357  * @tc.name: DragEventActuatorSetTextPixelMapTest001
358  * @tc.desc: Test SetTextPixelMap function.
359  * @tc.type: FUNC
360  */
361 HWTEST_F(DragEventTestNg, DragEventActuatorSetTextPixelMapTest001, TestSize.Level1)
362 {
363     /**
364      * @tc.steps: step1. Create DragEventActuator.
365      */
366     auto eventHub = AceType::MakeRefPtr<EventHub>();
367     ASSERT_NE(eventHub, nullptr);
368     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
369     ASSERT_NE(frameNode, nullptr);
370     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
371     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
372     ASSERT_NE(gestureEventHub, nullptr);
373     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
374         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
375     ASSERT_NE(dragEventActuator, nullptr);
376 
377     /**
378      * @tc.steps: step2. Invoke HidePixelMap.
379      */
380     dragEventActuator->SetTextPixelMap(gestureEventHub);
381     EXPECT_EQ(dragEventActuator->textPixelMap_, nullptr);
382 }
383 
384 /**
385  * @tc.name: DragEventActuatorSetImageNodeInitAttrTest001
386  * @tc.desc: Test SetImageNodeInitAttr function.
387  * @tc.type: FUNC
388  */
389 HWTEST_F(DragEventTestNg, DragEventActuatorSetImageNodeInitAttrTest001, TestSize.Level1)
390 {
391     /**
392      * @tc.steps: step1. Create DragEventActuator.
393      */
394     auto eventHub = AceType::MakeRefPtr<EventHub>();
395     ASSERT_NE(eventHub, nullptr);
396     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
397     ASSERT_NE(frameNode, nullptr);
398     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
399     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
400     ASSERT_NE(gestureEventHub, nullptr);
401     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
402         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
403     ASSERT_NE(dragEventActuator, nullptr);
404 
405     /**
406      * @tc.steps: step2. Invoke SetImageNodeInitAttr.
407      * @tc.desc: defaultAnimationBeforeLifting = true, layoutProperty != nullptr.
408      */
409     auto imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
__anon3bb4a1c20402() 410         []() { return AceType::MakeRefPtr<ImagePattern>(); });
411     EXPECT_NE(imageNode, nullptr);
412     auto imageContext = imageNode->GetRenderContext();
413     EXPECT_NE(imageContext, nullptr);
414     auto dragPreviewOption = frameNode->GetDragPreviewOption();
415     dragPreviewOption.defaultAnimationBeforeLifting = true;
416     auto layoutProperty = frameNode->GetLayoutProperty();
417     auto shadow = Shadow::CreateShadow(ShadowStyle::None);
418 
419     dragEventActuator->SetImageNodeInitAttr(frameNode, imageNode);
420     EXPECT_TRUE(dragPreviewOption.defaultAnimationBeforeLifting);
421     EXPECT_NE(layoutProperty, nullptr);
422     EXPECT_FALSE(dragPreviewOption.options.shadow.has_value());
423 
424     /**
425      * @tc.steps: step3. Invoke SetImageNodeInitAttr.
426      * @tc.desc: defaultAnimationBeforeLifting = true, layoutProperty = nullptr.
427      */
428     frameNode->layoutProperty_ = nullptr;
429     dragEventActuator->SetImageNodeInitAttr(frameNode, imageNode);
430     EXPECT_EQ(frameNode->GetLayoutProperty(), nullptr);
431 
432     /**
433      * @tc.steps: step3. Invoke SetImageNodeInitAttr.
434      * @tc.desc: defaultAnimationBeforeLifting = false, layoutProperty = nullptr.
435      */
436     dragPreviewOption.defaultAnimationBeforeLifting = false;
437     dragEventActuator->SetImageNodeInitAttr(frameNode, imageNode);
438     EXPECT_FALSE(dragPreviewOption.defaultAnimationBeforeLifting);
439 
440     /**
441      * @tc.steps: step3. Invoke SetImageNodeInitAttr.
442      * @tc.desc: dragPreviewOption.options.shadow.has_value() = true.
443      */
444     dragPreviewOption.options.shadow = Shadow::CreateShadow(ShadowStyle::OuterDefaultXS);
445     dragEventActuator->SetImageNodeInitAttr(frameNode, imageNode);
446     EXPECT_TRUE(dragPreviewOption.options.shadow.has_value());
447 }
448 
449 /**
450  * @tc.name: DragEventActuatorSetImageNodeFinishAttrTest001
451  * @tc.desc: Test SetImageNodeFinishAttr function.
452  * @tc.type: FUNC
453  */
454 HWTEST_F(DragEventTestNg, DragEventActuatorSetImageNodeFinishAttrTest001, TestSize.Level1)
455 {
456     /**
457      * @tc.steps: step1. Create DragEventActuator.
458      */
459     auto eventHub = AceType::MakeRefPtr<EventHub>();
460     ASSERT_NE(eventHub, nullptr);
461     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
462     ASSERT_NE(frameNode, nullptr);
463     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
464     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
465     ASSERT_NE(gestureEventHub, nullptr);
466     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
467         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
468     ASSERT_NE(dragEventActuator, nullptr);
469 
470     /**
471      * @tc.steps: step2. Invoke SetImageNodeFinishAttr.
472      */
473     auto imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
__anon3bb4a1c20502() 474         []() { return AceType::MakeRefPtr<ImagePattern>(); });
475     EXPECT_NE(imageNode, nullptr);
476     auto imageContext = imageNode->GetRenderContext();
477     EXPECT_NE(imageContext, nullptr);
478     auto dragPreviewOption = frameNode->GetDragPreviewOption();
479 
480     dragEventActuator->SetImageNodeFinishAttr(frameNode, imageNode);
481     EXPECT_FALSE(dragPreviewOption.options.shadow->GetIsFilled());
482     EXPECT_FALSE(dragPreviewOption.options.shadow.has_value());
483 
484     /**
485      * @tc.steps: step3. Invoke SetImageNodeFinishAttr.
486      */
487     dragPreviewOption.options.shadow->isFilled_ = true;
488     dragEventActuator->SetImageNodeFinishAttr(frameNode, imageNode);
489     EXPECT_TRUE(dragPreviewOption.options.shadow->GetIsFilled());
490     EXPECT_FALSE(dragPreviewOption.options.shadow.has_value());
491 
492     /**
493      * @tc.steps: step4. Invoke SetImageNodeFinishAttr.
494      */
495     dragPreviewOption.options.shadow = Shadow::CreateShadow(ShadowStyle::OuterDefaultXS);
496     dragPreviewOption.options.shadow->isFilled_ = false;
497     dragEventActuator->SetImageNodeFinishAttr(frameNode, imageNode);
498     EXPECT_FALSE(dragPreviewOption.options.shadow->GetIsFilled());
499     EXPECT_TRUE(dragPreviewOption.options.shadow.has_value());
500 
501     /**
502      * @tc.steps: step5. Invoke SetImageNodeFinishAttr.
503      */
504     dragPreviewOption.options.shadow = Shadow::CreateShadow(ShadowStyle::OuterDefaultXS);
505     dragPreviewOption.options.shadow->isFilled_ = true;
506     dragEventActuator->SetImageNodeFinishAttr(frameNode, imageNode);
507     EXPECT_TRUE(dragPreviewOption.options.shadow->GetIsFilled());
508     EXPECT_TRUE(dragPreviewOption.options.shadow.has_value());
509 }
510 
511 /**
512  * @tc.name: DragEventActuatorGetOrCreateGatherNodeTest001
513  * @tc.desc: Test GetOrCreateGatherNode function.
514  * @tc.type: FUNC
515  */
516 HWTEST_F(DragEventTestNg, DragEventActuatorGetOrCreateGatherNodeTest001, TestSize.Level1)
517 {
518     /**
519      * @tc.steps: step1. Create DragEventActuator.
520      */
521     auto eventHub = AceType::MakeRefPtr<EventHub>();
522     ASSERT_NE(eventHub, nullptr);
523     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
524     ASSERT_NE(frameNode, nullptr);
525     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
526     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
527     ASSERT_NE(gestureEventHub, nullptr);
528     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
529         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
530     ASSERT_NE(dragEventActuator, nullptr);
531 
532     /**
533      * @tc.steps: step2. Invoke GetOrCreateGatherNode with dragEventActuator->IsNeedGather() false.
534      */
535     std::vector<GatherNodeChildInfo> gatherNodeChildInfo(2);
536     auto pipeline = PipelineContext::GetCurrentContext();
537     auto overlayManager = pipeline->GetOverlayManager();
538     EXPECT_NE(overlayManager, nullptr);
539     auto gatherNode = dragEventActuator->GetOrCreateGatherNode(overlayManager, dragEventActuator, gatherNodeChildInfo);
540     EXPECT_EQ(gatherNode, nullptr);
541 }
542 
543 /**
544  * @tc.name: DragEventActuatorResetNodeTest001
545  * @tc.desc: Test ResetNode function.
546  * @tc.type: FUNC
547  */
548 HWTEST_F(DragEventTestNg, DragEventActuatorResetNodeTest001, TestSize.Level1)
549 {
550     /**
551      * @tc.steps: step1. Create DragEventActuator.
552      */
553     auto eventHub = AceType::MakeRefPtr<EventHub>();
554     ASSERT_NE(eventHub, nullptr);
555     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
556     ASSERT_NE(frameNode, nullptr);
557     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
558     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
559     ASSERT_NE(gestureEventHub, nullptr);
560     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
561         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
562     ASSERT_NE(dragEventActuator, nullptr);
563 
564     /**
565      * @tc.steps: step2. Invoke ResetNode.
566      */
567     auto dragPreviewOption = frameNode->GetDragPreviewOption();
568     dragPreviewOption.defaultAnimationBeforeLifting = false;
569     dragEventActuator->ResetNode(frameNode);
570     dragPreviewOption = frameNode->GetDragPreviewOption();
571     EXPECT_FALSE(dragPreviewOption.defaultAnimationBeforeLifting);
572 
573     /**
574      * @tc.steps: step3. Invoke ResetNode.
575      */
576     dragPreviewOption.defaultAnimationBeforeLifting = true;
577     frameNode->layoutProperty_ = nullptr;
578     dragEventActuator->ResetNode(frameNode);
579     EXPECT_EQ(frameNode->GetLayoutProperty(), nullptr);
580 }
581 
582 /**
583  * @tc.name: DragEventActuatorHandleTouchUpEventTest001
584  * @tc.desc: Test HandleTouchUpEvent function.
585  * @tc.type: FUNC
586  */
587 HWTEST_F(DragEventTestNg, DragEventActuatorHandleTouchUpEventTest001, TestSize.Level1)
588 {
589     /**
590      * @tc.steps: step1. Create DragEventActuator.
591      */
592     auto eventHub = AceType::MakeRefPtr<EventHub>();
593     ASSERT_NE(eventHub, nullptr);
594     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
595     ASSERT_NE(frameNode, nullptr);
596     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
597     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
598     ASSERT_NE(gestureEventHub, nullptr);
599     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
600         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
601     ASSERT_NE(dragEventActuator, nullptr);
602 
603     /**
604      * @tc.steps: step2. Invoke HandleTouchUpEvent.
605      */
606     dragEventActuator->HandleTouchUpEvent();
607     auto pipelineContext = PipelineContext::GetCurrentContext();
608     EXPECT_NE(pipelineContext, nullptr);
609     auto dragDropManager = pipelineContext->GetDragDropManager();
610     EXPECT_NE(dragDropManager, nullptr);
611     EXPECT_FALSE(dragEventActuator->IsNeedGather());
612 }
613 
614 /**
615  * @tc.name: DragEventActuatorCreateBadgeTextNodeTest001
616  * @tc.desc: Test CreateBadgeTextNode function.
617  * @tc.type: FUNC
618  */
619 HWTEST_F(DragEventTestNg, DragEventActuatorCreateBadgeTextNodeTest001, TestSize.Level1)
620 {
621     /**
622      * @tc.steps: step1. Create DragEventActuator.
623      */
624     auto eventHub = AceType::MakeRefPtr<EventHub>();
625     ASSERT_NE(eventHub, nullptr);
626     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
627     ASSERT_NE(frameNode, nullptr);
628     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
629     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
630     ASSERT_NE(gestureEventHub, nullptr);
631     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
632         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
633     ASSERT_NE(dragEventActuator, nullptr);
634 
635     /**
636      * @tc.steps: step2. Invoke CreateBadgeTextNode.
637      */
638     auto textNode = dragEventActuator->CreateBadgeTextNode(frameNode, 1, 1.05f, true);
639     EXPECT_EQ(textNode, nullptr);
640 }
641 
642 /**
643  * @tc.name: DragEventActuatorHandleTouchMoveEventTest001
644  * @tc.desc: Test HandleTouchMoveEvent function.
645  * @tc.type: FUNC 6
646  */
647 HWTEST_F(DragEventTestNg, DragEventActuatorHandleTouchMoveEventTest001, TestSize.Level1)
648 {
649     /**
650      * @tc.steps: step1. Create DragEventActuator.
651      */
652     auto eventHub = AceType::MakeRefPtr<EventHub>();
653     ASSERT_NE(eventHub, nullptr);
654     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
655     ASSERT_NE(frameNode, nullptr);
656     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
657     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
658     ASSERT_NE(gestureEventHub, nullptr);
659     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
660         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
661     ASSERT_NE(dragEventActuator, nullptr);
662 
663     /**
664      * @tc.steps: step2. Invoke HandleTouchMoveEvent.
665      */
666     dragEventActuator->longPressRecognizer_ = nullptr;
667     dragEventActuator->HandleTouchMoveEvent();
668     EXPECT_EQ(dragEventActuator->longPressRecognizer_, nullptr);
669 
670     /**
671      * @tc.steps: step3. Invoke HandleTouchMoveEvent.
672      */
673     dragEventActuator->longPressRecognizer_ =
674         AceType::MakeRefPtr<LongPressRecognizer>(LONG_PRESS_DURATION, FINGERS_NUMBER, false, true);
675     dragEventActuator->isOnBeforeLiftingAnimation = false;
676     dragEventActuator->HandleTouchMoveEvent();
677     EXPECT_NE(dragEventActuator->longPressRecognizer_, nullptr);
678     EXPECT_FALSE(dragEventActuator->isOnBeforeLiftingAnimation);
679 
680     /**
681      * @tc.steps: step4. Invoke HandleTouchMoveEvent.
682      */
683     dragEventActuator->isOnBeforeLiftingAnimation = true;
684     dragEventActuator->longPressRecognizer_->disposal_ = GestureDisposal::ACCEPT;
685     dragEventActuator->HandleTouchMoveEvent();
686     EXPECT_NE(dragEventActuator->longPressRecognizer_, nullptr);
687     EXPECT_TRUE(dragEventActuator->isOnBeforeLiftingAnimation);
688     EXPECT_FALSE(dragEventActuator->longPressRecognizer_->GetGestureDisposal() == GestureDisposal::REJECT);
689 
690     /**
691      * @tc.steps: step5. Invoke HandleTouchMoveEvent.
692      */
693     dragEventActuator->longPressRecognizer_->disposal_ = GestureDisposal::REJECT;
694     dragEventActuator->isOnBeforeLiftingAnimation = true;
695     dragEventActuator->HandleTouchMoveEvent();
696     EXPECT_NE(dragEventActuator->longPressRecognizer_, nullptr);
697     EXPECT_FALSE(dragEventActuator->isOnBeforeLiftingAnimation);
698     EXPECT_TRUE(dragEventActuator->longPressRecognizer_->GetGestureDisposal() == GestureDisposal::REJECT);
699 }
700 
701 /**
702  * @tc.name: DragEventActuatorMountGatherNodeTest001
703  * @tc.desc: Test MountGatherNode function.
704  * @tc.type: FUNC 3
705  */
706 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest001, TestSize.Level1)
707 {
708     /**
709      * @tc.steps: step1. Create DragEventActuator.
710      */
711     auto eventHub = AceType::MakeRefPtr<EventHub>();
712     EXPECT_NE(eventHub, nullptr);
713     auto frameNode1 = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
714     EXPECT_NE(frameNode1, nullptr);
715     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode1));
716     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
717     EXPECT_NE(gestureEventHub, nullptr);
718     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
719         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
720     EXPECT_NE(dragEventActuator, nullptr);
721 
722     /**
723      * @tc.steps: step2. Create manager, gatherNode, gatherNodeChildrenInfo.
724      */
725     auto pipelineContext = PipelineContext::GetCurrentContext();
726     EXPECT_NE(pipelineContext, nullptr);
727     auto manager = pipelineContext->GetOverlayManager();
728     EXPECT_NE(manager, nullptr);
729     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
730     EXPECT_NE(gestureHub, nullptr);
731     auto frameNode2 = gestureHub->GetFrameNode();
732     EXPECT_NE(frameNode2, nullptr);
733     manager->gatherNodeWeak_ = frameNode2;
734     auto gatherNode = manager->GetGatherNode();
735     EXPECT_NE(gatherNode, nullptr);
736     std::vector<GatherNodeChildInfo> gatherNodeChildrenInfo(2);
737     dragEventActuator->MountGatherNode(manager, frameNode1, gatherNode, gatherNodeChildrenInfo);
738 
739     /**
740      * @tc.steps: step3. Invoke MountGatherNode.
741      */
742     dragEventActuator->MountGatherNode(nullptr, frameNode1, gatherNode, gatherNodeChildrenInfo);
743     EXPECT_FALSE(gatherNode->isLayoutDirtyMarked_);
744 
745     /**
746      * @tc.steps: step4. Invoke MountGatherNode.
747      */
748     dragEventActuator->MountGatherNode(manager, nullptr, gatherNode, gatherNodeChildrenInfo);
749     EXPECT_FALSE(gatherNode->isLayoutDirtyMarked_);
750 
751     /**
752      * @tc.steps: step5. Invoke MountGatherNode.
753      */
754     dragEventActuator->MountGatherNode(nullptr, frameNode1, nullptr, gatherNodeChildrenInfo);
755     EXPECT_FALSE(gatherNode->isLayoutDirtyMarked_);
756 }
757 
758 /**
759  * @tc.name: DragEventActuatorMountGatherNodeTest002
760  * @tc.desc: Test HandleDragDampingMove function.
761  * @tc.type: FUNC
762  */
763 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest002, TestSize.Level1)
764 {
765     /**
766      * @tc.steps: step1. Create DragEventActuator.
767      */
768     auto eventHub = AceType::MakeRefPtr<EventHub>();
769     ASSERT_NE(eventHub, nullptr);
770     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
771     ASSERT_NE(framenode, nullptr);
772     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
773     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
774     ASSERT_NE(gestureEventHub, nullptr);
775     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
776         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
777     ASSERT_NE(dragEventActuator, nullptr);
778 
779     /**
780      * @tc.steps: step2. Invoke DragDampingMove with DragDropMgrState::IDLE and same Pointer.
781      * @tc.expected: cover DragDampingMove.
782      */
783     auto pipeline = PipelineContext::GetCurrentContext();
784     CHECK_NULL_VOID(pipeline);
785     auto dragDropManager = pipeline->GetDragDropManager();
786     CHECK_NULL_VOID(dragDropManager);
787     TouchEventInfo info(TOUCH_EVENT_INFO_TYPE);
788     auto point = Point(
789         info.GetTouches().front().GetGlobalLocation().GetX(), info.GetTouches().front().GetGlobalLocation().GetY());
790     dragDropManager->SetDraggingPointer(info.GetTouches().front().GetFingerId());
791     dragDropManager->ResetDragging(DragDropMgrState::IDLE);
792     dragEventActuator->isRedragStart_ = false;
793     dragEventActuator->HandleDragDampingMove(point, info.GetTouches().front().GetFingerId(), true);
794     SUCCEED();
795 }
796 
797 /**
798  * @tc.name: DragEventActuatorMountGatherNodeTest003
799  * @tc.desc: Test GetFloatImageOffset.
800  * @tc.type: FUNC
801  */
802 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest003, TestSize.Level1)
803 {
804     /**
805      * @tc.steps: step1. Create DragEventActuator.
806      */
807     auto eventHub = AceType::MakeRefPtr<EventHub>();
808     ASSERT_NE(eventHub, nullptr);
809     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
810     ASSERT_NE(framenode, nullptr);
811     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
812     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
813     ASSERT_NE(gestureEventHub, nullptr);
814     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
815         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
816     ASSERT_NE(dragEventActuator, nullptr);
817     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
818     CHECK_NULL_VOID(gestureHub);
819     auto frameNode = gestureHub->GetFrameNode();
820     CHECK_NULL_VOID(frameNode);
821     RefPtr<PixelMap> pixelMap = gestureHub->GetPixelMap();
822     CHECK_NULL_VOID(pixelMap);
823     auto pipelineContext = PipelineContext::GetCurrentContext();
824     pipelineContext->windowModal_ = WindowModal::SEMI_MODAL;
825     dragEventActuator->GetFloatImageOffset(framenode, pixelMap);
826     SUCCEED();
827 }
828 
829 /**
830  * @tc.name: DragEventActuatorMountGatherNodeTest004
831  * @tc.desc: Test SetDragPreviewOptions.
832  * @tc.type: FUNC
833  */
834 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest004, TestSize.Level1)
835 {
836     /**
837      * @tc.steps: step1. Create DragEventActuator.
838      */
839     auto eventHub = AceType::MakeRefPtr<EventHub>();
840     ASSERT_NE(eventHub, nullptr);
841     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
842     ASSERT_NE(framenode, nullptr);
843     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
844     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
845     ASSERT_NE(gestureEventHub, nullptr);
846     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
847         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
848     ASSERT_NE(dragEventActuator, nullptr);
849     DragPreviewOption previewOption;
850     previewOption.isDefaultRadiusEnabled = true;
851     framenode->SetDragPreviewOptions(previewOption);
852     dragEventActuator->UpdatePreviewOptionDefaultAttr(framenode);
853     SUCCEED();
854 }
855 
856 /**
857  * @tc.name: DragEventActuatorMountGatherNodeTest005
858  * @tc.desc: Test SetEventColumn.
859  * @tc.type: FUNC
860  */
861 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest005, TestSize.Level1)
862 {
863     /**
864      * @tc.steps: step1. Create DragEventActuator.
865      */
866     auto eventHub = AceType::MakeRefPtr<EventHub>();
867     ASSERT_NE(eventHub, nullptr);
868     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
869     ASSERT_NE(framenode, nullptr);
870     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
871     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
872     ASSERT_NE(gestureEventHub, nullptr);
873     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
874         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
875     ASSERT_NE(dragEventActuator, nullptr);
876     auto pipelineContext = PipelineContext::GetCurrentContext();
877     CHECK_NULL_VOID(pipelineContext);
878     auto manager = pipelineContext->GetOverlayManager();
879     manager->hasEvent_ = true;
880     dragEventActuator->SetEventColumn(dragEventActuator);
881     SUCCEED();
882 }
883 
884 /**
885  * @tc.name: DragEventActuatorMountGatherNodeTest006
886  * @tc.desc: Test BindClickEvent.
887  * @tc.type: FUNC
888  */
889 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest006, TestSize.Level1)
890 {
891     /**
892      * @tc.steps: step1. Create DragEventActuator.
893      */
894     auto eventHub = AceType::MakeRefPtr<EventHub>();
895     ASSERT_NE(eventHub, nullptr);
896     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
897     ASSERT_NE(framenode, nullptr);
898     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
899     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
900     ASSERT_NE(gestureEventHub, nullptr);
901     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
902         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
903     ASSERT_NE(dragEventActuator, nullptr);
904     dragEventActuator->BindClickEvent(framenode);
905     auto columnGestureHub = framenode->GetOrCreateGestureEventHub();
906     auto event = columnGestureHub->clickEventActuator_->clickEvents_;
907     GestureEvent info;
908     for (auto item : event) {
909         (*item)(info);
910     }
911     SUCCEED();
912 }
913 
914 /**
915  * @tc.name: DragEventActuatorMountGatherNodeTest007
916  * @tc.desc: Test BindClickEvent.
917  * @tc.type: FUNC
918  */
919 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest007, TestSize.Level1)
920 {
921     /**
922      * @tc.steps: step1. Create DragEventActuator.
923      */
924     auto eventHub = AceType::MakeRefPtr<EventHub>();
925     ASSERT_NE(eventHub, nullptr);
926     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
927     ASSERT_NE(framenode, nullptr);
928     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
929     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
930     ASSERT_NE(gestureEventHub, nullptr);
931     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
932         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
933     ASSERT_NE(dragEventActuator, nullptr);
934     dragEventActuator->BindClickEvent(framenode);
935     auto columnGestureHub = framenode->GetOrCreateGestureEventHub();
936     auto event = columnGestureHub->clickEventActuator_->clickEvents_;
937     GestureEvent info;
938     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
939     gestureHub->textDraggable_ = true;
940     for (auto item : event) {
941         (*item)(info);
942     }
943     SUCCEED();
944 }
945 
946 /**
947  * @tc.name: DragEventActuatorMountGatherNodeTest008
948  * @tc.desc: Test SetImageNodeInitAttr.
949  * @tc.type: FUNC
950  */
951 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest008, TestSize.Level1)
952 {
953     /**
954      * @tc.steps: step1. Create DragEventActuator.
955      */
956     auto eventHub = AceType::MakeRefPtr<EventHub>();
957     ASSERT_NE(eventHub, nullptr);
958     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
959     auto framenode1 = FrameNode::CreateFrameNode("test1", 1, AceType::MakeRefPtr<Pattern>(), false);
960     ASSERT_NE(framenode, nullptr);
961     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
962     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
963     ASSERT_NE(gestureEventHub, nullptr);
964     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
965         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
966     framenode->previewOption_.defaultAnimationBeforeLifting = true;
967     ASSERT_NE(dragEventActuator, nullptr);
968     dragEventActuator->SetImageNodeInitAttr(framenode, framenode1);
969     SUCCEED();
970     framenode->layoutProperty_ = nullptr;
971     dragEventActuator->SetImageNodeInitAttr(framenode, framenode1);
972     SUCCEED();
973 }
974 
975 /**
976  * @tc.name: DragEventActuatorMountGatherNodeTest009
977  * @tc.desc: Test GetFrameNodePreviewPixelMap.
978  * @tc.type: FUNC
979  */
980 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest009, TestSize.Level1)
981 {
982     /**
983      * @tc.steps: step1. Create DragEventActuator.
984      */
985     auto eventHub = AceType::MakeRefPtr<EventHub>();
986     ASSERT_NE(eventHub, nullptr);
987     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
988     ASSERT_NE(framenode, nullptr);
989     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
990     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
991     ASSERT_NE(gestureEventHub, nullptr);
992     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
993         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
994     ASSERT_NE(dragEventActuator, nullptr);
995     framenode->dragPreviewInfo_.inspectorId = "test";
996     dragEventActuator->GetFrameNodePreviewPixelMap(framenode);
997     SUCCEED();
998     RefPtr<PixelMap> pixelMap = PixelMap::CreatePixelMap(static_cast<void*>(new char[0]));
999     framenode->dragPreviewInfo_.pixelMap = pixelMap;
1000     framenode->dragPreviewInfo_.inspectorId = "";
1001     dragEventActuator->GetFrameNodePreviewPixelMap(framenode);
1002     SUCCEED();
1003 }
1004 }