• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 <future>
17 #include <optional>
18 #include <vector>
19 
20 #include <unistd.h>
21 
22 #include <gtest/gtest.h>
23 #include "pointer_event.h"
24 #include "securec.h"
25 
26 #include "devicestatus_define.h"
27 #include "devicestatus_errors.h"
28 #include "interaction_manager.h"
29 
30 #undef LOG_TAG
31 #define LOG_TAG "InteractionDragDrawingTest"
32 
33 namespace OHOS {
34 namespace Msdp {
35 namespace DeviceStatus {
36 using namespace testing::ext;
37 namespace {
38 constexpr uint32_t DEFAULT_ICON_COLOR { 0xFF };
39 constexpr int32_t TIME_WAIT_FOR_OP_MS { 20 };
40 constexpr int32_t PIXEL_MAP_WIDTH { 300 };
41 constexpr int32_t PIXEL_MAP_HEIGHT { 300 };
42 constexpr int32_t MIDDLE_PIXEL_MAP_WIDTH { 400 };
43 constexpr int32_t MIDDLE_PIXEL_MAP_HEIGHT { 400 };
44 constexpr int32_t MAX_PIXEL_MAP_WIDTH { 600 };
45 constexpr int32_t MAX_PIXEL_MAP_HEIGHT { 600 };
46 constexpr int32_t POINTER_ID { 0 };
47 constexpr int32_t DISPLAY_ID { 0 };
48 constexpr int32_t DISPLAY_X { 50 };
49 constexpr int32_t DISPLAY_Y { 50 };
50 constexpr int32_t DRAG_NUM_ONE { 1 };
51 constexpr int32_t SHADOW_NUM_ONE { 1 };
52 constexpr int32_t DRAG_NUM_TWO { 2 };
53 constexpr int32_t SHADOW_NUM_TWO { 2 };
54 constexpr int32_t DRAG_NUM_THREE { 3 };
55 constexpr int32_t SHADOW_NUM_THREE { 3 };
56 constexpr int32_t SHADOW_NUM_TOO_MUCH { 5 };
57 constexpr int32_t DRAG_NUM_MULTIPLE { 10 };
58 constexpr int32_t SHADOW_NUM_MULTIPLE { 10 };
59 constexpr int32_t INT32_BYTE { 4 };
60 constexpr int32_t PROMISE_WAIT_SPAN_MS { 2000 };
61 constexpr int32_t TIME_WAIT_FOR_UPDATE_DRAG_STYLE { 50 };
62 constexpr int32_t TIME_WAIT_FOR_ANIMATION_END { 1000 };
63 constexpr int32_t WINDOW_ID { -1 };
64 constexpr bool HAS_CANCELED_ANIMATION { true };
65 constexpr bool HAS_CUSTOM_ANIMATION { true };
66 constexpr bool DRAG_WINDOW_VISIBLE { true };
67 const std::string UD_KEY { "Unified data key" };
68 const std::string FILTER_INFO { "Undefined filter info" };
69 const std::string EXTRA_INFO { "Undefined extra info" };
70 } // namespace
71 
72 class InteractionDragDrawingTest : public testing::Test {
73 public:
74     void SetUp();
75     void TearDown();
76     static void SetUpTestCase();
77     static std::shared_ptr<Media::PixelMap> CreatePixelMap(int32_t width, int32_t height);
78     static std::optional<DragData> CreateDragData(int32_t sourceType, int32_t pointerId, int32_t dragNum,
79         bool hasCoordinateCorrected, int32_t shadowNum);
80 };
81 
SetUpTestCase()82 void InteractionDragDrawingTest::SetUpTestCase() {}
83 
SetUp()84 void InteractionDragDrawingTest::SetUp() {}
85 
TearDown()86 void InteractionDragDrawingTest::TearDown()
87 {
88     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP_MS));
89 }
90 
CreatePixelMap(int32_t width,int32_t height)91 std::shared_ptr<Media::PixelMap> InteractionDragDrawingTest::CreatePixelMap(int32_t width, int32_t height)
92 {
93     CALL_DEBUG_ENTER;
94     if (width <= 0 || width > MAX_PIXEL_MAP_WIDTH || height <= 0 || height > MAX_PIXEL_MAP_HEIGHT) {
95         FI_HILOGE("Size invalid, height:%{public}d, width:%{public}d", height, width);
96         return nullptr;
97     }
98     Media::InitializationOptions opts;
99     opts.size.height = height;
100     opts.size.width = width;
101     opts.pixelFormat = Media::PixelFormat::BGRA_8888;
102     opts.alphaType = Media::AlphaType::IMAGE_ALPHA_TYPE_OPAQUE;
103     opts.scaleMode = Media::ScaleMode::FIT_TARGET_SIZE;
104 
105     int32_t colorLen = width * height;
106     uint32_t *pixelColors = new (std::nothrow) uint32_t[colorLen];
107     CHKPP(pixelColors);
108     int32_t colorByteCount = colorLen * INT32_BYTE;
109     errno_t ret = memset_s(pixelColors, colorByteCount, DEFAULT_ICON_COLOR, colorByteCount);
110     if (ret != EOK) {
111         FI_HILOGE("memset_s failed");
112         delete[] pixelColors;
113         return nullptr;
114     }
115     std::shared_ptr<Media::PixelMap> pixelMap = Media::PixelMap::Create(pixelColors, colorLen, opts);
116     if (pixelMap == nullptr) {
117         FI_HILOGE("Create pixelMap failed");
118         delete[] pixelColors;
119         return nullptr;
120     }
121     delete[] pixelColors;
122     return pixelMap;
123 }
124 
125 class TestStartDragListener : public IStartDragListener {
126 public:
TestStartDragListener(std::function<void (const DragNotifyMsg &)> function)127     explicit TestStartDragListener(std::function<void(const DragNotifyMsg&)> function) : function_(function) { }
OnDragEndMessage(const DragNotifyMsg & msg)128     void OnDragEndMessage(const DragNotifyMsg &msg) override
129     {
130         FI_HILOGD("DisplayX:%{public}d, displayY:%{public}d, targetPid:%{public}d, result:%{public}d",
131             msg.displayX, msg.displayY, msg.targetPid, static_cast<int32_t>(msg.result));
132         if (function_ != nullptr) {
133             function_(msg);
134         }
135         FI_HILOGD("Test OnDragEndMessage");
136     }
137 
OnHideIconMessage()138     void OnHideIconMessage() override
139     {
140         FI_HILOGD("Test OnHideIconMessage");
141     }
142 private:
143     std::function<void(const DragNotifyMsg&)> function_;
144 };
145 
CreateDragData(int32_t sourceType,int32_t pointerId,int32_t dragNum,bool hasCoordinateCorrected,int32_t shadowNum)146 std::optional<DragData> InteractionDragDrawingTest::CreateDragData(int32_t sourceType,
147     int32_t pointerId, int32_t dragNum, bool hasCoordinateCorrected, int32_t shadowNum)
148 {
149     CALL_DEBUG_ENTER;
150     DragData dragData;
151     for (int32_t i = 0; i < shadowNum; i++) {
152         std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(PIXEL_MAP_WIDTH, PIXEL_MAP_HEIGHT);
153         if (pixelMap == nullptr) {
154             FI_HILOGE("CreatePixelMap failed");
155             return std::nullopt;
156         }
157         dragData.shadowInfos.push_back({ pixelMap, 0, 0 });
158     }
159     dragData.buffer = std::vector<uint8_t>(MAX_BUFFER_SIZE, 0);
160     dragData.udKey = UD_KEY;
161     dragData.extraInfo = FILTER_INFO;
162     dragData.extraInfo = EXTRA_INFO;
163     dragData.sourceType = sourceType;
164     dragData.pointerId = pointerId;
165     dragData.dragNum = dragNum;
166     dragData.displayX = DISPLAY_X;
167     dragData.displayY = DISPLAY_Y;
168     dragData.displayId = DISPLAY_ID;
169     dragData.hasCanceledAnimation = HAS_CANCELED_ANIMATION;
170     dragData.hasCoordinateCorrected = hasCoordinateCorrected;
171     return dragData;
172 }
173 
174 /**
175  * @tc.name: InteractionDragDrawingTest_Mouse_DragNum_One
176  * @tc.desc: Drag Drawing
177  * @tc.type: FUNC
178  * @tc.require:
179  */
180 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Mouse_DragNum_One, TestSize.Level1)
181 {
182     CALL_TEST_DEBUG;
183     std::promise<bool> promiseFlag;
184     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750202(const DragNotifyMsg &notifyMessage) 185     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
186         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
187             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
188         promiseFlag.set_value(true);
189     };
190     std::optional<DragData> dragData = CreateDragData(
191         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
192     ASSERT_TRUE(dragData);
193     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
194         std::make_shared<TestStartDragListener>(callback));
195     ASSERT_EQ(ret, RET_OK);
196     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
197     ASSERT_EQ(ret, RET_OK);
198     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
199     ASSERT_EQ(ret, RET_OK);
200     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
201     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
202     ASSERT_EQ(ret, RET_OK);
203     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
204     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
205     ASSERT_EQ(ret, RET_OK);
206     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
207     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
208     ASSERT_EQ(ret, RET_OK);
209     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
210     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
211     ASSERT_EQ(ret, RET_OK);
212     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
213     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
214     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
215     ASSERT_EQ(ret, RET_OK);
216     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
217 }
218 
219 /**
220  * @tc.name: InteractionDragDrawingTest_Mouse_DragNum_Two
221  * @tc.desc: Drag Drawing
222  * @tc.type: FUNC
223  * @tc.require:
224  */
225 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Mouse_DragNum_Two, TestSize.Level1)
226 {
227     CALL_TEST_DEBUG;
228     std::promise<bool> promiseFlag;
229     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750302(const DragNotifyMsg &notifyMessage) 230     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
231         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
232             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
233         promiseFlag.set_value(true);
234     };
235     std::optional<DragData> dragData = CreateDragData(
236         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
237     ASSERT_TRUE(dragData);
238     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
239         std::make_shared<TestStartDragListener>(callback));
240     ASSERT_EQ(ret, RET_OK);
241     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
242     ASSERT_EQ(ret, RET_OK);
243     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
244     ASSERT_EQ(ret, RET_OK);
245     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
246     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
247     ASSERT_EQ(ret, RET_OK);
248     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
249     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
250     ASSERT_EQ(ret, RET_OK);
251     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
252     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
253     ASSERT_EQ(ret, RET_OK);
254     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
255     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
256     ASSERT_EQ(ret, RET_OK);
257     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
258     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
259     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
260     ASSERT_EQ(ret, RET_OK);
261     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
262 }
263 
264 /**
265  * @tc.name: InteractionDragDrawingTest_Mouse_DragNum_Three
266  * @tc.desc: Drag Drawing
267  * @tc.type: FUNC
268  * @tc.require:
269  */
270 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Mouse_DragNum_Three, TestSize.Level1)
271 {
272     CALL_TEST_DEBUG;
273     std::promise<bool> promiseFlag;
274     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750402(const DragNotifyMsg &notifyMessage) 275     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
276         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
277             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
278         promiseFlag.set_value(true);
279     };
280     std::optional<DragData> dragData = CreateDragData(
281         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
282     ASSERT_TRUE(dragData);
283     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
284         std::make_shared<TestStartDragListener>(callback));
285     ASSERT_EQ(ret, RET_OK);
286     ASSERT_EQ(ret, RET_OK);
287     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
288     ASSERT_EQ(ret, RET_OK);
289     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
290     ASSERT_EQ(ret, RET_OK);
291     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
292     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
293     ASSERT_EQ(ret, RET_OK);
294     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
295     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
296     ASSERT_EQ(ret, RET_OK);
297     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
298     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
299     ASSERT_EQ(ret, RET_OK);
300     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
301     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
302     ASSERT_EQ(ret, RET_OK);
303     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
304     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
305     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
306     ASSERT_EQ(ret, RET_OK);
307     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
308 }
309 
310 /**
311  * @tc.name: InteractionDragDrawingTest_Mouse_DragNum_Multiple
312  * @tc.desc: Drag Drawing
313  * @tc.type: FUNC
314  * @tc.require:
315  */
316 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Mouse_DragNum_Multiple, TestSize.Level1)
317 {
318     CALL_TEST_DEBUG;
319     std::promise<bool> promiseFlag;
320     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750502(const DragNotifyMsg &notifyMessage) 321     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
322         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
323             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
324         promiseFlag.set_value(true);
325     };
326     std::optional<DragData> dragData = CreateDragData(
327         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
328     ASSERT_TRUE(dragData);
329     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
330         std::make_shared<TestStartDragListener>(callback));
331     ASSERT_EQ(ret, RET_OK);
332     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
333     ASSERT_EQ(ret, RET_OK);
334     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
335     ASSERT_EQ(ret, RET_OK);
336     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
337     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
338     ASSERT_EQ(ret, RET_OK);
339     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
340     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
341     ASSERT_EQ(ret, RET_OK);
342     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
343     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
344     ASSERT_EQ(ret, RET_OK);
345     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
346     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
347     ASSERT_EQ(ret, RET_OK);
348     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
349     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
350     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
351     ASSERT_EQ(ret, RET_OK);
352     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
353 }
354 
355 /**
356  * @tc.name: InteractionDragDrawingTest_Touchscreen_DragNum_One
357  * @tc.desc: Drag Drawing
358  * @tc.type: FUNC
359  * @tc.require:
360  */
361 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Touchscreen_DragNum_One, TestSize.Level1)
362 {
363     CALL_TEST_DEBUG;
364     std::promise<bool> promiseFlag;
365     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750602(const DragNotifyMsg &notifyMessage) 366     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
367         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
368             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
369         promiseFlag.set_value(true);
370     };
371     std::optional<DragData> dragData = CreateDragData(
372         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
373     ASSERT_TRUE(dragData);
374     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
375         std::make_shared<TestStartDragListener>(callback));
376     ASSERT_EQ(ret, RET_OK);
377     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
378     ASSERT_EQ(ret, RET_OK);
379     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
380     ASSERT_EQ(ret, RET_OK);
381     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
382     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
383     ASSERT_EQ(ret, RET_OK);
384     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
385     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
386     ASSERT_EQ(ret, RET_OK);
387     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
388     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
389     ASSERT_EQ(ret, RET_OK);
390     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
391     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
392     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
393     ASSERT_EQ(ret, RET_OK);
394     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
395 }
396 
397 /**
398  * @tc.name: InteractionDragDrawingTest_Touchscreen_DragNum_Two
399  * @tc.desc: Drag Drawing
400  * @tc.type: FUNC
401  * @tc.require:
402  */
403 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Touchscreen_DragNum_Two, TestSize.Level1)
404 {
405     CALL_TEST_DEBUG;
406     std::promise<bool> promiseFlag;
407     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750702(const DragNotifyMsg &notifyMessage) 408     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
409         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
410             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
411         promiseFlag.set_value(true);
412     };
413     std::optional<DragData> dragData = CreateDragData(
414         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_TWO, false, SHADOW_NUM_TWO);
415     ASSERT_TRUE(dragData);
416     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
417         std::make_shared<TestStartDragListener>(callback));
418     ASSERT_EQ(ret, RET_OK);
419     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
420     ASSERT_EQ(ret, RET_OK);
421     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
422     ASSERT_EQ(ret, RET_OK);
423     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
424     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
425     ASSERT_EQ(ret, RET_OK);
426     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
427     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
428     ASSERT_EQ(ret, RET_OK);
429     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
430     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
431     ASSERT_EQ(ret, RET_OK);
432     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
433     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
434     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
435     ASSERT_EQ(ret, RET_OK);
436     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
437 }
438 
439 /**
440  * @tc.name: InteractionDragDrawingTest_Touchscreen_DragNum_Three
441  * @tc.desc: Drag Drawing
442  * @tc.type: FUNC
443  * @tc.require:
444  */
445 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Touchscreen_DragNum_Three, TestSize.Level1)
446 {
447     CALL_TEST_DEBUG;
448     std::promise<bool> promiseFlag;
449     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750802(const DragNotifyMsg &notifyMessage) 450     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
451         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
452             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
453         promiseFlag.set_value(true);
454     };
455     std::optional<DragData> dragData = CreateDragData(
456         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_THREE, false, SHADOW_NUM_THREE);
457     ASSERT_TRUE(dragData);
458     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
459         std::make_shared<TestStartDragListener>(callback));
460     ASSERT_EQ(ret, RET_OK);
461     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
462     ASSERT_EQ(ret, RET_OK);
463     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
464     ASSERT_EQ(ret, RET_OK);
465     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
466     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
467     ASSERT_EQ(ret, RET_OK);
468     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
469     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
470     ASSERT_EQ(ret, RET_OK);
471     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
472     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
473     ASSERT_EQ(ret, RET_OK);
474     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
475     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
476     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
477     ASSERT_EQ(ret, RET_OK);
478     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
479 }
480 
481 /**
482  * @tc.name: InteractionDragDrawingTest_Touchscreen_DragNum_Multiple
483  * @tc.desc: Drag Drawing
484  * @tc.type: FUNC
485  * @tc.require:
486  */
487 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Touchscreen_DragNum_Multiple, TestSize.Level1)
488 {
489     CALL_TEST_DEBUG;
490     std::optional<DragData> dragData = CreateDragData(
491         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
492     ASSERT_TRUE(dragData);
493     std::promise<bool> promiseFlag;
494     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750902(const DragNotifyMsg &notifyMessage) 495     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
496         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
497             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
498         promiseFlag.set_value(true);
499     };
500     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
501         std::make_shared<TestStartDragListener>(callback));
502     ASSERT_EQ(ret, RET_OK);
503     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
504     ASSERT_EQ(ret, RET_OK);
505     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
506     ASSERT_EQ(ret, RET_OK);
507     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
508     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::DEFAULT);
509     ASSERT_EQ(ret, RET_OK);
510     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
511     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::FORBIDDEN);
512     ASSERT_EQ(ret, RET_OK);
513     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
514     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
515     ASSERT_EQ(ret, RET_OK);
516     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
517     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
518     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
519     ASSERT_EQ(ret, RET_OK);
520     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
521 }
522 
523 /**
524  * @tc.name: InteractionDragDrawingTest_UpdateShadowPic
525  * @tc.desc: Drag Drawing
526  * @tc.type: FUNC
527  * @tc.require:
528  */
529 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_UpdateShadowPic, TestSize.Level1)
530 {
531     CALL_TEST_DEBUG;
532     std::optional<DragData> dragData = CreateDragData(
533         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
534     ASSERT_TRUE(dragData);
535     std::promise<bool> promiseFlag;
536     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750a02(const DragNotifyMsg &notifyMessage) 537     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
538         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
539             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
540         promiseFlag.set_value(true);
541     };
542     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
543         std::make_shared<TestStartDragListener>(callback));
544     ASSERT_EQ(ret, RET_OK);
545     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
546     ASSERT_NE(pixelMap, nullptr);
547     ShadowInfo shadowInfo = { pixelMap, 0, 0 };
548     ret = InteractionManager::GetInstance()->UpdateShadowPic(shadowInfo);
549     ASSERT_EQ(ret, RET_OK);
550     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
551     ASSERT_EQ(ret, RET_OK);
552     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
553     ASSERT_EQ(ret, RET_OK);
554     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
555     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
556     ASSERT_EQ(ret, RET_OK);
557     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
558     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_ANIMATION_END));
559 }
560 
561 /**
562  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_001
563  * @tc.desc: Drag Drawing
564  * @tc.type: FUNC
565  * @tc.require:
566  */
567 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_001, TestSize.Level1)
568 {
569     CALL_TEST_DEBUG;
__anon963ae2750b02(bool result) 570     auto addSelectedPixelmapCallback = [](bool result) {
571         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
572     };
573     std::optional<DragData> dragData = CreateDragData(
574         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
575     ASSERT_TRUE(dragData);
576     std::promise<bool> promiseFlag;
577     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750c02(const DragNotifyMsg &notifyMessage) 578     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
579         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
580             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
581         promiseFlag.set_value(true);
582     };
583     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
584         std::make_shared<TestStartDragListener>(callback));
585     ASSERT_EQ(ret, RET_OK);
586     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
587     ASSERT_EQ(ret, RET_OK);
588     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
589     ASSERT_EQ(ret, RET_OK);
590     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
591     ASSERT_NE(pixelMap, nullptr);
592     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
593     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
594     ASSERT_EQ(ret, RET_OK);
595     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
596     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
597     ASSERT_EQ(ret, RET_OK);
598     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
599     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
600     ASSERT_EQ(ret, RET_OK);
601     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
602     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
603     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
604     ASSERT_EQ(ret, RET_OK);
605     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
606 }
607 
608 /**
609  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_002
610  * @tc.desc: Drag Drawing
611  * @tc.type: FUNC
612  * @tc.require:
613  */
614 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_002, TestSize.Level1)
615 {
616     CALL_TEST_DEBUG;
__anon963ae2750d02(bool result) 617     auto addSelectedPixelmapCallback = [](bool result) {
618         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
619     };
620     std::optional<DragData> dragData = CreateDragData(
621         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
622     ASSERT_TRUE(dragData);
623     std::promise<bool> promiseFlag;
624     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2750e02(const DragNotifyMsg &notifyMessage) 625     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
626         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
627             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
628         promiseFlag.set_value(true);
629     };
630     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
631         std::make_shared<TestStartDragListener>(callback));
632     ASSERT_EQ(ret, RET_OK);
633     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
634     ASSERT_EQ(ret, RET_OK);
635     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
636     ASSERT_EQ(ret, RET_OK);
637     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
638     ASSERT_NE(pixelMap, nullptr);
639     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
640     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
641     ASSERT_EQ(ret, RET_OK);
642     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
643     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
644     ASSERT_EQ(ret, RET_OK);
645     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
646     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
647     ASSERT_EQ(ret, RET_OK);
648     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
649     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
650     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
651     ASSERT_EQ(ret, RET_OK);
652     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
653 }
654 
655 /**
656  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_003
657  * @tc.desc: Drag Drawing
658  * @tc.type: FUNC
659  * @tc.require:
660  */
661 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_003, TestSize.Level1)
662 {
663     CALL_TEST_DEBUG;
__anon963ae2750f02(bool result) 664     auto addSelectedPixelmapCallback = [](bool result) {
665         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
666     };
667     std::optional<DragData> dragData = CreateDragData(
668         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
669     ASSERT_TRUE(dragData);
670     std::promise<bool> promiseFlag;
671     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751002(const DragNotifyMsg &notifyMessage) 672     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
673         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
674             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
675         promiseFlag.set_value(true);
676     };
677     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
678         std::make_shared<TestStartDragListener>(callback));
679     ASSERT_EQ(ret, RET_OK);
680     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
681     ASSERT_EQ(ret, RET_OK);
682     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
683     ASSERT_EQ(ret, RET_OK);
684     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
685     ASSERT_NE(pixelMap, nullptr);
686     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
687     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
688     ASSERT_EQ(ret, RET_OK);
689     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
690     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
691     ASSERT_EQ(ret, RET_OK);
692     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
693     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
694     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
695     ASSERT_EQ(ret, RET_OK);
696     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
697 }
698 
699 /**
700  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_004
701  * @tc.desc: Drag Drawing
702  * @tc.type: FUNC
703  * @tc.require:
704  */
705 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_004, TestSize.Level1)
706 {
707     CALL_TEST_DEBUG;
__anon963ae2751102(bool result) 708     auto addSelectedPixelmapCallback = [](bool result) {
709         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
710     };
711     std::optional<DragData> dragData = CreateDragData(
712         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_MULTIPLE);
713     ASSERT_TRUE(dragData);
714     std::promise<bool> promiseFlag;
715     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751202(const DragNotifyMsg &notifyMessage) 716     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
717         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
718             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
719         promiseFlag.set_value(true);
720     };
721     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
722         std::make_shared<TestStartDragListener>(callback));
723     ASSERT_EQ(ret, RET_OK);
724     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
725     ASSERT_EQ(ret, RET_OK);
726     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
727     ASSERT_EQ(ret, RET_OK);
728     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
729     ASSERT_NE(pixelMap, nullptr);
730     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
731     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, nullptr);
732     ASSERT_EQ(ret, RET_ERR);
733     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
734     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(nullptr, addSelectedPixelmapCallback);
735     ASSERT_EQ(ret, RET_ERR);
736     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
737     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
738     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
739     ASSERT_EQ(ret, RET_OK);
740     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
741     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
742     ASSERT_EQ(ret, RET_ERR);
743     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
744 }
745 
746 /**
747  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_005
748  * @tc.desc: Drag Drawing
749  * @tc.type: FUNC
750  * @tc.require:
751  */
752 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_005, TestSize.Level1)
753 {
754     CALL_TEST_DEBUG;
__anon963ae2751302(bool result) 755     auto addSelectedPixelmapCallback = [](bool result) {
756         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
757     };
758     std::optional<DragData> dragData = CreateDragData(
759         MMI::PointerEvent::SOURCE_TYPE_MOUSE, POINTER_ID, DRAG_NUM_THREE, false, SHADOW_NUM_THREE);
760     ASSERT_TRUE(dragData);
761     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(), nullptr);
762     ASSERT_EQ(ret, RET_ERR);
763     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
764     ASSERT_NE(pixelMap, nullptr);
765     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
766     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
767     ASSERT_EQ(ret, RET_ERR);
768     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
769     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, nullptr);
770     ASSERT_EQ(ret, RET_ERR);
771     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
772     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(nullptr, addSelectedPixelmapCallback);
773     ASSERT_EQ(ret, RET_ERR);
774     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
775     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
776     ASSERT_EQ(ret, RET_ERR);
777 }
778 
779 /**
780  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_006
781  * @tc.desc: Drag Drawing
782  * @tc.type: FUNC
783  * @tc.require:
784  */
785 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_006, TestSize.Level1)
786 {
787     CALL_TEST_DEBUG;
788     std::promise<bool> promiseFlag;
789     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751402(const DragNotifyMsg &notifyMessage) 790     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
791         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
792             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
793         promiseFlag.set_value(true);
794     };
__anon963ae2751502(bool result) 795     auto addSelectedPixelmapCallback = [](bool result) {
796         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
797     };
798     std::optional<DragData> dragData = CreateDragData(
799         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
800     ASSERT_TRUE(dragData);
801     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
802         std::make_shared<TestStartDragListener>(callback));
803     ASSERT_EQ(ret, RET_OK);
804     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
805     ASSERT_EQ(ret, RET_OK);
806     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
807     ASSERT_EQ(ret, RET_OK);
808     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
809     ASSERT_NE(pixelMap, nullptr);
810     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
811     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
812     ASSERT_EQ(ret, RET_OK);
813     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
814     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
815     ASSERT_EQ(ret, RET_OK);
816     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
817     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
818     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
819     ASSERT_EQ(ret, RET_OK);
820     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
821 }
822 
823 /**
824  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_007
825  * @tc.desc: Drag Drawing
826  * @tc.type: FUNC
827  * @tc.require:
828  */
829 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_007, TestSize.Level1)
830 {
831     CALL_TEST_DEBUG;
832     std::promise<bool> promiseFlag;
833     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751602(const DragNotifyMsg &notifyMessage) 834     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
835         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
836             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
837         promiseFlag.set_value(true);
838     };
__anon963ae2751702(bool result) 839     auto addSelectedPixelmapCallback = [](bool result) {
840         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
841     };
842     std::optional<DragData> dragData = CreateDragData(
843         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_TWO, false, SHADOW_NUM_TWO);
844     ASSERT_TRUE(dragData);
845     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
846         std::make_shared<TestStartDragListener>(callback));
847     ASSERT_EQ(ret, RET_OK);
848     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
849     ASSERT_EQ(ret, RET_OK);
850     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
851     ASSERT_EQ(ret, RET_OK);
852     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
853     ASSERT_NE(pixelMap, nullptr);
854     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
855     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
856     ASSERT_EQ(ret, RET_OK);
857     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
858     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
859     ASSERT_EQ(ret, RET_OK);
860     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
861     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
862     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
863     ASSERT_EQ(ret, RET_OK);
864     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
865 }
866 
867 /**
868  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_008
869  * @tc.desc: Drag Drawing
870  * @tc.type: FUNC
871  * @tc.require:
872  */
873 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_008, TestSize.Level1)
874 {
875     CALL_TEST_DEBUG;
876     std::promise<bool> promiseFlag;
877     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751802(const DragNotifyMsg &notifyMessage) 878     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
879         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
880             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
881         promiseFlag.set_value(true);
882     };
__anon963ae2751902(bool result) 883     auto addSelectedPixelmapCallback = [](bool result) {
884         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
885     };
886     std::optional<DragData> dragData = CreateDragData(
887         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_THREE, false, SHADOW_NUM_THREE);
888     ASSERT_TRUE(dragData);
889     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
890         std::make_shared<TestStartDragListener>(callback));
891     ASSERT_EQ(ret, RET_OK);
892     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
893     ASSERT_EQ(ret, RET_OK);
894     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
895     ASSERT_EQ(ret, RET_OK);
896     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
897     ASSERT_NE(pixelMap, nullptr);
898     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
899     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
900     ASSERT_EQ(ret, RET_OK);
901     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
902     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
903     ASSERT_EQ(ret, RET_OK);
904     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
905     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
906     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
907     ASSERT_EQ(ret, RET_OK);
908     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
909 }
910 
911 /**
912  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_009
913  * @tc.desc: Drag Drawing
914  * @tc.type: FUNC
915  * @tc.require:
916  */
917 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_009, TestSize.Level1)
918 {
919     CALL_TEST_DEBUG;
920     std::promise<bool> promiseFlag;
921     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751a02(const DragNotifyMsg &notifyMessage) 922     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
923         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
924             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
925         promiseFlag.set_value(true);
926     };
__anon963ae2751b02(bool result) 927     auto addSelectedPixelmapCallback = [](bool result) {
928         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
929     };
930     std::optional<DragData> dragData = CreateDragData(
931         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_THREE, false, SHADOW_NUM_THREE);
932     ASSERT_TRUE(dragData);
933     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
934         std::make_shared<TestStartDragListener>(callback));
935     ASSERT_EQ(ret, RET_OK);
936     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
937     ASSERT_EQ(ret, RET_OK);
938     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::MOVE);
939     ASSERT_EQ(ret, RET_OK);
940     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
941     ASSERT_NE(pixelMap, nullptr);
942     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
943     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, nullptr);
944     ASSERT_EQ(ret, RET_ERR);
945     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
946     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(nullptr, addSelectedPixelmapCallback);
947     ASSERT_EQ(ret, RET_ERR);
948     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
949     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
950     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
951     ASSERT_EQ(ret, RET_OK);
952     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
953     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
954     ASSERT_EQ(ret, RET_ERR);
955     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
956 }
957 
958 /**
959  * @tc.name: InteractionDragDrawingTest_AddSelectedPixelMap_010
960  * @tc.desc: Drag Drawing
961  * @tc.type: FUNC
962  * @tc.require:
963  */
964 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_AddSelectedPixelMap_010, TestSize.Level1)
965 {
966     CALL_TEST_DEBUG;
__anon963ae2751c02(bool result) 967     auto addSelectedPixelmapCallback = [](bool result) {
968         FI_HILOGD("Get AddSelectedPixelMap result, result:%{public}d", result);
969     };
970     std::optional<DragData> dragData = CreateDragData(
971         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_THREE, false, SHADOW_NUM_THREE);
972     ASSERT_TRUE(dragData);
973     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(), nullptr);
974     ASSERT_EQ(ret, RET_ERR);
975     std::shared_ptr<Media::PixelMap> pixelMap = CreatePixelMap(MIDDLE_PIXEL_MAP_WIDTH, MIDDLE_PIXEL_MAP_HEIGHT);
976     ASSERT_NE(pixelMap, nullptr);
977     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
978     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, addSelectedPixelmapCallback);
979     ASSERT_EQ(ret, RET_ERR);
980     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
981     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(pixelMap, nullptr);
982     ASSERT_EQ(ret, RET_ERR);
983     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
984     ret = InteractionManager::GetInstance()->AddSelectedPixelMap(nullptr, addSelectedPixelmapCallback);
985     ASSERT_EQ(ret, RET_ERR);
986     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
987     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
988     ASSERT_EQ(ret, RET_ERR);
989 }
990 
991 /**
992  * @tc.name: InteractionDragDrawingTest_Mouse_Animation
993  * @tc.desc: Drag Drawing
994  * @tc.type: FUNC
995  * @tc.require:
996  */
997 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Mouse_Animation, TestSize.Level1)
998 {
999     CALL_TEST_DEBUG;
1000     std::promise<bool> promiseFlag;
1001     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751d02(const DragNotifyMsg &notifyMessage) 1002     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1003         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
1004             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
1005         promiseFlag.set_value(true);
1006     };
1007     std::optional<DragData> dragData = CreateDragData(
1008         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
1009     ASSERT_TRUE(dragData);
1010     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1011         std::make_shared<TestStartDragListener>(callback));
1012     ASSERT_EQ(ret, RET_OK);
1013     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1014     ASSERT_EQ(ret, RET_OK);
1015     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
1016     ASSERT_EQ(ret, RET_OK);
1017     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1018     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1019     ASSERT_EQ(ret, RET_OK);
1020     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1021     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_ANIMATION_END));
1022 }
1023 
1024 /**
1025  * @tc.name: InteractionDragDrawingTest_Touchscreen_Animation
1026  * @tc.desc: Drag Drawing
1027  * @tc.type: FUNC
1028  * @tc.require:
1029  */
1030 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Touchscreen_Animation, TestSize.Level1)
1031 {
1032     CALL_TEST_DEBUG;
1033     std::promise<bool> promiseFlag;
1034     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751e02(const DragNotifyMsg &notifyMessage) 1035     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1036         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, target:%{public}d, result:%{public}d",
1037             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.targetPid, notifyMessage.result);
1038         promiseFlag.set_value(true);
1039     };
1040     std::optional<DragData> dragData = CreateDragData(
1041         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
1042     ASSERT_TRUE(dragData);
1043     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1044         std::make_shared<TestStartDragListener>(callback));
1045     ASSERT_EQ(ret, RET_OK);
1046     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1047     ASSERT_EQ(ret, RET_OK);
1048     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
1049     ASSERT_EQ(ret, RET_OK);
1050     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1051     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1052     ASSERT_EQ(ret, RET_OK);
1053     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1054 }
1055 
1056 /**
1057  * @tc.name: InteractionDragDrawingTest_Multiple_Shadow
1058  * @tc.desc: Drag Drawing
1059  * @tc.type: FUNC
1060  * @tc.require:
1061  */
1062 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_ONE_Shadow, TestSize.Level1)
1063 {
1064     CALL_TEST_DEBUG;
1065     std::promise<bool> promiseFlag;
1066     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2751f02(const DragNotifyMsg &notifyMessage) 1067     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1068         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
1069             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
1070         promiseFlag.set_value(true);
1071     };
1072     std::optional<DragData> dragData = CreateDragData(
1073         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
1074     ASSERT_TRUE(dragData);
1075     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1076         std::make_shared<TestStartDragListener>(callback));
1077     ASSERT_EQ(ret, RET_OK);
1078     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1079     ASSERT_EQ(ret, RET_OK);
1080     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
1081     ASSERT_EQ(ret, RET_OK);
1082     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1083     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1084     ASSERT_EQ(ret, RET_OK);
1085     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1086 }
1087 
1088 /**
1089  * @tc.name: InteractionDragDrawingTest_Multiple_Shadow
1090  * @tc.desc: Drag Drawing
1091  * @tc.type: FUNC
1092  * @tc.require:
1093  */
1094 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Multiple_Shadow, TestSize.Level1)
1095 {
1096     CALL_TEST_DEBUG;
1097     std::promise<bool> promiseFlag;
1098     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752002(const DragNotifyMsg &notifyMessage) 1099     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1100         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
1101             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
1102         promiseFlag.set_value(true);
1103     };
1104     std::optional<DragData> dragData = CreateDragData(
1105         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_THREE);
1106     ASSERT_TRUE(dragData);
1107     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1108         std::make_shared<TestStartDragListener>(callback));
1109     ASSERT_EQ(ret, RET_OK);
1110     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1111     ASSERT_EQ(ret, RET_OK);
1112     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
1113     ASSERT_EQ(ret, RET_OK);
1114     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1115     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1116     ASSERT_EQ(ret, RET_OK);
1117     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1118 }
1119 
1120 /**
1121  * @tc.name: InteractionDragDrawingTest_Multiple_Shadow
1122  * @tc.desc: Drag Drawing
1123  * @tc.type: FUNC
1124  * @tc.require:
1125  */
1126 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_Too_Much_Shadow, TestSize.Level1)
1127 {
1128     CALL_TEST_DEBUG;
1129     std::promise<bool> promiseFlag;
1130     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752102(const DragNotifyMsg &notifyMessage) 1131     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1132         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
1133             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
1134         promiseFlag.set_value(true);
1135     };
1136     std::optional<DragData> dragData = CreateDragData(
1137         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_TOO_MUCH);
1138     ASSERT_TRUE(dragData);
1139     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1140         std::make_shared<TestStartDragListener>(callback));
1141     ASSERT_EQ(ret, RET_OK);
1142     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1143     ASSERT_EQ(ret, RET_OK);
1144     ret = InteractionManager::GetInstance()->UpdateDragStyle(DragCursorStyle::COPY);
1145     ASSERT_EQ(ret, RET_OK);
1146     DragDropResult dropResult { DragResult::DRAG_FAIL, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1147     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1148     ASSERT_EQ(ret, RET_OK);
1149     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1150 }
1151 
1152 /**
1153  * @tc.name: EnterTextEditorArea001
1154  * @tc.desc: normal test for pixelMap 8dp bit movement effect
1155  * @tc.type: FUNC
1156  * @tc.require:
1157  */
1158 HWTEST_F(InteractionDragDrawingTest, EnterTextEditorArea001, TestSize.Level1)
1159 {
1160     CALL_TEST_DEBUG;
1161     std::promise<bool> promiseFlag;
1162     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752202(const DragNotifyMsg &notifyMessage) 1163     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1164         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
1165             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
1166         promiseFlag.set_value(true);
1167     };
1168     std::optional<DragData> dragData = CreateDragData(
1169         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
1170     ASSERT_TRUE(dragData);
1171     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1172         std::make_shared<TestStartDragListener>(callback));
1173     ASSERT_EQ(ret, RET_OK);
1174     ret = InteractionManager::GetInstance()->EnterTextEditorArea(true);
1175     EXPECT_EQ(ret, RET_OK);
1176     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_ANIMATION_END));
1177     ret = InteractionManager::GetInstance()->EnterTextEditorArea(false);
1178     EXPECT_EQ(ret, RET_OK);
1179     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1180     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1181     ASSERT_EQ(ret, RET_OK);
1182     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1183 }
1184 
1185 /**
1186  * @tc.name: EnterTextEditorArea002
1187  * @tc.desc: abnormal test for pixelMap 8dp bit movement effect
1188  * @tc.type: FUNC
1189  * @tc.require:
1190  */
1191 HWTEST_F(InteractionDragDrawingTest, EnterTextEditorArea002, TestSize.Level1)
1192 {
1193     CALL_TEST_DEBUG;
1194     std::promise<bool> promiseFlag;
1195     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752302(const DragNotifyMsg &notifyMessage) 1196     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1197         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d, target:%{public}d",
1198             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result, notifyMessage.targetPid);
1199         promiseFlag.set_value(true);
1200     };
1201     std::optional<DragData> dragData = CreateDragData(
1202         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, false, SHADOW_NUM_ONE);
1203     ASSERT_TRUE(dragData);
1204     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1205         std::make_shared<TestStartDragListener>(callback));
1206     ASSERT_EQ(ret, RET_OK);
1207     ret = InteractionManager::GetInstance()->EnterTextEditorArea(false);
1208     EXPECT_EQ(ret, RET_ERR);
1209     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1210     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1211     ASSERT_EQ(ret, RET_OK);
1212     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1213 }
1214 
1215 /**
1216  * @tc.name: EnterTextEditorArea003
1217  * @tc.desc: abnormal test for pixelMap 8dp bit movement effect
1218  * @tc.type: FUNC
1219  * @tc.require:
1220  */
1221 HWTEST_F(InteractionDragDrawingTest, EnterTextEditorArea003, TestSize.Level1)
1222 {
1223     CALL_TEST_DEBUG;
1224     std::optional<DragData> dragData = CreateDragData(
1225         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_ONE, true, SHADOW_NUM_ONE);
1226     ASSERT_TRUE(dragData);
1227     int32_t ret = InteractionManager::GetInstance()->EnterTextEditorArea(true);
1228     EXPECT_EQ(ret, RET_ERR);
1229 }
1230 
1231 /**
1232  * @tc.name: InteractionDragDrawingTest_DragOpacity001
1233  * @tc.desc: Abnormal transparency test for drag and drop backboard
1234  * @tc.type: FUNC
1235  * @tc.require:
1236  */
1237 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragOpacity001, TestSize.Level1)
1238 {
1239     CALL_TEST_DEBUG;
1240     std::optional<DragData> dragData = CreateDragData(
1241         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1242     ASSERT_TRUE(dragData);
1243     dragData->filterInfo = " { \"dip_opacity\": nullptr } ";
1244     std::promise<bool> promiseFlag;
1245     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752402(const DragNotifyMsg &notifyMessage) 1246     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1247         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1248             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1249         promiseFlag.set_value(true);
1250     };
1251     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1252         std::make_shared<TestStartDragListener>(callback));
1253     ASSERT_EQ(ret, RET_OK);
1254     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1255     ASSERT_EQ(ret, RET_OK);
1256     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1257     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1258     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1259     ASSERT_EQ(ret, RET_OK);
1260     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1261 }
1262 
1263 /**
1264  * @tc.name: InteractionDragDrawingTest_DragOpacity002
1265  * @tc.desc: Abnormal transparency test for drag and drop backboard
1266  * @tc.type: FUNC
1267  * @tc.require:
1268  */
1269 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragOpacity002, TestSize.Level1)
1270 {
1271     CALL_TEST_DEBUG;
1272     std::optional<DragData> dragData = CreateDragData(
1273         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1274     ASSERT_TRUE(dragData);
1275     dragData->filterInfo = " { \"dip_opacity\": 3.0 } ";
1276     std::promise<bool> promiseFlag;
1277     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752502(const DragNotifyMsg &notifyMessage) 1278     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1279         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1280             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1281         promiseFlag.set_value(true);
1282     };
1283     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1284         std::make_shared<TestStartDragListener>(callback));
1285     ASSERT_EQ(ret, RET_OK);
1286     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1287     ASSERT_EQ(ret, RET_OK);
1288     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1289     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1290     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1291     ASSERT_EQ(ret, RET_OK);
1292     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1293 }
1294 
1295 /**
1296  * @tc.name: InteractionDragDrawingTest_DragOpacity003
1297  * @tc.desc: Normal transparency test for drag and drop backboard
1298  * @tc.type: FUNC
1299  * @tc.require:
1300  */
1301 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragOpacity003, TestSize.Level1)
1302 {
1303     CALL_TEST_DEBUG;
1304     std::optional<DragData> dragData = CreateDragData(
1305         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1306     ASSERT_TRUE(dragData);
1307     dragData->filterInfo = " { \"dip_opacity\": 0.60 } ";
1308     std::promise<bool> promiseFlag;
1309     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752602(const DragNotifyMsg &notifyMessage) 1310     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1311         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1312             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1313         promiseFlag.set_value(true);
1314     };
1315     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1316         std::make_shared<TestStartDragListener>(callback));
1317     ASSERT_EQ(ret, RET_OK);
1318     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1319     ASSERT_EQ(ret, RET_OK);
1320     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1321     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1322     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1323     ASSERT_EQ(ret, RET_OK);
1324     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1325 }
1326 
1327 /**
1328  * @tc.name: InteractionDragDrawingTest_DragCornerRadius001
1329  * @tc.desc: Abnormal rounded corner test for drag and drop backboard
1330  * @tc.type: FUNC
1331  * @tc.require:
1332  */
1333 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragCornerRadius001, TestSize.Level1)
1334 {
1335     CALL_TEST_DEBUG;
1336     std::optional<DragData> dragData = CreateDragData(
1337         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1338     ASSERT_TRUE(dragData);
1339     dragData->filterInfo = " { \"dip_scale\": 0.0, \"drag_corner_radius1\": 30.0, \"drag_corner_radius2\": 30.0, \
1340         \"drag_corner_radius3\": 30.0, \"drag_corner_radius4\": 30.0} ";
1341     std::promise<bool> promiseFlag;
1342     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752702(const DragNotifyMsg &notifyMessage) 1343     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1344         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1345             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1346         promiseFlag.set_value(true);
1347     };
1348     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1349         std::make_shared<TestStartDragListener>(callback));
1350     ASSERT_EQ(ret, RET_OK);
1351     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1352     ASSERT_EQ(ret, RET_OK);
1353     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1354     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1355     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1356     ASSERT_EQ(ret, RET_OK);
1357     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1358 }
1359 
1360 /**
1361  * @tc.name: InteractionDragDrawingTest_DragCornerRadius002
1362  * @tc.desc: Abnormal rounded corner test for drag and drop backboard
1363  * @tc.type: FUNC
1364  * @tc.require:
1365  */
1366 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragCornerRadius002, TestSize.Level1)
1367 {
1368     CALL_TEST_DEBUG;
1369     std::optional<DragData> dragData = CreateDragData(
1370         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1371     ASSERT_TRUE(dragData);
1372     dragData->filterInfo = " { \"dip_scale\": 3.5, \"drag_corner_radius1\": 0.0, \"drag_corner_radius2\": 0.0 , \
1373         \"drag_corner_radius3\": 0.0, \"drag_corner_radius4\": 0.0} ";
1374     std::promise<bool> promiseFlag;
1375     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752802(const DragNotifyMsg &notifyMessage) 1376     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1377         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1378             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1379         promiseFlag.set_value(true);
1380     };
1381     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1382         std::make_shared<TestStartDragListener>(callback));
1383     ASSERT_EQ(ret, RET_OK);
1384     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1385     ASSERT_EQ(ret, RET_OK);
1386     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1387     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1388     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1389     ASSERT_EQ(ret, RET_OK);
1390     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1391 }
1392 
1393 /**
1394  * @tc.name: InteractionDragDrawingTest_DragCornerRadius003
1395  * @tc.desc: Normal testing of dragging the rounded corners of the backboard
1396  * @tc.type: FUNC
1397  * @tc.require:
1398  */
1399 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragCornerRadius003, TestSize.Level1)
1400 {
1401     CALL_TEST_DEBUG;
1402     std::optional<DragData> dragData = CreateDragData(
1403         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1404     ASSERT_TRUE(dragData);
1405     dragData->filterInfo = " { \"dip_scale\": 3.5, \"drag_corner_radius1\": 30.0, \"drag_corner_radius2\":30.0, \
1406         \"drag_corner_radius3\": 30.0, \"drag_corner_radius4\": 30.0} ";
1407     std::promise<bool> promiseFlag;
1408     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752902(const DragNotifyMsg &notifyMessage) 1409     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1410         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1411             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1412         promiseFlag.set_value(true);
1413     };
1414     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1415         std::make_shared<TestStartDragListener>(callback));
1416     ASSERT_EQ(ret, RET_OK);
1417     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1418     ASSERT_EQ(ret, RET_OK);
1419     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1420     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1421     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1422     ASSERT_EQ(ret, RET_OK);
1423     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1424 }
1425 
1426 /**
1427  * @tc.name: InteractionDragDrawingTest_DragCornerRadius004
1428  * @tc.desc: Normal testing of dragging the rounded corners of the backboard
1429  * @tc.type: FUNC
1430  * @tc.require:
1431  */
1432 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_DragCornerRadius004, TestSize.Level1)
1433 {
1434     CALL_TEST_DEBUG;
1435     std::optional<DragData> dragData = CreateDragData(
1436         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1437     ASSERT_TRUE(dragData);
1438     dragData->filterInfo = " { \"dip_scale\": 3.5, \"drag_corner_radius1\": 30.0, \"drag_corner_radius2\":80.0, \
1439         \"drag_corner_radius3\": 50.0, \"drag_corner_radius4\": 20.0} ";
1440     std::promise<bool> promiseFlag;
1441     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752a02(const DragNotifyMsg &notifyMessage) 1442     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1443         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1444             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1445         promiseFlag.set_value(true);
1446     };
1447     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1448         std::make_shared<TestStartDragListener>(callback));
1449     ASSERT_EQ(ret, RET_OK);
1450     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1451     ASSERT_EQ(ret, RET_OK);
1452     std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_UPDATE_DRAG_STYLE));
1453     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1454     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1455     ASSERT_EQ(ret, RET_OK);
1456     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1457 }
1458 
1459 /**
1460  * @tc.name: InteractionDragDrawingTest_RotateDragWindowSync
1461  * @tc.desc: Rotate and drag the window to Synchronize
1462  * @tc.type: FUNC
1463  * @tc.require:
1464  */
1465 HWTEST_F(InteractionDragDrawingTest, InteractionDragDrawingTest_RotateDragWindowSync, TestSize.Level1)
1466 {
1467     CALL_TEST_DEBUG;
1468     std::optional<DragData> dragData = CreateDragData(
1469         MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, POINTER_ID, DRAG_NUM_MULTIPLE, false, SHADOW_NUM_ONE);
1470     ASSERT_TRUE(dragData);
1471     std::promise<bool> promiseFlag;
1472     std::future<bool> futureFlag = promiseFlag.get_future();
__anon963ae2752b02(const DragNotifyMsg &notifyMessage) 1473     auto callback = [&promiseFlag](const DragNotifyMsg &notifyMessage) {
1474         FI_HILOGD("displayX:%{public}d, displayY:%{public}d, result:%{public}d",
1475             notifyMessage.displayX, notifyMessage.displayY, notifyMessage.result);
1476         promiseFlag.set_value(true);
1477     };
1478     int32_t ret = InteractionManager::GetInstance()->StartDrag(dragData.value(),
1479         std::make_shared<TestStartDragListener>(callback));
1480     ASSERT_EQ(ret, RET_OK);
1481     ret = InteractionManager::GetInstance()->SetDragWindowVisible(DRAG_WINDOW_VISIBLE);
1482     ASSERT_EQ(ret, RET_OK);
1483     const std::shared_ptr<Rosen::RSTransaction>& rsTransaction { nullptr };
1484     InteractionManager::GetInstance()->RotateDragWindowSync(rsTransaction);
1485     DragDropResult dropResult { DragResult::DRAG_SUCCESS, HAS_CUSTOM_ANIMATION, WINDOW_ID };
1486     ret = InteractionManager::GetInstance()->StopDrag(dropResult);
1487     ASSERT_EQ(ret, RET_OK);
1488     ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) != std::future_status::timeout);
1489 }
1490 } // namespace DeviceStatus
1491 } // namespace Msdp
1492 } // namespace OHOS
1493