1 /*
2  * Copyright (c) 2024 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 <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 #include <linux/input.h>
19 
20 #include "input_windows_manager.h"
21 #include "mock.h"
22 #include "window_info.h"
23 
24 namespace OHOS {
25 namespace MMI {
26 namespace {
27 using namespace testing::ext;
28 using namespace testing;
29 const std::string PROGRAM_NAME = "uds_session_test";
30 constexpr int32_t MODULE_TYPE = 1;
31 constexpr int32_t UDS_FD = 1;
32 constexpr int32_t UDS_UID = 100;
33 constexpr int32_t UDS_PID = 100;
34 } // namespace
35 
36 class InputWindowsManagerTest : public testing::Test {
37 public:
38     static void SetUpTestCase(void);
39     static void TearDownTestCase();
SetUp()40     void SetUp() {}
TearDown()41     void TearDown() {}
42 
43     static inline std::shared_ptr<MessageParcelMock> messageParcelMock_ = nullptr;
44 };
45 
SetUpTestCase(void)46 void InputWindowsManagerTest::SetUpTestCase(void)
47 {
48     messageParcelMock_ = std::make_shared<MessageParcelMock>();
49     MessageParcelMock::messageParcel = messageParcelMock_;
50 }
TearDownTestCase()51 void InputWindowsManagerTest::TearDownTestCase()
52 {
53     IInputWindowsManager::instance_.reset();
54     IInputWindowsManager::instance_ = nullptr;
55     MessageParcelMock::messageParcel = nullptr;
56     messageParcelMock_ = nullptr;
57 }
58 
59 #ifdef OHOS_BUILD_ENABLE_KEYBOARD
60 /**
61  * @tc.name: UpdateTarget_001
62  * @tc.desc: Test the function UpdateTarget
63  * @tc.type: FUNC
64  * @tc.require:
65  */
66 HWTEST_F(InputWindowsManagerTest, UpdateTarget_001, TestSize.Level1)
67 {
68     CALL_TEST_DEBUG;
69     std::shared_ptr<InputWindowsManager> inputWindowsManager =
70         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
71     ASSERT_NE(inputWindowsManager, nullptr);
72     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
73     ASSERT_NE(keyEvent, nullptr);
74     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
75 }
76 
77 /**
78  * @tc.name: UpdateTarget_002
79  * @tc.desc: Test the function UpdateTarget
80  * @tc.type: FUNC
81  * @tc.require:
82  */
83 HWTEST_F(InputWindowsManagerTest, UpdateTarget_002, TestSize.Level1)
84 {
85     CALL_TEST_DEBUG;
86     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(-1));
87     std::shared_ptr<InputWindowsManager> inputWindowsManager =
88         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
89     ASSERT_NE(inputWindowsManager, nullptr);
90     UDSServer udsServer;
91     inputWindowsManager->udsServer_ = &udsServer;
92     inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
93     WindowInfo windowInfo;
94     windowInfo.id = 1;
95     windowInfo.pid = 11;
96     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
97     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
98     ASSERT_NE(keyEvent, nullptr);
99     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
100     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
101     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
102     inputWindowsManager->udsServer_ = nullptr;
103 }
104 
105 /**
106  * @tc.name: UpdateTarget_003
107  * @tc.desc: Test the function UpdateTarget
108  * @tc.type: FUNC
109  * @tc.require:
110  */
111 HWTEST_F(InputWindowsManagerTest, UpdateTarget_003, TestSize.Level1)
112 {
113     CALL_TEST_DEBUG;
114     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
115     std::shared_ptr<InputWindowsManager> inputWindowsManager =
116         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
117     ASSERT_NE(inputWindowsManager, nullptr);
118     UDSServer udsServer;
119     inputWindowsManager->udsServer_ = &udsServer;
120     inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
121     WindowInfo windowInfo;
122     windowInfo.id = 1;
123     windowInfo.pid = 11;
124     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
125     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
126     ASSERT_NE(keyEvent, nullptr);
127     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
128     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
129     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
130     inputWindowsManager->udsServer_ = nullptr;
131 }
132 #endif // OHOS_BUILD_ENABLE_KEYBOARD
133 
134 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING)
135 /**
136  * @tc.name: PointerDrawingManagerOnDisplayInfo_001
137  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
138  * @tc.type: FUNC
139  * @tc.require:
140  */
141 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_001, TestSize.Level1)
142 {
143     CALL_TEST_DEBUG;
144     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(false));
145     std::shared_ptr<InputWindowsManager> inputWindowsManager =
146         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
147     ASSERT_NE(inputWindowsManager, nullptr);
148     DisplayGroupInfo displayGroupInfo;
149     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
150 }
151 
152 /**
153  * @tc.name: PointerDrawingManagerOnDisplayInfo_002
154  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
155  * @tc.type: FUNC
156  * @tc.require:
157  */
158 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_002, TestSize.Level1)
159 {
160     CALL_TEST_DEBUG;
161     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
162     std::shared_ptr<InputWindowsManager> inputWindowsManager =
163         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
164     ASSERT_NE(inputWindowsManager, nullptr);
165     DisplayInfo displayInfo;
166     displayInfo.id = 0;
167     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
168     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
169     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
170     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
171     DisplayGroupInfo displayGroupInfo;
172     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
173     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
174     inputWindowsManager->lastPointerEvent_.reset();
175     inputWindowsManager->lastPointerEvent_ = nullptr;
176 }
177 
178 /**
179  * @tc.name: PointerDrawingManagerOnDisplayInfo_003
180  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
181  * @tc.type: FUNC
182  * @tc.require:
183  */
184 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_003, TestSize.Level1)
185 {
186     CALL_TEST_DEBUG;
187     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
188     std::shared_ptr<InputWindowsManager> inputWindowsManager =
189         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
190     ASSERT_NE(inputWindowsManager, nullptr);
191     DisplayInfo displayInfo;
192     displayInfo.id = 0;
193     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
194     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
195     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
196     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
197     inputWindowsManager->lastPointerEvent_->SetButtonPressed(1);
198     DisplayGroupInfo displayGroupInfo;
199     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
200     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
201     inputWindowsManager->lastPointerEvent_.reset();
202     inputWindowsManager->lastPointerEvent_ = nullptr;
203 }
204 
205 /**
206  * @tc.name: PointerDrawingManagerOnDisplayInfo_004
207  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
208  * @tc.type: FUNC
209  * @tc.require:
210  */
211 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_004, TestSize.Level1)
212 {
213     CALL_TEST_DEBUG;
214     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
215     std::shared_ptr<InputWindowsManager> inputWindowsManager =
216         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
217     ASSERT_NE(inputWindowsManager, nullptr);
218     DisplayInfo displayInfo;
219     displayInfo.id = 0;
220     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
221     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
222     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
223     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
224     DisplayGroupInfo displayGroupInfo;
225     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
226     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
227     inputWindowsManager->lastPointerEvent_.reset();
228     inputWindowsManager->lastPointerEvent_ = nullptr;
229 }
230 
231 /**
232  * @tc.name: PointerDrawingManagerOnDisplayInfo_005
233  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
234  * @tc.type: FUNC
235  * @tc.require:
236  */
237 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_005, TestSize.Level1)
238 {
239     CALL_TEST_DEBUG;
240     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
241     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
242     std::shared_ptr<InputWindowsManager> inputWindowsManager =
243         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
244     ASSERT_NE(inputWindowsManager, nullptr);
245     DisplayInfo displayInfo;
246     displayInfo.id = 0;
247     displayInfo.x = 8;
248     displayInfo.y = 8;
249     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
250     WindowInfo windowInfo;
251     windowInfo.id = 1;
252     windowInfo.pid = 11;
253     windowInfo.transform.push_back(1.1);
254     Rect rect;
255     rect.x = 5;
256     rect.y = 5;
257     rect.width = 10;
258     rect.height = 10;
259     windowInfo.pointerHotAreas.push_back(rect);
260     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
261     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
262     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
263     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
264     DisplayGroupInfo displayGroupInfo;
265     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
266     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
267     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
268     inputWindowsManager->lastPointerEvent_.reset();
269     inputWindowsManager->lastPointerEvent_ = nullptr;
270 }
271 
272 /**
273  * @tc.name: PointerDrawingManagerOnDisplayInfo_006
274  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
275  * @tc.type: FUNC
276  * @tc.require:
277  */
278 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_006, TestSize.Level1)
279 {
280     CALL_TEST_DEBUG;
281     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
282     std::shared_ptr<InputWindowsManager> inputWindowsManager =
283         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
284     ASSERT_NE(inputWindowsManager, nullptr);
285     DisplayInfo displayInfo;
286     displayInfo.id = 0;
287     displayInfo.x = 8;
288     displayInfo.y = 8;
289     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
290     WindowInfo windowInfo;
291     windowInfo.id = 1;
292     windowInfo.pid = 11;
293     windowInfo.transform.push_back(1.1);
294     Rect rect;
295     rect.x = 5;
296     rect.y = 5;
297     rect.width = 10;
298     rect.height = 10;
299     windowInfo.pointerHotAreas.push_back(rect);
300     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
301     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
302     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
303     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
304     inputWindowsManager->isDragBorder_ = true;
305     inputWindowsManager->dragFlag_ = true;
306     DisplayGroupInfo displayGroupInfo;
307     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
308     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
309     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
310     inputWindowsManager->lastPointerEvent_.reset();
311     inputWindowsManager->lastPointerEvent_ = nullptr;
312     inputWindowsManager->isDragBorder_ = false;
313     inputWindowsManager->dragFlag_ = false;
314 }
315 
316 /**
317  * @tc.name: PointerDrawingManagerOnDisplayInfo_007
318  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
319  * @tc.type: FUNC
320  * @tc.require:
321  */
322 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_007, TestSize.Level1)
323 {
324     CALL_TEST_DEBUG;
325     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
326     std::shared_ptr<InputWindowsManager> inputWindowsManager =
327         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
328     ASSERT_NE(inputWindowsManager, nullptr);
329     DisplayInfo displayInfo;
330     displayInfo.id = 0;
331     displayInfo.x = 8;
332     displayInfo.y = 8;
333     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
334     WindowInfo windowInfo;
335     windowInfo.id = 1;
336     windowInfo.pid = 11;
337     windowInfo.transform.push_back(1.1);
338     Rect rect;
339     rect.x = 5;
340     rect.y = 5;
341     rect.width = 10;
342     rect.height = 10;
343     windowInfo.pointerHotAreas.push_back(rect);
344     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
345     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
346     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
347     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
348     inputWindowsManager->isDragBorder_ = true;
349     inputWindowsManager->dragFlag_ = true;
350     DisplayGroupInfo displayGroupInfo;
351     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
352     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
353     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
354     inputWindowsManager->lastPointerEvent_.reset();
355     inputWindowsManager->lastPointerEvent_ = nullptr;
356     inputWindowsManager->isDragBorder_ = false;
357     inputWindowsManager->dragFlag_ = false;
358 }
359 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING
360 
361 /**
362  * @tc.name: SendPointerEvent_001
363  * @tc.desc: Test the function SendPointerEvent
364  * @tc.type: FUNC
365  * @tc.require:
366  */
367 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_001, TestSize.Level1)
368 {
369     CALL_TEST_DEBUG;
370     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
371     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
372     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
373     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
374     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
375 
376     std::shared_ptr<InputWindowsManager> inputWindowsManager =
377         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
378     ASSERT_NE(inputWindowsManager, nullptr);
379     UDSServer udsServer;
380     inputWindowsManager->udsServer_ = &udsServer;
381     int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
382     DisplayInfo displayInfo;
383     displayInfo.id = 10;
384     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
385     inputWindowsManager->extraData_.appended = true;
386     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
387     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
388     inputWindowsManager->udsServer_ = nullptr;
389     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
390     inputWindowsManager->extraData_.appended = false;
391     inputWindowsManager->extraData_.sourceType = -1;
392 }
393 
394 /**
395  * @tc.name: SendPointerEvent_002
396  * @tc.desc: Test the function SendPointerEvent
397  * @tc.type: FUNC
398  * @tc.require:
399  */
400 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_002, TestSize.Level1)
401 {
402     CALL_TEST_DEBUG;
403     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
404     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
405     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
406     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
407     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
408 
409     std::shared_ptr<InputWindowsManager> inputWindowsManager =
410         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
411     ASSERT_NE(inputWindowsManager, nullptr);
412     UDSServer udsServer;
413     inputWindowsManager->udsServer_ = &udsServer;
414     int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
415     DisplayInfo displayInfo;
416     displayInfo.id = 10;
417     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
418     inputWindowsManager->extraData_.appended = false;
419     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
420     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
421     inputWindowsManager->udsServer_ = nullptr;
422     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
423     inputWindowsManager->extraData_.sourceType = -1;
424 }
425 
426 /**
427  * @tc.name: SkipNavigationWindow_001
428  * @tc.desc: Test the function SkipNavigationWindow
429  * @tc.type: FUNC
430  * @tc.require:
431  */
432 HWTEST_F(InputWindowsManagerTest, SkipNavigationWindow_001, TestSize.Level1)
433 {
434     CALL_TEST_DEBUG;
435     std::shared_ptr<InputWindowsManager> inputWindowsManager =
436         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
437     ASSERT_NE(inputWindowsManager, nullptr);
438     WindowInputType windowType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
439     int32_t toolType = PointerEvent::TOOL_TYPE_FINGER;
440     EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
441 
442     toolType = PointerEvent::TOOL_TYPE_PEN;
443     inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
444     inputWindowsManager->antiMistake_.isOpen = true;
445     EXPECT_TRUE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
446 
447     inputWindowsManager->isOpenAntiMisTakeObserver_ = true;
448     inputWindowsManager->antiMistake_.isOpen = false;
449     EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
450     inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
451 }
452 
453 /**
454  * @tc.name: TransformTipPoint_001
455  * @tc.desc: Test the function TransformTipPoint
456  * @tc.type: FUNC
457  * @tc.require:
458  */
459 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_001, TestSize.Level1)
460 {
461     CALL_TEST_DEBUG;
462     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
463     std::shared_ptr<InputWindowsManager> inputWindowsManager =
464         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
465     ASSERT_NE(inputWindowsManager, nullptr);
466     DisplayInfo displayInfo;
467     displayInfo.id = 0;
468     displayInfo.uniq = "default0";
469     displayInfo.direction = DIRECTION90;
470     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
471     libinput_event_tablet_tool event {};
472     PhysicalCoordinate coord;
473     int32_t displayId;
474     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
475     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
476 }
477 
478 /**
479  * @tc.name: TransformTipPoint_002
480  * @tc.desc: Test the function TransformTipPoint
481  * @tc.type: FUNC
482  * @tc.require:
483  */
484 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_002, TestSize.Level1)
485 {
486     CALL_TEST_DEBUG;
487     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
488     std::shared_ptr<InputWindowsManager> inputWindowsManager =
489         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
490     ASSERT_NE(inputWindowsManager, nullptr);
491     DisplayInfo displayInfo;
492     displayInfo.id = 0;
493     displayInfo.uniq = "default0";
494     displayInfo.direction = DIRECTION270;
495     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
496     libinput_event_tablet_tool event {};
497     PhysicalCoordinate coord;
498     int32_t displayId;
499     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
500     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
501 }
502 
503 /**
504  * @tc.name: TransformTipPoint_003
505  * @tc.desc: Test the function TransformTipPoint
506  * @tc.type: FUNC
507  * @tc.require:
508  */
509 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_003, TestSize.Level1)
510 {
511     CALL_TEST_DEBUG;
512     std::shared_ptr<InputWindowsManager> inputWindowsManager =
513         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
514     ASSERT_NE(inputWindowsManager, nullptr);
515     DisplayInfo displayInfo;
516     displayInfo.id = 0;
517     displayInfo.uniq = "default0";
518     displayInfo.direction = DIRECTION0;
519     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
520     libinput_event_tablet_tool event {};
521     PhysicalCoordinate coord;
522     int32_t displayId;
523     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
524     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
525 }
526 
527 /**
528  * @tc.name: InputWindowsManagerTest_TransformTipPoint_004
529  * @tc.desc: Test the function TransformTipPoint
530  * @tc.type: FUNC
531  * @tc.require:
532  */
533 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_004, TestSize.Level1)
534 {
535     CALL_TEST_DEBUG;
536     std::shared_ptr<InputWindowsManager> inputWindowsManager =
537         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
538     ASSERT_NE(inputWindowsManager, nullptr);
539     auto displayInfo = inputWindowsManager->FindPhysicalDisplayInfo("default0");
540 
541     libinput_event_tablet_tool event {};
542     Direction direction;
543     direction = DIRECTION90;
544     PhysicalCoordinate coord;
545     coord.x = 5.5;
546     coord.y = 3.2;
547     int32_t displayId = 2;
548     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
549     EXPECT_FALSE(ret);
550 }
551 
552 /**
553  * @tc.name: InputWindowsManagerTest_TransformTipPoint_005
554  * @tc.desc: Test the function TransformTipPoint
555  * @tc.type: FUNC
556  * @tc.require:
557  */
558 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_005, TestSize.Level1)
559 {
560     CALL_TEST_DEBUG;
561     std::shared_ptr<InputWindowsManager> inputWindowsManager =
562         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
563     ASSERT_NE(inputWindowsManager, nullptr);
564     auto displayInfo = inputWindowsManager->FindPhysicalDisplayInfo("default0");
565 
566     libinput_event_tablet_tool event {};
567     Direction direction;
568     direction = DIRECTION270;
569     PhysicalCoordinate coord;
570     coord.x = 6.5;
571     coord.y = 8.2;
572     int32_t displayId = 3;
573     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
574     EXPECT_FALSE(ret);
575 }
576 
577 /**
578  * @tc.name: InputWindowsManagerTest_TransformTipPoint_006
579  * @tc.desc: Test the function TransformTipPoint
580  * @tc.type: FUNC
581  * @tc.require:
582  */
583 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_006, TestSize.Level1)
584 {
585     CALL_TEST_DEBUG;
586     std::shared_ptr<InputWindowsManager> inputWindowsManager =
587         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
588     ASSERT_NE(inputWindowsManager, nullptr);
589     auto displayInfo = inputWindowsManager->FindPhysicalDisplayInfo("default0");
590 
591     libinput_event_tablet_tool event {};
592     Direction direction;
593     direction = DIRECTION0;
594     PhysicalCoordinate coord;
595     coord.x = 6.5;
596     coord.y = 8.2;
597     int32_t displayId = 3;
598     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
599     EXPECT_FALSE(ret);
600 }
601 
602 /**
603  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_001
604  * @tc.desc: Test the function IsNeedRefreshLayer
605  * @tc.type: FUNC
606  * @tc.require:
607  */
608 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_001, TestSize.Level1)
609 {
610     CALL_TEST_DEBUG;
611     std::shared_ptr<InputWindowsManager> inputWindowsManager =
612         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
613     ASSERT_NE(inputWindowsManager, nullptr);
614     int32_t windowId = 2;
615     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
616 
617     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
618     EXPECT_TRUE(ret);
619 }
620 
621 /**
622  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_002
623  * @tc.desc: Test the function IsNeedRefreshLayer
624  * @tc.type: FUNC
625  * @tc.require:
626  */
627 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_002, TestSize.Level1)
628 {
629     CALL_TEST_DEBUG;
630     std::shared_ptr<InputWindowsManager> inputWindowsManager =
631         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
632     ASSERT_NE(inputWindowsManager, nullptr);
633     int32_t windowId = 3;
634     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
635 
636     int32_t displayId = MouseEventHdr->GetDisplayId();
637     EXPECT_FALSE(displayId < 0);
638 
639     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(5, 7);
640     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
641     EXPECT_FALSE(ret);
642 }
643 
644 /**
645  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_003
646  * @tc.desc: Test the function IsNeedRefreshLayer
647  * @tc.type: FUNC
648  * @tc.require:
649  */
650 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_003, TestSize.Level1)
651 {
652     CALL_TEST_DEBUG;
653     std::shared_ptr<InputWindowsManager> inputWindowsManager =
654         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
655     ASSERT_NE(inputWindowsManager, nullptr);
656     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
657     int32_t displayId = MouseEventHdr->GetDisplayId();
658     EXPECT_FALSE(displayId < 0);
659 
660     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(6, 8);
661     int32_t windowId = GLOBAL_WINDOW_ID;
662     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
663     EXPECT_FALSE(ret);
664 }
665 
666 /**
667  * @tc.name: CalculateTipPoint_001
668  * @tc.desc: Test the function CalculateTipPoint
669  * @tc.type: FUNC
670  * @tc.require:
671  */
672 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_001, TestSize.Level1)
673 {
674     CALL_TEST_DEBUG;
675     std::shared_ptr<InputWindowsManager> inputWindowsManager =
676         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
677     ASSERT_NE(inputWindowsManager, nullptr);
678     libinput_event_tablet_tool event {};
679     PhysicalCoordinate coord;
680     int32_t displayId;
681     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
682 }
683 
684 /**
685  * @tc.name: CalculateTipPoint_002
686  * @tc.desc: Test the function CalculateTipPoint
687  * @tc.type: FUNC
688  * @tc.require:
689  */
690 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_002, TestSize.Level1)
691 {
692     CALL_TEST_DEBUG;
693     std::shared_ptr<InputWindowsManager> inputWindowsManager =
694         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
695     ASSERT_NE(inputWindowsManager, nullptr);
696     DisplayInfo displayInfo;
697     displayInfo.id = 0;
698     displayInfo.uniq = "default0";
699     displayInfo.direction = DIRECTION0;
700     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
701     libinput_event_tablet_tool event {};
702     PhysicalCoordinate coord;
703     int32_t displayId;
704     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
705     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
706 }
707 
708 /**
709  * @tc.name: CalculateTipPoint_003
710  * @tc.desc: Test the function CalculateTipPoint
711  * @tc.type: FUNC
712  * @tc.require:
713  */
714 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_003, TestSize.Level1)
715 {
716     CALL_TEST_DEBUG;
717     std::shared_ptr<InputWindowsManager> inputWindowsManager =
718         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
719     ASSERT_NE(inputWindowsManager, nullptr);
720 
721     libinput_event_tablet_tool event {};
722     int32_t targetDisplayId = 3;
723     PhysicalCoordinate coord;
724     coord.x = 3.5;
725     coord.y = 5.2;
726     bool result = inputWindowsManager->TransformTipPoint(&event, coord, targetDisplayId);
727     EXPECT_FALSE(result);
728     bool ret = inputWindowsManager->CalculateTipPoint(&event, targetDisplayId, coord);
729     EXPECT_FALSE(ret);
730 }
731 
732 /**
733  * @tc.name: UpdateMouseTarget_001
734  * @tc.desc: Test the function UpdateMouseTarget
735  * @tc.type: FUNC
736  * @tc.require:
737  */
738 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_001, TestSize.Level1)
739 {
740     CALL_TEST_DEBUG;
741     std::shared_ptr<InputWindowsManager> inputWindowsManager =
742         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
743     ASSERT_NE(inputWindowsManager, nullptr);
744     DisplayInfo displayInfo;
745     displayInfo.id = 0;
746     displayInfo.displayDirection = DIRECTION0;
747     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
748     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
749     ASSERT_NE(pointerEvent, nullptr);
750     PointerEvent::PointerItem item;
751     pointerEvent->AddPointerItem(item);
752     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
753     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
754 }
755 
756 /**
757  * @tc.name: UpdateMouseTarget_002
758  * @tc.desc: Test the function UpdateMouseTarget
759  * @tc.type: FUNC
760  * @tc.require:
761  */
762 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_002, TestSize.Level1)
763 {
764     CALL_TEST_DEBUG;
765     std::shared_ptr<InputWindowsManager> inputWindowsManager =
766         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
767     ASSERT_NE(inputWindowsManager, nullptr);
768     DisplayInfo displayInfo;
769     displayInfo.id = 0;
770     displayInfo.displayDirection = DIRECTION0;
771     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
772     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
773     ASSERT_NE(pointerEvent, nullptr);
774     PointerEvent::PointerItem item;
775     pointerEvent->AddPointerItem(item);
776     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
777     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
778     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
779 }
780 
781 /**
782  * @tc.name: UpdateMouseTarget_003
783  * @tc.desc: Test the function UpdateMouseTarget
784  * @tc.type: FUNC
785  * @tc.require:
786  */
787 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_003, TestSize.Level1)
788 {
789     CALL_TEST_DEBUG;
790     std::shared_ptr<InputWindowsManager> inputWindowsManager =
791         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
792     ASSERT_NE(inputWindowsManager, nullptr);
793     inputWindowsManager->mouseDownInfo_.id = 1;
794     DisplayInfo displayInfo;
795     displayInfo.id = 0;
796     displayInfo.displayDirection = DIRECTION0;
797     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
798     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
799     ASSERT_NE(pointerEvent, nullptr);
800     PointerEvent::PointerItem item;
801     pointerEvent->AddPointerItem(item);
802     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
803     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
804     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
805     inputWindowsManager->mouseDownInfo_.id = -1;
806 }
807 
808 /**
809  * @tc.name: UpdateMouseTarget_004
810  * @tc.desc: Test the function UpdateMouseTarget
811  * @tc.type: FUNC
812  * @tc.require:
813  */
814 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_004, TestSize.Level1)
815 {
816     CALL_TEST_DEBUG;
817     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
818     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
819     std::shared_ptr<InputWindowsManager> inputWindowsManager =
820         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
821     ASSERT_NE(inputWindowsManager, nullptr);
822     UDSServer udsServer;
823     inputWindowsManager->udsServer_ = &udsServer;
824     inputWindowsManager->mouseDownInfo_.id = 1;
825     DisplayInfo displayInfo;
826     displayInfo.id = 0;
827     displayInfo.displayDirection = DIRECTION0;
828     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
829     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
830     ASSERT_NE(pointerEvent, nullptr);
831     PointerEvent::PointerItem item;
832     pointerEvent->AddPointerItem(item);
833     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
834     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
835     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
836     inputWindowsManager->mouseDownInfo_.id = -1;
837     inputWindowsManager->udsServer_ = nullptr;
838 }
839 
840 /**
841  * @tc.name: UpdateMouseTarget_005
842  * @tc.desc: Test the function UpdateMouseTarget
843  * @tc.type: FUNC
844  * @tc.require:
845  */
846 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_005, TestSize.Level1)
847 {
848     CALL_TEST_DEBUG;
849     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillOnce(Return(false));
850     std::shared_ptr<InputWindowsManager> inputWindowsManager =
851         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
852     ASSERT_NE(inputWindowsManager, nullptr);
853     WindowInfo windowInfo;
854     windowInfo.id = -1;
855     windowInfo.pid = 11;
856     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
857     UDSServer udsServer;
858     inputWindowsManager->udsServer_ = &udsServer;
859     inputWindowsManager->mouseDownInfo_.id = 1;
860     inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
861     DisplayInfo displayInfo;
862     displayInfo.id = 0;
863     displayInfo.displayDirection = DIRECTION0;
864     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
865     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
866     ASSERT_NE(pointerEvent, nullptr);
867     PointerEvent::PointerItem item;
868     pointerEvent->AddPointerItem(item);
869     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
870     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
871     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
872     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
873     inputWindowsManager->mouseDownInfo_.id = -1;
874     inputWindowsManager->udsServer_ = nullptr;
875     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
876 }
877 
878 /**
879  * @tc.name: UpdateMouseTarget_006
880  * @tc.desc: Test the function UpdateMouseTarget
881  * @tc.type: FUNC
882  * @tc.require:
883  */
884 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_006, TestSize.Level1)
885 {
886     CALL_TEST_DEBUG;
887     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
888     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
889     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
890     std::shared_ptr<InputWindowsManager> inputWindowsManager =
891         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
892     ASSERT_NE(inputWindowsManager, nullptr);
893     WindowInfo windowInfo;
894     windowInfo.id = -1;
895     windowInfo.pid = 11;
896     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
897     UDSServer udsServer;
898     inputWindowsManager->udsServer_ = &udsServer;
899     inputWindowsManager->mouseDownInfo_.id = 1;
900     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
901     DisplayInfo displayInfo;
902     displayInfo.id = 0;
903     displayInfo.displayDirection = DIRECTION0;
904     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
905     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
906     ASSERT_NE(pointerEvent, nullptr);
907     PointerEvent::PointerItem item;
908     pointerEvent->AddPointerItem(item);
909     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
910     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
911     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
912     inputWindowsManager->mouseDownInfo_.id = -1;
913     inputWindowsManager->udsServer_ = nullptr;
914     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
915 }
916 
917 /**
918  * @tc.name: UpdateMouseTarget_007
919  * @tc.desc: Test the function UpdateMouseTarget
920  * @tc.type: FUNC
921  * @tc.require:
922  */
923 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_007, TestSize.Level1)
924 {
925     CALL_TEST_DEBUG;
926     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
927     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
928     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
929     std::shared_ptr<InputWindowsManager> inputWindowsManager =
930         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
931     ASSERT_NE(inputWindowsManager, nullptr);
932     WindowInfo windowInfo;
933     windowInfo.id = -1;
934     windowInfo.pid = 11;
935     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
936     UDSServer udsServer;
937     inputWindowsManager->udsServer_ = &udsServer;
938     inputWindowsManager->mouseDownInfo_.id = 1;
939     DisplayInfo displayInfo;
940     displayInfo.id = 0;
941     displayInfo.displayDirection = DIRECTION0;
942     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
943     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
944     ASSERT_NE(pointerEvent, nullptr);
945     PointerEvent::PointerItem item;
946     pointerEvent->AddPointerItem(item);
947     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
948     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
949     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
950     inputWindowsManager->mouseDownInfo_.id = -1;
951     inputWindowsManager->udsServer_ = nullptr;
952     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
953 }
954 
955 /**
956  * @tc.name: UpdateMouseTarget_008
957  * @tc.desc: Test the function UpdateMouseTarget
958  * @tc.type: FUNC
959  * @tc.require:
960  */
961 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_008, TestSize.Level1)
962 {
963     CALL_TEST_DEBUG;
964     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
965     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
966     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
967     std::shared_ptr<InputWindowsManager> inputWindowsManager =
968         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
969     ASSERT_NE(inputWindowsManager, nullptr);
970     WindowInfo windowInfo;
971     windowInfo.id = -1;
972     windowInfo.pid = 11;
973     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
974     UDSServer udsServer;
975     inputWindowsManager->udsServer_ = &udsServer;
976     inputWindowsManager->mouseDownInfo_.id = 1;
977     DisplayInfo displayInfo;
978     displayInfo.id = 0;
979     displayInfo.displayDirection = DIRECTION0;
980     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
981     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
982     ASSERT_NE(pointerEvent, nullptr);
983     PointerEvent::PointerItem item;
984     pointerEvent->AddPointerItem(item);
985     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
986     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
987     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
988     inputWindowsManager->mouseDownInfo_.id = -1;
989     inputWindowsManager->udsServer_ = nullptr;
990     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
991 }
992 
993 /**
994  * @tc.name: UpdateMouseTarget_009
995  * @tc.desc: Test the function UpdateMouseTarget
996  * @tc.type: FUNC
997  * @tc.require:
998  */
999 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_009, TestSize.Level1)
1000 {
1001     CALL_TEST_DEBUG;
1002     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
1003     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1004     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1005     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1006         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1007     ASSERT_NE(inputWindowsManager, nullptr);
1008     WindowInfo windowInfo;
1009     windowInfo.id = -1;
1010     windowInfo.pid = 11;
1011     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1012     UDSServer udsServer;
1013     inputWindowsManager->udsServer_ = &udsServer;
1014     inputWindowsManager->mouseDownInfo_.id = 1;
1015     inputWindowsManager->isUiExtension_ = true;
1016     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1017     DisplayInfo displayInfo;
1018     displayInfo.id = 0;
1019     displayInfo.displayDirection = DIRECTION0;
1020     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1021     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1022     ASSERT_NE(pointerEvent, nullptr);
1023     PointerEvent::PointerItem item;
1024     pointerEvent->AddPointerItem(item);
1025     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1026     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1027     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1028     inputWindowsManager->isUiExtension_ = false;
1029     inputWindowsManager->mouseDownInfo_.id = -1;
1030     inputWindowsManager->udsServer_ = nullptr;
1031     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1032 }
1033 
1034 /**
1035  * @tc.name: UpdateMouseTarget_010
1036  * @tc.desc: Test the function UpdateMouseTarget
1037  * @tc.type: FUNC
1038  * @tc.require:
1039  */
1040 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_010, TestSize.Level1)
1041 {
1042     CALL_TEST_DEBUG;
1043     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1044     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1045     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1046         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1047     ASSERT_NE(inputWindowsManager, nullptr);
1048     WindowInfo windowInfo;
1049     windowInfo.id = -1;
1050     windowInfo.pid = 11;
1051     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1052     UDSServer udsServer;
1053     inputWindowsManager->udsServer_ = &udsServer;
1054     inputWindowsManager->mouseDownInfo_.id = 1;
1055     inputWindowsManager->dragFlag_ = true;
1056     inputWindowsManager->isDragBorder_ = true;
1057     inputWindowsManager->isUiExtension_ = true;
1058     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1059     DisplayInfo displayInfo;
1060     displayInfo.id = 0;
1061     displayInfo.displayDirection = DIRECTION0;
1062     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1063     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1064     ASSERT_NE(pointerEvent, nullptr);
1065     PointerEvent::PointerItem item;
1066     pointerEvent->AddPointerItem(item);
1067     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1068     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1069     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1070     inputWindowsManager->dragFlag_ = false;
1071     inputWindowsManager->isDragBorder_ = false;
1072     inputWindowsManager->isUiExtension_ = false;
1073     inputWindowsManager->mouseDownInfo_.id = -1;
1074     inputWindowsManager->udsServer_ = nullptr;
1075     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1076 }
1077 
1078 /**
1079  * @tc.name: UpdateMouseTarget_011
1080  * @tc.desc: Test the function UpdateMouseTarget
1081  * @tc.type: FUNC
1082  * @tc.require:
1083  */
1084 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_011, TestSize.Level1)
1085 {
1086     CALL_TEST_DEBUG;
1087     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1088     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1089     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1090         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1091     ASSERT_NE(inputWindowsManager, nullptr);
1092     WindowInfo windowInfo;
1093     windowInfo.id = -1;
1094     windowInfo.pid = 11;
1095     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1096     UDSServer udsServer;
1097     inputWindowsManager->udsServer_ = &udsServer;
1098     inputWindowsManager->mouseDownInfo_.id = 1;
1099     inputWindowsManager->dragFlag_ = true;
1100     inputWindowsManager->isDragBorder_ = true;
1101     inputWindowsManager->isUiExtension_ = false;
1102     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1103     DisplayInfo displayInfo;
1104     displayInfo.id = 0;
1105     displayInfo.displayDirection = DIRECTION90;
1106     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1107     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1108     ASSERT_NE(pointerEvent, nullptr);
1109     PointerEvent::PointerItem item;
1110     pointerEvent->AddPointerItem(item);
1111     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1112     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1113     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1114     inputWindowsManager->dragFlag_ = false;
1115     inputWindowsManager->isDragBorder_ = false;
1116     inputWindowsManager->isUiExtension_ = false;
1117     inputWindowsManager->mouseDownInfo_.id = -1;
1118     inputWindowsManager->udsServer_ = nullptr;
1119     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1120 }
1121 
1122 /**
1123  * @tc.name: UpdateMouseTarget_012
1124  * @tc.desc: Test the function UpdateMouseTarget
1125  * @tc.type: FUNC
1126  * @tc.require:
1127  */
1128 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_012, TestSize.Level1)
1129 {
1130     CALL_TEST_DEBUG;
1131     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1132     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1133     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1134         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1135     ASSERT_NE(inputWindowsManager, nullptr);
1136     WindowInfo windowInfo;
1137     windowInfo.id = -1;
1138     windowInfo.pid = 11;
1139     windowInfo.transform.push_back(1.1);
1140     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1141     UDSServer udsServer;
1142     inputWindowsManager->udsServer_ = &udsServer;
1143     inputWindowsManager->mouseDownInfo_.id = 1;
1144     inputWindowsManager->dragFlag_ = true;
1145     inputWindowsManager->isDragBorder_ = true;
1146     inputWindowsManager->isUiExtension_ = false;
1147     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1148     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1149     inputWindowsManager->captureModeInfo_.windowId = 1;
1150     inputWindowsManager->extraData_.appended = true;
1151     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1152     DisplayInfo displayInfo;
1153     displayInfo.id = 0;
1154     displayInfo.displayDirection = DIRECTION90;
1155     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1156     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1157     ASSERT_NE(pointerEvent, nullptr);
1158     PointerEvent::PointerItem item;
1159     pointerEvent->AddPointerItem(item);
1160     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1161     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1162     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1163     inputWindowsManager->dragFlag_ = false;
1164     inputWindowsManager->isDragBorder_ = false;
1165     inputWindowsManager->isUiExtension_ = false;
1166     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1167     inputWindowsManager->captureModeInfo_.windowId = -1;
1168     inputWindowsManager->mouseDownInfo_.id = -1;
1169     inputWindowsManager->udsServer_ = nullptr;
1170     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1171     inputWindowsManager->extraData_.appended = false;
1172     inputWindowsManager->extraData_.sourceType = -1;
1173 }
1174 
1175 /**
1176  * @tc.name: UpdateMouseTarget_013
1177  * @tc.desc: Test the function UpdateMouseTarget
1178  * @tc.type: FUNC
1179  * @tc.require:
1180  */
1181 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_013, TestSize.Level1)
1182 {
1183     CALL_TEST_DEBUG;
1184     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1185     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1186     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1187         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1188     ASSERT_NE(inputWindowsManager, nullptr);
1189     WindowInfo windowInfo;
1190     windowInfo.id = -1;
1191     windowInfo.pid = 11;
1192     windowInfo.transform.push_back(1.1);
1193     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1194     UDSServer udsServer;
1195     inputWindowsManager->udsServer_ = &udsServer;
1196     inputWindowsManager->mouseDownInfo_.id = 1;
1197     inputWindowsManager->dragFlag_ = true;
1198     inputWindowsManager->isDragBorder_ = true;
1199     inputWindowsManager->isUiExtension_ = false;
1200     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1201     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1202     inputWindowsManager->captureModeInfo_.windowId = -1;
1203     inputWindowsManager->extraData_.appended = true;
1204     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1205     DisplayInfo displayInfo;
1206     displayInfo.id = 0;
1207     displayInfo.displayDirection = DIRECTION90;
1208     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1209     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1210     ASSERT_NE(pointerEvent, nullptr);
1211     PointerEvent::PointerItem item;
1212     pointerEvent->AddPointerItem(item);
1213     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1214     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1215     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1216     inputWindowsManager->dragFlag_ = false;
1217     inputWindowsManager->isDragBorder_ = false;
1218     inputWindowsManager->isUiExtension_ = false;
1219     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1220     inputWindowsManager->mouseDownInfo_.id = -1;
1221     inputWindowsManager->udsServer_ = nullptr;
1222     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1223     inputWindowsManager->extraData_.appended = false;
1224     inputWindowsManager->extraData_.sourceType = -1;
1225 }
1226 
1227 /**
1228  * @tc.name: UpdateMouseTarget_014
1229  * @tc.desc: Test the function UpdateMouseTarget
1230  * @tc.type: FUNC
1231  * @tc.require:
1232  */
1233 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_014, TestSize.Level1)
1234 {
1235     CALL_TEST_DEBUG;
1236     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1237     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1238     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1239         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1240     ASSERT_NE(inputWindowsManager, nullptr);
1241     WindowInfo windowInfo;
1242     windowInfo.id = -1;
1243     windowInfo.pid = 11;
1244     windowInfo.transform.push_back(1.1);
1245     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1246     UDSServer udsServer;
1247     inputWindowsManager->udsServer_ = &udsServer;
1248     inputWindowsManager->mouseDownInfo_.id = 1;
1249     inputWindowsManager->dragFlag_ = true;
1250     inputWindowsManager->isDragBorder_ = true;
1251     inputWindowsManager->isUiExtension_ = false;
1252     inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1253     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1254     inputWindowsManager->captureModeInfo_.windowId = -1;
1255     inputWindowsManager->extraData_.appended = false;
1256     inputWindowsManager->extraData_.sourceType = -1;
1257     DisplayInfo displayInfo;
1258     displayInfo.id = 0;
1259     displayInfo.displayDirection = DIRECTION90;
1260     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1261     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1262     ASSERT_NE(pointerEvent, nullptr);
1263     PointerEvent::PointerItem item;
1264     pointerEvent->AddPointerItem(item);
1265     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1266     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1267     inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1268     inputWindowsManager->dragFlag_ = false;
1269     inputWindowsManager->isDragBorder_ = false;
1270     inputWindowsManager->isUiExtension_ = false;
1271     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1272     inputWindowsManager->mouseDownInfo_.id = -1;
1273     inputWindowsManager->udsServer_ = nullptr;
1274     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1275 }
1276 
1277 /**
1278  * @tc.name: IsNeedDrawPointer_001
1279  * @tc.desc: Test the function IsNeedDrawPointer
1280  * @tc.type: FUNC
1281  * @tc.require:
1282  */
1283 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_001, TestSize.Level1)
1284 {
1285     CALL_TEST_DEBUG;
1286     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1287         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1288     ASSERT_NE(inputWindowsManager, nullptr);
1289     PointerEvent::PointerItem pointerItem;
1290     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_FINGER);
1291     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1292 }
1293 
1294 /**
1295  * @tc.name: IsNeedDrawPointer_002
1296  * @tc.desc: Test the function IsNeedDrawPointer
1297  * @tc.type: FUNC
1298  * @tc.require:
1299  */
1300 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_002, TestSize.Level1)
1301 {
1302     CALL_TEST_DEBUG;
1303     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(nullptr));
1304     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1305         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1306     ASSERT_NE(inputWindowsManager, nullptr);
1307     PointerEvent::PointerItem pointerItem;
1308     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1309     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1310 }
1311 
1312 /**
1313  * @tc.name: IsNeedDrawPointer_003
1314  * @tc.desc: Test the function IsNeedDrawPointer
1315  * @tc.type: FUNC
1316  * @tc.require:
1317  */
1318 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_003, TestSize.Level1)
1319 {
1320     CALL_TEST_DEBUG;
1321     std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1322     inputDevice->SetBus(BUS_USB);
1323     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1324     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1325         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1326     ASSERT_NE(inputWindowsManager, nullptr);
1327     PointerEvent::PointerItem pointerItem;
1328     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1329     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1330 }
1331 
1332 /**
1333  * @tc.name: IsNeedDrawPointer_004
1334  * @tc.desc: Test the function IsNeedDrawPointer
1335  * @tc.type: FUNC
1336  * @tc.require:
1337  */
1338 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_004, TestSize.Level1)
1339 {
1340     CALL_TEST_DEBUG;
1341     std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1342     inputDevice->SetBus(BUS_HIL);
1343     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1344     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1345         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1346     ASSERT_NE(inputWindowsManager, nullptr);
1347     PointerEvent::PointerItem pointerItem;
1348     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1349     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1350 }
1351 
1352 /**
1353  * @tc.name: DispatchTouch_001
1354  * @tc.desc: Test the function DispatchTouch
1355  * @tc.type: FUNC
1356  * @tc.require:
1357  */
1358 HWTEST_F(InputWindowsManagerTest, DispatchTouch_001, TestSize.Level1)
1359 {
1360     CALL_TEST_DEBUG;
1361     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1362         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1363     ASSERT_NE(inputWindowsManager, nullptr);
1364     UDSServer udsServer;
1365     inputWindowsManager->udsServer_ = &udsServer;
1366     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1367     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1368     WindowInfo windowInfo;
1369     windowInfo.id = 1;
1370     windowInfo.pid = 11;
1371     windowInfo.flags = 1;
1372     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1373     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1374     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1375     inputWindowsManager->udsServer_ = nullptr;
1376     inputWindowsManager->lastTouchEvent_ = nullptr;
1377     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1378 }
1379 
1380 /**
1381  * @tc.name: DispatchTouch_002
1382  * @tc.desc: Test the function DispatchTouch
1383  * @tc.type: FUNC
1384  * @tc.require:
1385  */
1386 HWTEST_F(InputWindowsManagerTest, DispatchTouch_002, TestSize.Level1)
1387 {
1388     CALL_TEST_DEBUG;
1389     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1390         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1391     ASSERT_NE(inputWindowsManager, nullptr);
1392     UDSServer udsServer;
1393     inputWindowsManager->udsServer_ = &udsServer;
1394     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1395     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1396     WindowInfo windowInfo;
1397     windowInfo.id = 1;
1398     windowInfo.pid = 11;
1399     windowInfo.flags = 0;
1400     windowInfo.transform.push_back(1.1);
1401     Rect rect;
1402     rect.x = 5;
1403     rect.y = 5;
1404     rect.width = 10;
1405     rect.height = 10;
1406     windowInfo.defaultHotAreas.push_back(rect);
1407     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1408     inputWindowsManager->lastTouchLogicX_ = 8;
1409     inputWindowsManager->lastTouchLogicY_ = 8;
1410     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1411     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1412     inputWindowsManager->udsServer_ = nullptr;
1413     inputWindowsManager->lastTouchEvent_ = nullptr;
1414     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1415     inputWindowsManager->lastTouchLogicX_ = -1;
1416     inputWindowsManager->lastTouchLogicY_ = -1;
1417     inputWindowsManager->lastTouchWindowInfo_.id = -1;
1418     inputWindowsManager->lastTouchWindowInfo_.pid = -1;
1419     inputWindowsManager->lastTouchWindowInfo_.uid = -1;
1420     inputWindowsManager->lastTouchWindowInfo_.agentWindowId = -1;
1421     inputWindowsManager->lastTouchWindowInfo_.area = { 0, 0, 0, 0 };
1422     inputWindowsManager->lastTouchWindowInfo_.flags = -1;
1423     inputWindowsManager->lastTouchWindowInfo_.windowType = 0;
1424 }
1425 
1426 /**
1427  * @tc.name: DispatchTouch_003
1428  * @tc.desc: Test the function DispatchTouch
1429  * @tc.type: FUNC
1430  * @tc.require:
1431  */
1432 HWTEST_F(InputWindowsManagerTest, DispatchTouch_003, TestSize.Level1)
1433 {
1434     CALL_TEST_DEBUG;
1435     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1436     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(nullptr));
1437     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1438         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1439     ASSERT_NE(inputWindowsManager, nullptr);
1440     UDSServer udsServer;
1441     inputWindowsManager->udsServer_ = &udsServer;
1442     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1443     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1444     PointerEvent::PointerItem item;
1445     item.SetPointerId(1);
1446     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1447     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1448     WindowInfo windowInfo;
1449     windowInfo.id = -1;
1450     windowInfo.pid = 11;
1451     windowInfo.flags = 0;
1452     windowInfo.transform.push_back(1.1);
1453     Rect rect;
1454     rect.x = 5;
1455     rect.y = 5;
1456     rect.width = 10;
1457     rect.height = 10;
1458     windowInfo.defaultHotAreas.push_back(rect);
1459     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1460     inputWindowsManager->lastTouchLogicX_ = 8;
1461     inputWindowsManager->lastTouchLogicY_ = 8;
1462     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1463     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1464     inputWindowsManager->udsServer_ = nullptr;
1465     inputWindowsManager->lastTouchEvent_ = nullptr;
1466     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1467     inputWindowsManager->lastTouchLogicX_ = -1;
1468     inputWindowsManager->lastTouchLogicY_ = -1;
1469 }
1470 
1471 /**
1472  * @tc.name: DispatchTouch_004
1473  * @tc.desc: Test the function DispatchTouch
1474  * @tc.type: FUNC
1475  * @tc.require:
1476  */
1477 HWTEST_F(InputWindowsManagerTest, DispatchTouch_004, TestSize.Level1)
1478 {
1479     CALL_TEST_DEBUG;
1480     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1481     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1482     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
1483     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
1484     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1485         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1486     ASSERT_NE(inputWindowsManager, nullptr);
1487     UDSServer udsServer;
1488     inputWindowsManager->udsServer_ = &udsServer;
1489     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1490     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1491     PointerEvent::PointerItem item;
1492     item.SetPointerId(1);
1493     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1494     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1495     WindowInfo windowInfo;
1496     windowInfo.id = -1;
1497     windowInfo.pid = 11;
1498     windowInfo.flags = 0;
1499     windowInfo.transform.push_back(1.1);
1500     Rect rect;
1501     rect.x = 5;
1502     rect.y = 5;
1503     rect.width = 10;
1504     rect.height = 10;
1505     windowInfo.defaultHotAreas.push_back(rect);
1506     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1507     inputWindowsManager->lastTouchLogicX_ = 8;
1508     inputWindowsManager->lastTouchLogicY_ = 8;
1509     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1510     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1511     inputWindowsManager->udsServer_ = nullptr;
1512     inputWindowsManager->lastTouchEvent_ = nullptr;
1513     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1514     inputWindowsManager->lastTouchLogicX_ = -1;
1515     inputWindowsManager->lastTouchLogicY_ = -1;
1516 }
1517 
1518 /**
1519  * @tc.name: DispatchTouch_005
1520  * @tc.desc: Test the function DispatchTouch
1521  * @tc.type: FUNC
1522  * @tc.require:
1523  */
1524 HWTEST_F(InputWindowsManagerTest, DispatchTouch_005, TestSize.Level1)
1525 {
1526     CALL_TEST_DEBUG;
1527     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1528     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1529     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
1530     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
1531     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1532         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1533     ASSERT_NE(inputWindowsManager, nullptr);
1534     UDSServer udsServer;
1535     inputWindowsManager->udsServer_ = &udsServer;
1536     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1537     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1538     PointerEvent::PointerItem item;
1539     item.SetPointerId(1);
1540     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1541     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1542     WindowInfo windowInfo;
1543     windowInfo.id = -1;
1544     windowInfo.pid = 11;
1545     windowInfo.flags = 0;
1546     windowInfo.transform.push_back(1.1);
1547     Rect rect;
1548     rect.x = 5;
1549     rect.y = 5;
1550     rect.width = 10;
1551     rect.height = 10;
1552     windowInfo.defaultHotAreas.push_back(rect);
1553     inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1554     inputWindowsManager->lastTouchLogicX_ = 8;
1555     inputWindowsManager->lastTouchLogicY_ = 8;
1556     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1557     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1558     inputWindowsManager->udsServer_ = nullptr;
1559     inputWindowsManager->lastTouchEvent_ = nullptr;
1560     inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1561     inputWindowsManager->lastTouchLogicX_ = -1;
1562     inputWindowsManager->lastTouchLogicY_ = -1;
1563 }
1564 
1565 /**
1566  * @tc.name: TransformWindowXY_001
1567  * @tc.desc: Test the function TransformWindowXY
1568  * @tc.type: FUNC
1569  * @tc.require:
1570  */
1571 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_001, TestSize.Level1)
1572 {
1573     CALL_TEST_DEBUG;
1574     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1575         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1576     ASSERT_NE(inputWindowsManager, nullptr);
1577     WindowInfo window;
1578     window.transform = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
1579     double logicX = 1.1;
1580     double logicY = 1.1;
1581     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1582 }
1583 
1584 /**
1585  * @tc.name: TransformWindowXY_002
1586  * @tc.desc: Test the function TransformWindowXY
1587  * @tc.type: FUNC
1588  * @tc.require:
1589  */
1590 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_002, TestSize.Level1)
1591 {
1592     CALL_TEST_DEBUG;
1593     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1594         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1595     ASSERT_NE(inputWindowsManager, nullptr);
1596     WindowInfo window;
1597     window.transform = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 };
1598     double logicX = 1.1;
1599     double logicY = 1.1;
1600     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1601 }
1602 
1603 /**
1604  * @tc.name: IsValidZorderWindow_001
1605  * @tc.desc: Test the function IsValidZorderWindow
1606  * @tc.type: FUNC
1607  * @tc.require:
1608  */
1609 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_001, TestSize.Level1)
1610 {
1611     CALL_TEST_DEBUG;
1612     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1613         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1614     ASSERT_NE(inputWindowsManager, nullptr);
1615     WindowInfo window;
1616     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1617     ASSERT_NE(pointerEvent, nullptr);
1618     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
1619     pointerEvent->SetZOrder(-6.6);
1620     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1621 }
1622 
1623 /**
1624  * @tc.name: IsValidZorderWindow_002
1625  * @tc.desc: Test the function IsValidZorderWindow
1626  * @tc.type: FUNC
1627  * @tc.require:
1628  */
1629 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_002, TestSize.Level1)
1630 {
1631     CALL_TEST_DEBUG;
1632     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1633         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1634     ASSERT_NE(inputWindowsManager, nullptr);
1635     WindowInfo window;
1636     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1637     ASSERT_NE(pointerEvent, nullptr);
1638     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
1639     pointerEvent->SetZOrder(6.6);
1640     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1641 }
1642 
1643 /**
1644  * @tc.name: IsValidZorderWindow_003
1645  * @tc.desc: Test the function IsValidZorderWindow
1646  * @tc.type: FUNC
1647  * @tc.require:
1648  */
1649 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_003, TestSize.Level1)
1650 {
1651     CALL_TEST_DEBUG;
1652     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1653         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1654     ASSERT_NE(inputWindowsManager, nullptr);
1655     WindowInfo window;
1656     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1657     ASSERT_NE(pointerEvent, nullptr);
1658     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
1659     pointerEvent->SetZOrder(-6.6);
1660     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1661 }
1662 
1663 /**
1664  * @tc.name: IsValidZorderWindow_004
1665  * @tc.desc: Test the function IsValidZorderWindow
1666  * @tc.type: FUNC
1667  * @tc.require:
1668  */
1669 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_004, TestSize.Level1)
1670 {
1671     CALL_TEST_DEBUG;
1672     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1673         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1674     ASSERT_NE(inputWindowsManager, nullptr);
1675     WindowInfo window;
1676     window.zOrder = 8.8;
1677     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1678     ASSERT_NE(pointerEvent, nullptr);
1679     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
1680     pointerEvent->SetZOrder(6.6);
1681     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1682 }
1683 
1684 /**
1685  * @tc.name: IsValidZorderWindow_005
1686  * @tc.desc: Test the function IsValidZorderWindow
1687  * @tc.type: FUNC
1688  * @tc.require:
1689  */
1690 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_005, TestSize.Level1)
1691 {
1692     CALL_TEST_DEBUG;
1693     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1694         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1695     ASSERT_NE(inputWindowsManager, nullptr);
1696     WindowInfo window;
1697     window.zOrder = 1.1;
1698     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1699     ASSERT_NE(pointerEvent, nullptr);
1700     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
1701     pointerEvent->SetZOrder(6.6);
1702     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1703 }
1704 
1705 /**
1706  * @tc.name: HandleWindowInputType_001
1707  * @tc.desc: Test the function HandleWindowInputType
1708  * @tc.type: FUNC
1709  * @tc.require:
1710  */
1711 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_001, TestSize.Level1)
1712 {
1713     CALL_TEST_DEBUG;
1714     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1715         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1716     ASSERT_NE(inputWindowsManager, nullptr);
1717     WindowInfo window;
1718     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1719     ASSERT_NE(pointerEvent, nullptr);
1720     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1721 }
1722 
1723 /**
1724  * @tc.name: HandleWindowInputType_002
1725  * @tc.desc: Test the function HandleWindowInputType
1726  * @tc.type: FUNC
1727  * @tc.require:
1728  */
1729 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_002, TestSize.Level1)
1730 {
1731     CALL_TEST_DEBUG;
1732     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1733         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1734     ASSERT_NE(inputWindowsManager, nullptr);
1735     WindowInfo window;
1736     window.windowInputType = WindowInputType::NORMAL;
1737     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1738     ASSERT_NE(pointerEvent, nullptr);
1739     PointerEvent::PointerItem item;
1740     item.SetPointerId(1);
1741     pointerEvent->AddPointerItem(item);
1742     pointerEvent->SetPointerId(1);
1743     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1744 }
1745 
1746 /**
1747  * @tc.name: HandleWindowInputType_003
1748  * @tc.desc: Test the function HandleWindowInputType
1749  * @tc.type: FUNC
1750  * @tc.require:
1751  */
1752 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_003, TestSize.Level1)
1753 {
1754     CALL_TEST_DEBUG;
1755     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1756         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1757     ASSERT_NE(inputWindowsManager, nullptr);
1758     WindowInfo window;
1759     window.windowInputType = WindowInputType::TRANSMIT_ALL;
1760     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1761     ASSERT_NE(pointerEvent, nullptr);
1762     PointerEvent::PointerItem item;
1763     item.SetPointerId(1);
1764     pointerEvent->AddPointerItem(item);
1765     pointerEvent->SetPointerId(1);
1766     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1767 }
1768 
1769 /**
1770  * @tc.name: HandleWindowInputType_004
1771  * @tc.desc: Test the function HandleWindowInputType
1772  * @tc.type: FUNC
1773  * @tc.require:
1774  */
1775 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_004, TestSize.Level1)
1776 {
1777     CALL_TEST_DEBUG;
1778     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1779         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1780     ASSERT_NE(inputWindowsManager, nullptr);
1781     WindowInfo window;
1782     window.windowInputType = WindowInputType::TRANSMIT_EXCEPT_MOVE;
1783     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1784     ASSERT_NE(pointerEvent, nullptr);
1785     PointerEvent::PointerItem item;
1786     item.SetPointerId(1);
1787     pointerEvent->AddPointerItem(item);
1788     pointerEvent->SetPointerId(1);
1789     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1790 }
1791 
1792 /**
1793  * @tc.name: HandleWindowInputType_005
1794  * @tc.desc: Test the function HandleWindowInputType
1795  * @tc.type: FUNC
1796  * @tc.require:
1797  */
1798 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_005, TestSize.Level1)
1799 {
1800     CALL_TEST_DEBUG;
1801     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1802         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1803     ASSERT_NE(inputWindowsManager, nullptr);
1804     WindowInfo window;
1805     window.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
1806     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1807     ASSERT_NE(pointerEvent, nullptr);
1808     PointerEvent::PointerItem item;
1809     item.SetPointerId(1);
1810     pointerEvent->AddPointerItem(item);
1811     pointerEvent->SetPointerId(1);
1812     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1813 }
1814 
1815 /**
1816  * @tc.name: HandleWindowInputType_006
1817  * @tc.desc: Test the function HandleWindowInputType
1818  * @tc.type: FUNC
1819  * @tc.require:
1820  */
1821 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_006, TestSize.Level1)
1822 {
1823     CALL_TEST_DEBUG;
1824     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1825         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1826     ASSERT_NE(inputWindowsManager, nullptr);
1827     WindowInfo window;
1828     window.windowInputType = WindowInputType::TRANSMIT_AXIS_MOVE;
1829     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1830     ASSERT_NE(pointerEvent, nullptr);
1831     PointerEvent::PointerItem item;
1832     item.SetPointerId(1);
1833     pointerEvent->AddPointerItem(item);
1834     pointerEvent->SetPointerId(1);
1835     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1836 }
1837 
1838 /**
1839  * @tc.name: HandleWindowInputType_007
1840  * @tc.desc: Test the function HandleWindowInputType
1841  * @tc.type: FUNC
1842  * @tc.require:
1843  */
1844 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_007, TestSize.Level1)
1845 {
1846     CALL_TEST_DEBUG;
1847     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1848         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1849     ASSERT_NE(inputWindowsManager, nullptr);
1850     WindowInfo window;
1851     window.windowInputType = WindowInputType::TRANSMIT_MOUSE_MOVE;
1852     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1853     ASSERT_NE(pointerEvent, nullptr);
1854     PointerEvent::PointerItem item;
1855     item.SetPointerId(1);
1856     pointerEvent->AddPointerItem(item);
1857     pointerEvent->SetPointerId(1);
1858     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1859 }
1860 
1861 /**
1862  * @tc.name: HandleWindowInputType_008
1863  * @tc.desc: Test the function HandleWindowInputType
1864  * @tc.type: FUNC
1865  * @tc.require:
1866  */
1867 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_008, TestSize.Level1)
1868 {
1869     CALL_TEST_DEBUG;
1870     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1871         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1872     ASSERT_NE(inputWindowsManager, nullptr);
1873     WindowInfo window;
1874     window.windowInputType = WindowInputType::TRANSMIT_LEFT_RIGHT;
1875     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1876     ASSERT_NE(pointerEvent, nullptr);
1877     PointerEvent::PointerItem item;
1878     item.SetPointerId(1);
1879     pointerEvent->AddPointerItem(item);
1880     pointerEvent->SetPointerId(1);
1881     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1882 }
1883 
1884 /**
1885  * @tc.name: HandleWindowInputType_009
1886  * @tc.desc: Test the function HandleWindowInputType
1887  * @tc.type: FUNC
1888  * @tc.require:
1889  */
1890 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_009, TestSize.Level1)
1891 {
1892     CALL_TEST_DEBUG;
1893     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1894         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1895     ASSERT_NE(inputWindowsManager, nullptr);
1896     WindowInfo window;
1897     window.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
1898     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1899     ASSERT_NE(pointerEvent, nullptr);
1900     PointerEvent::PointerItem item;
1901     item.SetPointerId(1);
1902     pointerEvent->AddPointerItem(item);
1903     pointerEvent->SetPointerId(1);
1904     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1905 }
1906 
1907 /**
1908  * @tc.name: HandleWindowInputType_010
1909  * @tc.desc: Test the function HandleWindowInputType
1910  * @tc.type: FUNC
1911  * @tc.require:
1912  */
1913 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_010, TestSize.Level1)
1914 {
1915     CALL_TEST_DEBUG;
1916     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1917         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1918     ASSERT_NE(inputWindowsManager, nullptr);
1919     WindowInfo window;
1920     window.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
1921     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1922     ASSERT_NE(pointerEvent, nullptr);
1923     PointerEvent::PointerItem item;
1924     item.SetPointerId(1);
1925     pointerEvent->AddPointerItem(item);
1926     pointerEvent->SetPointerId(1);
1927     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1928 }
1929 
1930 /**
1931  * @tc.name: HandleWindowInputType_011
1932  * @tc.desc: Test the function HandleWindowInputType
1933  * @tc.type: FUNC
1934  * @tc.require:
1935  */
1936 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_011, TestSize.Level1)
1937 {
1938     CALL_TEST_DEBUG;
1939     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1940         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1941     ASSERT_NE(inputWindowsManager, nullptr);
1942     WindowInfo window;
1943     window.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
1944     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1945     ASSERT_NE(pointerEvent, nullptr);
1946     PointerEvent::PointerItem item;
1947     item.SetPointerId(1);
1948     pointerEvent->AddPointerItem(item);
1949     pointerEvent->SetPointerId(1);
1950     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1951 }
1952 
1953 /**
1954  * @tc.name: HandleWindowInputType_012
1955  * @tc.desc: Test the function HandleWindowInputType
1956  * @tc.type: FUNC
1957  * @tc.require:
1958  */
1959 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_012, TestSize.Level1)
1960 {
1961     CALL_TEST_DEBUG;
1962     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1963         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1964     ASSERT_NE(inputWindowsManager, nullptr);
1965     WindowInfo window;
1966     window.windowInputType = static_cast<WindowInputType>(8);
1967     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1968     ASSERT_NE(pointerEvent, nullptr);
1969     PointerEvent::PointerItem item;
1970     item.SetPointerId(1);
1971     pointerEvent->AddPointerItem(item);
1972     pointerEvent->SetPointerId(1);
1973     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
1974 }
1975 
1976 /**
1977  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent
1978  * @tc.desc: Cover if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) branch
1979  * @tc.type: FUNC
1980  * @tc.require:
1981  */
1982 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent, TestSize.Level1)
1983 {
1984     CALL_TEST_DEBUG;
1985     std::shared_ptr<InputWindowsManager> inputWindowsMgr =
1986         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1987     ASSERT_NE(inputWindowsMgr, nullptr);
1988     std::shared_ptr<PointerEvent> pointer = PointerEvent::Create();
1989     ASSERT_NE(pointer, nullptr);
1990     int32_t logicalX = 500;
1991     int32_t logicalY = 500;
1992     WindowInfo windowInfo;
1993     pointer->SetPointerId(0);
1994     PointerEvent::PointerItem item;
1995     item.SetPointerId(1);
1996     pointer->AddPointerItem(item);
1997     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->SendUIExtentionPointerEvent(logicalX, logicalY, windowInfo, pointer));
1998 }
1999 
2000 /**
2001  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplayCoord_001
2002  * @tc.desc: Test the funcation GetPhysicalDisplayCoord
2003  * @tc.type: FUNC
2004  * @tc.require:
2005  */
2006 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoord_001, TestSize.Level1)
2007 {
2008     CALL_TEST_DEBUG;
2009     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2010         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2011     ASSERT_NE(inputWindowsManager, nullptr);
2012     libinput_event_touch touch {};
2013     DisplayInfo info;
2014     EventTouch touchInfo;
2015     info.direction = DIRECTION90;
2016     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2017     info.direction = DIRECTION270;
2018     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2019     info.direction = DIRECTION180;
2020     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2021 }
2022 
2023 /**
2024  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_006
2025  * @tc.desc: Test the function IsNeedRefreshLayer
2026  * @tc.type: FUNC
2027  * @tc.require:
2028  */
2029 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_006, TestSize.Level1)
2030 {
2031     CALL_TEST_DEBUG;
2032     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2033         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2034     ASSERT_NE(inputWindowsManager, nullptr);
2035     int32_t windowId = -1;
2036     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2037     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2038     EXPECT_NE(inputEvent, nullptr);
2039     inputEvent->targetDisplayId_ = -1;
2040     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2041     EXPECT_FALSE(ret);
2042     inputEvent->targetDisplayId_ = 2;
2043     DisplayInfo displayInfo;
2044     displayInfo.id = 2;
2045     displayInfo.x = 2;
2046     displayInfo.y = 3;
2047     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2048     ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2049     EXPECT_FALSE(ret);
2050     windowId = 5;
2051     ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2052     EXPECT_FALSE(ret);
2053 }
2054 
2055 /**
2056  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_001
2057  * @tc.desc: Test the funcation SendUIExtentionPointerEvent
2058  * @tc.type: FUNC
2059  * @tc.require:
2060  */
2061 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_001, TestSize.Level1)
2062 {
2063     CALL_TEST_DEBUG;
2064     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2065         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2066     ASSERT_NE(inputWindowsManager, nullptr);
2067     int32_t logicalX = 100;
2068     int32_t logicalY = 200;
2069     WindowInfo windowInfo;
2070     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2071     ASSERT_NE(pointerEvent, nullptr);
2072     pointerEvent->pointerId_ = 1;
2073     PointerEvent::PointerItem item;
2074     item.pointerId_ = -1;
2075     pointerEvent->pointers_.push_back(item);
2076     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2077         (logicalX, logicalY, windowInfo, pointerEvent));
2078     item.pointerId_ = 1;
2079     pointerEvent->pointers_.push_back(item);
2080     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2081         (logicalX, logicalY, windowInfo, pointerEvent));
2082     windowInfo.id = 1;
2083     windowInfo.pid = 11;
2084     windowInfo.transform.push_back(1.1);
2085     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2086         (logicalX, logicalY, windowInfo, pointerEvent));
2087 }
2088 
2089 /**
2090  * @tc.name: InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001
2091  * @tc.desc: Test the funcation DispatchUIExtentionPointerEvent
2092  * @tc.type: FUNC
2093  * @tc.require:
2094  */
2095 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001, TestSize.Level1)
2096 {
2097     CALL_TEST_DEBUG;
2098     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2099         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2100     ASSERT_NE(inputWindowsManager, nullptr);
2101     int32_t logicalX = 400;
2102     int32_t logicalY = 600;
2103     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2104     ASSERT_NE(pointerEvent, nullptr);
2105     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2106     EXPECT_NE(inputEvent, nullptr);
2107     inputEvent->targetDisplayId_ = 2;
2108     PointerEvent::PointerItem pointerItem;
2109     pointerItem.targetWindowId_ = 2;
2110     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2111     pointerItem.targetWindowId_ = 3;
2112     WindowInfo windowInfo;
2113     windowInfo.id = 3;
2114     windowInfo.uiExtentionWindowInfo.push_back(windowInfo);
2115     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2116     pointerItem.targetWindowId_ = 6;
2117     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2118 }
2119 
2120 /**
2121  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_001
2122  * @tc.desc: Test the funcation SelectWindowInfo
2123  * @tc.type: FUNC
2124  * @tc.require:
2125  */
2126 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_001, TestSize.Level1)
2127 {
2128     CALL_TEST_DEBUG;
2129     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2130         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2131     ASSERT_NE(inputWindowsManager, nullptr);
2132     int32_t logicalX = 10;
2133     int32_t logicalY = 20;
2134     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2135     EXPECT_NE(pointerEvent, nullptr);
2136     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2137     inputWindowsManager->firstBtnDownWindowId_ = -1;
2138     PointerEvent::PointerItem pointerItem;
2139     pointerItem.targetWindowId_ = 2;
2140     inputWindowsManager->extraData_.appended = true;
2141     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
2142     WindowInfo windowInfo;
2143     windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2144     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2145     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2146     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2147     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2148     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2149     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2150     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2151     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_IN_WINDOW);
2152     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2153     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW);
2154     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2155     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2156     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2157     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_LEAVE_WINDOW);
2158     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2159     pointerEvent->pressedButtons_.insert(1);
2160     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2161     windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2162     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2163     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2164     inputWindowsManager->extraData_.appended = false;
2165     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2166     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2167     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2168 }
2169 
2170 /**
2171  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_002
2172  * @tc.desc: Test the funcation SelectWindowInfo
2173  * @tc.type: FUNC
2174  * @tc.require:
2175  */
2176 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_002, TestSize.Level1)
2177 {
2178     CALL_TEST_DEBUG;
2179     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2180         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2181     ASSERT_NE(inputWindowsManager, nullptr);
2182     int32_t logicalX = 10;
2183     int32_t logicalY = 20;
2184     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2185     EXPECT_NE(pointerEvent, nullptr);
2186     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2187     inputWindowsManager->firstBtnDownWindowId_ = -1;
2188     PointerEvent::PointerItem pointerItem;
2189     pointerItem.targetWindowId_ = 2;
2190     inputWindowsManager->extraData_.appended = false;
2191     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2192     WindowInfo windowInfo;
2193     windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2194     windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2195     pointerEvent->pressedButtons_.insert(1);
2196     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2197     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2198     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2199     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2200     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2201     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2202     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2203     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2204     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2205     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ENTER_WINDOW);
2206     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2207     inputWindowsManager->firstBtnDownWindowId_ = 1;
2208     pointerEvent->pressedButtons_.insert(2);
2209     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2210     inputWindowsManager->extraData_.appended = false;
2211     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2212 }
2213 
2214 /**
2215  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint
2216  * @tc.desc: Test the funcation TouchPointToDisplayPoint
2217  * @tc.type: FUNC
2218  * @tc.require:
2219  */
2220 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint, TestSize.Level1)
2221 {
2222     CALL_TEST_DEBUG;
2223     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2224         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2225     ASSERT_NE(inputWindowsManager, nullptr);
2226     int32_t deviceId = 10;
2227     libinput_event_touch touch {};
2228     EventTouch touchInfo;
2229     int32_t physicalDisplayId;
2230     inputWindowsManager->bindInfo_.AddDisplay(2, "abcdefg");
2231     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2232         (deviceId, &touch, touchInfo, physicalDisplayId));
2233     deviceId = 2;
2234     DisplayInfo displayInfo;
2235     displayInfo.width = -1;
2236     displayInfo.height = 3;
2237     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2238     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2239         (deviceId, &touch, touchInfo, physicalDisplayId));
2240     displayInfo.width = 3;
2241     displayInfo.height = -1;
2242     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2243     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2244         (deviceId, &touch, touchInfo, physicalDisplayId));
2245     displayInfo.width = -5;
2246     displayInfo.height = -6;
2247     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2248     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2249         (deviceId, &touch, touchInfo, physicalDisplayId));
2250     displayInfo.width = 3;
2251     displayInfo.height = 2;
2252     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2253     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2254         (deviceId, &touch, touchInfo, physicalDisplayId));
2255 }
2256 
2257 /**
2258  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_001
2259  * @tc.desc: Test the funcation AdjustDisplayRotation
2260  * @tc.type: FUNC
2261  * @tc.require:
2262  */
2263 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_001, TestSize.Level1)
2264 {
2265     CALL_TEST_DEBUG;
2266     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2267         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2268     ASSERT_NE(inputWindowsManager, nullptr);
2269     inputWindowsManager->cursorPos_.direction = Direction::DIRECTION0;
2270     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
2271     inputWindowsManager->cursorPos_.direction = Direction::DIRECTION90;
2272     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
2273     inputWindowsManager->cursorPos_.direction = Direction::DIRECTION180;
2274     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
2275     inputWindowsManager->cursorPos_.direction = Direction::DIRECTION270;
2276     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
2277 }
2278 
2279 /**
2280  * @tc.name: InputWindowsManagerTest_FoldScreenRotation
2281  * @tc.desc: Test the function FoldScreenRotation
2282  * @tc.type: FUNC
2283  * @tc.require:
2284  */
2285 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation, TestSize.Level1)
2286 {
2287     CALL_TEST_DEBUG;
2288     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2289         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2290     ASSERT_NE(inputWindowsManager, nullptr);
2291     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2292     ASSERT_NE(pointerEvent, nullptr);
2293     WindowInfoEX winInfoEx;
2294     pointerEvent->bitwise_ = 0x00000000;
2295     pointerEvent->SetPointerId(1);
2296     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2297     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
2298     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2299 }
2300 
2301 /**
2302  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_001
2303  * @tc.desc: Test the function FoldScreenRotation
2304  * @tc.type: FUNC
2305  * @tc.require:
2306  */
2307 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_001, TestSize.Level1)
2308 {
2309     CALL_TEST_DEBUG;
2310     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
2311     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2312         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2313     ASSERT_NE(inputWindowsManager, nullptr);
2314     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2315     ASSERT_NE(pointerEvent, nullptr);
2316     WindowInfoEX winInfoEx;
2317     DisplayInfo displayInfo;
2318     displayInfo.id = 10;
2319     pointerEvent->bitwise_ = 0x00000000;
2320     pointerEvent->SetPointerId(1);
2321     pointerEvent->SetTargetDisplayId(10);
2322     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2323     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2324     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2325     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2326 }
2327 
2328 /**
2329  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_002
2330  * @tc.desc: Test the function FoldScreenRotation
2331  * @tc.type: FUNC
2332  * @tc.require:
2333  */
2334 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_002, TestSize.Level1)
2335 {
2336     CALL_TEST_DEBUG;
2337     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2338     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2339         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2340     ASSERT_NE(inputWindowsManager, nullptr);
2341     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2342     ASSERT_NE(pointerEvent, nullptr);
2343     WindowInfoEX winInfoEx;
2344     DisplayInfo displayInfo;
2345     displayInfo.id = 10;
2346     pointerEvent->SetPointerId(1);
2347     pointerEvent->SetTargetDisplayId(10);
2348     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2349     inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2350     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2351     inputWindowsManager->lastDirection_ = static_cast<Direction>(-1);
2352     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2353 }
2354 
2355 /**
2356  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_003
2357  * @tc.desc: Test the function FoldScreenRotation
2358  * @tc.type: FUNC
2359  * @tc.require:
2360  */
2361 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_003, TestSize.Level1)
2362 {
2363     CALL_TEST_DEBUG;
2364     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2365     InputWindowsManager inputWindowsManager;
2366     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2367     ASSERT_NE(pointerEvent, nullptr);
2368     PointerEvent::PointerItem item;
2369     DisplayInfo displayInfo;
2370     displayInfo.id = 10;
2371     displayInfo.direction = DIRECTION90;
2372     item.SetPointerId(2);
2373     pointerEvent->AddPointerItem(item);
2374     pointerEvent->SetPointerId(1);
2375     pointerEvent->SetTargetDisplayId(10);
2376     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2377     inputWindowsManager.lastDirection_ = DIRECTION0;
2378     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2379     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2380 }
2381 
2382 /**
2383  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_004
2384  * @tc.desc: Test the function FoldScreenRotation
2385  * @tc.type: FUNC
2386  * @tc.require:
2387  */
2388 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_004, TestSize.Level1)
2389 {
2390     CALL_TEST_DEBUG;
2391     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2392     InputWindowsManager inputWindowsManager;
2393     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2394     ASSERT_NE(pointerEvent, nullptr);
2395     PointerEvent::PointerItem item;
2396     DisplayInfo displayInfo;
2397     displayInfo.id = 10;
2398     displayInfo.direction = DIRECTION90;
2399     item.SetPointerId(1);
2400     item.SetPressed(false);
2401     pointerEvent->AddPointerItem(item);
2402     pointerEvent->SetPointerId(1);
2403     pointerEvent->SetTargetDisplayId(10);
2404     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2405     inputWindowsManager.lastDirection_ = DIRECTION0;
2406     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2407     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2408 }
2409 
2410 /**
2411  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_005
2412  * @tc.desc: Test the function FoldScreenRotation
2413  * @tc.type: FUNC
2414  * @tc.require:
2415  */
2416 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_005, TestSize.Level1)
2417 {
2418     CALL_TEST_DEBUG;
2419     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2420     InputWindowsManager inputWindowsManager;
2421     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2422     ASSERT_NE(pointerEvent, nullptr);
2423     PointerEvent::PointerItem item;
2424     DisplayInfo displayInfo;
2425     displayInfo.id = 10;
2426     displayInfo.direction = DIRECTION90;
2427     item.SetPointerId(1);
2428     item.SetPressed(true);
2429     pointerEvent->AddPointerItem(item);
2430     pointerEvent->SetPointerId(1);
2431     pointerEvent->SetTargetDisplayId(10);
2432     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2433     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
2434     inputWindowsManager.lastDirection_ = DIRECTION0;
2435     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2436     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2437 }
2438 
2439 /**
2440  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_006
2441  * @tc.desc: Test the function FoldScreenRotation
2442  * @tc.type: FUNC
2443  * @tc.require:
2444  */
2445 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_006, TestSize.Level1)
2446 {
2447     CALL_TEST_DEBUG;
2448     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2449     InputWindowsManager inputWindowsManager;
2450     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2451     ASSERT_NE(pointerEvent, nullptr);
2452     PointerEvent::PointerItem item;
2453     WindowInfoEX winInfoEx;
2454     DisplayInfo displayInfo;
2455     displayInfo.id = 10;
2456     displayInfo.direction = DIRECTION90;
2457     item.SetPointerId(1);
2458     item.SetPressed(true);
2459     pointerEvent->bitwise_ = 0x00000000;
2460     pointerEvent->AddPointerItem(item);
2461     pointerEvent->SetPointerId(1);
2462     pointerEvent->SetTargetDisplayId(10);
2463     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2464     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2465     inputWindowsManager.lastDirection_ = DIRECTION0;
2466     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2467     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2468     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2469 }
2470 
2471 /**
2472  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_007
2473  * @tc.desc: Test the function FoldScreenRotation
2474  * @tc.type: FUNC
2475  * @tc.require:
2476  */
2477 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_007, TestSize.Level1)
2478 {
2479     CALL_TEST_DEBUG;
2480     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2481     InputWindowsManager inputWindowsManager;
2482     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2483     ASSERT_NE(pointerEvent, nullptr);
2484     PointerEvent::PointerItem item;
2485     WindowInfoEX winInfoEx;
2486     DisplayInfo displayInfo;
2487     displayInfo.id = 10;
2488     displayInfo.direction = DIRECTION90;
2489     item.SetPointerId(1);
2490     item.SetPressed(true);
2491     pointerEvent->bitwise_ = 0x00000080;
2492     pointerEvent->AddPointerItem(item);
2493     pointerEvent->SetPointerId(1);
2494     pointerEvent->SetTargetDisplayId(10);
2495     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2496     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2497     inputWindowsManager.lastDirection_ = DIRECTION0;
2498     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2499     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2500     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2501 }
2502 
2503 /**
2504  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_008
2505  * @tc.desc: Test the function FoldScreenRotation
2506  * @tc.type: FUNC
2507  * @tc.require:
2508  */
2509 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_008, TestSize.Level1)
2510 {
2511     CALL_TEST_DEBUG;
2512     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2513     InputWindowsManager inputWindowsManager;
2514     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2515     ASSERT_NE(pointerEvent, nullptr);
2516     PointerEvent::PointerItem item;
2517     WindowInfoEX winInfoEx;
2518     DisplayInfo displayInfo;
2519     displayInfo.id = 10;
2520     displayInfo.direction = DIRECTION90;
2521     item.SetPointerId(1);
2522     item.SetPressed(true);
2523     pointerEvent->bitwise_ = 0x00000000;
2524     pointerEvent->AddPointerItem(item);
2525     pointerEvent->SetPointerId(1);
2526     pointerEvent->SetTargetDisplayId(10);
2527     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2528     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2529     inputWindowsManager.lastDirection_ = DIRECTION0;
2530     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2531     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2532     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2533 }
2534 
2535 /**
2536  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_009
2537  * @tc.desc: Test the function FoldScreenRotation
2538  * @tc.type: FUNC
2539  * @tc.require:
2540  */
2541 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_009, TestSize.Level1)
2542 {
2543     CALL_TEST_DEBUG;
2544     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2545     InputWindowsManager inputWindowsManager;
2546     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2547     ASSERT_NE(pointerEvent, nullptr);
2548     PointerEvent::PointerItem item;
2549     DisplayInfo displayInfo;
2550     displayInfo.id = 10;
2551     displayInfo.direction = DIRECTION90;
2552     item.SetPointerId(1);
2553     pointerEvent->AddPointerItem(item);
2554     pointerEvent->SetPointerId(1);
2555     pointerEvent->SetTargetDisplayId(10);
2556     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2557     inputWindowsManager.lastDirection_ = DIRECTION90;
2558     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2559     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2560 }
2561 
2562 /**
2563  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_010
2564  * @tc.desc: Test the function FoldScreenRotation
2565  * @tc.type: FUNC
2566  * @tc.require:
2567  */
2568 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_010, TestSize.Level1)
2569 {
2570     CALL_TEST_DEBUG;
2571     InputWindowsManager inputWindowsManager;
2572     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2573     ASSERT_NE(pointerEvent, nullptr);
2574     WindowInfoEX winInfoEx;
2575     DisplayInfo displayInfo;
2576     displayInfo.id = 10;
2577     pointerEvent->bitwise_ = 0x00000080;
2578     pointerEvent->SetPointerId(1);
2579     pointerEvent->SetTargetDisplayId(10);
2580     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2581     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2582     inputWindowsManager.shellTouchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
2583     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2584 }
2585 
2586 /**
2587  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_011
2588  * @tc.desc: Test the function FoldScreenRotation
2589  * @tc.type: FUNC
2590  * @tc.require:
2591  */
2592 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_011, TestSize.Level1)
2593 {
2594     CALL_TEST_DEBUG;
2595     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
2596     InputWindowsManager inputWindowsManager;
2597     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2598     ASSERT_NE(pointerEvent, nullptr);
2599     WindowInfoEX winInfoEx;
2600     DisplayInfo displayInfo;
2601     displayInfo.id = 10;
2602     pointerEvent->bitwise_ = 0x00000080;
2603     pointerEvent->SetPointerId(1);
2604     pointerEvent->SetTargetDisplayId(10);
2605     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2606     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2607     inputWindowsManager.shellTouchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2608     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2609 }
2610 
2611 /**
2612  * @tc.name: InputWindowsManagerTest_RotateScreen
2613  * @tc.desc: Test the function RotateScreen
2614  * @tc.type: FUNC
2615  * @tc.require:
2616  */
2617 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen, TestSize.Level1)
2618 {
2619     CALL_TEST_DEBUG;
2620     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2621     InputWindowsManager inputWindowsManager;
2622     DisplayInfo info;
2623     PhysicalCoordinate coord;
2624     info.height = 500;
2625     coord.x = 200;
2626     info.direction = DIRECTION0;
2627     inputWindowsManager.cursorPos_.direction = DIRECTION90;
2628     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
2629 }
2630 
2631 /**
2632  * @tc.name: InputWindowsManagerTest_RotateScreen_001
2633  * @tc.desc: Test the function RotateScreen
2634  * @tc.type: FUNC
2635  * @tc.require:
2636  */
2637 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, TestSize.Level1)
2638 {
2639     CALL_TEST_DEBUG;
2640     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2641     InputWindowsManager inputWindowsManager;
2642     DisplayInfo info;
2643     PhysicalCoordinate coord;
2644     info.width = 500;
2645     coord.y = 200;
2646     info.direction = DIRECTION0;
2647     inputWindowsManager.cursorPos_.direction = DIRECTION270;
2648     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
2649 }
2650 
2651 /**
2652  * @tc.name: InputWindowsManagerTest_RotateScreen_002
2653  * @tc.desc: Test the function RotateScreen
2654  * @tc.type: FUNC
2655  * @tc.require:
2656  */
2657 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, TestSize.Level1)
2658 {
2659     CALL_TEST_DEBUG;
2660     InputWindowsManager inputWindowsManager;
2661     DisplayInfo info;
2662     PhysicalCoordinate coord;
2663     info.direction = static_cast<Direction>(10);
2664     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
2665 }
2666 
2667 /**
2668  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer
2669  * @tc.desc: Test the function IsNeedRefreshLayer
2670  * @tc.type: FUNC
2671  * @tc.require:
2672  */
2673 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer, TestSize.Level1)
2674 {
2675     CALL_TEST_DEBUG;
2676     int32_t displayId = -1;
2677     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2678     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
2679     InputWindowsManager inputWindowsManager;
2680     int32_t windowId = 10;
2681     DisplayInfo displayInfo;
2682     WindowInfo winInfo;
2683     displayInfo.id = 100;
2684     displayInfo.x = 200;
2685     displayInfo.y = 200;
2686     winInfo.flags = 0;
2687     winInfo.id = 10;
2688     inputWindowsManager.mouseLocation_.displayId = 80;
2689     inputWindowsManager.mouseLocation_.physicalX = 100;
2690     inputWindowsManager.mouseLocation_.physicalY = 100;
2691     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
2692     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2693     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
2694     EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
2695 }
2696 
2697 /**
2698  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_007
2699  * @tc.desc: Test the function IsNeedRefreshLayer
2700  * @tc.type: FUNC
2701  * @tc.require:
2702  */
2703 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_007, TestSize.Level1)
2704 {
2705     CALL_TEST_DEBUG;
2706     int32_t displayId = -1;
2707     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2708     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
2709     InputWindowsManager inputWindowsManager;
2710     int32_t windowId = -1;
2711     DisplayInfo displayInfo;
2712     WindowInfo winInfo;
2713     displayInfo.id = 100;
2714     displayInfo.x = 200;
2715     displayInfo.y = 200;
2716     winInfo.flags = 0;
2717     winInfo.id = 10;
2718     inputWindowsManager.mouseLocation_.displayId = 80;
2719     inputWindowsManager.mouseLocation_.physicalX = 100;
2720     inputWindowsManager.mouseLocation_.physicalY = 100;
2721     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
2722     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2723     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
2724     EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
2725 }
2726 
2727 /**
2728  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_008
2729  * @tc.desc: Test the function IsNeedRefreshLayer
2730  * @tc.type: FUNC
2731  * @tc.require:
2732  */
2733 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_008, TestSize.Level1)
2734 {
2735     CALL_TEST_DEBUG;
2736     int32_t displayId = -1;
2737     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2738     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
2739     InputWindowsManager inputWindowsManager;
2740     int32_t windowId = 50;
2741     DisplayInfo displayInfo;
2742     WindowInfo winInfo;
2743     displayInfo.id = 100;
2744     displayInfo.x = 200;
2745     displayInfo.y = 200;
2746     winInfo.flags = 0;
2747     winInfo.id = 10;
2748     inputWindowsManager.mouseLocation_.displayId = 80;
2749     inputWindowsManager.mouseLocation_.physicalX = 100;
2750     inputWindowsManager.mouseLocation_.physicalY = 100;
2751     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
2752     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2753     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
2754     EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
2755 }
2756 
2757 /**
2758  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_009
2759  * @tc.desc: Test the function IsNeedRefreshLayer
2760  * @tc.type: FUNC
2761  * @tc.require:
2762  */
2763 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_009, TestSize.Level1)
2764 {
2765     CALL_TEST_DEBUG;
2766     int32_t displayId = -1;
2767     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2768     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
2769     InputWindowsManager inputWindowsManager;
2770     int32_t windowId = 50;
2771     DisplayInfo displayInfo;
2772     WindowInfo winInfo;
2773     displayInfo.id = 100;
2774     displayInfo.x = 200;
2775     displayInfo.y = 200;
2776     winInfo.flags = 0;
2777     inputWindowsManager.mouseLocation_.displayId = 80;
2778     inputWindowsManager.mouseLocation_.physicalX = 100;
2779     inputWindowsManager.mouseLocation_.physicalY = 100;
2780     winInfo.pointerHotAreas.push_back({ 100, 100, INT32_MAX, 1000 });
2781     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2782     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
2783     EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
2784 }
2785 } // namespace MMI
2786 } // namespace OHOS