• 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 #include <optional>
16 
17 #include "gtest/gtest.h"
18 
19 #define private public
20 
21 #include "base/geometry/ng/offset_t.h"
22 #include "base/geometry/ng/rect_t.h"
23 #include "base/geometry/ng/size_t.h"
24 #include "base/image/pixel_map.h"
25 #include "base/memory/ace_type.h"
26 #include "base/memory/referenced.h"
27 #include "core/components_ng/base/frame_node.h"
28 #include "core/components_ng/base/geometry_node.h"
29 #include "core/components_ng/base/ui_node.h"
30 #include "core/components_ng/event/event_hub.h"
31 #include "core/components_ng/manager/drag_drop/drag_drop_manager.h"
32 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h"
33 #include "frameworks/core/components_ng/pattern/pattern.h"
34 #include "test/mock/core/common/mock_container.h"
35 #include "test/mock/core/pipeline/mock_pipeline_context.h"
36 
37 using namespace testing;
38 using namespace testing::ext;
39 namespace OHOS::Ace::NG {
40 namespace {
41 constexpr int64_t PROXY_ID = 1;
42 constexpr int64_t PROXY_ID_NOT_FIT = 101;
43 const std::string GET_EXTRA("GetExtraInfoFromClipboard");
44 const std::string NODE_TAG("custom_node");
45 const std::string EXTRA_INFO_DRAG_START("drag_start_info");
46 const std::string ON_DRAG_START("OnDragStart");
47 const std::string ITEM_DRAG_START("OnItemDragStart");
48 constexpr int32_t DRAGGED_INDEX = 0;
49 const DragType DRAG_TYPE_GRID = DragType::GRID;
50 } // namespace
51 
52 class DragDropProxyTestNg : public testing::Test {
53 public:
54     static void SetUpTestCase();
55     static void TearDownTestCase();
56 
57 protected:
58 };
59 
SetUpTestCase()60 void DragDropProxyTestNg::SetUpTestCase()
61 {
62     MockPipelineContext::SetUp();
63     MockContainer::SetUp();
64 }
65 
TearDownTestCase()66 void DragDropProxyTestNg::TearDownTestCase()
67 {
68     MockPipelineContext::TearDown();
69     MockContainer::TearDown();
70 }
71 
72 /**
73  * @tc.name: DragDropProxyTest001
74  * @tc.desc: Test OnDragStart
75  * @tc.type: FUNC
76  * @tc.author:
77  */
78 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest001, TestSize.Level1)
79 {
80     /**
81      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
82      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
83      */
84     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
85     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
86 
87     /**
88      * @tc.steps: step2. call onDragStart
89      * @tc.expected: step2. no fatal errors happended
90      *                      DragDropManager->OnDragStart() & AddDataToClipboard() will not be called
91      *                      frameNode's nodeName_ not change
92      */
93     auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
94     GestureEvent info;
95     proxyUnFitted->OnDragStart(info, EXTRA_INFO_DRAG_START, frameNode);
96     auto nodeName = frameNode->GetNodeName();
97     EXPECT_EQ(nodeName, "");
98 
99     /**
100      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
101      * @tc.expected: step3. id_ = PROXY_ID
102      */
103     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
104     EXPECT_EQ(proxy->id_, PROXY_ID);
105 
106     /**
107      * @tc.steps: step4. call onDragStart
108      * @tc.expected: step4. DragDropManager->OnDragStart() & AddDataToClipboard() will be called
109      *                      some logs will be print
110      *                      they are defined in "mock_drag_drop_manager.cpp"
111      *                      frameNode's nodeName_ not change
112      */
113     proxy->OnDragStart(info, EXTRA_INFO_DRAG_START, frameNode);
114     nodeName = frameNode->GetNodeName();
115     EXPECT_EQ(nodeName, "");
116 }
117 
118 /**
119  * @tc.name: DragDropProxyTest002
120  * @tc.desc: Test OnDragMove
121  * @tc.type: FUNC
122  * @tc.author:
123  */
124 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest002, TestSize.Level1)
125 {
126     /**
127      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
128      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
129      */
130     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
131     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
132 
133     /**
134      * @tc.steps: step2. call OnDragMove
135      * @tc.expected: step2. no fatal errors happended
136      *                      DragDropManager->OnDragMove() & GetExtraInfoFromClipboard() will not be called
137      */
138     GestureEvent info;
139     proxyUnFitted->OnDragMove(info);
140 
141     /**
142      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
143      * @tc.expected: step3. id_ = PROXY_ID
144      */
145     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
146     EXPECT_EQ(proxy->id_, PROXY_ID);
147 
148     /**
149      * @tc.steps: step4. call OnDragMove
150      * @tc.expected: step4. DragDropManager->OnDragMove() & GetExtraInfoFromClipboard() will be called
151      *                      some logs will be print
152      *                      they are defined in "mock_drag_drop_manager.cpp"
153      */
154     proxy->OnDragMove(info);
155 }
156 
157 /**
158  * @tc.name: DragDropProxyTest003
159  * @tc.desc: Test OnDragEnd
160  * @tc.type: FUNC
161  * @tc.author:
162  */
163 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest003, TestSize.Level1)
164 {
165     /**
166      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
167      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
168      */
169     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
170     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
171 
172     /**
173      * @tc.steps: step2. call OnDragEnd
174      * @tc.expected: step2. no fatal errors happended
175      *                      DragDropManager->OnDragEnd() & GetExtraInfoFromClipboard() &
176      *                      RestoreClipboardData() will not be called
177      */
178     GestureEvent info;
179     proxyUnFitted->OnDragEnd(info);
180 
181     /**
182      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
183      * @tc.expected: step3. id_ = PROXY_ID
184      */
185     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
186     EXPECT_EQ(proxy->id_, PROXY_ID);
187 
188     /**
189      * @tc.steps: step4. call OnDragEnd
190      * @tc.expected: step4. DragDropManager->OnDragEnd() & GetExtraInfoFromClipboard() &
191      *                      RestoreClipboardData() will be called
192      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
193      */
194     proxy->OnDragEnd(info);
195 }
196 
197 /**
198  * @tc.name: DragDropProxyOnDragEndTest001
199  * @tc.desc: Test OnDragEnd
200  * @tc.type: FUNC
201  * @tc.author:
202  */
203 HWTEST_F(DragDropProxyTestNg, DragDropProxyOnDragEndTest001, TestSize.Level1)
204 {
205     /**
206      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
207      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
208      */
209     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
210     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
211 
212     /**
213      * @tc.steps: step2. call OnDragEnd
214      * @tc.expected: step2. no fatal errors happended
215      *                      DragDropManager->OnDragEnd() & GetExtraInfoFromClipboard() &
216      *                      RestoreClipboardData() will not be called
217      */
218     GestureEvent info;
219     proxyUnFitted->OnDragEnd(info, true);
220 
221     /**
222      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
223      * @tc.expected: step3. id_ = PROXY_ID
224      */
225     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
226     EXPECT_EQ(proxy->id_, PROXY_ID);
227 
228     /**
229      * @tc.steps: step4. call OnDragEnd
230      * @tc.expected: step4. DragDropManager->OnDragEnd() & GetExtraInfoFromClipboard() &
231      *                      RestoreClipboardData() will be called
232      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
233      */
234     proxy->OnDragEnd(info, true);
235     EXPECT_EQ(proxy->id_, PROXY_ID);
236 }
237 
238 /**
239  * @tc.name: DragDropProxyTest004
240  * @tc.desc: Test onDragCancel
241  * @tc.type: FUNC
242  * @tc.author:
243  */
244 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest004, TestSize.Level1)
245 {
246     /**
247      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
248      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
249      */
250     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
251     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
252 
253     /**
254      * @tc.steps: step2. call onDragCancel
255      * @tc.expected: step2. no fatal errors happended
256      *                      DragDropManager->onDragCancel() will not be called
257      */
258     proxyUnFitted->onDragCancel();
259 
260     /**
261      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
262      * @tc.expected: step3. id_ = PROXY_ID
263      */
264     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
265     EXPECT_EQ(proxy->id_, PROXY_ID);
266 
267     /**
268      * @tc.steps: step4. call onDragCancel
269      * @tc.expected: step4. DragDropManager->onDragCancel() will be called
270      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
271      */
272     auto pipeline = PipelineContext::GetCurrentContext();
273     auto manager = pipeline->GetDragDropManager();
274     manager->currentId_ = PROXY_ID;
275     proxy->onDragCancel();
276 }
277 
278 /**
279  * @tc.name: DragDropProxyTest005
280  * @tc.desc: Test onItemDragStart
281  * @tc.type: FUNC
282  * @tc.author:
283  */
284 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest005, TestSize.Level1)
285 {
286     /**
287      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
288      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
289      */
290     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
291     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
292 
293     /**
294      * @tc.steps: step2. call OnItemDragStart
295      * @tc.expected: step2. no fatal errors happended
296      *                      DragDropManager->OnItemDragStart() will not be called
297      *                      frameNode' nodeName not change
298      */
299     auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
300     GestureEvent info;
301     proxyUnFitted->OnItemDragStart(info, frameNode);
302     auto nodeName = frameNode->GetNodeName();
303     EXPECT_EQ(nodeName, "");
304 
305     /**
306      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
307      * @tc.expected: step3. id_ = PROXY_ID
308      */
309     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
310     EXPECT_EQ(proxy->id_, PROXY_ID);
311 
312     /**
313      * @tc.steps: step4. call OnItemDragStart
314      * @tc.expected: step4. DragDropManager->OnItemDragStart() will be called
315      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
316      *                      frameNode' nodeName not change
317      */
318     proxy->OnItemDragStart(info, frameNode);
319     nodeName = frameNode->GetNodeName();
320     EXPECT_EQ(nodeName, "");
321 }
322 
323 /**
324  * @tc.name: DragDropProxyTest006
325  * @tc.desc: Test OnItemDragMove
326  * @tc.type: FUNC
327  * @tc.author:
328  */
329 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest006, TestSize.Level1)
330 {
331     /**
332      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
333      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
334      */
335     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
336     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
337 
338     /**
339      * @tc.steps: step2. call OnItemDragMove
340      * @tc.expected: step2. no fatal errors happended
341      *                      DragDropManager->OnItemDragMove() will not be called
342      */
343     GestureEvent info;
344     proxyUnFitted->OnItemDragMove(info, DRAGGED_INDEX, DRAG_TYPE_GRID);
345 
346     /**
347      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
348      * @tc.expected: step3. id_ = PROXY_ID
349      */
350     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
351     EXPECT_EQ(proxy->id_, PROXY_ID);
352 
353     /**
354      * @tc.steps: step4. call OnItemDragMove
355      * @tc.expected: step4. DragDropManager->OnItemDragMove() will be called
356      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
357      */
358     proxy->OnItemDragMove(info, DRAGGED_INDEX, DRAG_TYPE_GRID);
359 }
360 
361 /**
362  * @tc.name: DragDropProxyTest007
363  * @tc.desc: Test OnItemDragEnd
364  * @tc.type: FUNC
365  * @tc.author:
366  */
367 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest007, TestSize.Level1)
368 {
369     /**
370      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
371      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
372      */
373     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
374     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
375 
376     /**
377      * @tc.steps: step2. call OnItemDragEnd
378      * @tc.expected: step2. no fatal errors happended
379      *                      DragDropManager->OnItemDragEnd() will not be called
380      */
381     GestureEvent info;
382     proxyUnFitted->OnItemDragEnd(info, DRAGGED_INDEX, DRAG_TYPE_GRID);
383 
384     /**
385      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
386      * @tc.expected: step3. id_ = PROXY_ID
387      */
388     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
389     EXPECT_EQ(proxy->id_, PROXY_ID);
390 
391     /**
392      * @tc.steps: step4. call OnItemDragEnd
393      * @tc.expected: step4. DragDropManager->OnItemDragEnd() will be called
394      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
395      */
396     proxy->OnItemDragEnd(info, DRAGGED_INDEX, DRAG_TYPE_GRID);
397 }
398 
399 /**
400  * @tc.name: DragDropProxyTest008
401  * @tc.desc: Test onItemDragCancel
402  * @tc.type: FUNC
403  * @tc.author:
404  */
405 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest008, TestSize.Level1)
406 {
407     /**
408      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId
409      * @tc.expected: step1. id_ = PROXY_ID_NOT_FIT
410      */
411     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
412     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
413 
414     /**
415      * @tc.steps: step2. call onItemDragCancel
416      * @tc.expected: step2. no fatal errors happended
417      *                      DragDropManager->onItemDragCancel() will not be called
418      */
419     GestureEvent info;
420     proxyUnFitted->onItemDragCancel();
421 
422     /**
423      * @tc.steps: step3. construct a DragDropProxy with fitted proxyId
424      * @tc.expected: step3. id_ = PROXY_ID
425      */
426     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
427     EXPECT_EQ(proxy->id_, PROXY_ID);
428 
429     /**
430      * @tc.steps: step4. call onItemDragCancel
431      * @tc.expected: step4. DragDropManager->onItemDragCancel() will be called
432      *                      some logs will be print they are defined in "mock_drag_drop_manager.cpp"
433      */
434     proxy->onItemDragCancel();
435 }
436 
437 /**
438  * @tc.name: DragDropProxyTest009
439  * @tc.desc: Test OnTextDragStart
440  * @tc.type: FUNC
441  * @tc.author:
442  */
443 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest009, TestSize.Level1)
444 {
445     /**
446      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyId.
447      * @tc.expected: step1. id_ is equal to PROXY_ID_NOT_FIT.
448      */
449     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
450     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
451 
452     /**
453      * @tc.steps: step2. construct a manager and update currentId_.
454      */
455     auto pipeline = PipelineContext::GetCurrentContext();
456     auto manager = pipeline->GetDragDropManager();
457     manager->currentId_ = PROXY_ID_NOT_FIT;
458 
459     /**
460      * @tc.steps: step3. call OnTextDragStart with ON_DRAG_START.
461      * @tc.expected: step3. retFlag is true.
462      */
463     proxyUnFitted->OnTextDragStart(ON_DRAG_START);
464     auto retFlag = manager->CheckDragDropProxy(PROXY_ID_NOT_FIT);
465     EXPECT_TRUE(retFlag);
466 }
467 
468 /**
469  * @tc.name: DragDropProxyTest010
470  * @tc.desc: Test CheckDragDropProxy out of OnDragStart is a true branch
471  * @tc.type: FUNC
472  * @tc.author:
473  */
474 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest010, TestSize.Level1)
475 {
476     /**
477      * @tc.steps: step1. construct a DragDropProxy with unfitted proxyUnFitted.
478      * @tc.expected: step1. id_ is equal to PROXY_ID_NOT_FIT.
479      */
480     auto proxyUnFitted = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID_NOT_FIT);
481     EXPECT_EQ(proxyUnFitted->id_, PROXY_ID_NOT_FIT);
482 
483     /**
484      * @tc.steps: step2. construct a manager and update currentId_.
485      */
486     auto pipeline = PipelineContext::GetCurrentContext();
487     auto manager = pipeline->GetDragDropManager();
488     manager->currentId_ = PROXY_ID_NOT_FIT;
489 
490     /**
491      * @tc.steps: step3. call onDragStart with GestureEvent and frameNode.
492      * @tc.expected: step3. proxyUnFitted->id_ is equal to manager->currentId_.
493      */
494     GestureEvent info;
495     auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
496     proxyUnFitted->OnDragStart(info, EXTRA_INFO_DRAG_START, frameNode);
497     EXPECT_EQ(proxyUnFitted->id_, manager->currentId_);
498 }
499 
500 /**
501  * @tc.name: DragDropProxyTest011
502  * @tc.desc: Test isTextDragEnd out of OnDragEnd is a true branch
503  * @tc.type: FUNC
504  * @tc.author:
505  */
506 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest011, TestSize.Level1)
507 {
508     /**
509      * @tc.steps: step1. construct a DragDropProxy with fitted proxy.
510      * @tc.expected: step1. id_ is equal to PROXY_ID.
511      */
512     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
513     EXPECT_EQ(proxy->id_, PROXY_ID);
514 
515     /**
516      * @tc.steps: step2. construct a manager and update currentId_.
517      */
518     auto pipeline = PipelineContext::GetCurrentContext();
519     auto manager = pipeline->GetDragDropManager();
520     EXPECT_TRUE(manager);
521 
522     /**
523      * @tc.steps: step3. call OnDragEnd with GestureEvent and true.
524      * @tc.expected: step3. manager->currentId_ is equal to -1.
525      */
526     GestureEvent info;
527     manager->currentId_ = PROXY_ID;
528     proxy->OnDragEnd(info, true);
529     EXPECT_EQ(manager->currentId_, -1);
530 }
531 
532 /**
533  * @tc.name: DragDropProxyTest012
534  * @tc.desc: DestroyDragWindow
535  * @tc.type: FUNC
536  * @tc.author:
537  */
538 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest012, TestSize.Level1)
539 {
540     /**
541      * @tc.steps: step1. construct a DragDropProxy with fitted proxy.
542      * @tc.expected: step1. id_ is equal to PROXY_ID.
543      */
544     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
545     EXPECT_EQ(proxy->id_, PROXY_ID);
546 
547     /**
548      * @tc.steps: step2. construct a manager and update currentId_.
549      */
550     auto pipeline = PipelineContext::GetCurrentContext();
551     auto manager = pipeline->GetDragDropManager();
552     manager->currentId_ = PROXY_ID;
553 
554     /**
555      * @tc.steps: step3. call DestroyDragWindow.
556      * @tc.expected: step3. manager->currentId_ is equal to proxy->id_.
557      */
558     proxy->DestroyDragWindow();
559     EXPECT_EQ(manager->currentId_, -1);
560 }
561 
562 /**
563  * @tc.name: DragDropProxyTest013
564  * @tc.desc: Test OnDragStart DragEvent information
565  * @tc.type: FUNC
566  * @tc.author:
567  */
568 HWTEST_F(DragDropProxyTestNg, DragDropProxyTest013, TestSize.Level1)
569 {
570     /**
571     * @tc.steps: step1. construct a DragDropProxy.
572     */
573     auto proxy = AceType::MakeRefPtr<DragDropProxy>(PROXY_ID);
574     ASSERT_NE(proxy, nullptr);
575 
576     /**
577     * @tc.steps: step2. construct a manager.
578     */
579     auto pipeline = PipelineContext::GetCurrentContext();
580     ASSERT_NE(pipeline, nullptr);
581     auto manager = pipeline->GetDragDropManager();
582     ASSERT_NE(manager, nullptr);
583     manager->currentId_ = PROXY_ID;
584 
585     /**
586     * @tc.steps: step3. call OnDragStart with GestureEvent.
587     */
588     GestureEvent info;
589     info.SetSourceTool(SourceTool::FINGER);
590     info.SetTargetDisplayId(1);
591     proxy->OnDragStart(info, EXTRA_INFO_DRAG_START, nullptr);
592     EXPECT_EQ(manager->preDragPointerEvent_.sourceTool, SourceTool::FINGER);
593     EXPECT_EQ(manager->preDragPointerEvent_.displayId, 1);
594 }
595 } // namespace OHOS::Ace::NG
596