• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
__anonc1d0a8ca0102(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 = DragDropFuncWrapper::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(),
__anonc1d0a8ca0202() 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: DragEventActuatorBlurStyleToEffectionTest001
291  * @tc.desc: Test BlurStyleToEffection function.
292  * @tc.type: FUNC
293  */
294 HWTEST_F(DragEventTestNg, DragEventActuatorBlurStyleToEffectionTest001, 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 BlurStyleToEffection.
312      */
313     auto imageNode = FrameNode::GetOrCreateFrameNode(V2::IMAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
__anonc1d0a8ca0302() 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     DragDropFuncWrapper::BlurStyleToEffection(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(),
__anonc1d0a8ca0402() 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     DragAnimationHelper::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     DragAnimationHelper::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     DragAnimationHelper::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     DragAnimationHelper::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(),
__anonc1d0a8ca0502() 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     DragAnimationHelper::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     DragAnimationHelper::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     DragAnimationHelper::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     DragAnimationHelper::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     DragDropFuncWrapper::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     DragDropFuncWrapper::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 = DragAnimationHelper::CreateBadgeTextNode(1);
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     EXPECT_EQ(dragEventActuator->isRedragStart_, true);
795 }
796 
797 /**
798  * @tc.name: DragEventActuatorMountGatherNodeTest004
799  * @tc.desc: Test SetDragPreviewOptions.
800  * @tc.type: FUNC
801  */
802 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest004, 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     DragPreviewOption previewOption;
818     previewOption.isDefaultRadiusEnabled = true;
819     framenode->SetDragPreviewOptions(previewOption);
820     dragEventActuator->UpdatePreviewOptionDefaultAttr(framenode);
821     EXPECT_EQ(previewOption.isDefaultRadiusEnabled, true);
822 }
823 
824 /**
825  * @tc.name: DragEventActuatorMountGatherNodeTest005
826  * @tc.desc: Test SetEventColumn.
827  * @tc.type: FUNC
828  */
829 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest005, TestSize.Level1)
830 {
831     /**
832      * @tc.steps: step1. Create DragEventActuator.
833      */
834     auto eventHub = AceType::MakeRefPtr<EventHub>();
835     ASSERT_NE(eventHub, nullptr);
836     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
837     ASSERT_NE(framenode, nullptr);
838     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
839     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
840     ASSERT_NE(gestureEventHub, nullptr);
841     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
842         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
843     ASSERT_NE(dragEventActuator, nullptr);
844     auto pipelineContext = PipelineContext::GetCurrentContext();
845     CHECK_NULL_VOID(pipelineContext);
846     auto manager = pipelineContext->GetOverlayManager();
847     manager->hasEvent_ = true;
848     dragEventActuator->SetEventColumn(dragEventActuator);
849     EXPECT_EQ(manager->hasEvent_, true);
850 }
851 
852 /**
853  * @tc.name: DragEventActuatorMountGatherNodeTest006
854  * @tc.desc: Test BindClickEvent.
855  * @tc.type: FUNC
856  */
857 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest006, TestSize.Level1)
858 {
859     /**
860      * @tc.steps: step1. Create DragEventActuator.
861      */
862     auto eventHub = AceType::MakeRefPtr<EventHub>();
863     ASSERT_NE(eventHub, nullptr);
864     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
865     ASSERT_NE(framenode, nullptr);
866     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
867     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
868     ASSERT_NE(gestureEventHub, nullptr);
869     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
870         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
871     ASSERT_NE(dragEventActuator, nullptr);
872     dragEventActuator->BindClickEvent(framenode);
873     auto columnGestureHub = framenode->GetOrCreateGestureEventHub();
874     auto event = columnGestureHub->clickEventActuator_->clickEvents_;
875     GestureEvent info;
876     for (auto item : event) {
877         (*item)(info);
878     }
879     EXPECT_EQ(columnGestureHub->GetHitTestMode(), HitTestMode::HTMBLOCK);
880 }
881 
882 /**
883  * @tc.name: DragEventActuatorMountGatherNodeTest007
884  * @tc.desc: Test BindClickEvent.
885  * @tc.type: FUNC
886  */
887 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest007, TestSize.Level1)
888 {
889     /**
890      * @tc.steps: step1. Create DragEventActuator.
891      */
892     auto eventHub = AceType::MakeRefPtr<EventHub>();
893     ASSERT_NE(eventHub, nullptr);
894     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
895     ASSERT_NE(framenode, nullptr);
896     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
897     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
898     ASSERT_NE(gestureEventHub, nullptr);
899     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
900         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
901     ASSERT_NE(dragEventActuator, nullptr);
902     dragEventActuator->BindClickEvent(framenode);
903     auto columnGestureHub = framenode->GetOrCreateGestureEventHub();
904     auto event = columnGestureHub->clickEventActuator_->clickEvents_;
905     GestureEvent info;
906     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
907     gestureHub->textDraggable_ = true;
908     for (auto item : event) {
909         (*item)(info);
910     }
911     EXPECT_EQ(columnGestureHub->GetHitTestMode(), HitTestMode::HTMBLOCK);
912 }
913 
914 /**
915  * @tc.name: DragEventActuatorMountGatherNodeTest008
916  * @tc.desc: Test SetImageNodeInitAttr.
917  * @tc.type: FUNC
918  */
919 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest008, 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     auto framenode1 = FrameNode::CreateFrameNode("test1", 1, AceType::MakeRefPtr<Pattern>(), false);
928     ASSERT_NE(framenode, nullptr);
929     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
930     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
931     ASSERT_NE(gestureEventHub, nullptr);
932     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
933         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
934     framenode->previewOption_.defaultAnimationBeforeLifting = true;
935     ASSERT_NE(dragEventActuator, nullptr);
936     DragAnimationHelper::SetImageNodeInitAttr(framenode, framenode1);
937     framenode->layoutProperty_ = nullptr;
938     DragAnimationHelper::SetImageNodeInitAttr(framenode, framenode1);
939     EXPECT_EQ(framenode->previewOption_.defaultAnimationBeforeLifting, true);
940 }
941 
942 /**
943  * @tc.name: DragEventActuatorMountGatherNodeTest009
944  * @tc.desc: Test GetFrameNodePreviewPixelMap.
945  * @tc.type: FUNC
946  */
947 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest009, TestSize.Level1)
948 {
949     /**
950      * @tc.steps: step1. Create DragEventActuator.
951      */
952     auto eventHub = AceType::MakeRefPtr<EventHub>();
953     ASSERT_NE(eventHub, nullptr);
954     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
955     ASSERT_NE(framenode, nullptr);
956     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
957     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
958     ASSERT_NE(gestureEventHub, nullptr);
959     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
960         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
961     ASSERT_NE(dragEventActuator, nullptr);
962     framenode->dragPreviewInfo_.inspectorId = "test";
963     dragEventActuator->GetFrameNodePreviewPixelMap(framenode);
964     RefPtr<PixelMap> pixelMap = PixelMap::CreatePixelMap(static_cast<void*>(new char[0]));
965     framenode->dragPreviewInfo_.pixelMap = pixelMap;
966     framenode->dragPreviewInfo_.inspectorId = "";
967     dragEventActuator->GetFrameNodePreviewPixelMap(framenode);
968     EXPECT_EQ(gestureEventHub->GetDragPreviewPixelMap(), nullptr);;
969 }
970 
971 /**
972  * @tc.name: DragEventActuatorMountGatherNodeTest010
973  * @tc.desc: Test OnCollectTouchTarget.
974  * @tc.type: FUNC
975  */
976 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest010, TestSize.Level1)
977 {
978     /**
979      * @tc.steps: step1. Create DragEventActuator.
980      */
981     auto eventHub = AceType::MakeRefPtr<EventHub>();
982     ASSERT_NE(eventHub, nullptr);
983     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
984     ASSERT_NE(framenode, nullptr);
985     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
986     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
987     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
988         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
989     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
990     ASSERT_NE(getEventTargetImpl, nullptr);
991     TouchTestResult finalResult;
992     ResponseLinkResult responseLinkResult;
993     framenode->GetOrCreateFocusHub();
994     dragEventActuator->OnCollectTouchTarget(
995         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
996     EXPECT_EQ(dragEventActuator->panRecognizer_->onActionEnd_, nullptr);
997     EXPECT_TRUE(finalResult.empty());
998     double unknownPropertyValue = GESTURE_EVENT_PROPERTY_DEFAULT_VALUE;
999     GestureEventFunc actionStart = [&unknownPropertyValue](
__anonc1d0a8ca0602( GestureEvent& info) 1000                                        GestureEvent& info) { unknownPropertyValue = info.GetScale(); };
1001     GestureEventFunc actionUpdate = [&unknownPropertyValue](
__anonc1d0a8ca0702( GestureEvent& info) 1002                                         GestureEvent& info) { unknownPropertyValue = info.GetScale(); };
1003     GestureEventFunc actionEnd = [&unknownPropertyValue](
__anonc1d0a8ca0802( GestureEvent& info) 1004                                      GestureEvent& info) { unknownPropertyValue = info.GetScale(); };
__anonc1d0a8ca0902() 1005     GestureEventNoParameter actionCancel = [&unknownPropertyValue]() {
1006         unknownPropertyValue = GESTURE_EVENT_PROPERTY_VALUE;
1007     };
1008     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1009         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1010     dragEventActuator->ReplaceDragEvent(dragEvent);
1011     dragEventActuator->SetCustomDragEvent(dragEvent);
1012     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1013     dragEventActuator->OnCollectTouchTarget(
1014         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1015     GestureEvent info = GestureEvent();
1016     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
1017     gestureHub->textDraggable_ = true;
1018     (*(dragEventActuator->panRecognizer_->onActionEnd_))(info);
1019     EXPECT_EQ(gestureHub->textDraggable_, true);
1020 }
1021 
1022 /**
1023  * @tc.name: DragEventActuatorMountGatherNodeTest011
1024  * @tc.desc: Create DragEventActuator and invoke onActionCancel callback.
1025  * @tc.type: FUNC
1026  */
1027 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest011, TestSize.Level1)
1028 {
1029     /**
1030      * @tc.steps: step1. Create DragEventActuator.
1031      */
1032     auto eventHub = AceType::MakeRefPtr<EventHub>();
1033     ASSERT_NE(eventHub, nullptr);
1034     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1035     ASSERT_NE(frameNode, nullptr);
1036     frameNode->SetDraggable(true);
1037     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1038     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1039     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1040         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1041     /**
1042      * @tc.steps: step2. Create DragEvent and set as DragEventActuator's DragEvent.
1043      * @tc.expected: dragEventActuator's userCallback_ is not null.
1044      */
1045     double unknownPropertyValue = GESTURE_EVENT_PROPERTY_DEFAULT_VALUE;
__anonc1d0a8ca0a02(GestureEvent& info) 1046     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca0b02(GestureEvent& info) 1047     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca0c02(GestureEvent& info) 1048     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca0d02() 1049     GestureEventNoParameter actionCancel = [&unknownPropertyValue]() {
1050         unknownPropertyValue = GESTURE_EVENT_PROPERTY_VALUE;
1051     };
1052     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1053         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1054     dragEventActuator->ReplaceDragEvent(dragEvent);
1055     dragEventActuator->SetCustomDragEvent(dragEvent);
1056     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1057     /**
1058      * @tc.steps: step3. Invoke OnCollectTouchTarget when userCallback_ is not null.
1059      * @tc.expected: longPressRecognizer is not nullptr and panRecognizer's callback onActionCancel is not nullptr.
1060      */
1061     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1062     TouchTestResult finalResult;
1063     ResponseLinkResult responseLinkResult;
1064     frameNode->GetOrCreateFocusHub();
1065     dragEventActuator->OnCollectTouchTarget(
1066         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1067     dragEventActuator->panRecognizer_->onActionCancel_ = std::make_unique<GestureEventFunc>(
__anonc1d0a8ca0e02(GestureEvent& info) 1068         [&unknownPropertyValue](GestureEvent& info) { unknownPropertyValue = GESTURE_EVENT_PROPERTY_VALUE; });
1069     ASSERT_NE(dragEventActuator->panRecognizer_->onActionCancel_, nullptr);
1070     unknownPropertyValue = GESTURE_EVENT_PROPERTY_DEFAULT_VALUE;
1071     dragEventActuator->isNotInPreviewState_ = true;
1072     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
1073     gestureHub->textDraggable_ = false;
1074     GestureEvent info = GestureEvent();
1075     (*(dragEventActuator->panRecognizer_->onActionCancel_))(info);
1076     EXPECT_EQ(unknownPropertyValue, GESTURE_EVENT_PROPERTY_VALUE);
1077 }
1078 
1079 /**
1080  * @tc.name: DragEventActuatorMountGatherNodeTest012
1081  * @tc.desc: Create DragEventActuator and invoke longPressUpdate callback.
1082  * @tc.type: FUNC
1083  */
1084 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest012, TestSize.Level1)
1085 {
1086     /**
1087      * @tc.steps: step1. Create DragEventActuator.
1088      */
1089     auto eventHub = AceType::MakeRefPtr<EventHub>();
1090     ASSERT_NE(eventHub, nullptr);
1091     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1092     ASSERT_NE(frameNode, nullptr);
1093     DragDropInfo dragDropInfo;
1094     frameNode->SetDragPreview(dragDropInfo);
1095     frameNode->SetDraggable(true);
1096     frameNode->GetOrCreateFocusHub();
1097     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1098     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1099     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1100         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1101     /**
1102      * @tc.steps: step2. Create DragEvent and set as DragEventActuator's DragEvent.
1103      * @tc.expected: dragEventActuator's userCallback_ is not null.
1104      */
__anonc1d0a8ca0f02(GestureEvent& info) 1105     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca1002(GestureEvent& info) 1106     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca1102(GestureEvent& info) 1107     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca1202() 1108     GestureEventNoParameter actionCancel = []() {};
1109     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1110         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1111     dragEventActuator->ReplaceDragEvent(dragEvent);
1112     dragEventActuator->SetCustomDragEvent(dragEvent);
1113     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1114     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1115     TouchTestResult finalResult;
1116     ResponseLinkResult responseLinkResult;
1117     frameNode->GetOrCreateFocusHub();
1118     dragEventActuator->OnCollectTouchTarget(
1119         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1120     ASSERT_NE(dragEventActuator->previewLongPressRecognizer_->onAction_, nullptr);
1121     SystemProperties::debugEnabled_ = true;
1122     GestureEvent info = GestureEvent();
1123     dragEventActuator->userCallback_->actionLongPress_ = actionEnd;
1124     (*(dragEventActuator->longPressRecognizer_->onAction_))(info);
1125     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), true);
1126     dragEventActuator->userCallback_ = nullptr;
1127     (*(dragEventActuator->longPressRecognizer_->onAction_))(info);
1128     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), true);
1129 }
1130 
1131 /**
1132  * @tc.name: DragEventActuatorMountGatherNodeTest013
1133  * @tc.desc: Create DragEventActuator and invoke longPressUpdate callback.
1134  * @tc.type: FUNC
1135  */
1136 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest013, TestSize.Level1)
1137 {
1138     /**
1139      * @tc.steps: step1. Create DragEventActuator.
1140      */
1141     auto eventHub = AceType::MakeRefPtr<EventHub>();
1142     ASSERT_NE(eventHub, nullptr);
1143     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1144     ASSERT_NE(frameNode, nullptr);
1145     DragDropInfo dragDropInfo;
1146     frameNode->SetDragPreview(dragDropInfo);
1147     frameNode->SetDraggable(true);
1148     frameNode->GetOrCreateFocusHub();
1149     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1150     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1151     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1152         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1153     /**
1154      * @tc.steps: step2. Create DragEvent and set as DragEventActuator's DragEvent.
1155      * @tc.expected: dragEventActuator's userCallback_ is not null.
1156      */
__anonc1d0a8ca1302(GestureEvent& info) 1157     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca1402(GestureEvent& info) 1158     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca1502(GestureEvent& info) 1159     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca1602() 1160     GestureEventNoParameter actionCancel = []() {};
1161     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1162         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1163     dragEventActuator->ReplaceDragEvent(dragEvent);
1164     dragEventActuator->SetCustomDragEvent(dragEvent);
1165     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1166     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1167     TouchTestResult finalResult;
1168     ResponseLinkResult responseLinkResult;
1169     frameNode->GetOrCreateFocusHub();
1170     dragEventActuator->OnCollectTouchTarget(
1171         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1172     ASSERT_NE(dragEventActuator->previewLongPressRecognizer_->onAction_, nullptr);
1173     SystemProperties::debugEnabled_ = true;
1174     GestureEvent info = GestureEvent();
1175     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
1176     gestureHub->textDraggable_ = true;
1177     dragEventActuator->userCallback_->actionLongPress_ = actionEnd;
1178     (*(dragEventActuator->longPressRecognizer_->onAction_))(info);
1179     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), true);
1180 }
1181 
1182 /**
1183  * @tc.name: DragEventActuatorMountGatherNodeTest014
1184  * @tc.desc: Create DragEventActuator and invoke longPressUpdate callback.
1185  * @tc.type: FUNC
1186  */
1187 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest014, TestSize.Level1)
1188 {
1189     auto eventHub = AceType::MakeRefPtr<EventHub>();
1190     ASSERT_NE(eventHub, nullptr);
1191     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1192     ASSERT_NE(frameNode, nullptr);
1193     DragDropInfo dragDropInfo;
1194     frameNode->SetDragPreview(dragDropInfo);
1195     frameNode->SetDraggable(true);
1196     frameNode->GetOrCreateFocusHub();
1197     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1198     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1199     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1200         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
__anonc1d0a8ca1702(GestureEvent& info) 1201     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca1802(GestureEvent& info) 1202     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca1902(GestureEvent& info) 1203     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca1a02() 1204     GestureEventNoParameter actionCancel = []() {};
1205     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1206         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1207     dragEventActuator->ReplaceDragEvent(dragEvent);
1208     dragEventActuator->SetCustomDragEvent(dragEvent);
1209     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1210     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1211     TouchTestResult finalResult;
1212     ResponseLinkResult responseLinkResult;
1213     frameNode->GetOrCreateFocusHub();
1214     dragEventActuator->OnCollectTouchTarget(
1215         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1216     ASSERT_NE(dragEventActuator->previewLongPressRecognizer_->onAction_, nullptr);
1217     SystemProperties::debugEnabled_ = true;
1218     EXPECT_EQ(gestureEventHub->GetTextDraggable(), false);
1219     EXPECT_EQ(dragEventActuator->IsAllowedDrag(), true);
1220     auto pipeline = PipelineContext::GetCurrentContext();
1221     CHECK_NULL_VOID(pipeline);
1222 
1223     auto overlayManager = pipeline->GetOverlayManager();
1224     CHECK_NULL_VOID(overlayManager);
1225     overlayManager->hasPixelMap_ = true;
1226     GestureEvent info = GestureEvent();
1227     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1228     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), false);
1229 }
1230 
1231 /**
1232  * @tc.name: DragEventActuatorMountGatherNodeTest015
1233  * @tc.desc: Create DragEventActuator and invoke longPressUpdate callback.
1234  * @tc.type: FUNC
1235  */
1236 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest015, TestSize.Level1)
1237 {
1238     /**
1239      * @tc.steps: step1. Create DragEventActuator.
1240      */
1241     auto eventHub = AceType::MakeRefPtr<EventHub>();
1242     ASSERT_NE(eventHub, nullptr);
1243     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1244     ASSERT_NE(frameNode, nullptr);
1245     DragDropInfo dragDropInfo;
1246     frameNode->SetDragPreview(dragDropInfo);
1247     frameNode->SetDraggable(true);
1248     frameNode->GetOrCreateFocusHub();
1249     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1250     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1251     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1252         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1253 
__anonc1d0a8ca1b02(GestureEvent& info) 1254     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca1c02(GestureEvent& info) 1255     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca1d02(GestureEvent& info) 1256     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca1e02() 1257     GestureEventNoParameter actionCancel = []() {};
1258     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1259         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1260     dragEventActuator->ReplaceDragEvent(dragEvent);
1261     dragEventActuator->SetCustomDragEvent(dragEvent);
1262     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1263     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1264     TouchTestResult finalResult;
1265     ResponseLinkResult responseLinkResult;
1266     frameNode->GetOrCreateFocusHub();
1267     dragEventActuator->OnCollectTouchTarget(
1268         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1269     ASSERT_NE(dragEventActuator->previewLongPressRecognizer_->onAction_, nullptr);
1270     SystemProperties::debugEnabled_ = true;
1271     EXPECT_EQ(gestureEventHub->GetTextDraggable(), false);
1272     EXPECT_EQ(dragEventActuator->IsAllowedDrag(), true);
1273     auto pipeline = PipelineContext::GetCurrentContext();
1274     ASSERT_NE(pipeline, nullptr);
1275     auto dragDropManager = pipeline->GetDragDropManager();
1276     ASSERT_NE(dragDropManager, nullptr);
1277     dragDropManager->dragDropState_ = DragDropMgrState::ABOUT_TO_PREVIEW;
1278     GestureEvent info = GestureEvent();
1279     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1280     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), false);
1281 }
1282 
1283 /**
1284  * @tc.name: DragEventActuatorMountGatherNodeTest016
1285  * @tc.desc: Create DragEventActuator and invoke longPressUpdate callback.
1286  * @tc.type: FUNC
1287  */
1288 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest016, TestSize.Level1)
1289 {
1290     /**
1291      * @tc.steps: step1. Create DragEventActuator.
1292      */
1293     auto eventHub = AceType::MakeRefPtr<EventHub>();
1294     ASSERT_NE(eventHub, nullptr);
1295     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1296     ASSERT_NE(frameNode, nullptr);
1297     DragDropInfo dragDropInfo;
1298     frameNode->SetDragPreview(dragDropInfo);
1299     frameNode->SetDraggable(true);
1300     frameNode->GetOrCreateFocusHub();
1301     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1302     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1303     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1304         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
__anonc1d0a8ca1f02(GestureEvent& info) 1305     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca2002(GestureEvent& info) 1306     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca2102(GestureEvent& info) 1307     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca2202() 1308     GestureEventNoParameter actionCancel = []() {};
1309     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1310         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1311     dragEventActuator->ReplaceDragEvent(dragEvent);
1312     dragEventActuator->SetCustomDragEvent(dragEvent);
1313     ASSERT_NE(dragEventActuator->userCallback_, nullptr);
1314     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1315     TouchTestResult finalResult;
1316     ResponseLinkResult responseLinkResult;
1317     frameNode->GetOrCreateFocusHub();
1318     dragEventActuator->OnCollectTouchTarget(
1319         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1320     ASSERT_NE(dragEventActuator->previewLongPressRecognizer_->onAction_, nullptr);
1321     SystemProperties::debugEnabled_ = true;
1322     EXPECT_EQ(gestureEventHub->GetTextDraggable(), false);
1323     EXPECT_EQ(dragEventActuator->IsAllowedDrag(), true);
1324     auto pipeline = PipelineContext::GetCurrentContext();
1325     ASSERT_NE(pipeline, nullptr);
1326     auto dragDropManager = pipeline->GetDragDropManager();
1327     ASSERT_NE(dragDropManager, nullptr);
1328     dragDropManager->dragDropState_ = DragDropMgrState::DRAGGING;
1329     GestureEvent info = GestureEvent();
1330     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1331     EXPECT_EQ(dragEventActuator->GetIsNotInPreviewState(), false);
1332 }
1333 
1334 /**
1335  * @tc.name: DragEventActuatorMountGatherNodeTest017
1336  * @tc.desc: Test BlurStyleToEffection.
1337  * @tc.type: FUNC
1338  */
1339 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest017, TestSize.Level1)
1340 {
1341     /**
1342      * @tc.steps: step1. Create DragEventActuator.
1343      */
1344     auto eventHub = AceType::MakeRefPtr<EventHub>();
1345     ASSERT_NE(eventHub, nullptr);
1346     auto frameNode = FrameNode::CreateFrameNode(
1347         V2::TEXT_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(), AceType::MakeRefPtr<ImagePattern>());
1348     ASSERT_NE(frameNode, nullptr);
1349     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1350     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1351     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1352         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1353 
1354     std::vector<float> vecGrayScale = { 0.0f, 0.0f };
1355     BlurStyleOption blurStyleInfo = { BlurStyle::NO_MATERIAL, ThemeColorMode::SYSTEM, AdaptiveColor::DEFAULT, 1.0,
1356         { vecGrayScale } };
1357     std::optional<BlurStyleOption> optBlurStyleInfo(blurStyleInfo);
1358     auto optEffectOption = DragDropFuncWrapper::BlurStyleToEffection(optBlurStyleInfo);
1359     auto pipeline = PipelineContext::GetCurrentContext();
1360     ASSERT_NE(pipeline, nullptr);
1361     EXPECT_EQ(optEffectOption.has_value(), false);
1362 
1363     auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
1364     MockPipelineContext::GetCurrent()->SetThemeManager(themeManager);
1365     EXPECT_CALL(*themeManager, GetTheme(_)).WillRepeatedly(Return(AceType::MakeRefPtr<BlurStyleTheme>()));
1366     auto blurStyleTheme = pipeline->GetTheme<BlurStyleTheme>();
1367     ASSERT_NE(blurStyleTheme, nullptr);
1368     auto resAdapter = RefPtr<ResourceAdapter>();
1369     auto themeConstants = AceType::MakeRefPtr<ThemeConstants>(resAdapter);
1370     std::unordered_map<std::string, ResValueWrapper> attributes;
1371     ResValueWrapper resValueWrapper;
1372     resValueWrapper.type = ThemeConstantsType::THEME;
1373     resValueWrapper.value = AceType::MakeRefPtr<ThemeStyle>();
1374     attributes.insert(std::pair<std::string, ResValueWrapper>(THEME_BLUR_STYLE_COMMON, resValueWrapper));
1375     themeConstants->currentThemeStyle_ = AceType::MakeRefPtr<ThemeStyle>();
1376     themeConstants->currentThemeStyle_->SetAttributes(attributes);
1377     auto blThemeInstance = BlurStyleTheme::Builder().Build(themeConstants);
1378     EXPECT_CALL(*themeManager, GetTheme(BlurStyleTheme::TypeId())).WillRepeatedly(Return(blThemeInstance));
1379 
1380     optBlurStyleInfo->colorMode = ThemeColorMode::LIGHT;
1381     optEffectOption = DragDropFuncWrapper::BlurStyleToEffection(optBlurStyleInfo);
1382     ASSERT_NE(optEffectOption.has_value(), true);
1383     EXPECT_EQ(resValueWrapper.type, ThemeConstantsType::THEME);
1384 }
1385 
1386 /**
1387  * @tc.name: DragEventActuatorMountGatherNodeTest018
1388  * @tc.desc: Test SetFilter.
1389  * @tc.type: FUNC
1390  */
1391 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest018, TestSize.Level1)
1392 {
1393     auto eventHub = AceType::MakeRefPtr<EventHub>();
1394     ASSERT_NE(eventHub, nullptr);
1395     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1396     ASSERT_NE(framenode, nullptr);
1397     auto parentNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1398     ASSERT_NE(parentNode, nullptr);
1399     framenode->SetParent(parentNode);
1400     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1401     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1402     ASSERT_NE(gestureEventHub, nullptr);
1403     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1404         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1405     ASSERT_NE(dragEventActuator, nullptr);
1406     auto dragEventActuatorTwo = AceType::MakeRefPtr<DragEventActuator>(
1407         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1408     ASSERT_NE(dragEventActuatorTwo, nullptr);
1409     dragEventActuator->SetFilter(dragEventActuatorTwo);
1410     parentNode->depth_ = 1;
1411     dragEventActuator->SetFilter(dragEventActuatorTwo);
1412     EXPECT_EQ(parentNode->depth_, 1);
1413 }
1414 
1415 /**
1416  * @tc.name: DragEventActuatorMountGatherNodeTest019
1417  * @tc.desc: Test SetFilter.
1418  * @tc.type: FUNC
1419  */
1420 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest019, TestSize.Level1)
1421 {
1422     auto eventHub = AceType::MakeRefPtr<EventHub>();
1423     ASSERT_NE(eventHub, nullptr);
1424     auto framenode = FrameNode::CreateFrameNode(V2::WEB_ETS_TAG, 1, AceType::MakeRefPtr<Pattern>(), false);
1425     ASSERT_NE(framenode, nullptr);
1426     auto parentNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1427     ASSERT_NE(parentNode, nullptr);
1428     framenode->SetParent(parentNode);
1429     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1430     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1431     ASSERT_NE(gestureEventHub, nullptr);
1432     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1433         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1434     ASSERT_NE(dragEventActuator, nullptr);
1435     auto dragEventActuatorTwo = AceType::MakeRefPtr<DragEventActuator>(
1436         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1437     ASSERT_NE(dragEventActuatorTwo, nullptr);
1438     parentNode->depth_ = 1;
1439     MockContainer::SetUp();
1440     dragEventActuator->SetFilter(dragEventActuatorTwo);
1441     auto container = MockContainer::Current();
1442     container->isScenceBoardWindow_ = true;
1443     auto pipelineContext = PipelineContext::GetCurrentContext();
1444     ASSERT_NE(pipelineContext, nullptr);
1445     auto manager = pipelineContext->GetOverlayManager();
1446     ASSERT_NE(manager, nullptr);
1447     manager->hasFilter_ = false;
1448     dragEventActuator->SetFilter(dragEventActuatorTwo);
1449     manager->isOnAnimation_ = true;
1450     manager->hasFilter_ = false;
1451     dragEventActuator->SetFilter(dragEventActuatorTwo);
1452     manager->hasFilter_ = true;
1453     dragEventActuator->SetFilter(dragEventActuatorTwo);
1454     container->isScenceBoardWindow_ = false;
1455     MockContainer::TearDown();
1456     EXPECT_EQ(manager->hasFilter_, true);
1457 }
1458 
1459 /**
1460  * @tc.name: DragEventActuatorMountGatherNodeTest021
1461  * @tc.desc: Test SetPixelMap.
1462  * @tc.type: FUNC
1463  */
1464 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest021, TestSize.Level1)
1465 {
1466     auto eventHub = AceType::MakeRefPtr<EventHub>();
1467     ASSERT_NE(eventHub, nullptr);
1468     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1469     ASSERT_NE(framenode, nullptr);
1470     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1471     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1472     ASSERT_NE(gestureEventHub, nullptr);
1473     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1474         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1475     ASSERT_NE(dragEventActuator, nullptr);
1476 
1477     auto pipelineContext = PipelineContext::GetCurrentContext();
1478     ASSERT_NE(pipelineContext, nullptr);
1479     auto manager = pipelineContext->GetOverlayManager();
1480     ASSERT_NE(manager, nullptr);
1481     manager->SetHasPixelMap(false);
1482     void* voidPtr = static_cast<void*>(new char[0]);
1483     RefPtr<PixelMap> pixelMap = PixelMap::CreatePixelMap(voidPtr);
1484     gestureEventHub->SetPixelMap(pixelMap);
1485     dragEventActuator->SetPixelMap(dragEventActuator);
1486     MockContainer::SetUp();
1487     auto container = MockContainer::Current();
1488     container->isScenceBoardWindow_ = true;
1489     manager->SetHasPixelMap(false);
1490     dragEventActuator->SetPixelMap(dragEventActuator);
1491     manager->SetHasPixelMap(false);
1492     container->isScenceBoardWindow_ = false;
1493     dragEventActuator->SetPixelMap(dragEventActuator);
1494     MockContainer::TearDown();
1495     EXPECT_EQ(container->isScenceBoardWindow_, false);
1496 }
1497 
1498 /**
1499  * @tc.name: DragEventActuatorMountGatherNodeTest022
1500  * @tc.desc: Test UpdatePreviewOptionFromModifier function.
1501  * @tc.type: FUNC
1502  */
1503 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest022, TestSize.Level1)
1504 {
1505     auto eventHub = AceType::MakeRefPtr<EventHub>();
1506     ASSERT_NE(eventHub, nullptr);
1507     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1508     ASSERT_NE(framenode, nullptr);
1509     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1510     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1511     ASSERT_NE(gestureEventHub, nullptr);
1512     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1513         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1514     ASSERT_NE(dragEventActuator, nullptr);
1515     NG::DragPreviewOption previewOptions;
__anonc1d0a8ca2302(WeakPtr<NG::FrameNode> frameNodes) 1516     previewOptions.onApply = [](WeakPtr<NG::FrameNode> frameNodes) {
1517         auto node = frameNodes.Upgrade();
1518         auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1519         mockRenderContext->UpdateOpacity(-0.1f);
1520         BorderRadiusProperty borderRadius;
1521         borderRadius.SetRadius(Dimension(0.1));
1522         Shadow shadow;
1523         shadow.SetIsFilled(true);
1524         shadow.SetOffset(Offset(5, 5));
1525         shadow.SetBlurRadius(10.0);
1526         shadow.SetColor(Color::FromARGB(255, 255, 0, 0));
1527         mockRenderContext->UpdateBackShadow(shadow);
1528         mockRenderContext->UpdateBorderRadius(borderRadius);
1529         node->renderContext_ = mockRenderContext;
1530     };
1531     framenode->SetDragPreviewOptions(previewOptions);
1532     dragEventActuator->UpdatePreviewOptionFromModifier(framenode);
1533 
__anonc1d0a8ca2402(WeakPtr<NG::FrameNode> frameNodes) 1534     previewOptions.onApply = [](WeakPtr<NG::FrameNode> frameNodes) {
1535         auto node = frameNodes.Upgrade();
1536         auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1537         mockRenderContext->UpdateOpacity(1.1f);
1538         node->renderContext_ = mockRenderContext;
1539     };
1540     framenode->SetDragPreviewOptions(previewOptions);
1541     dragEventActuator->UpdatePreviewOptionFromModifier(framenode);
1542 
__anonc1d0a8ca2502(WeakPtr<NG::FrameNode> frameNodes) 1543     previewOptions.onApply = [](WeakPtr<NG::FrameNode> frameNodes) {
1544         auto node = frameNodes.Upgrade();
1545         auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1546         node->renderContext_ = mockRenderContext;
1547     };
1548     framenode->SetDragPreviewOptions(previewOptions);
1549     dragEventActuator->UpdatePreviewOptionFromModifier(framenode);
1550     EXPECT_EQ(previewOptions.isMultiSelectionEnabled, false);
1551 }
1552 
1553 /**
1554  * @tc.name: DragEventActuatorMountGatherNodeTest023
1555  * @tc.desc: Test UpdatePreviewOptionFromModifier function.
1556  * @tc.type: FUNC
1557  */
1558 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest023, TestSize.Level1)
1559 {
1560     auto eventHub = AceType::MakeRefPtr<EventHub>();
1561     ASSERT_NE(eventHub, nullptr);
1562     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1563     ASSERT_NE(framenode, nullptr);
1564     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1565     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1566     ASSERT_NE(gestureEventHub, nullptr);
1567     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1568         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1569     ASSERT_NE(dragEventActuator, nullptr);
1570     NG::DragPreviewOption previewOptions;
__anonc1d0a8ca2602(WeakPtr<NG::FrameNode> frameNodes) 1571     previewOptions.onApply = [](WeakPtr<NG::FrameNode> frameNodes) {
1572         auto node = frameNodes.Upgrade();
1573         auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1574         BlurStyleOption styleOption;
1575         styleOption.blurStyle = BlurStyle::COMPONENT_THICK;
1576         styleOption.scale = 0.5;
1577         styleOption.colorMode = ThemeColorMode::LIGHT;
1578         mockRenderContext->UpdateBackBlurStyle(styleOption);
1579         node->renderContext_ = mockRenderContext;
1580     };
1581     framenode->SetDragPreviewOptions(previewOptions);
1582     dragEventActuator->UpdatePreviewOptionFromModifier(framenode);
1583 
__anonc1d0a8ca2702(WeakPtr<NG::FrameNode> frameNodes) 1584     previewOptions.onApply = [](WeakPtr<NG::FrameNode> frameNodes) {
1585         auto node = frameNodes.Upgrade();
1586         auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1587         CalcDimension radius;
1588         radius.SetValue(80.0f);
1589         Color color = Color::FromARGB(13, 255, 255, 255);
1590         EffectOption effoption = { radius, 1.0, 1.08, color };
1591         const auto& groupProperty = mockRenderContext->GetOrCreateBackground();
1592         groupProperty->propEffectOption = effoption;
1593         node->renderContext_ = mockRenderContext;
1594     };
1595     framenode->SetDragPreviewOptions(previewOptions);
1596     dragEventActuator->UpdatePreviewOptionFromModifier(framenode);
1597     EXPECT_EQ(previewOptions.isMultiSelectionEnabled, false);
1598 }
1599 
1600 /**
1601  * @tc.name: DragEventActuatorMountGatherNodeTest024
1602  * @tc.desc: Test SetFilter.
1603  * @tc.type: FUNC
1604  */
1605 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest024, TestSize.Level1)
1606 {
1607     auto eventHub = AceType::MakeRefPtr<EventHub>();
1608     ASSERT_NE(eventHub, nullptr);
1609     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1610     ASSERT_NE(framenode, nullptr);
1611     auto parentNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1612     ASSERT_NE(parentNode, nullptr);
1613     framenode->SetParent(parentNode);
1614     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1615     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1616     ASSERT_NE(gestureEventHub, nullptr);
1617     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1618         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1619     ASSERT_NE(dragEventActuator, nullptr);
1620     DragDropFuncWrapper::ApplyNewestOptionExecutedFromModifierToNode(framenode, parentNode);
1621     Dimension dimen(2.0);
1622     BlurBackGroundInfo bgBackEffect = { { dimen, 1.0f, 1.0f, Color::TRANSPARENT, AdaptiveColor::DEFAULT,
1623         { { 2.0f, 2.0f } } } };
1624     Shadow shadow;
1625     shadow.SetIsFilled(false);
1626     shadow.SetOffset(Offset(5, 5));
1627     shadow.SetBlurRadius(10.0);
1628     shadow.SetColor(Color::FromARGB(255, 255, 0, 0));
1629     BorderRadiusProperty borderRadius;
1630     borderRadius.SetRadius(Dimension(0.1));
1631     OptionsAfterApplied optionTmp = { 0, shadow, "test", true, borderRadius, { bgBackEffect } };
1632     NG::DragPreviewOption previewOptions;
1633     previewOptions.options = optionTmp;
1634     parentNode->SetDragPreviewOptions(previewOptions);
1635     DragDropFuncWrapper::ApplyNewestOptionExecutedFromModifierToNode(framenode, parentNode);
1636     EXPECT_EQ(previewOptions.isMultiSelectionEnabled, false);
1637 }
1638 
1639 /**
1640  * @tc.name: DragEventActuatorMountGatherNodeTest025
1641  * @tc.desc: Test SetEventColumn.
1642  * @tc.type: FUNC
1643  */
1644 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest025, TestSize.Level1)
1645 {
1646     auto eventHub = AceType::MakeRefPtr<EventHub>();
1647     ASSERT_NE(eventHub, nullptr);
1648     auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::TEXT_ETS_TAG, -1, AceType::MakeRefPtr<TextPattern>());
1649     ASSERT_NE(frameNode, nullptr);
1650     DragDropInfo dragDropInfo;
1651     frameNode->SetDragPreview(dragDropInfo);
1652     frameNode->GetOrCreateFocusHub();
1653     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1654     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1655     ASSERT_NE(gestureEventHub, nullptr);
1656     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1657         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1658     ASSERT_NE(dragEventActuator, nullptr);
__anonc1d0a8ca2802(GestureEvent& info) 1659     GestureEventFunc actionStart = [](GestureEvent& info) {};
__anonc1d0a8ca2902(GestureEvent& info) 1660     GestureEventFunc actionUpdate = [](GestureEvent& info) {};
__anonc1d0a8ca2a02(GestureEvent& info) 1661     GestureEventFunc actionEnd = [](GestureEvent& info) {};
__anonc1d0a8ca2b02() 1662     GestureEventNoParameter actionCancel = []() {};
1663     auto dragEvent = AceType::MakeRefPtr<DragEvent>(
1664         std::move(actionStart), std::move(actionUpdate), std::move(actionEnd), std::move(actionCancel));
1665     dragEventActuator->ReplaceDragEvent(dragEvent);
1666     dragEventActuator->SetCustomDragEvent(dragEvent);
1667     auto getEventTargetImpl = eventHub->CreateGetEventTargetImpl();
1668     TouchTestResult finalResult;
1669     ResponseLinkResult responseLinkResult;
1670     dragEventActuator->OnCollectTouchTarget(
1671         COORDINATE_OFFSET, DRAG_TOUCH_RESTRICT, getEventTargetImpl, finalResult, responseLinkResult);
1672     GestureEvent info = GestureEvent();
1673     SystemProperties::debugEnabled_ = false;
1674     frameNode->SetDraggable(false);
1675     gestureEventHub->SetTextDraggable(true);
1676     gestureEventHub->SetIsTextDraggable(true);
1677     dragEventActuator->SetIsNotInPreviewState(true);
1678     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1679     auto pipelineContext = PipelineContext::GetCurrentContext();
1680     ASSERT_NE(pipelineContext, nullptr);
1681     auto manager = pipelineContext->GetOverlayManager();
1682     manager->hasEvent_ = false;
1683     MockContainer::SetUp();
1684     auto container = MockContainer::Current();
1685     container->isScenceBoardWindow_ = true;
1686     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1687     container->isScenceBoardWindow_ = false;
1688     manager->hasEvent_ = false;
1689     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1690     (*(dragEventActuator->previewLongPressRecognizer_->onAction_))(info);
1691     MockContainer::TearDown();
1692     EXPECT_EQ(manager->hasEvent_, true);
1693 }
1694 
1695 /**
1696  * @tc.name: DragEventActuatorMountGatherNodeTest026
1697  * @tc.desc: Test SetImageNodeInitAttr
1698  * @tc.type: FUNC
1699  */
1700 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest026, TestSize.Level1)
1701 {
1702     auto eventHub = AceType::MakeRefPtr<EventHub>();
1703     ASSERT_NE(eventHub, nullptr);
1704     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1705     ASSERT_NE(framenode, nullptr);
1706     auto framenodeOne = FrameNode::CreateFrameNode("test1", 1, AceType::MakeRefPtr<Pattern>(), false);
1707     ASSERT_NE(framenodeOne, nullptr);
1708     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1709     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1710     ASSERT_NE(gestureEventHub, nullptr);
1711     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1712         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1713     framenode->previewOption_.defaultAnimationBeforeLifting = true;
1714     ASSERT_NE(dragEventActuator, nullptr);
1715     auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
1716     mockRenderContext->UpdateOpacity(1.1f);
1717     framenodeOne->renderContext_ = mockRenderContext;
1718     Dimension dimen(2.0);
1719     BlurBackGroundInfo bgBackEffect = { { dimen, 1.0f, 1.0f, Color::TRANSPARENT, AdaptiveColor::DEFAULT,
1720         { { 2.0f, 2.0f } } } };
1721     Shadow shadow;
1722     shadow.SetIsFilled(false);
1723     shadow.SetOffset(Offset(5, 5));
1724     shadow.SetBlurRadius(10.0);
1725     shadow.SetColor(Color::FromARGB(255, 255, 0, 0));
1726     BorderRadiusProperty borderRadius;
1727     borderRadius.SetRadius(Dimension(0.1));
1728     OptionsAfterApplied optionTmp = { 0, shadow, "test", true, borderRadius, { bgBackEffect } };
1729     NG::DragPreviewOption previewOptions;
1730     previewOptions.options = optionTmp;
1731     framenode->SetDragPreviewOptions(previewOptions);
1732     DragAnimationHelper::SetImageNodeInitAttr(framenode, framenodeOne);
1733     DragAnimationHelper::SetImageNodeFinishAttr(framenode, framenodeOne);
1734     previewOptions.options.shadow->isFilled_ = true;
1735     framenode->SetDragPreviewOptions(previewOptions);
1736     DragAnimationHelper::SetImageNodeFinishAttr(framenode, framenodeOne);
1737 
1738     DragDropInfo dragDropInfo;
1739     RefPtr<PixelMap> pixelMap = PixelMap::CreatePixelMap(static_cast<void*>(new char[0]));
1740     dragDropInfo.pixelMap = pixelMap;
1741     dragDropInfo.inspectorId = "";
1742     gestureEventHub->dragPreviewPixelMap_ = pixelMap;
1743     framenode->SetDragPreview(dragDropInfo);
1744     GatherNodeChildInfo gatherNodeChildInfo;
1745     dragEventActuator->CreateImageNode(framenode, gatherNodeChildInfo);
1746     EXPECT_EQ(shadow.GetBlurRadius(), 10.0);
1747 }
1748 
1749 /**
1750  * @tc.name: DragEventActuatorMountGatherNodeTest027
1751  * @tc.desc: Test MountGatherNode function.
1752  * @tc.type: FUNC
1753  */
1754 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest027, TestSize.Level1)
1755 {
1756     auto eventHub = AceType::MakeRefPtr<EventHub>();
1757     ASSERT_NE(eventHub, nullptr);
1758     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1759     ASSERT_NE(frameNode, nullptr);
1760     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1761     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1762     ASSERT_NE(gestureEventHub, nullptr);
1763     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1764         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1765     ASSERT_NE(dragEventActuator, nullptr);
1766     auto pipelineContext = PipelineContext::GetCurrentContext();
1767     ASSERT_NE(pipelineContext, nullptr);
1768     auto manager = pipelineContext->GetOverlayManager();
1769     ASSERT_NE(manager, nullptr);
1770     auto gestureHub = dragEventActuator->gestureEventHub_.Upgrade();
1771     ASSERT_NE(gestureHub, nullptr);
1772     auto frameNodeOne = gestureHub->GetFrameNode();
1773     ASSERT_NE(frameNodeOne, nullptr);
1774     manager->gatherNodeWeak_ = frameNodeOne;
1775     auto gatherNode = manager->GetGatherNode();
1776     ASSERT_NE(gatherNode, nullptr);
1777     std::vector<GatherNodeChildInfo> gatherNodeChildrenInfo(2);
1778     MockContainer::SetUp();
1779     auto container = MockContainer::Current();
1780     container->isScenceBoardWindow_ = true;
1781     dragEventActuator->MountGatherNode(manager, frameNode, gatherNode, gatherNodeChildrenInfo);
1782     container->isScenceBoardWindow_ = false;
1783     MockContainer::TearDown();
1784     EXPECT_EQ(container->isScenceBoardWindow_, false);
1785 }
1786 
1787 /**
1788  * @tc.name: DragEventActuatorMountGatherNodeTest028
1789  * @tc.desc: Test IsBelongToMultiItemNode function.
1790  * @tc.type: FUNC
1791  */
1792 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest028, TestSize.Level1)
1793 {
1794     auto eventHub = AceType::MakeRefPtr<EventHub>();
1795     ASSERT_NE(eventHub, nullptr);
1796     auto frameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1797     ASSERT_NE(frameNode, nullptr);
1798     auto parentNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1799     ASSERT_NE(parentNode, nullptr);
1800     frameNode->SetParent(parentNode);
1801 
1802     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(frameNode));
1803     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1804     ASSERT_NE(gestureEventHub, nullptr);
1805     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1806         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1807     dragEventActuator->IsBelongToMultiItemNode(frameNode);
1808     DragPreviewOption previewOption;
1809     previewOption.isMultiSelectionEnabled = true;
1810     parentNode->SetDragPreviewOptions(previewOption);
1811     dragEventActuator->IsBelongToMultiItemNode(frameNode);
1812     auto eventHubp = parentNode->GetEventHub<EventHub>();
1813     ASSERT_NE(eventHubp, nullptr);
__anonc1d0a8ca2c02(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&) 1814     auto func = [](const RefPtr<OHOS::Ace::DragEvent>&, const std::string&) { return DragDropInfo(); };
1815     eventHubp->onDragStart_ = func;
1816     dragEventActuator->IsBelongToMultiItemNode(frameNode);
1817     auto childNode = FrameNode::CreateFrameNode(V2::GRID_ITEM_ETS_TAG, 1, AceType::MakeRefPtr<Pattern>(), false);
1818     ASSERT_NE(childNode, nullptr);
1819     auto parentNodeTwo = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1820     ASSERT_NE(parentNodeTwo, nullptr);
1821     childNode->SetParent(parentNodeTwo);
1822     dragEventActuator->FindItemParentNode(frameNode);
1823     dragEventActuator->FindItemParentNode(childNode);
1824     EXPECT_EQ(previewOption.isMultiSelectionEnabled, true);
1825 }
1826 
1827 /**
1828  * @tc.name: DragEventActuatorMountGatherNodeTest029
1829  * @tc.desc: Test PrepareShadowParametersForDragData
1830  * @tc.type: FUNC
1831  */
1832 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest029, TestSize.Level1)
1833 {
1834     auto eventHub = AceType::MakeRefPtr<EventHub>();
1835     ASSERT_NE(eventHub, nullptr);
1836     auto framenode = FrameNode::CreateFrameNode(V2::RICH_EDITOR_ETS_TAG, 1, AceType::MakeRefPtr<Pattern>(), false);
1837     ASSERT_NE(framenode, nullptr);
1838     auto framenodeOne = FrameNode::CreateFrameNode(V2::TEXT_ETS_TAG, 1, AceType::MakeRefPtr<Pattern>(), false);
1839     ASSERT_NE(framenodeOne, nullptr);
1840     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1841     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1842     ASSERT_NE(gestureEventHub, nullptr);
1843     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1844         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1845     ASSERT_NE(dragEventActuator, nullptr);
1846     Dimension dimen(2.0);
1847     BlurBackGroundInfo bgBackEffect = { { dimen, 1.0f, 1.0f, Color::TRANSPARENT, AdaptiveColor::DEFAULT,
1848         { { 2.0f, 2.0f } } } };
1849     Shadow shadow;
1850     shadow.SetIsFilled(false);
1851     shadow.SetOffset(Offset(5, 5));
1852     shadow.SetBlurRadius(10.0);
1853     shadow.SetColor(Color::FromARGB(255, 255, 0, 0));
1854     BorderRadiusProperty borderRadius;
1855     borderRadius.SetRadius(Dimension(0.1));
1856     OptionsAfterApplied optionTmp = { 0, shadow, "test", true, borderRadius, { bgBackEffect } };
1857     NG::DragPreviewOption previewOptions;
1858     previewOptions.options = optionTmp;
1859     previewOptions.options.shadow->isFilled_ = true;
1860     framenode->SetDragPreviewOptions(previewOptions);
1861     framenodeOne->SetDragPreviewOptions(previewOptions);
1862     std::unique_ptr<JsonValue> arkExtraInfoJson = std::make_unique<JsonValue>();
1863     float scale = 1.0f;
1864     auto gestureHub = framenode->GetOrCreateGestureEventHub();
1865     auto gestureHubOne = framenodeOne->GetOrCreateGestureEventHub();
1866     dragEventActuator->PrepareShadowParametersForDragData(framenode, arkExtraInfoJson, scale);
1867     gestureHub->textDraggable_ = true;
1868     dragEventActuator->PrepareShadowParametersForDragData(framenode, arkExtraInfoJson, scale);
1869     gestureHub->isTextDraggable_ = true;
1870     dragEventActuator->PrepareShadowParametersForDragData(framenode, arkExtraInfoJson, scale);
1871     gestureHubOne->isTextDraggable_ = true;
1872     gestureHubOne->textDraggable_ = true;
1873     dragEventActuator->PrepareShadowParametersForDragData(framenodeOne, arkExtraInfoJson, scale);
1874     EXPECT_EQ(gestureHubOne->textDraggable_, true);
1875 }
1876 
1877 /**
1878  * @tc.name: DragEventActuatorMountGatherNodeTest030
1879  * @tc.desc: Test PrepareShadowParametersForDragData
1880  * @tc.type: FUNC
1881  */
1882 HWTEST_F(DragEventTestNg, DragEventActuatorMountGatherNodeTest030, TestSize.Level1)
1883 {
1884     auto eventHub = AceType::MakeRefPtr<EventHub>();
1885     ASSERT_NE(eventHub, nullptr);
1886     auto framenode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
1887     ASSERT_NE(framenode, nullptr);
1888     eventHub->host_ = AceType::WeakClaim(AceType::RawPtr(framenode));
1889     auto gestureEventHub = AceType::MakeRefPtr<GestureEventHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
1890     ASSERT_NE(gestureEventHub, nullptr);
1891     auto dragEventActuator = AceType::MakeRefPtr<DragEventActuator>(
1892         AceType::WeakClaim(AceType::RawPtr(gestureEventHub)), DRAG_DIRECTION, FINGERS_NUMBER, DISTANCE);
1893     ASSERT_NE(dragEventActuator, nullptr);
1894     Dimension dimen(2.0);
1895     BlurBackGroundInfo bgBackEffect = { { dimen, 1.0f, 1.0f, Color::TRANSPARENT, AdaptiveColor::DEFAULT,
1896         { { 2.0f, 2.0f } } } };
1897     Shadow shadow;
1898     shadow.SetIsFilled(false);
1899     shadow.SetOffset(Offset(0, 0));
1900     shadow.SetBlurRadius(-10.0);
1901     shadow.SetColor(Color::FromARGB(255, 255, 0, 0));
1902     BorderRadiusProperty borderRadius;
1903     borderRadius.SetRadius(Dimension(0.1));
1904     OptionsAfterApplied optionTmp = { 0, shadow, "test", true, borderRadius, { bgBackEffect } };
1905     NG::DragPreviewOption previewOptions;
1906     previewOptions.options = optionTmp;
1907     previewOptions.options.shadow->isFilled_ = true;
1908     framenode->SetDragPreviewOptions(previewOptions);
1909     std::unique_ptr<JsonValue> arkExtraInfoJson = std::make_unique<JsonValue>();
1910     float scale = 1.0f;
1911     dragEventActuator->PrepareShadowParametersForDragData(framenode, arkExtraInfoJson, scale);
1912     Shadow shadows;
1913     shadows.SetIsFilled(false);
1914     shadows.SetOffset(Offset(5, 5));
1915     optionTmp = { 0, shadows, "test", true, borderRadius, { bgBackEffect } };
1916     previewOptions.options = optionTmp;
1917     framenode->SetDragPreviewOptions(previewOptions);
1918     dragEventActuator->PrepareShadowParametersForDragData(framenode, arkExtraInfoJson, scale);
1919     EXPECT_EQ(previewOptions.options.opacity, 0.0f);
1920 }
1921 }