• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 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 "mmi_matrix3.h"
22 #include "mock.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 constexpr int32_t CAST_INPUT_DEVICEID { 0xAAAAAAFF };
35 constexpr int32_t CAST_SCREEN_DEVICEID { 0xAAAAAAFE };
36 } // namespace
37 
38 class InputWindowsManagerTest : public testing::Test {
39 public:
40     static void SetUpTestCase(void);
41     static void TearDownTestCase();
SetUp()42     void SetUp() {}
TearDown()43     void TearDown() {}
44 
45     static inline std::shared_ptr<MessageParcelMock> messageParcelMock_ = nullptr;
46 };
47 
SetUpTestCase(void)48 void InputWindowsManagerTest::SetUpTestCase(void)
49 {
50     messageParcelMock_ = std::make_shared<MessageParcelMock>();
51     MessageParcelMock::messageParcel = messageParcelMock_;
52 }
TearDownTestCase()53 void InputWindowsManagerTest::TearDownTestCase()
54 {
55     IInputWindowsManager::instance_.reset();
56     IInputWindowsManager::instance_ = nullptr;
57     MessageParcelMock::messageParcel = nullptr;
58     messageParcelMock_ = nullptr;
59 }
60 
61 #ifdef OHOS_BUILD_ENABLE_KEYBOARD
62 /**
63  * @tc.name: UpdateTarget_001
64  * @tc.desc: Test the function UpdateTarget
65  * @tc.type: FUNC
66  * @tc.require:
67  */
68 HWTEST_F(InputWindowsManagerTest, UpdateTarget_001, TestSize.Level1)
69 {
70     CALL_TEST_DEBUG;
71     std::shared_ptr<InputWindowsManager> inputWindowsManager =
72         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
73     ASSERT_NE(inputWindowsManager, nullptr);
74     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
75     ASSERT_NE(keyEvent, nullptr);
76     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
77 }
78 
79 /**
80  * @tc.name: UpdateTarget_002
81  * @tc.desc: Test the function UpdateTarget
82  * @tc.type: FUNC
83  * @tc.require:
84  */
85 HWTEST_F(InputWindowsManagerTest, UpdateTarget_002, TestSize.Level1)
86 {
87     CALL_TEST_DEBUG;
88     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(-1));
89     std::shared_ptr<InputWindowsManager> inputWindowsManager =
90         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
91     ASSERT_NE(inputWindowsManager, nullptr);
92     UDSServer udsServer;
93     inputWindowsManager->udsServer_ = &udsServer;
94     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
95     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
96         it->second.focusWindowId = 1;
97     }
98     WindowInfo windowInfo;
99     windowInfo.id = 1;
100     windowInfo.pid = 11;
101     it->second.windowsInfo.push_back(windowInfo);
102     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
103     ASSERT_NE(keyEvent, nullptr);
104     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
105     it->second.focusWindowId = -1;
106     it->second.windowsInfo.clear();
107     inputWindowsManager->udsServer_ = nullptr;
108 }
109 
110 /**
111  * @tc.name: UpdateTarget_003
112  * @tc.desc: Test the function UpdateTarget
113  * @tc.type: FUNC
114  * @tc.require:
115  */
116 HWTEST_F(InputWindowsManagerTest, UpdateTarget_003, TestSize.Level1)
117 {
118     CALL_TEST_DEBUG;
119     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
120     std::shared_ptr<InputWindowsManager> inputWindowsManager =
121         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
122     ASSERT_NE(inputWindowsManager, nullptr);
123     UDSServer udsServer;
124     inputWindowsManager->udsServer_ = &udsServer;
125     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
126     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
127         it->second.focusWindowId = 1;
128     }
129     WindowInfo windowInfo;
130     windowInfo.id = 1;
131     windowInfo.pid = 11;
132     it->second.windowsInfo.push_back(windowInfo);
133     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
134     ASSERT_NE(keyEvent, nullptr);
135     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
136     it->second.focusWindowId = -1;
137     it->second.windowsInfo.clear();
138     inputWindowsManager->udsServer_ = nullptr;
139 }
140 #endif // OHOS_BUILD_ENABLE_KEYBOARD
141 
142 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING)
143 /**
144  * @tc.name: PointerDrawingManagerOnDisplayInfo_001
145  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
146  * @tc.type: FUNC
147  * @tc.require:
148  */
149 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_001, TestSize.Level1)
150 {
151     CALL_TEST_DEBUG;
152     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(false));
153     std::shared_ptr<InputWindowsManager> inputWindowsManager =
154         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
155     ASSERT_NE(inputWindowsManager, nullptr);
156     OLD::DisplayGroupInfo displayGroupInfo;
157     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
158 }
159 
160 /**
161  * @tc.name: PointerDrawingManagerOnDisplayInfo_002
162  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
163  * @tc.type: FUNC
164  * @tc.require:
165  */
166 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_002, TestSize.Level1)
167 {
168     CALL_TEST_DEBUG;
169     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
170     std::shared_ptr<InputWindowsManager> inputWindowsManager =
171         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
172     ASSERT_NE(inputWindowsManager, nullptr);
173     OLD::DisplayInfo displayInfo;
174     displayInfo.id = 0;
175     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
176     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
177         it->second.displaysInfo.push_back(displayInfo);
178     }
179     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
180     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
181     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
182     OLD::DisplayGroupInfo displayGroupInfo;
183     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
184     it->second.displaysInfo.clear();
185     inputWindowsManager->lastPointerEvent_.reset();
186     inputWindowsManager->lastPointerEvent_ = nullptr;
187 }
188 
189 /**
190  * @tc.name: PointerDrawingManagerOnDisplayInfo_003
191  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
192  * @tc.type: FUNC
193  * @tc.require:
194  */
195 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_003, TestSize.Level1)
196 {
197     CALL_TEST_DEBUG;
198     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
199     std::shared_ptr<InputWindowsManager> inputWindowsManager =
200         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
201     ASSERT_NE(inputWindowsManager, nullptr);
202     OLD::DisplayInfo displayInfo;
203     displayInfo.id = 0;
204     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
205     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
206         it->second.displaysInfo.push_back(displayInfo);
207     }
208     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
209     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
210     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
211     inputWindowsManager->lastPointerEvent_->SetButtonPressed(1);
212     OLD::DisplayGroupInfo displayGroupInfo;
213     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
214     it->second.displaysInfo.clear();
215     inputWindowsManager->lastPointerEvent_.reset();
216     inputWindowsManager->lastPointerEvent_ = nullptr;
217 }
218 
219 /**
220  * @tc.name: PointerDrawingManagerOnDisplayInfo_004
221  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
222  * @tc.type: FUNC
223  * @tc.require:
224  */
225 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_004, TestSize.Level1)
226 {
227     CALL_TEST_DEBUG;
228     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
229     std::shared_ptr<InputWindowsManager> inputWindowsManager =
230         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
231     ASSERT_NE(inputWindowsManager, nullptr);
232     OLD::DisplayInfo displayInfo;
233     displayInfo.id = 0;
234     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
235     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
236         it->second.displaysInfo.push_back(displayInfo);
237     }
238     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
239     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
240     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
241     OLD::DisplayGroupInfo displayGroupInfo;
242     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
243     it->second.displaysInfo.clear();
244     inputWindowsManager->lastPointerEvent_.reset();
245     inputWindowsManager->lastPointerEvent_ = nullptr;
246 }
247 
248 /**
249  * @tc.name: PointerDrawingManagerOnDisplayInfo_005
250  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
251  * @tc.type: FUNC
252  * @tc.require:
253  */
254 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_005, TestSize.Level1)
255 {
256     CALL_TEST_DEBUG;
257     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
258     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
259     std::shared_ptr<InputWindowsManager> inputWindowsManager =
260         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
261     ASSERT_NE(inputWindowsManager, nullptr);
262     OLD::DisplayInfo displayInfo;
263     displayInfo.id = 0;
264     displayInfo.x = 8;
265     displayInfo.y = 8;
266     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
267     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
268         it->second.displaysInfo.push_back(displayInfo);
269     }
270     WindowInfo windowInfo;
271     windowInfo.id = 1;
272     windowInfo.pid = 11;
273     windowInfo.transform.push_back(1.1);
274     Rect rect;
275     rect.x = 5;
276     rect.y = 5;
277     rect.width = 10;
278     rect.height = 10;
279     windowInfo.pointerHotAreas.push_back(rect);
280     it->second.windowsInfo.push_back(windowInfo);
281     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
282     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
283     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
284     OLD::DisplayGroupInfo displayGroupInfo;
285     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
286     it->second.windowsInfo.clear();
287     it->second.displaysInfo.clear();
288     inputWindowsManager->lastPointerEvent_.reset();
289     inputWindowsManager->lastPointerEvent_ = nullptr;
290 }
291 
292 /**
293  * @tc.name: PointerDrawingManagerOnDisplayInfo_006
294  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
295  * @tc.type: FUNC
296  * @tc.require:
297  */
298 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_006, TestSize.Level1)
299 {
300     CALL_TEST_DEBUG;
301     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
302     std::shared_ptr<InputWindowsManager> inputWindowsManager =
303         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
304     ASSERT_NE(inputWindowsManager, nullptr);
305     OLD::DisplayInfo displayInfo;
306     displayInfo.id = 0;
307     displayInfo.x = 8;
308     displayInfo.y = 8;
309     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
310     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
311         it->second.displaysInfo.push_back(displayInfo);
312     }
313     WindowInfo windowInfo;
314     windowInfo.id = 1;
315     windowInfo.pid = 11;
316     windowInfo.transform.push_back(1.1);
317     Rect rect;
318     rect.x = 5;
319     rect.y = 5;
320     rect.width = 10;
321     rect.height = 10;
322     windowInfo.pointerHotAreas.push_back(rect);
323     it->second.windowsInfo.push_back(windowInfo);
324     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
325     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
326     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
327     inputWindowsManager->isDragBorder_ = true;
328     inputWindowsManager->dragFlag_ = true;
329     OLD::DisplayGroupInfo displayGroupInfo;
330     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
331     it->second.displaysInfo.clear();
332     it->second.windowsInfo.clear();
333     inputWindowsManager->lastPointerEvent_.reset();
334     inputWindowsManager->lastPointerEvent_ = nullptr;
335     inputWindowsManager->isDragBorder_ = false;
336     inputWindowsManager->dragFlag_ = false;
337 }
338 
339 /**
340  * @tc.name: PointerDrawingManagerOnDisplayInfo_007
341  * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
342  * @tc.type: FUNC
343  * @tc.require:
344  */
345 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_007, TestSize.Level1)
346 {
347     CALL_TEST_DEBUG;
348     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
349     std::shared_ptr<InputWindowsManager> inputWindowsManager =
350         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
351     ASSERT_NE(inputWindowsManager, nullptr);
352     OLD::DisplayInfo displayInfo;
353     displayInfo.id = 0;
354     displayInfo.x = 8;
355     displayInfo.y = 8;
356     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
357     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
358         it->second.displaysInfo.push_back(displayInfo);
359     }
360     WindowInfo windowInfo;
361     windowInfo.id = 1;
362     windowInfo.pid = 11;
363     windowInfo.transform.push_back(1.1);
364     Rect rect;
365     rect.x = 5;
366     rect.y = 5;
367     rect.width = 10;
368     rect.height = 10;
369     windowInfo.pointerHotAreas.push_back(rect);
370     it->second.windowsInfo.push_back(windowInfo);
371     inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
372     ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
373     inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
374     inputWindowsManager->isDragBorder_ = true;
375     inputWindowsManager->dragFlag_ = true;
376     OLD::DisplayGroupInfo displayGroupInfo;
377     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
378     it->second.displaysInfo.clear();
379     it->second.windowsInfo.clear();
380     inputWindowsManager->lastPointerEvent_.reset();
381     inputWindowsManager->lastPointerEvent_ = nullptr;
382     inputWindowsManager->isDragBorder_ = false;
383     inputWindowsManager->dragFlag_ = false;
384 }
385 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING
386 
387 /**
388  * @tc.name: SendPointerEvent_001
389  * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
390  * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
391  * @tc.type: FUNC
392  * @tc.require:
393  */
394 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_001, TestSize.Level1)
395 {
396     CALL_TEST_DEBUG;
397     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
398     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
399     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
400     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
401     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
402 
403     std::shared_ptr<InputWindowsManager> inputWindowsManager =
404         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
405     ASSERT_NE(inputWindowsManager, nullptr);
406     UDSServer udsServer;
407     inputWindowsManager->udsServer_ = &udsServer;
408     int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
409     OLD::DisplayInfo displayInfo;
410     displayInfo.id = 10;
411     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
412     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
413         it->second.displaysInfo.push_back(displayInfo);
414     }
415     inputWindowsManager->extraData_.appended = true;
416     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
417     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
418     inputWindowsManager->udsServer_ = nullptr;
419     it->second.displaysInfo.clear();
420     inputWindowsManager->extraData_.appended = false;
421     inputWindowsManager->extraData_.sourceType = -1;
422 }
423 
424 /**
425  * @tc.name: SendPointerEvent_002
426  * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
427  * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
428  * @tc.type: FUNC
429  * @tc.require:
430  */
431 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_002, TestSize.Level1)
432 {
433     CALL_TEST_DEBUG;
434     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
435     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
436     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
437     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
438     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
439 
440     std::shared_ptr<InputWindowsManager> inputWindowsManager =
441         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
442     ASSERT_NE(inputWindowsManager, nullptr);
443     UDSServer udsServer;
444     inputWindowsManager->udsServer_ = &udsServer;
445     int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW ;
446     OLD::DisplayInfo displayInfo;
447     displayInfo.id = 10;
448     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
449     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
450         it->second.displaysInfo.push_back(displayInfo);
451     }
452     inputWindowsManager->extraData_.appended = false;
453     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
454     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
455     inputWindowsManager->udsServer_ = nullptr;
456     it->second.displaysInfo.clear();
457     inputWindowsManager->extraData_.sourceType = -1;
458 }
459 
460 /**
461  * @tc.name: SendPointerEvent_003
462  * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
463  * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
464  * @tc.type: FUNC
465  * @tc.require:
466  */
467 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_003, TestSize.Level1)
468 {
469     CALL_TEST_DEBUG;
470     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
471     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
472     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
473     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
474     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
475 
476     std::shared_ptr<InputWindowsManager> inputWindowsManager =
477         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
478     ASSERT_NE(inputWindowsManager, nullptr);
479     UDSServer udsServer;
480     inputWindowsManager->udsServer_ = &udsServer;
481     int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
482     OLD::DisplayInfo displayInfo;
483     displayInfo.id = 10;
484     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
485     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
486         it->second.displaysInfo.push_back(displayInfo);
487     }
488     inputWindowsManager->extraData_.appended = false;
489     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
490     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
491     inputWindowsManager->udsServer_ = nullptr;
492     it->second.displaysInfo.clear();
493     inputWindowsManager->extraData_.sourceType = -1;
494 }
495 
496 /**
497  * @tc.name: SendPointerEvent_004
498  * @tc.desc: Verify if (!UpdateDisplayId(displayId))
499  * @tc.type: FUNC
500  * @tc.require:
501  */
502 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_004, TestSize.Level1)
503 {
504     CALL_TEST_DEBUG;
505     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
506     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
507     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
508     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
509     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
510 
511     std::shared_ptr<InputWindowsManager> inputWindowsManager =
512         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
513     ASSERT_NE(inputWindowsManager, nullptr);
514     UDSServer udsServer;
515     inputWindowsManager->udsServer_ = &udsServer;
516     int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
517     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
518     inputWindowsManager->udsServer_ = nullptr;
519 }
520 
521 /**
522  * @tc.name: SendPointerEvent_005
523  * @tc.desc: Verify if (extraData_.appended && extraData_.sourceType == PointerEvent::SOURCE_TYPE_MOUSE)
524  * @tc.type: FUNC
525  * @tc.require:
526  */
527 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_005, TestSize.Level1)
528 {
529     CALL_TEST_DEBUG;
530     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
531     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
532     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
533     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
534     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
535 
536     std::shared_ptr<InputWindowsManager> inputWindowsManager =
537         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
538     ASSERT_NE(inputWindowsManager, nullptr);
539     UDSServer udsServer;
540     inputWindowsManager->udsServer_ = &udsServer;
541     int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
542     OLD::DisplayInfo displayInfo;
543     displayInfo.id = 10;
544     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
545     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
546         it->second.displaysInfo.push_back(displayInfo);
547     }
548     inputWindowsManager->extraData_.appended = true;
549     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
550     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
551     inputWindowsManager->udsServer_ = nullptr;
552     inputWindowsManager->extraData_.appended = false;
553     it->second.displaysInfo.clear();
554     inputWindowsManager->extraData_.sourceType = -1;
555 }
556 
557 /**
558  * @tc.name: SkipNavigationWindow_001
559  * @tc.desc: Test the function SkipNavigationWindow
560  * @tc.type: FUNC
561  * @tc.require:
562  */
563 HWTEST_F(InputWindowsManagerTest, SkipNavigationWindow_001, TestSize.Level1)
564 {
565     CALL_TEST_DEBUG;
566     std::shared_ptr<InputWindowsManager> inputWindowsManager =
567         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
568     ASSERT_NE(inputWindowsManager, nullptr);
569     WindowInputType windowType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
570     int32_t toolType = PointerEvent::TOOL_TYPE_FINGER;
571     EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
572 
573     toolType = PointerEvent::TOOL_TYPE_PEN;
574     inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
575     inputWindowsManager->antiMistake_.isOpen = true;
576     EXPECT_TRUE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
577 
578     inputWindowsManager->isOpenAntiMisTakeObserver_ = true;
579     inputWindowsManager->antiMistake_.isOpen = false;
580     EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
581     inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
582 }
583 
584 /**
585  * @tc.name: TransformTipPoint_001
586  * @tc.desc: Test the function TransformTipPoint
587  * @tc.type: FUNC
588  * @tc.require:
589  */
590 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_001, TestSize.Level1)
591 {
592     CALL_TEST_DEBUG;
593     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
594     std::shared_ptr<InputWindowsManager> inputWindowsManager =
595         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
596     ASSERT_NE(inputWindowsManager, nullptr);
597     OLD::DisplayInfo displayInfo;
598     displayInfo.id = 0;
599     displayInfo.uniq = "default0";
600     displayInfo.direction = DIRECTION90;
601     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
602     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
603         it->second.displaysInfo.push_back(displayInfo);
604     }
605     libinput_event_tablet_tool event {};
606     PhysicalCoordinate coord;
607     int32_t displayId;
608     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
609     it->second.displaysInfo.clear();
610 }
611 
612 /**
613  * @tc.name: TransformTipPoint_002
614  * @tc.desc: Test the function TransformTipPoint
615  * @tc.type: FUNC
616  * @tc.require:
617  */
618 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_002, TestSize.Level1)
619 {
620     CALL_TEST_DEBUG;
621     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
622     std::shared_ptr<InputWindowsManager> inputWindowsManager =
623         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
624     ASSERT_NE(inputWindowsManager, nullptr);
625     OLD::DisplayInfo displayInfo;
626     displayInfo.id = 0;
627     displayInfo.uniq = "default0";
628     displayInfo.direction = DIRECTION270;
629     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
630     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
631         it->second.displaysInfo.push_back(displayInfo);
632     }
633     libinput_event_tablet_tool event {};
634     PhysicalCoordinate coord;
635     int32_t displayId;
636     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
637     it->second.displaysInfo.clear();
638 }
639 
640 /**
641  * @tc.name: TransformTipPoint_003
642  * @tc.desc: Test the function TransformTipPoint
643  * @tc.type: FUNC
644  * @tc.require:
645  */
646 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_003, TestSize.Level1)
647 {
648     CALL_TEST_DEBUG;
649     std::shared_ptr<InputWindowsManager> inputWindowsManager =
650         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
651     ASSERT_NE(inputWindowsManager, nullptr);
652     OLD::DisplayInfo displayInfo;
653     displayInfo.id = 0;
654     displayInfo.uniq = "default0";
655     displayInfo.direction = DIRECTION0;
656     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
657     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
658         it->second.displaysInfo.push_back(displayInfo);
659     }
660     libinput_event_tablet_tool event {};
661     PhysicalCoordinate coord;
662     int32_t displayId;
663     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
664     it->second.displaysInfo.clear();
665 }
666 
667 /**
668  * @tc.name: InputWindowsManagerTest_TransformTipPoint_004
669  * @tc.desc: Test the function TransformTipPoint
670  * @tc.type: FUNC
671  * @tc.require:
672  */
673 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_004, TestSize.Level1)
674 {
675     CALL_TEST_DEBUG;
676     std::shared_ptr<InputWindowsManager> inputWindowsManager =
677         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
678     ASSERT_NE(inputWindowsManager, nullptr);
679     libinput_event_tablet_tool event {};
680     Direction direction;
681     direction = DIRECTION90;
682     PhysicalCoordinate coord;
683     coord.x = 5.5;
684     coord.y = 3.2;
685     int32_t displayId = 2;
686     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
687     EXPECT_FALSE(ret);
688 }
689 
690 /**
691  * @tc.name: InputWindowsManagerTest_TransformTipPoint_005
692  * @tc.desc: Test the function TransformTipPoint
693  * @tc.type: FUNC
694  * @tc.require:
695  */
696 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_005, TestSize.Level1)
697 {
698     CALL_TEST_DEBUG;
699     std::shared_ptr<InputWindowsManager> inputWindowsManager =
700         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
701     ASSERT_NE(inputWindowsManager, nullptr);
702     libinput_event_tablet_tool event {};
703     Direction direction;
704     direction = DIRECTION270;
705     PhysicalCoordinate coord;
706     coord.x = 6.5;
707     coord.y = 8.2;
708     int32_t displayId = 3;
709     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
710     EXPECT_FALSE(ret);
711 }
712 
713 /**
714  * @tc.name: InputWindowsManagerTest_TransformTipPoint_006
715  * @tc.desc: Test the function TransformTipPoint
716  * @tc.type: FUNC
717  * @tc.require:
718  */
719 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_006, TestSize.Level1)
720 {
721     CALL_TEST_DEBUG;
722     std::shared_ptr<InputWindowsManager> inputWindowsManager =
723         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
724     ASSERT_NE(inputWindowsManager, nullptr);
725     libinput_event_tablet_tool event {};
726     Direction direction;
727     direction = DIRECTION0;
728     PhysicalCoordinate coord;
729     coord.x = 6.5;
730     coord.y = 8.2;
731     int32_t displayId = 3;
732     bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
733     EXPECT_FALSE(ret);
734 }
735 
736 /**
737  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_001
738  * @tc.desc: Test the function IsNeedRefreshLayer
739  * @tc.type: FUNC
740  * @tc.require:
741  */
742 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_001, TestSize.Level1)
743 {
744     CALL_TEST_DEBUG;
745     std::shared_ptr<InputWindowsManager> inputWindowsManager =
746         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
747     ASSERT_NE(inputWindowsManager, nullptr);
748     int32_t windowId = 2;
749     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
750 
751     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
752     EXPECT_TRUE(ret);
753 }
754 
755 /**
756  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_002
757  * @tc.desc: Test the function IsNeedRefreshLayer
758  * @tc.type: FUNC
759  * @tc.require:
760  */
761 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_002, TestSize.Level1)
762 {
763     CALL_TEST_DEBUG;
764     std::shared_ptr<InputWindowsManager> inputWindowsManager =
765         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
766     ASSERT_NE(inputWindowsManager, nullptr);
767     int32_t windowId = 3;
768     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
769 
770     int32_t displayId = MouseEventHdr->GetDisplayId();
771     EXPECT_FALSE(displayId < 0);
772 
773     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(5, 7);
774     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
775     EXPECT_FALSE(ret);
776 }
777 
778 /**
779  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_003
780  * @tc.desc: Test the function IsNeedRefreshLayer
781  * @tc.type: FUNC
782  * @tc.require:
783  */
784 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_003, TestSize.Level1)
785 {
786     CALL_TEST_DEBUG;
787     std::shared_ptr<InputWindowsManager> inputWindowsManager =
788         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
789     ASSERT_NE(inputWindowsManager, nullptr);
790     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
791     int32_t displayId = MouseEventHdr->GetDisplayId();
792     EXPECT_FALSE(displayId < 0);
793 
794     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(6, 8);
795     int32_t windowId = GLOBAL_WINDOW_ID;
796     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
797     EXPECT_FALSE(ret);
798 }
799 
800 /**
801  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_004
802  * @tc.desc: Test the function IsNeedRefreshLayer
803  * @tc.type: FUNC
804  * @tc.require:
805  */
806 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_004, TestSize.Level1)
807 {
808     CALL_TEST_DEBUG;
809     std::shared_ptr<InputWindowsManager> inputWindowsManager =
810         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
811     ASSERT_NE(inputWindowsManager, nullptr);
812     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
813     int32_t displayId = MouseEventHdr->GetDisplayId();
814     EXPECT_FALSE(displayId < 0);
815 
816     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(2, 3);
817     touchWindow = std::nullopt;
818     int32_t windowId = GLOBAL_WINDOW_ID;
819     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
820     EXPECT_FALSE(ret);
821 }
822 
823 /**
824  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_005
825  * @tc.desc: Test the function IsNeedRefreshLayer
826  * @tc.type: FUNC
827  * @tc.require:
828  */
829 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_005, TestSize.Level1)
830 {
831     CALL_TEST_DEBUG;
832     std::shared_ptr<InputWindowsManager> inputWindowsManager =
833         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
834     ASSERT_NE(inputWindowsManager, nullptr);
835     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
836     int32_t displayId = MouseEventHdr->GetDisplayId();
837     EXPECT_FALSE(displayId < 0);
838 
839     std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(3, 5);
840     touchWindow->id = GLOBAL_WINDOW_ID;
841     touchWindow->pid = 2;
842     touchWindow->uid = 3;
843     int32_t windowId = GLOBAL_WINDOW_ID;
844     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
845     EXPECT_FALSE(ret);
846 }
847 
848 /**
849  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_01
850  * @tc.desc: Cover if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) branch
851  * @tc.type: FUNC
852  * @tc.require:
853  */
854 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_01, TestSize.Level1)
855 {
856     CALL_TEST_DEBUG;
857     std::shared_ptr<InputWindowsManager> inputWindowsMgr =
858         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
859     ASSERT_NE(inputWindowsMgr, nullptr);
860 
861     std::shared_ptr<PointerEvent> pointer = PointerEvent::Create();
862     ASSERT_NE(pointer, nullptr);
863     pointer->pointerId_ = 2;
864 
865     PointerEvent::PointerItem pointerItem;
866     pointerItem.SetPointerId(1);
867     bool ret = pointer->GetPointerItem(pointer->pointerId_, pointerItem);
868     EXPECT_FALSE(ret);
869 
870     int32_t logicalX = 300;
871     int32_t logicalY = 500;
872     WindowInfo windowInfo;
873     windowInfo.id = 1;
874     windowInfo.pid = 2;
875     windowInfo.transform.push_back(1.1);
876     EXPECT_FALSE(windowInfo.transform.empty());
877     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->SendUIExtentionPointerEvent(logicalX, logicalY, windowInfo, pointer));
878 }
879 
880 /**
881  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplayCoord_01
882  * @tc.desc: Test the function GetPhysicalDisplayCoord
883  * @tc.type: FUNC
884  * @tc.require:
885  */
886 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoord_01, TestSize.Level1)
887 {
888     CALL_TEST_DEBUG;
889     std::shared_ptr<InputWindowsManager> inputWindowsMgr =
890         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
891     ASSERT_NE(inputWindowsMgr, nullptr);
892     libinput_event_touch *touch = nullptr;
893     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
894 
895     OLD::DisplayInfo info;
896     info.direction = DIRECTION90;
897     info.direction = DIRECTION270;
898 
899     EventTouch touchInfo;
900     touchInfo.point.x = 125;
901     touchInfo.point.y = 300;
902     touchInfo.toolRect.point.x = 300;
903     touchInfo.toolRect.point.y = 600;
904     touchInfo.toolRect.width = 720;
905     touchInfo.toolRect.height = 1000;
906     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->GetPhysicalDisplayCoord(touch, info, touchInfo));
907 }
908 
909 /**
910  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_01
911  * @tc.desc: Test the function TouchPointToDisplayPoint
912  * @tc.type: FUNC
913  * @tc.require:
914  */
915 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_01, TestSize.Level1)
916 {
917     CALL_TEST_DEBUG;
918     std::shared_ptr<InputWindowsManager> inputWindowsMgr =
919         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
920     ASSERT_NE(inputWindowsMgr, nullptr);
921     libinput_event_touch *touch = nullptr;
922     int32_t deviceId = 1;
923     EventTouch touchInfo;
924     touchInfo.point.x = 125;
925     touchInfo.point.y = 300;
926     touchInfo.toolRect.point.x = 300;
927     touchInfo.toolRect.point.y = 600;
928     touchInfo.toolRect.width = 720;
929     touchInfo.toolRect.height = 1000;
930     int32_t physicalDisplayId = 2;
931     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->TouchPointToDisplayPoint(deviceId, touch, touchInfo, physicalDisplayId));
932 }
933 
934 /**
935  * @tc.name: CalculateTipPoint_001
936  * @tc.desc: Test the function CalculateTipPoint
937  * @tc.type: FUNC
938  * @tc.require:
939  */
940 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_001, TestSize.Level1)
941 {
942     CALL_TEST_DEBUG;
943     std::shared_ptr<InputWindowsManager> inputWindowsManager =
944         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
945     ASSERT_NE(inputWindowsManager, nullptr);
946     libinput_event_tablet_tool event {};
947     PhysicalCoordinate coord;
948     int32_t displayId;
949     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
950 }
951 
952 /**
953  * @tc.name: CalculateTipPoint_002
954  * @tc.desc: Test the function CalculateTipPoint
955  * @tc.type: FUNC
956  * @tc.require:
957  */
958 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_002, TestSize.Level1)
959 {
960     CALL_TEST_DEBUG;
961     std::shared_ptr<InputWindowsManager> inputWindowsManager =
962         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
963     ASSERT_NE(inputWindowsManager, nullptr);
964     OLD::DisplayInfo displayInfo;
965     displayInfo.id = 0;
966     displayInfo.uniq = "default0";
967     displayInfo.direction = DIRECTION0;
968     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
969     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
970         it->second.displaysInfo.push_back(displayInfo);
971     }
972     libinput_event_tablet_tool event {};
973     PhysicalCoordinate coord;
974     int32_t displayId;
975     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
976     it->second.displaysInfo.clear();
977 }
978 
979 /**
980  * @tc.name: CalculateTipPoint_003
981  * @tc.desc: Test the function CalculateTipPoint
982  * @tc.type: FUNC
983  * @tc.require:
984  */
985 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_003, TestSize.Level1)
986 {
987     CALL_TEST_DEBUG;
988     std::shared_ptr<InputWindowsManager> inputWindowsManager =
989         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
990     ASSERT_NE(inputWindowsManager, nullptr);
991 
992     libinput_event_tablet_tool event {};
993     int32_t targetDisplayId = 3;
994     PhysicalCoordinate coord;
995     coord.x = 3.5;
996     coord.y = 5.2;
997     bool result = inputWindowsManager->TransformTipPoint(&event, coord, targetDisplayId);
998     EXPECT_FALSE(result);
999     bool ret = inputWindowsManager->CalculateTipPoint(&event, targetDisplayId, coord);
1000     EXPECT_FALSE(ret);
1001 }
1002 
1003 /**
1004  * @tc.name: UpdateMouseTarget_001
1005  * @tc.desc: Test the function UpdateMouseTarget
1006  * @tc.type: FUNC
1007  * @tc.require:
1008  */
1009 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_001, TestSize.Level1)
1010 {
1011     CALL_TEST_DEBUG;
1012     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1013         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1014     ASSERT_NE(inputWindowsManager, nullptr);
1015     OLD::DisplayInfo displayInfo;
1016     displayInfo.id = 0;
1017     displayInfo.displayDirection = DIRECTION0;
1018     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1019     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1020         it->second.displaysInfo.push_back(displayInfo);
1021     }
1022     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1023     ASSERT_NE(pointerEvent, nullptr);
1024     PointerEvent::PointerItem item;
1025     pointerEvent->AddPointerItem(item);
1026     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1027     it->second.displaysInfo.clear();
1028 }
1029 
1030 /**
1031  * @tc.name: UpdateMouseTarget_002
1032  * @tc.desc: Test the function UpdateMouseTarget
1033  * @tc.type: FUNC
1034  * @tc.require:
1035  */
1036 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_002, TestSize.Level1)
1037 {
1038     CALL_TEST_DEBUG;
1039     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1040         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1041     ASSERT_NE(inputWindowsManager, nullptr);
1042     OLD::DisplayInfo displayInfo;
1043     displayInfo.id = 0;
1044     displayInfo.displayDirection = DIRECTION0;
1045     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1046     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1047         it->second.displaysInfo.push_back(displayInfo);
1048     }
1049     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1050     ASSERT_NE(pointerEvent, nullptr);
1051     PointerEvent::PointerItem item;
1052     pointerEvent->AddPointerItem(item);
1053     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1054     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1055     it->second.displaysInfo.clear();
1056 }
1057 
1058 /**
1059  * @tc.name: UpdateMouseTarget_003
1060  * @tc.desc: Test the function UpdateMouseTarget
1061  * @tc.type: FUNC
1062  * @tc.require:
1063  */
1064 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_003, TestSize.Level1)
1065 {
1066     CALL_TEST_DEBUG;
1067     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1068         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1069     ASSERT_NE(inputWindowsManager, nullptr);
1070     inputWindowsManager->mouseDownInfo_.id = 1;
1071     OLD::DisplayInfo displayInfo;
1072     displayInfo.id = 0;
1073     displayInfo.displayDirection = DIRECTION0;
1074     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1075     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1076         it->second.displaysInfo.push_back(displayInfo);
1077     }
1078     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1079     ASSERT_NE(pointerEvent, nullptr);
1080     PointerEvent::PointerItem item;
1081     pointerEvent->AddPointerItem(item);
1082     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1083     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1084     it->second.displaysInfo.clear();
1085     inputWindowsManager->mouseDownInfo_.id = -1;
1086 }
1087 
1088 /**
1089  * @tc.name: UpdateMouseTarget_004
1090  * @tc.desc: Test the function UpdateMouseTarget
1091  * @tc.type: FUNC
1092  * @tc.require:
1093  */
1094 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_004, TestSize.Level1)
1095 {
1096     CALL_TEST_DEBUG;
1097     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1098     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1099     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1100         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1101     ASSERT_NE(inputWindowsManager, nullptr);
1102     UDSServer udsServer;
1103     inputWindowsManager->udsServer_ = &udsServer;
1104     inputWindowsManager->mouseDownInfo_.id = 1;
1105     OLD::DisplayInfo displayInfo;
1106     displayInfo.id = 0;
1107     displayInfo.displayDirection = DIRECTION0;
1108     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1109     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1110         it->second.displaysInfo.push_back(displayInfo);
1111     }
1112     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1113     ASSERT_NE(pointerEvent, nullptr);
1114     PointerEvent::PointerItem item;
1115     pointerEvent->AddPointerItem(item);
1116     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1117     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1118     it->second.displaysInfo.clear();
1119     inputWindowsManager->mouseDownInfo_.id = -1;
1120     inputWindowsManager->udsServer_ = nullptr;
1121 }
1122 
1123 /**
1124  * @tc.name: UpdateMouseTarget_005
1125  * @tc.desc: Test the function UpdateMouseTarget
1126  * @tc.type: FUNC
1127  * @tc.require:
1128  */
1129 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_005, TestSize.Level1)
1130 {
1131     CALL_TEST_DEBUG;
1132     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillOnce(Return(false));
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     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1140     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1141         it->second.windowsInfo.push_back(windowInfo);
1142     }
1143     UDSServer udsServer;
1144     inputWindowsManager->udsServer_ = &udsServer;
1145     inputWindowsManager->mouseDownInfo_.id = 1;
1146     it->second.focusWindowId = 1;
1147     OLD::DisplayInfo displayInfo;
1148     displayInfo.id = 0;
1149     displayInfo.displayDirection = DIRECTION0;
1150     it->second.displaysInfo.push_back(displayInfo);
1151     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1152     ASSERT_NE(pointerEvent, nullptr);
1153     PointerEvent::PointerItem item;
1154     pointerEvent->AddPointerItem(item);
1155     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1156     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1157     it->second.displaysInfo.clear();
1158     it->second.focusWindowId = -1;
1159     inputWindowsManager->mouseDownInfo_.id = -1;
1160     inputWindowsManager->udsServer_ = nullptr;
1161     it->second.windowsInfo.clear();
1162 }
1163 
1164 /**
1165  * @tc.name: UpdateMouseTarget_006
1166  * @tc.desc: Test the function UpdateMouseTarget
1167  * @tc.type: FUNC
1168  * @tc.require:
1169  */
1170 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_006, TestSize.Level1)
1171 {
1172     CALL_TEST_DEBUG;
1173     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
1174     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1175     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1176     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1177         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1178     ASSERT_NE(inputWindowsManager, nullptr);
1179     WindowInfo windowInfo;
1180     windowInfo.id = -1;
1181     windowInfo.pid = 11;
1182     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1183     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1184         it->second.windowsInfo.push_back(windowInfo);
1185     }
1186     UDSServer udsServer;
1187     inputWindowsManager->udsServer_ = &udsServer;
1188     inputWindowsManager->mouseDownInfo_.id = 1;
1189     it->second.focusWindowId = -1;
1190     OLD::DisplayInfo displayInfo;
1191     displayInfo.id = 0;
1192     displayInfo.displayDirection = DIRECTION0;
1193     it->second.displaysInfo.push_back(displayInfo);
1194     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1195     ASSERT_NE(pointerEvent, nullptr);
1196     PointerEvent::PointerItem item;
1197     pointerEvent->AddPointerItem(item);
1198     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1199     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1200     it->second.displaysInfo.clear();
1201     inputWindowsManager->mouseDownInfo_.id = -1;
1202     inputWindowsManager->udsServer_ = nullptr;
1203     it->second.windowsInfo.clear();
1204 }
1205 
1206 /**
1207  * @tc.name: UpdateMouseTarget_007
1208  * @tc.desc: Test the function UpdateMouseTarget
1209  * @tc.type: FUNC
1210  * @tc.require:
1211  */
1212 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_007, TestSize.Level1)
1213 {
1214     CALL_TEST_DEBUG;
1215     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
1216     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
1217     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1218     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1219         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1220     ASSERT_NE(inputWindowsManager, nullptr);
1221     WindowInfo windowInfo;
1222     windowInfo.id = -1;
1223     windowInfo.pid = 11;
1224     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1225     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1226         it->second.windowsInfo.push_back(windowInfo);
1227     }
1228     UDSServer udsServer;
1229     inputWindowsManager->udsServer_ = &udsServer;
1230     inputWindowsManager->mouseDownInfo_.id = 1;
1231     OLD::DisplayInfo displayInfo;
1232     displayInfo.id = 0;
1233     displayInfo.displayDirection = DIRECTION0;
1234     it->second.displaysInfo.push_back(displayInfo);
1235     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1236     ASSERT_NE(pointerEvent, nullptr);
1237     PointerEvent::PointerItem item;
1238     pointerEvent->AddPointerItem(item);
1239     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1240     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1241     it->second.displaysInfo.clear();
1242     inputWindowsManager->mouseDownInfo_.id = -1;
1243     inputWindowsManager->udsServer_ = nullptr;
1244     it->second.windowsInfo.clear();
1245 }
1246 
1247 /**
1248  * @tc.name: UpdateMouseTarget_008
1249  * @tc.desc: Test the function UpdateMouseTarget
1250  * @tc.type: FUNC
1251  * @tc.require:
1252  */
1253 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_008, TestSize.Level1)
1254 {
1255     CALL_TEST_DEBUG;
1256     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
1257     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
1258     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1259     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1260         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1261     ASSERT_NE(inputWindowsManager, nullptr);
1262     WindowInfo windowInfo;
1263     windowInfo.id = -1;
1264     windowInfo.pid = 11;
1265     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1266     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1267         it->second.windowsInfo.push_back(windowInfo);
1268     }
1269     UDSServer udsServer;
1270     inputWindowsManager->udsServer_ = &udsServer;
1271     inputWindowsManager->mouseDownInfo_.id = 1;
1272     OLD::DisplayInfo displayInfo;
1273     displayInfo.id = 0;
1274     displayInfo.displayDirection = DIRECTION0;
1275     it->second.displaysInfo.push_back(displayInfo);
1276     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1277     ASSERT_NE(pointerEvent, nullptr);
1278     PointerEvent::PointerItem item;
1279     pointerEvent->AddPointerItem(item);
1280     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1281     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1282     it->second.displaysInfo.clear();
1283     inputWindowsManager->mouseDownInfo_.id = -1;
1284     inputWindowsManager->udsServer_ = nullptr;
1285     it->second.windowsInfo.clear();
1286 }
1287 
1288 /**
1289  * @tc.name: UpdateMouseTarget_009
1290  * @tc.desc: Test the function UpdateMouseTarget
1291  * @tc.type: FUNC
1292  * @tc.require:
1293  */
1294 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_009, TestSize.Level1)
1295 {
1296     CALL_TEST_DEBUG;
1297     EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
1298     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1299     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1300     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1301         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1302     ASSERT_NE(inputWindowsManager, nullptr);
1303     WindowInfo windowInfo;
1304     windowInfo.id = -1;
1305     windowInfo.pid = 11;
1306     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1307     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1308         it->second.windowsInfo.push_back(windowInfo);
1309     }
1310     UDSServer udsServer;
1311     inputWindowsManager->udsServer_ = &udsServer;
1312     inputWindowsManager->mouseDownInfo_.id = 1;
1313     inputWindowsManager->isUiExtension_ = true;
1314     it->second.focusWindowId = -1;
1315     OLD::DisplayInfo displayInfo;
1316     displayInfo.id = 0;
1317     displayInfo.displayDirection = DIRECTION0;
1318     it->second.displaysInfo.push_back(displayInfo);
1319     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1320     ASSERT_NE(pointerEvent, nullptr);
1321     PointerEvent::PointerItem item;
1322     pointerEvent->AddPointerItem(item);
1323     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1324     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1325     it->second.displaysInfo.clear();
1326     inputWindowsManager->isUiExtension_ = false;
1327     inputWindowsManager->mouseDownInfo_.id = -1;
1328     inputWindowsManager->udsServer_ = nullptr;
1329     it->second.windowsInfo.clear();
1330 }
1331 
1332 /**
1333  * @tc.name: UpdateMouseTarget_010
1334  * @tc.desc: Test the function UpdateMouseTarget
1335  * @tc.type: FUNC
1336  * @tc.require:
1337  */
1338 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_010, TestSize.Level1)
1339 {
1340     CALL_TEST_DEBUG;
1341     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1342     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1343     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1344         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1345     ASSERT_NE(inputWindowsManager, nullptr);
1346     WindowInfo windowInfo;
1347     windowInfo.id = -1;
1348     windowInfo.pid = 11;
1349     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1350     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1351         it->second.windowsInfo.push_back(windowInfo);
1352     }
1353     UDSServer udsServer;
1354     inputWindowsManager->udsServer_ = &udsServer;
1355     inputWindowsManager->mouseDownInfo_.id = 1;
1356     inputWindowsManager->dragFlag_ = true;
1357     inputWindowsManager->isDragBorder_ = true;
1358     inputWindowsManager->isUiExtension_ = true;
1359     it->second.focusWindowId = -1;
1360     OLD::DisplayInfo displayInfo;
1361     displayInfo.id = 0;
1362     displayInfo.displayDirection = DIRECTION0;
1363     it->second.displaysInfo.push_back(displayInfo);
1364     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1365     ASSERT_NE(pointerEvent, nullptr);
1366     PointerEvent::PointerItem item;
1367     pointerEvent->AddPointerItem(item);
1368     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1369     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1370     it->second.displaysInfo.clear();
1371     inputWindowsManager->dragFlag_ = false;
1372     inputWindowsManager->isDragBorder_ = false;
1373     inputWindowsManager->isUiExtension_ = false;
1374     inputWindowsManager->mouseDownInfo_.id = -1;
1375     inputWindowsManager->udsServer_ = nullptr;
1376     it->second.windowsInfo.clear();
1377 }
1378 
1379 /**
1380  * @tc.name: UpdateMouseTarget_011
1381  * @tc.desc: Test the function UpdateMouseTarget
1382  * @tc.type: FUNC
1383  * @tc.require:
1384  */
1385 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_011, TestSize.Level1)
1386 {
1387     CALL_TEST_DEBUG;
1388     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1389     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1390     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1391         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1392     ASSERT_NE(inputWindowsManager, nullptr);
1393     WindowInfo windowInfo;
1394     windowInfo.id = -1;
1395     windowInfo.pid = 11;
1396     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1397     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1398         it->second.windowsInfo.push_back(windowInfo);
1399     }
1400     UDSServer udsServer;
1401     inputWindowsManager->udsServer_ = &udsServer;
1402     inputWindowsManager->mouseDownInfo_.id = 1;
1403     inputWindowsManager->dragFlag_ = true;
1404     inputWindowsManager->isDragBorder_ = true;
1405     inputWindowsManager->isUiExtension_ = false;
1406     it->second.focusWindowId = -1;
1407     OLD::DisplayInfo displayInfo;
1408     displayInfo.id = 0;
1409     displayInfo.displayDirection = DIRECTION90;
1410     it->second.displaysInfo.push_back(displayInfo);
1411     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1412     ASSERT_NE(pointerEvent, nullptr);
1413     PointerEvent::PointerItem item;
1414     pointerEvent->AddPointerItem(item);
1415     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1416     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1417     it->second.displaysInfo.clear();
1418     inputWindowsManager->dragFlag_ = false;
1419     inputWindowsManager->isDragBorder_ = false;
1420     inputWindowsManager->isUiExtension_ = false;
1421     inputWindowsManager->mouseDownInfo_.id = -1;
1422     inputWindowsManager->udsServer_ = nullptr;
1423     it->second.windowsInfo.clear();
1424 }
1425 
1426 /**
1427  * @tc.name: UpdateMouseTarget_012
1428  * @tc.desc: Test the function UpdateMouseTarget
1429  * @tc.type: FUNC
1430  * @tc.require:
1431  */
1432 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_012, TestSize.Level1)
1433 {
1434     CALL_TEST_DEBUG;
1435     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1436     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1437     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1438         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1439     ASSERT_NE(inputWindowsManager, nullptr);
1440     WindowInfo windowInfo;
1441     windowInfo.id = -1;
1442     windowInfo.pid = 11;
1443     windowInfo.transform.push_back(1.1);
1444     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1445     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1446         it->second.windowsInfo.push_back(windowInfo);
1447     }
1448     UDSServer udsServer;
1449     inputWindowsManager->udsServer_ = &udsServer;
1450     inputWindowsManager->mouseDownInfo_.id = 1;
1451     inputWindowsManager->dragFlag_ = true;
1452     inputWindowsManager->isDragBorder_ = true;
1453     inputWindowsManager->isUiExtension_ = false;
1454     it->second.focusWindowId = -1;
1455     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1456     inputWindowsManager->captureModeInfo_.windowId = 1;
1457     inputWindowsManager->extraData_.appended = true;
1458     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1459     OLD::DisplayInfo displayInfo;
1460     displayInfo.id = 0;
1461     displayInfo.displayDirection = DIRECTION90;
1462     it->second.displaysInfo.push_back(displayInfo);
1463     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1464     ASSERT_NE(pointerEvent, nullptr);
1465     PointerEvent::PointerItem item;
1466     pointerEvent->AddPointerItem(item);
1467     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1468     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1469     it->second.displaysInfo.clear();
1470     inputWindowsManager->dragFlag_ = false;
1471     inputWindowsManager->isDragBorder_ = false;
1472     inputWindowsManager->isUiExtension_ = false;
1473     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1474     inputWindowsManager->captureModeInfo_.windowId = -1;
1475     inputWindowsManager->mouseDownInfo_.id = -1;
1476     inputWindowsManager->udsServer_ = nullptr;
1477     it->second.windowsInfo.clear();
1478     inputWindowsManager->extraData_.appended = false;
1479     inputWindowsManager->extraData_.sourceType = -1;
1480 }
1481 
1482 /**
1483  * @tc.name: UpdateMouseTarget_013
1484  * @tc.desc: Test the function UpdateMouseTarget
1485  * @tc.type: FUNC
1486  * @tc.require:
1487  */
1488 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_013, TestSize.Level1)
1489 {
1490     CALL_TEST_DEBUG;
1491     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1492     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1493     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1494         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1495     ASSERT_NE(inputWindowsManager, nullptr);
1496     WindowInfo windowInfo;
1497     windowInfo.id = -1;
1498     windowInfo.pid = 11;
1499     windowInfo.transform.push_back(1.1);
1500     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1501     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1502         it->second.windowsInfo.push_back(windowInfo);
1503     }
1504     UDSServer udsServer;
1505     inputWindowsManager->udsServer_ = &udsServer;
1506     inputWindowsManager->mouseDownInfo_.id = 1;
1507     inputWindowsManager->dragFlag_ = true;
1508     inputWindowsManager->isDragBorder_ = true;
1509     inputWindowsManager->isUiExtension_ = false;
1510     it->second.focusWindowId = -1;
1511     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1512     inputWindowsManager->captureModeInfo_.windowId = -1;
1513     inputWindowsManager->extraData_.appended = true;
1514     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1515     OLD::DisplayInfo displayInfo;
1516     displayInfo.id = 0;
1517     displayInfo.displayDirection = DIRECTION90;
1518     it->second.displaysInfo.push_back(displayInfo);
1519     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1520     ASSERT_NE(pointerEvent, nullptr);
1521     PointerEvent::PointerItem item;
1522     pointerEvent->AddPointerItem(item);
1523     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1524     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY);
1525     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1526     it->second.displaysInfo.clear();
1527     inputWindowsManager->dragFlag_ = false;
1528     inputWindowsManager->isDragBorder_ = false;
1529     inputWindowsManager->isUiExtension_ = false;
1530     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1531     inputWindowsManager->mouseDownInfo_.id = -1;
1532     inputWindowsManager->udsServer_ = nullptr;
1533     it->second.windowsInfo.clear();
1534     inputWindowsManager->extraData_.appended = false;
1535     inputWindowsManager->extraData_.sourceType = -1;
1536 }
1537 
1538 /**
1539  * @tc.name: UpdateMouseTarget_014
1540  * @tc.desc: Test the function UpdateMouseTarget
1541  * @tc.type: FUNC
1542  * @tc.require:
1543  */
1544 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_014, TestSize.Level1)
1545 {
1546     CALL_TEST_DEBUG;
1547     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1548     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1549     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1550         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1551     ASSERT_NE(inputWindowsManager, nullptr);
1552     WindowInfo windowInfo;
1553     windowInfo.id = -1;
1554     windowInfo.pid = 11;
1555     windowInfo.transform.push_back(1.1);
1556     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1557     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1558         it->second.windowsInfo.push_back(windowInfo);
1559     }
1560     UDSServer udsServer;
1561     inputWindowsManager->udsServer_ = &udsServer;
1562     inputWindowsManager->mouseDownInfo_.id = 1;
1563     inputWindowsManager->dragFlag_ = true;
1564     inputWindowsManager->isDragBorder_ = true;
1565     inputWindowsManager->isUiExtension_ = false;
1566     it->second.focusWindowId = -1;
1567     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1568     inputWindowsManager->captureModeInfo_.windowId = -1;
1569     inputWindowsManager->extraData_.appended = false;
1570     inputWindowsManager->extraData_.sourceType = -1;
1571     OLD::DisplayInfo displayInfo;
1572     displayInfo.id = 0;
1573     displayInfo.displayDirection = DIRECTION90;
1574     it->second.displaysInfo.push_back(displayInfo);
1575     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1576     ASSERT_NE(pointerEvent, nullptr);
1577     PointerEvent::PointerItem item;
1578     pointerEvent->AddPointerItem(item);
1579     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1580     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1581     it->second.displaysInfo.clear();
1582     inputWindowsManager->dragFlag_ = false;
1583     inputWindowsManager->isDragBorder_ = false;
1584     inputWindowsManager->isUiExtension_ = false;
1585     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1586     inputWindowsManager->mouseDownInfo_.id = -1;
1587     inputWindowsManager->udsServer_ = nullptr;
1588     it->second.windowsInfo.clear();
1589 }
1590 
1591 /**
1592  * @tc.name: IsNeedDrawPointer_001
1593  * @tc.desc: Test the function IsNeedDrawPointer
1594  * @tc.type: FUNC
1595  * @tc.require:
1596  */
1597 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_001, TestSize.Level1)
1598 {
1599     CALL_TEST_DEBUG;
1600     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1601         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1602     ASSERT_NE(inputWindowsManager, nullptr);
1603     PointerEvent::PointerItem pointerItem;
1604     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_FINGER);
1605     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1606 }
1607 
1608 /**
1609  * @tc.name: IsNeedDrawPointer_002
1610  * @tc.desc: Test the function IsNeedDrawPointer
1611  * @tc.type: FUNC
1612  * @tc.require:
1613  */
1614 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_002, TestSize.Level1)
1615 {
1616     CALL_TEST_DEBUG;
1617     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(nullptr));
1618     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1619         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1620     ASSERT_NE(inputWindowsManager, nullptr);
1621     PointerEvent::PointerItem pointerItem;
1622     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1623     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1624 }
1625 
1626 /**
1627  * @tc.name: IsNeedDrawPointer_003
1628  * @tc.desc: Test the function IsNeedDrawPointer
1629  * @tc.type: FUNC
1630  * @tc.require:
1631  */
1632 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_003, TestSize.Level1)
1633 {
1634     CALL_TEST_DEBUG;
1635     std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1636     inputDevice->SetBus(BUS_USB);
1637     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1638     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1639         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1640     ASSERT_NE(inputWindowsManager, nullptr);
1641     PointerEvent::PointerItem pointerItem;
1642     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1643     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1644 }
1645 
1646 /**
1647  * @tc.name: IsNeedDrawPointer_004
1648  * @tc.desc: Test the function IsNeedDrawPointer
1649  * @tc.type: FUNC
1650  * @tc.require:
1651  */
1652 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_004, TestSize.Level1)
1653 {
1654     CALL_TEST_DEBUG;
1655     std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1656     inputDevice->SetBus(BUS_HIL);
1657     EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1658     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1659         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1660     ASSERT_NE(inputWindowsManager, nullptr);
1661     PointerEvent::PointerItem pointerItem;
1662     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1663     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1664 }
1665 
1666 /**
1667  * @tc.name: DispatchTouch_001
1668  * @tc.desc: Test the function DispatchTouch
1669  * @tc.type: FUNC
1670  * @tc.require:
1671  */
1672 HWTEST_F(InputWindowsManagerTest, DispatchTouch_001, TestSize.Level1)
1673 {
1674     CALL_TEST_DEBUG;
1675     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1676         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1677     ASSERT_NE(inputWindowsManager, nullptr);
1678     UDSServer udsServer;
1679     inputWindowsManager->udsServer_ = &udsServer;
1680     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1681     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1682     WindowInfo windowInfo;
1683     windowInfo.id = 1;
1684     windowInfo.pid = 11;
1685     windowInfo.flags = 1;
1686     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1687     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1688         it->second.windowsInfo.push_back(windowInfo);
1689     }
1690     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1691     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1692     inputWindowsManager->udsServer_ = nullptr;
1693     inputWindowsManager->lastTouchEvent_ = nullptr;
1694     it->second.windowsInfo.clear();
1695 }
1696 
1697 /**
1698  * @tc.name: DispatchTouch_002
1699  * @tc.desc: Test the function DispatchTouch
1700  * @tc.type: FUNC
1701  * @tc.require:
1702  */
1703 HWTEST_F(InputWindowsManagerTest, DispatchTouch_002, TestSize.Level1)
1704 {
1705     CALL_TEST_DEBUG;
1706     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1707         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1708     ASSERT_NE(inputWindowsManager, nullptr);
1709     UDSServer udsServer;
1710     inputWindowsManager->udsServer_ = &udsServer;
1711     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1712     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1713     WindowInfo windowInfo;
1714     windowInfo.id = 1;
1715     windowInfo.pid = 11;
1716     windowInfo.flags = 0;
1717     windowInfo.transform.push_back(1.1);
1718     Rect rect;
1719     rect.x = 5;
1720     rect.y = 5;
1721     rect.width = 10;
1722     rect.height = 10;
1723     windowInfo.defaultHotAreas.push_back(rect);
1724     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1725     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1726         it->second.windowsInfo.push_back(windowInfo);
1727     }
1728     inputWindowsManager->lastTouchLogicX_ = 8;
1729     inputWindowsManager->lastTouchLogicY_ = 8;
1730     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1731     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1732     inputWindowsManager->udsServer_ = nullptr;
1733     inputWindowsManager->lastTouchEvent_ = nullptr;
1734     it->second.windowsInfo.clear();
1735     inputWindowsManager->lastTouchLogicX_ = -1;
1736     inputWindowsManager->lastTouchLogicY_ = -1;
1737     inputWindowsManager->lastTouchWindowInfo_.id = -1;
1738     inputWindowsManager->lastTouchWindowInfo_.pid = -1;
1739     inputWindowsManager->lastTouchWindowInfo_.uid = -1;
1740     inputWindowsManager->lastTouchWindowInfo_.agentWindowId = -1;
1741     inputWindowsManager->lastTouchWindowInfo_.area = { 0, 0, 0, 0 };
1742     inputWindowsManager->lastTouchWindowInfo_.flags = -1;
1743     inputWindowsManager->lastTouchWindowInfo_.windowType = 0;
1744 }
1745 
1746 /**
1747  * @tc.name: DispatchTouch_003
1748  * @tc.desc: Test the function DispatchTouch
1749  * @tc.type: FUNC
1750  * @tc.require:
1751  */
1752 HWTEST_F(InputWindowsManagerTest, DispatchTouch_003, TestSize.Level1)
1753 {
1754     CALL_TEST_DEBUG;
1755     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1756     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(nullptr));
1757     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1758         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1759     ASSERT_NE(inputWindowsManager, nullptr);
1760     UDSServer udsServer;
1761     inputWindowsManager->udsServer_ = &udsServer;
1762     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1763     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1764     PointerEvent::PointerItem item;
1765     item.SetPointerId(1);
1766     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1767     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1768     WindowInfo windowInfo;
1769     windowInfo.id = -1;
1770     windowInfo.pid = 11;
1771     windowInfo.flags = 0;
1772     windowInfo.transform.push_back(1.1);
1773     Rect rect;
1774     rect.x = 5;
1775     rect.y = 5;
1776     rect.width = 10;
1777     rect.height = 10;
1778     windowInfo.defaultHotAreas.push_back(rect);
1779     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1780     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1781         it->second.windowsInfo.push_back(windowInfo);
1782     }
1783     inputWindowsManager->lastTouchLogicX_ = 8;
1784     inputWindowsManager->lastTouchLogicY_ = 8;
1785     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1786     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1787     inputWindowsManager->udsServer_ = nullptr;
1788     inputWindowsManager->lastTouchEvent_ = nullptr;
1789     it->second.windowsInfo.clear();
1790     inputWindowsManager->lastTouchLogicX_ = -1;
1791     inputWindowsManager->lastTouchLogicY_ = -1;
1792 }
1793 
1794 /**
1795  * @tc.name: DispatchTouch_004
1796  * @tc.desc: Test the function DispatchTouch
1797  * @tc.type: FUNC
1798  * @tc.require:
1799  */
1800 HWTEST_F(InputWindowsManagerTest, DispatchTouch_004, TestSize.Level1)
1801 {
1802     CALL_TEST_DEBUG;
1803     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1804     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1805     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
1806     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
1807     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1808         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1809     ASSERT_NE(inputWindowsManager, nullptr);
1810     UDSServer udsServer;
1811     inputWindowsManager->udsServer_ = &udsServer;
1812     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1813     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1814     PointerEvent::PointerItem item;
1815     item.SetPointerId(1);
1816     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1817     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1818     WindowInfo windowInfo;
1819     windowInfo.id = -1;
1820     windowInfo.pid = 11;
1821     windowInfo.flags = 0;
1822     windowInfo.transform.push_back(1.1);
1823     Rect rect;
1824     rect.x = 5;
1825     rect.y = 5;
1826     rect.width = 10;
1827     rect.height = 10;
1828     windowInfo.defaultHotAreas.push_back(rect);
1829     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1830     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1831         it->second.windowsInfo.push_back(windowInfo);
1832     }
1833     inputWindowsManager->lastTouchLogicX_ = 8;
1834     inputWindowsManager->lastTouchLogicY_ = 8;
1835     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1836     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1837     inputWindowsManager->udsServer_ = nullptr;
1838     inputWindowsManager->lastTouchEvent_ = nullptr;
1839     it->second.windowsInfo.clear();
1840     inputWindowsManager->lastTouchLogicX_ = -1;
1841     inputWindowsManager->lastTouchLogicY_ = -1;
1842 }
1843 
1844 /**
1845  * @tc.name: DispatchTouch_005
1846  * @tc.desc: Test the function DispatchTouch
1847  * @tc.type: FUNC
1848  * @tc.require:
1849  */
1850 HWTEST_F(InputWindowsManagerTest, DispatchTouch_005, TestSize.Level1)
1851 {
1852     CALL_TEST_DEBUG;
1853     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillRepeatedly(Return(1));
1854     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1855     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillRepeatedly(Return(session));
1856     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillRepeatedly(Return(true));
1857     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1858         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1859     ASSERT_NE(inputWindowsManager, nullptr);
1860     UDSServer udsServer;
1861     inputWindowsManager->udsServer_ = &udsServer;
1862     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1863     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1864     PointerEvent::PointerItem item;
1865     item.SetPointerId(1);
1866     inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1867     inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1868     WindowInfo windowInfo;
1869     windowInfo.id = -1;
1870     windowInfo.pid = 11;
1871     windowInfo.flags = 0;
1872     windowInfo.transform.push_back(1.1);
1873     Rect rect;
1874     rect.x = 5;
1875     rect.y = 5;
1876     rect.width = 10;
1877     rect.height = 10;
1878     windowInfo.defaultHotAreas.push_back(rect);
1879     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
1880     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
1881         it->second.windowsInfo.push_back(windowInfo);
1882     }
1883     inputWindowsManager->lastTouchLogicX_ = 8;
1884     inputWindowsManager->lastTouchLogicY_ = 8;
1885     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1886     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1887     inputWindowsManager->udsServer_ = nullptr;
1888     inputWindowsManager->lastTouchEvent_ = nullptr;
1889     it->second.windowsInfo.clear();
1890     inputWindowsManager->lastTouchLogicX_ = -1;
1891     inputWindowsManager->lastTouchLogicY_ = -1;
1892 }
1893 
1894 /**
1895  * @tc.name: DispatchTouch_006
1896  * @tc.desc: Test the function DispatchTouch
1897  * @tc.type: FUNC
1898  * @tc.require:
1899  */
1900 HWTEST_F(InputWindowsManagerTest, DispatchTouch_006, TestSize.Level1)
1901 {
1902     CALL_TEST_DEBUG;
1903     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1904         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1905     ASSERT_NE(inputWindowsManager, nullptr);
1906     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1907     ASSERT_NE(pointerEvent, nullptr);
1908 
1909     UDSServer udsServer;
1910     inputWindowsManager->udsServer_ = &udsServer;
1911     ASSERT_NE(inputWindowsManager->udsServer_, nullptr);
1912 
1913     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1914     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1915 
1916     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1917     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1918 }
1919 
1920 /**
1921  * @tc.name: DispatchTouch_007
1922  * @tc.desc: Test the function DispatchTouch
1923  * @tc.type: FUNC
1924  * @tc.require:
1925  */
1926 HWTEST_F(InputWindowsManagerTest, DispatchTouch_007, TestSize.Level1)
1927 {
1928     CALL_TEST_DEBUG;
1929     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1930         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1931     ASSERT_NE(inputWindowsManager, nullptr);
1932     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1933     ASSERT_NE(pointerEvent, nullptr);
1934 
1935     UDSServer udsServer;
1936     inputWindowsManager->udsServer_ = &udsServer;
1937     ASSERT_NE(inputWindowsManager->udsServer_, nullptr);
1938 
1939     inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1940     ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1941 
1942     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1943     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1944 }
1945 
1946 /**
1947  * @tc.name: TransformWindowXY_001
1948  * @tc.desc: Test the function TransformWindowXY
1949  * @tc.type: FUNC
1950  * @tc.require:
1951  */
1952 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_001, TestSize.Level1)
1953 {
1954     CALL_TEST_DEBUG;
1955     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1956         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1957     ASSERT_NE(inputWindowsManager, nullptr);
1958     WindowInfo window;
1959     window.transform = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
1960     double logicX = 1.1;
1961     double logicY = 1.1;
1962     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1963 }
1964 
1965 /**
1966  * @tc.name: TransformWindowXY_002
1967  * @tc.desc: Test the function TransformWindowXY
1968  * @tc.type: FUNC
1969  * @tc.require:
1970  */
1971 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_002, TestSize.Level1)
1972 {
1973     CALL_TEST_DEBUG;
1974     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1975         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1976     ASSERT_NE(inputWindowsManager, nullptr);
1977     WindowInfo window;
1978     window.transform = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 };
1979     double logicX = 1.1;
1980     double logicY = 1.1;
1981     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1982 }
1983 
1984 /**
1985  * @tc.name: TransformWindowXY_003
1986  * @tc.desc: Test the function TransformWindowXY
1987  * @tc.type: FUNC
1988  * @tc.require:
1989  */
1990 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_003, TestSize.Level1)
1991 {
1992     CALL_TEST_DEBUG;
1993     std::shared_ptr<InputWindowsManager> inputWindowsManager =
1994         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1995     ASSERT_NE(inputWindowsManager, nullptr);
1996 
1997     WindowInfo window;
1998     window.transform = { 1.0, 2.0, 3.0 };
1999     Matrix3f transforms(window.transform);
2000 
2001     EXPECT_TRUE(window.transform.size() == 3);
2002     bool ret = transforms.IsIdentity();
2003     EXPECT_FALSE(ret);
2004 
2005     double logicX = 1.1;
2006     double logicY = 2.1;
2007     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
2008 }
2009 
2010 /**
2011  * @tc.name: TransformWindowXY_004
2012  * @tc.desc: Test the function TransformWindowXY
2013  * @tc.type: FUNC
2014  * @tc.require:
2015  */
2016 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_004, TestSize.Level1)
2017 {
2018     CALL_TEST_DEBUG;
2019     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2020         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2021     ASSERT_NE(inputWindowsManager, nullptr);
2022 
2023     WindowInfo window;
2024     window.transform = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
2025     Matrix3f transforms(window.transform);
2026 
2027     EXPECT_TRUE(window.transform.size() == 9);
2028     bool ret = transforms.IsIdentity();
2029     EXPECT_FALSE(ret);
2030 
2031     double logicX = 3.2;
2032     double logicY = 5.1;
2033     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
2034 }
2035 
2036 /**
2037  * @tc.name: IsValidZorderWindow_001
2038  * @tc.desc: Test the function IsValidZorderWindow
2039  * @tc.type: FUNC
2040  * @tc.require:
2041  */
2042 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_001, TestSize.Level1)
2043 {
2044     CALL_TEST_DEBUG;
2045     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2046         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2047     ASSERT_NE(inputWindowsManager, nullptr);
2048     WindowInfo window;
2049     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2050     ASSERT_NE(pointerEvent, nullptr);
2051     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
2052     pointerEvent->SetZOrder(-6.6);
2053     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2054 }
2055 
2056 /**
2057  * @tc.name: IsValidZorderWindow_002
2058  * @tc.desc: Test the function IsValidZorderWindow
2059  * @tc.type: FUNC
2060  * @tc.require:
2061  */
2062 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_002, TestSize.Level1)
2063 {
2064     CALL_TEST_DEBUG;
2065     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2066         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2067     ASSERT_NE(inputWindowsManager, nullptr);
2068     WindowInfo window;
2069     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2070     ASSERT_NE(pointerEvent, nullptr);
2071     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
2072     pointerEvent->SetZOrder(6.6);
2073     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2074 }
2075 
2076 /**
2077  * @tc.name: IsValidZorderWindow_003
2078  * @tc.desc: Test the function IsValidZorderWindow
2079  * @tc.type: FUNC
2080  * @tc.require:
2081  */
2082 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_003, TestSize.Level1)
2083 {
2084     CALL_TEST_DEBUG;
2085     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2086         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2087     ASSERT_NE(inputWindowsManager, nullptr);
2088     WindowInfo window;
2089     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2090     ASSERT_NE(pointerEvent, nullptr);
2091     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
2092     pointerEvent->SetZOrder(-6.6);
2093     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2094 }
2095 
2096 /**
2097  * @tc.name: IsValidZorderWindow_004
2098  * @tc.desc: Test the function IsValidZorderWindow
2099  * @tc.type: FUNC
2100  * @tc.require:
2101  */
2102 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_004, TestSize.Level1)
2103 {
2104     CALL_TEST_DEBUG;
2105     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2106         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2107     ASSERT_NE(inputWindowsManager, nullptr);
2108     WindowInfo window;
2109     window.zOrder = 8.8;
2110     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2111     ASSERT_NE(pointerEvent, nullptr);
2112     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
2113     pointerEvent->SetZOrder(6.6);
2114     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2115 }
2116 
2117 /**
2118  * @tc.name: IsValidZorderWindow_005
2119  * @tc.desc: Test the function IsValidZorderWindow
2120  * @tc.type: FUNC
2121  * @tc.require:
2122  */
2123 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_005, TestSize.Level1)
2124 {
2125     CALL_TEST_DEBUG;
2126     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2127         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2128     ASSERT_NE(inputWindowsManager, nullptr);
2129     WindowInfo window;
2130     window.zOrder = 1.1;
2131     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2132     ASSERT_NE(pointerEvent, nullptr);
2133     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
2134     pointerEvent->SetZOrder(6.6);
2135     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2136 }
2137 
2138 /**
2139  * @tc.name: IsValidZorderWindow_006
2140  * @tc.desc: Test the function IsValidZorderWindow
2141  * @tc.type: FUNC
2142  * @tc.require:
2143  */
2144 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_006, TestSize.Level1)
2145 {
2146     CALL_TEST_DEBUG;
2147     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2148         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2149     ASSERT_NE(inputWindowsManager, nullptr);
2150 
2151     uint32_t flag;
2152     WindowInfo window;
2153     window.zOrder = 1.1;
2154     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2155     ASSERT_NE(pointerEvent, nullptr);
2156     flag = InputEvent::EVENT_FLAG_SIMULATE;
2157     EXPECT_FALSE(pointerEvent->HasFlag(flag));
2158 
2159     bool ret = inputWindowsManager->IsValidZorderWindow(window, pointerEvent);
2160     EXPECT_TRUE(ret);
2161 }
2162 
2163 /**
2164  * @tc.name: IsValidZorderWindow_007
2165  * @tc.desc: Test the function IsValidZorderWindow
2166  * @tc.type: FUNC
2167  * @tc.require:
2168  */
2169 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_007, TestSize.Level1)
2170 {
2171     CALL_TEST_DEBUG;
2172     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2173         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2174     ASSERT_NE(inputWindowsManager, nullptr);
2175 
2176     uint32_t flag;
2177     WindowInfo window;
2178     window.zOrder = 3.2;
2179     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2180     ASSERT_NE(pointerEvent, nullptr);
2181     flag = InputEvent::EVENT_FLAG_TOUCHPAD_POINTER;
2182     EXPECT_FALSE(pointerEvent->HasFlag(flag));
2183 
2184     bool ret = inputWindowsManager->IsValidZorderWindow(window, pointerEvent);
2185     EXPECT_TRUE(ret);
2186 }
2187 
2188 /**
2189  * @tc.name: HandleWindowInputType_001
2190  * @tc.desc: Test the function HandleWindowInputType
2191  * @tc.type: FUNC
2192  * @tc.require:
2193  */
2194 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_001, TestSize.Level1)
2195 {
2196     CALL_TEST_DEBUG;
2197     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2198         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2199     ASSERT_NE(inputWindowsManager, nullptr);
2200     WindowInfo window;
2201     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2202     ASSERT_NE(pointerEvent, nullptr);
2203     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2204 }
2205 
2206 /**
2207  * @tc.name: HandleWindowInputType_002
2208  * @tc.desc: Test the function HandleWindowInputType
2209  * @tc.type: FUNC
2210  * @tc.require:
2211  */
2212 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_002, TestSize.Level1)
2213 {
2214     CALL_TEST_DEBUG;
2215     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2216         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2217     ASSERT_NE(inputWindowsManager, nullptr);
2218     WindowInfo window;
2219     window.windowInputType = WindowInputType::NORMAL;
2220     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2221     ASSERT_NE(pointerEvent, nullptr);
2222     PointerEvent::PointerItem item;
2223     item.SetPointerId(1);
2224     pointerEvent->AddPointerItem(item);
2225     pointerEvent->SetPointerId(1);
2226     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2227 }
2228 
2229 /**
2230  * @tc.name: HandleWindowInputType_003
2231  * @tc.desc: Test the function HandleWindowInputType
2232  * @tc.type: FUNC
2233  * @tc.require:
2234  */
2235 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_003, TestSize.Level1)
2236 {
2237     CALL_TEST_DEBUG;
2238     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2239         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2240     ASSERT_NE(inputWindowsManager, nullptr);
2241     WindowInfo window;
2242     window.windowInputType = WindowInputType::TRANSMIT_ALL;
2243     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2244     ASSERT_NE(pointerEvent, nullptr);
2245     PointerEvent::PointerItem item;
2246     item.SetPointerId(1);
2247     pointerEvent->AddPointerItem(item);
2248     pointerEvent->SetPointerId(1);
2249     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2250 }
2251 
2252 /**
2253  * @tc.name: HandleWindowInputType_004
2254  * @tc.desc: Test the function HandleWindowInputType
2255  * @tc.type: FUNC
2256  * @tc.require:
2257  */
2258 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_004, TestSize.Level1)
2259 {
2260     CALL_TEST_DEBUG;
2261     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2262         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2263     ASSERT_NE(inputWindowsManager, nullptr);
2264     WindowInfo window;
2265     window.windowInputType = WindowInputType::TRANSMIT_EXCEPT_MOVE;
2266     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2267     ASSERT_NE(pointerEvent, nullptr);
2268     PointerEvent::PointerItem item;
2269     item.SetPointerId(1);
2270     pointerEvent->AddPointerItem(item);
2271     pointerEvent->SetPointerId(1);
2272     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2273 }
2274 
2275 /**
2276  * @tc.name: HandleWindowInputType_005
2277  * @tc.desc: Test the function HandleWindowInputType
2278  * @tc.type: FUNC
2279  * @tc.require:
2280  */
2281 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_005, TestSize.Level1)
2282 {
2283     CALL_TEST_DEBUG;
2284     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2285         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2286     ASSERT_NE(inputWindowsManager, nullptr);
2287     WindowInfo window;
2288     window.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
2289     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2290     ASSERT_NE(pointerEvent, nullptr);
2291     PointerEvent::PointerItem item;
2292     item.SetPointerId(1);
2293     pointerEvent->AddPointerItem(item);
2294     pointerEvent->SetPointerId(1);
2295     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2296 }
2297 
2298 /**
2299  * @tc.name: HandleWindowInputType_006
2300  * @tc.desc: Test the function HandleWindowInputType
2301  * @tc.type: FUNC
2302  * @tc.require:
2303  */
2304 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_006, TestSize.Level1)
2305 {
2306     CALL_TEST_DEBUG;
2307     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2308         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2309     ASSERT_NE(inputWindowsManager, nullptr);
2310     WindowInfo window;
2311     window.windowInputType = WindowInputType::TRANSMIT_AXIS_MOVE;
2312     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2313     ASSERT_NE(pointerEvent, nullptr);
2314     PointerEvent::PointerItem item;
2315     item.SetPointerId(1);
2316     pointerEvent->AddPointerItem(item);
2317     pointerEvent->SetPointerId(1);
2318     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2319 }
2320 
2321 /**
2322  * @tc.name: HandleWindowInputType_007
2323  * @tc.desc: Test the function HandleWindowInputType
2324  * @tc.type: FUNC
2325  * @tc.require:
2326  */
2327 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_007, TestSize.Level1)
2328 {
2329     CALL_TEST_DEBUG;
2330     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2331         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2332     ASSERT_NE(inputWindowsManager, nullptr);
2333     WindowInfo window;
2334     window.windowInputType = WindowInputType::TRANSMIT_MOUSE_MOVE;
2335     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2336     ASSERT_NE(pointerEvent, nullptr);
2337     PointerEvent::PointerItem item;
2338     item.SetPointerId(1);
2339     pointerEvent->AddPointerItem(item);
2340     pointerEvent->SetPointerId(1);
2341     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2342 }
2343 
2344 /**
2345  * @tc.name: HandleWindowInputType_008
2346  * @tc.desc: Test the function HandleWindowInputType
2347  * @tc.type: FUNC
2348  * @tc.require:
2349  */
2350 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_008, TestSize.Level1)
2351 {
2352     CALL_TEST_DEBUG;
2353     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2354         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2355     ASSERT_NE(inputWindowsManager, nullptr);
2356     WindowInfo window;
2357     window.windowInputType = WindowInputType::TRANSMIT_LEFT_RIGHT;
2358     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2359     ASSERT_NE(pointerEvent, nullptr);
2360     PointerEvent::PointerItem item;
2361     item.SetPointerId(1);
2362     pointerEvent->AddPointerItem(item);
2363     pointerEvent->SetPointerId(1);
2364     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2365 }
2366 
2367 /**
2368  * @tc.name: HandleWindowInputType_009
2369  * @tc.desc: Test the function HandleWindowInputType
2370  * @tc.type: FUNC
2371  * @tc.require:
2372  */
2373 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_009, TestSize.Level1)
2374 {
2375     CALL_TEST_DEBUG;
2376     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2377         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2378     ASSERT_NE(inputWindowsManager, nullptr);
2379     WindowInfo window;
2380     window.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2381     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2382     ASSERT_NE(pointerEvent, nullptr);
2383     PointerEvent::PointerItem item;
2384     item.SetPointerId(1);
2385     pointerEvent->AddPointerItem(item);
2386     pointerEvent->SetPointerId(1);
2387     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2388 }
2389 
2390 /**
2391  * @tc.name: HandleWindowInputType_010
2392  * @tc.desc: Test the function HandleWindowInputType
2393  * @tc.type: FUNC
2394  * @tc.require:
2395  */
2396 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_010, TestSize.Level1)
2397 {
2398     CALL_TEST_DEBUG;
2399     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2400         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2401     ASSERT_NE(inputWindowsManager, nullptr);
2402     WindowInfo window;
2403     window.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2404     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2405     ASSERT_NE(pointerEvent, nullptr);
2406     PointerEvent::PointerItem item;
2407     item.SetPointerId(1);
2408     pointerEvent->AddPointerItem(item);
2409     pointerEvent->SetPointerId(1);
2410     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2411 }
2412 
2413 /**
2414  * @tc.name: HandleWindowInputType_011
2415  * @tc.desc: Test the function HandleWindowInputType
2416  * @tc.type: FUNC
2417  * @tc.require:
2418  */
2419 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_011, TestSize.Level1)
2420 {
2421     CALL_TEST_DEBUG;
2422     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2423         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2424     ASSERT_NE(inputWindowsManager, nullptr);
2425     WindowInfo window;
2426     window.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
2427     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2428     ASSERT_NE(pointerEvent, nullptr);
2429     PointerEvent::PointerItem item;
2430     item.SetPointerId(1);
2431     pointerEvent->AddPointerItem(item);
2432     pointerEvent->SetPointerId(1);
2433     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2434 }
2435 
2436 /**
2437  * @tc.name: HandleWindowInputType_012
2438  * @tc.desc: Test the function HandleWindowInputType
2439  * @tc.type: FUNC
2440  * @tc.require:
2441  */
2442 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_012, TestSize.Level1)
2443 {
2444     CALL_TEST_DEBUG;
2445     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2446         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2447     ASSERT_NE(inputWindowsManager, nullptr);
2448     WindowInfo window;
2449     window.windowInputType = static_cast<WindowInputType>(8);
2450     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2451     ASSERT_NE(pointerEvent, nullptr);
2452     PointerEvent::PointerItem item;
2453     item.SetPointerId(1);
2454     pointerEvent->AddPointerItem(item);
2455     pointerEvent->SetPointerId(1);
2456     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2457 }
2458 
2459 /**
2460  * @tc.name: HandleWindowInputType_013
2461  * @tc.desc: Test the function HandleWindowInputType
2462  * @tc.type: FUNC
2463  * @tc.require:
2464  */
2465 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_013, TestSize.Level1)
2466 {
2467     CALL_TEST_DEBUG;
2468     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2469         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2470     ASSERT_NE(inputWindowsManager, nullptr);
2471     WindowInfo window;
2472     window.windowInputType = WindowInputType::DUALTRIGGER_TOUCH;
2473     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2474     ASSERT_NE(pointerEvent, nullptr);
2475     PointerEvent::PointerItem item;
2476     item.SetPointerId(1);
2477     pointerEvent->AddPointerItem(item);
2478     pointerEvent->SetPointerId(1);
2479     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2480     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2481 
2482     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2483     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2484 }
2485 
2486 /**
2487  * @tc.name: DrawTouchGraphic_001
2488  * @tc.desc: Test the function DrawTouchGraphic
2489  * @tc.type: FUNC
2490  * @tc.require:
2491  */
2492 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_001, TestSize.Level1)
2493 {
2494     CALL_TEST_DEBUG;
2495     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2496         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2497     ASSERT_NE(inputWindowsManager, nullptr);
2498     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2499     ASSERT_NE(pointerEvent, nullptr);
2500     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
2501 }
2502 
2503 
2504 /**
2505  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent
2506  * @tc.desc: Cover if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) branch
2507  * @tc.type: FUNC
2508  * @tc.require:
2509  */
2510 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent, TestSize.Level1)
2511 {
2512     CALL_TEST_DEBUG;
2513     std::shared_ptr<InputWindowsManager> inputWindowsMgr =
2514         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2515     ASSERT_NE(inputWindowsMgr, nullptr);
2516     std::shared_ptr<PointerEvent> pointer = PointerEvent::Create();
2517     ASSERT_NE(pointer, nullptr);
2518     int32_t logicalX = 500;
2519     int32_t logicalY = 500;
2520     WindowInfo windowInfo;
2521     pointer->SetPointerId(0);
2522     PointerEvent::PointerItem item;
2523     item.SetPointerId(1);
2524     pointer->AddPointerItem(item);
2525     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->SendUIExtentionPointerEvent(logicalX, logicalY, windowInfo, pointer));
2526 }
2527 
2528 /**
2529  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplayCoord_001
2530  * @tc.desc: Test the function GetPhysicalDisplayCoord
2531  * @tc.type: FUNC
2532  * @tc.require:
2533  */
2534 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoord_001, TestSize.Level1)
2535 {
2536     CALL_TEST_DEBUG;
2537     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2538         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2539     ASSERT_NE(inputWindowsManager, nullptr);
2540     libinput_event_touch touch {};
2541     OLD::DisplayInfo info;
2542     EventTouch touchInfo;
2543     info.direction = DIRECTION90;
2544     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2545     info.direction = DIRECTION270;
2546     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2547     info.direction = DIRECTION180;
2548     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2549 }
2550 
2551 /**
2552  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_006
2553  * @tc.desc: Test the function IsNeedRefreshLayer
2554  * @tc.type: FUNC
2555  * @tc.require:
2556  */
2557 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_006, TestSize.Level1)
2558 {
2559     CALL_TEST_DEBUG;
2560     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2561         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2562     ASSERT_NE(inputWindowsManager, nullptr);
2563     int32_t windowId = -1;
2564     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2565     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2566     EXPECT_NE(inputEvent, nullptr);
2567     inputEvent->targetDisplayId_ = -1;
2568     bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2569     EXPECT_FALSE(ret);
2570     inputEvent->targetDisplayId_ = 2;
2571     OLD::DisplayInfo displayInfo;
2572     displayInfo.id = 2;
2573     displayInfo.x = 2;
2574     displayInfo.y = 3;
2575     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2576     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
2577         it->second.displaysInfo.push_back(displayInfo);
2578     }
2579     ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2580     EXPECT_FALSE(ret);
2581     windowId = 5;
2582     ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2583     EXPECT_FALSE(ret);
2584 }
2585 
2586 /**
2587 @tc.name: InputWindowsManagerTest_UpdateTransformDisplayXY_001
2588  * @tc.desc: Test the function UpdateTransformDisplayXY
2589  * @tc.type: FUNC
2590  * @tc.require:
2591  */
2592 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplayXY_001, TestSize.Level1)
2593 {
2594     CALL_TEST_DEBUG;
2595     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2596         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2597     ASSERT_NE(inputWindowsManager, nullptr);
2598     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2599     ASSERT_NE(pointerEvent, nullptr);
2600     std::vector<WindowInfo> windowsInfo;
2601     OLD::DisplayInfo displayInfo;
2602     pointerEvent->pointerId_ = 1;
2603     PointerEvent::PointerItem item;
2604     item.pointerId_ = 1;
2605     pointerEvent->pointers_.push_back(item);
2606     WindowInfo windowInfo;
2607     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2608     item.SetDisplayX(10);
2609     item.SetDisplayY(20);
2610     Rect rect = {0, 0, 30, 40};
2611     windowInfo.defaultHotAreas.push_back(rect);
2612     windowsInfo.push_back(windowInfo);
2613     pointerEvent->bitwise_ = 1;
2614     pointerEvent->zOrder_ = -1.0f;
2615     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2616     pointerEvent->bitwise_ = 0;
2617     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2618     pointerEvent->bitwise_ = 0x00000200;
2619     pointerEvent->zOrder_ = 1.0f;
2620     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2621     pointerEvent->bitwise_ = 0x00000100;
2622     pointerEvent->zOrder_ = 1.0f;
2623     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2624 }
2625 
2626 /**
2627  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_001
2628  * @tc.desc: Test the funcation SendUIExtentionPointerEvent
2629  * @tc.type: FUNC
2630  * @tc.require:
2631  */
2632 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_001, TestSize.Level1)
2633 {
2634     CALL_TEST_DEBUG;
2635     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2636         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2637     ASSERT_NE(inputWindowsManager, nullptr);
2638     int32_t logicalX = 100;
2639     int32_t logicalY = 200;
2640     WindowInfo windowInfo;
2641     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2642     ASSERT_NE(pointerEvent, nullptr);
2643     pointerEvent->pointerId_ = 1;
2644     PointerEvent::PointerItem item;
2645     item.pointerId_ = -1;
2646     pointerEvent->pointers_.push_back(item);
2647     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2648         (logicalX, logicalY, windowInfo, pointerEvent));
2649     item.pointerId_ = 1;
2650     pointerEvent->pointers_.push_back(item);
2651     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2652         (logicalX, logicalY, windowInfo, pointerEvent));
2653     windowInfo.id = 1;
2654     windowInfo.pid = 11;
2655     windowInfo.transform.push_back(1.1);
2656     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2657         (logicalX, logicalY, windowInfo, pointerEvent));
2658 }
2659 
2660 /**
2661  * @tc.name: InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001
2662  * @tc.desc: Test the funcation DispatchUIExtentionPointerEvent
2663  * @tc.type: FUNC
2664  * @tc.require:
2665  */
2666 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001, TestSize.Level1)
2667 {
2668     CALL_TEST_DEBUG;
2669     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2670         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2671     ASSERT_NE(inputWindowsManager, nullptr);
2672     int32_t logicalX = 400;
2673     int32_t logicalY = 600;
2674     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2675     ASSERT_NE(pointerEvent, nullptr);
2676     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2677     EXPECT_NE(inputEvent, nullptr);
2678     inputEvent->targetDisplayId_ = 2;
2679     PointerEvent::PointerItem pointerItem;
2680     pointerItem.targetWindowId_ = 2;
2681     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2682     pointerItem.targetWindowId_ = 3;
2683     WindowInfo windowInfo;
2684     windowInfo.id = 3;
2685     windowInfo.uiExtentionWindowInfo.push_back(windowInfo);
2686     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2687     pointerItem.targetWindowId_ = 6;
2688     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2689 }
2690 
2691 /**
2692  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_001
2693  * @tc.desc: Test the funcation SelectWindowInfo
2694  * @tc.type: FUNC
2695  * @tc.require:
2696  */
2697 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_001, TestSize.Level1)
2698 {
2699     CALL_TEST_DEBUG;
2700     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2701         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2702     ASSERT_NE(inputWindowsManager, nullptr);
2703     int32_t logicalX = 10;
2704     int32_t logicalY = 20;
2705     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2706     EXPECT_NE(pointerEvent, nullptr);
2707     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2708     inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
2709     PointerEvent::PointerItem pointerItem;
2710     pointerItem.targetWindowId_ = 2;
2711     inputWindowsManager->extraData_.appended = true;
2712     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
2713     WindowInfo windowInfo;
2714     windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2715     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2716     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2717     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2718     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2719     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2720     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2721     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2722     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_IN_WINDOW);
2723     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2724     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW);
2725     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2726     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2727     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2728     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_LEAVE_WINDOW);
2729     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2730     pointerEvent->pressedButtons_.insert(1);
2731     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2732     windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2733     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2734     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2735     inputWindowsManager->extraData_.appended = false;
2736     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2737     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2738     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2739 }
2740 
2741 /**
2742  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_002
2743  * @tc.desc: Test the funcation SelectWindowInfo
2744  * @tc.type: FUNC
2745  * @tc.require:
2746  */
2747 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_002, TestSize.Level1)
2748 {
2749     CALL_TEST_DEBUG;
2750     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2751         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2752     ASSERT_NE(inputWindowsManager, nullptr);
2753     int32_t logicalX = 10;
2754     int32_t logicalY = 20;
2755     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2756     EXPECT_NE(pointerEvent, nullptr);
2757     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2758     inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
2759     PointerEvent::PointerItem pointerItem;
2760     pointerItem.targetWindowId_ = 2;
2761     inputWindowsManager->extraData_.appended = false;
2762     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2763     WindowInfo windowInfo;
2764     windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2765     windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2766     pointerEvent->pressedButtons_.insert(1);
2767     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2768     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2769     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2770     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2771     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2772     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2773     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2774     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2775     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2776     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ENTER_WINDOW);
2777     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2778     inputWindowsManager->firstBtnDownWindowInfo_.first = 1;
2779     pointerEvent->pressedButtons_.insert(2);
2780     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2781     inputWindowsManager->extraData_.appended = false;
2782     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2783 }
2784 
2785 /**
2786  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint
2787  * @tc.desc: Test the funcation TouchPointToDisplayPoint
2788  * @tc.type: FUNC
2789  * @tc.require:
2790  */
2791 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint, TestSize.Level1)
2792 {
2793     CALL_TEST_DEBUG;
2794     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2795         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2796     ASSERT_NE(inputWindowsManager, nullptr);
2797     int32_t deviceId = 10;
2798     libinput_event_touch touch {};
2799     EventTouch touchInfo;
2800     int32_t physicalDisplayId;
2801     inputWindowsManager->bindInfo_.AddDisplay(2, "abcdefg");
2802     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2803         (deviceId, &touch, touchInfo, physicalDisplayId));
2804     deviceId = 2;
2805     OLD::DisplayInfo displayInfo;
2806     displayInfo.width = -1;
2807     displayInfo.height = 3;
2808     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2809     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
2810         it->second.displaysInfo.push_back(displayInfo);
2811     }
2812     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2813         (deviceId, &touch, touchInfo, physicalDisplayId));
2814     displayInfo.width = 3;
2815     displayInfo.height = -1;
2816     it->second.displaysInfo.push_back(displayInfo);
2817     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2818         (deviceId, &touch, touchInfo, physicalDisplayId));
2819     displayInfo.width = -5;
2820     displayInfo.height = -6;
2821     it->second.displaysInfo.push_back(displayInfo);
2822     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2823         (deviceId, &touch, touchInfo, physicalDisplayId));
2824     displayInfo.width = 3;
2825     displayInfo.height = 2;
2826     it->second.displaysInfo.push_back(displayInfo);
2827     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2828         (deviceId, &touch, touchInfo, physicalDisplayId));
2829 }
2830 
2831 /**
2832  * @tc.name: InputWindowsManagerTest_FoldScreenRotation
2833  * @tc.desc: Test the function FoldScreenRotation
2834  * @tc.type: FUNC
2835  * @tc.require:
2836  */
2837 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation, TestSize.Level1)
2838 {
2839     CALL_TEST_DEBUG;
2840     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2841         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2842     ASSERT_NE(inputWindowsManager, nullptr);
2843     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2844     ASSERT_NE(pointerEvent, nullptr);
2845     WindowInfoEX winInfoEx;
2846     pointerEvent->bitwise_ = 0x00000000;
2847     pointerEvent->SetPointerId(1);
2848     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2849     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
2850     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2851 }
2852 
2853 /**
2854  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_001
2855  * @tc.desc: Test the function FoldScreenRotation
2856  * @tc.type: FUNC
2857  * @tc.require:
2858  */
2859 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_001, TestSize.Level1)
2860 {
2861     CALL_TEST_DEBUG;
2862     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
2863     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2864         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2865     ASSERT_NE(inputWindowsManager, nullptr);
2866     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2867     ASSERT_NE(pointerEvent, nullptr);
2868     WindowInfoEX winInfoEx;
2869     OLD::DisplayInfo displayInfo;
2870     displayInfo.id = 10;
2871     pointerEvent->bitwise_ = 0x00000000;
2872     pointerEvent->SetPointerId(1);
2873     pointerEvent->SetTargetDisplayId(10);
2874     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2875     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2876     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
2877         it->second.displaysInfo.push_back(displayInfo);
2878     }
2879     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2880     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2881 }
2882 
2883 /**
2884  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_002
2885  * @tc.desc: Test the function FoldScreenRotation
2886  * @tc.type: FUNC
2887  * @tc.require:
2888  */
2889 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_002, TestSize.Level1)
2890 {
2891     CALL_TEST_DEBUG;
2892     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2893     std::shared_ptr<InputWindowsManager> inputWindowsManager =
2894         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2895     ASSERT_NE(inputWindowsManager, nullptr);
2896     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2897     ASSERT_NE(pointerEvent, nullptr);
2898     WindowInfoEX winInfoEx;
2899     OLD::DisplayInfo displayInfo;
2900     displayInfo.id = 10;
2901     pointerEvent->SetPointerId(1);
2902     pointerEvent->SetTargetDisplayId(10);
2903     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2904     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2905     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
2906         it->second.displaysInfo.push_back(displayInfo);
2907     }
2908     inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2909     inputWindowsManager->lastDirection_ = std::make_pair(10, static_cast<Direction>(-1));
2910     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2911 }
2912 
2913 /**
2914  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_003
2915  * @tc.desc: Test the function FoldScreenRotation
2916  * @tc.type: FUNC
2917  * @tc.require:
2918  */
2919 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_003, TestSize.Level1)
2920 {
2921     CALL_TEST_DEBUG;
2922     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2923     InputWindowsManager inputWindowsManager;
2924     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2925     ASSERT_NE(pointerEvent, nullptr);
2926     PointerEvent::PointerItem item;
2927     OLD::DisplayInfo displayInfo;
2928     displayInfo.id = 10;
2929     displayInfo.direction = DIRECTION90;
2930     item.SetPointerId(2);
2931     pointerEvent->AddPointerItem(item);
2932     pointerEvent->SetPointerId(1);
2933     pointerEvent->SetTargetDisplayId(10);
2934     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2935     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2936     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2937     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
2938         it->second.displaysInfo.push_back(displayInfo);
2939     }
2940     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2941 }
2942 
2943 /**
2944  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_004
2945  * @tc.desc: Test the function FoldScreenRotation
2946  * @tc.type: FUNC
2947  * @tc.require:
2948  */
2949 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_004, TestSize.Level1)
2950 {
2951     CALL_TEST_DEBUG;
2952     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2953     InputWindowsManager inputWindowsManager;
2954     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2955     ASSERT_NE(pointerEvent, nullptr);
2956     PointerEvent::PointerItem item;
2957     OLD::DisplayInfo displayInfo;
2958     displayInfo.id = 10;
2959     displayInfo.direction = DIRECTION90;
2960     item.SetPointerId(1);
2961     item.SetPressed(false);
2962     pointerEvent->AddPointerItem(item);
2963     pointerEvent->SetPointerId(1);
2964     pointerEvent->SetTargetDisplayId(10);
2965     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2966     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2967     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
2968     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
2969         it->second.displaysInfo.push_back(displayInfo);
2970     }
2971     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2972 }
2973 
2974 /**
2975  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_005
2976  * @tc.desc: Test the function FoldScreenRotation
2977  * @tc.type: FUNC
2978  * @tc.require:
2979  */
2980 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_005, TestSize.Level1)
2981 {
2982     CALL_TEST_DEBUG;
2983     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2984     InputWindowsManager inputWindowsManager;
2985     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2986     ASSERT_NE(pointerEvent, nullptr);
2987     PointerEvent::PointerItem item;
2988     OLD::DisplayInfo displayInfo;
2989     displayInfo.id = 10;
2990     displayInfo.direction = DIRECTION90;
2991     item.SetPointerId(1);
2992     item.SetPressed(true);
2993     pointerEvent->AddPointerItem(item);
2994     pointerEvent->SetPointerId(1);
2995     pointerEvent->SetTargetDisplayId(10);
2996     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2997     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
2998     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2999     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3000     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3001         it->second.displaysInfo.push_back(displayInfo);
3002     }
3003     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3004 }
3005 
3006 /**
3007  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_006
3008  * @tc.desc: Test the function FoldScreenRotation
3009  * @tc.type: FUNC
3010  * @tc.require:
3011  */
3012 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_006, TestSize.Level1)
3013 {
3014     CALL_TEST_DEBUG;
3015     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3016     InputWindowsManager inputWindowsManager;
3017     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3018     ASSERT_NE(pointerEvent, nullptr);
3019     PointerEvent::PointerItem item;
3020     WindowInfoEX winInfoEx;
3021     OLD::DisplayInfo displayInfo;
3022     displayInfo.id = 10;
3023     displayInfo.direction = DIRECTION90;
3024     item.SetPointerId(1);
3025     item.SetPressed(true);
3026     pointerEvent->bitwise_ = 0x00000000;
3027     pointerEvent->AddPointerItem(item);
3028     pointerEvent->SetPointerId(1);
3029     pointerEvent->SetTargetDisplayId(10);
3030     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
3031     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
3032     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
3033     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3034     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3035         it->second.displaysInfo.push_back(displayInfo);
3036     }
3037     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
3038     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3039 }
3040 
3041 /**
3042  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_007
3043  * @tc.desc: Test the function FoldScreenRotation
3044  * @tc.type: FUNC
3045  * @tc.require:
3046  */
3047 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_007, TestSize.Level1)
3048 {
3049     CALL_TEST_DEBUG;
3050     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3051     InputWindowsManager inputWindowsManager;
3052     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3053     ASSERT_NE(pointerEvent, nullptr);
3054     PointerEvent::PointerItem item;
3055     WindowInfoEX winInfoEx;
3056     OLD::DisplayInfo displayInfo;
3057     displayInfo.id = 10;
3058     displayInfo.direction = DIRECTION90;
3059     item.SetPointerId(1);
3060     item.SetPressed(true);
3061     pointerEvent->bitwise_ = 0x00000080;
3062     pointerEvent->AddPointerItem(item);
3063     pointerEvent->SetPointerId(1);
3064     pointerEvent->SetTargetDisplayId(10);
3065     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
3066     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
3067     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
3068     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3069     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3070         it->second.displaysInfo.push_back(displayInfo);
3071     }
3072     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
3073     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3074 }
3075 
3076 /**
3077  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_008
3078  * @tc.desc: Test the function FoldScreenRotation
3079  * @tc.type: FUNC
3080  * @tc.require:
3081  */
3082 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_008, TestSize.Level1)
3083 {
3084     CALL_TEST_DEBUG;
3085     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3086     InputWindowsManager inputWindowsManager;
3087     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3088     ASSERT_NE(pointerEvent, nullptr);
3089     PointerEvent::PointerItem item;
3090     WindowInfoEX winInfoEx;
3091     OLD::DisplayInfo displayInfo;
3092     displayInfo.id = 10;
3093     displayInfo.direction = DIRECTION90;
3094     item.SetPointerId(1);
3095     item.SetPressed(true);
3096     pointerEvent->bitwise_ = 0x00000000;
3097     pointerEvent->AddPointerItem(item);
3098     pointerEvent->SetPointerId(1);
3099     pointerEvent->SetTargetDisplayId(10);
3100     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
3101     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
3102     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
3103     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3104     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3105         it->second.displaysInfo.push_back(displayInfo);
3106     }
3107     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
3108     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3109 }
3110 
3111 /**
3112  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_009
3113  * @tc.desc: Test the function FoldScreenRotation
3114  * @tc.type: FUNC
3115  * @tc.require:
3116  */
3117 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_009, TestSize.Level1)
3118 {
3119     CALL_TEST_DEBUG;
3120     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3121     InputWindowsManager inputWindowsManager;
3122     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3123     ASSERT_NE(pointerEvent, nullptr);
3124     PointerEvent::PointerItem item;
3125     OLD::DisplayInfo displayInfo;
3126     displayInfo.id = 10;
3127     displayInfo.direction = DIRECTION90;
3128     item.SetPointerId(1);
3129     pointerEvent->AddPointerItem(item);
3130     pointerEvent->SetPointerId(1);
3131     pointerEvent->SetTargetDisplayId(10);
3132     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
3133     inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION90);
3134     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3135     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3136         it->second.displaysInfo.push_back(displayInfo);
3137     }
3138     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3139 }
3140 
3141 /**
3142  * @tc.name: InputWindowsManagerTest_RotateScreen
3143  * @tc.desc: Test the function RotateScreen
3144  * @tc.type: FUNC
3145  * @tc.require:
3146  */
3147 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen, TestSize.Level1)
3148 {
3149     CALL_TEST_DEBUG;
3150     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3151     InputWindowsManager inputWindowsManager;
3152     OLD::DisplayInfo info;
3153     PhysicalCoordinate coord;
3154     info.height = 500;
3155     coord.x = 200;
3156     info.direction = DIRECTION0;
3157     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3158     if (it != inputWindowsManager.cursorPosMap_.end()) {
3159         it->second.direction = DIRECTION90;
3160     }
3161     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3162 }
3163 
3164 /**
3165  * @tc.name: InputWindowsManagerTest_RotateScreen_001
3166  * @tc.desc: Test the function RotateScreen
3167  * @tc.type: FUNC
3168  * @tc.require:
3169  */
3170 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, TestSize.Level1)
3171 {
3172     CALL_TEST_DEBUG;
3173     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3174     InputWindowsManager inputWindowsManager;
3175     OLD::DisplayInfo info;
3176     PhysicalCoordinate coord;
3177     info.width = 500;
3178     coord.y = 200;
3179     info.direction = DIRECTION0;
3180     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3181     if (it != inputWindowsManager.cursorPosMap_.end()) {
3182         it->second.direction = DIRECTION270;
3183     }
3184     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3185 }
3186 
3187 /**
3188  * @tc.name: InputWindowsManagerTest_RotateScreen_002
3189  * @tc.desc: Test the function RotateScreen
3190  * @tc.type: FUNC
3191  * @tc.require:
3192  */
3193 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, TestSize.Level1)
3194 {
3195     CALL_TEST_DEBUG;
3196     InputWindowsManager inputWindowsManager;
3197     OLD::DisplayInfo info;
3198     PhysicalCoordinate coord;
3199     info.direction = static_cast<Direction>(10);
3200     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3201 }
3202 
3203 /**
3204  * @tc.name: InputWindowsManagerTest_RotateScreen_003
3205  * @tc.desc: Verify if (cursorPos_.displayDirection != info.displayDirection && cursorPos_.direction != info.direction)
3206  * @tc.type: FUNC
3207  * @tc.require:
3208  */
3209 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, TestSize.Level1)
3210 {
3211     CALL_TEST_DEBUG;
3212     PhysicalCoordinate coord;
3213     OLD::DisplayInfo info;
3214     InputWindowsManager inputWindowsManager;
3215 
3216     info.direction = DIRECTION0;
3217     info.displayDirection = DIRECTION0;
3218     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3219     if (it != inputWindowsManager.cursorPosMap_.end()) {
3220         it->second.direction = DIRECTION270;
3221         EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3222     }
3223     info.displayDirection = DIRECTION0;
3224     it->second.displayDirection = DIRECTION0;
3225     info.direction = DIRECTION0;
3226     it->second.direction = DIRECTION270;
3227     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3228 
3229     info.displayDirection = DIRECTION0;
3230     it->second.displayDirection = DIRECTION0;
3231     info.direction = DIRECTION0;
3232     it->second.direction = DIRECTION0;
3233     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3234 }
3235 
3236 /**
3237  * @tc.name: InputWindowsManagerTest_RotateScreen_004
3238  * @tc.desc: Verify if (cursorPos_.direction == Direction::DIRECTION90)
3239  * @tc.type: FUNC
3240  * @tc.require:
3241  */
3242 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_004, TestSize.Level1)
3243 {
3244     CALL_TEST_DEBUG;
3245     PhysicalCoordinate coord;
3246     OLD::DisplayInfo info;
3247     InputWindowsManager inputWindowsManager;
3248 
3249     info.displayDirection = DIRECTION0;
3250     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3251     if (it != inputWindowsManager.cursorPosMap_.end()) {
3252         it->second.displayDirection = DIRECTION0;
3253     }
3254     info.direction = DIRECTION0;
3255     it->second.direction = DIRECTION0;
3256 
3257     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3258 }
3259 
3260 /**
3261  * @tc.name: InputWindowsManagerTest_RotateScreen_005
3262  * @tc.desc: Verify if (cursorPos_.direction == Direction::DIRECTION90)
3263  * @tc.type: FUNC
3264  * @tc.require:
3265  */
3266 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_005, TestSize.Level1)
3267 {
3268     CALL_TEST_DEBUG;
3269     PhysicalCoordinate coord;
3270     OLD::DisplayInfo info;
3271     InputWindowsManager inputWindowsManager;
3272 
3273     info.displayDirection = DIRECTION0;
3274     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3275     if (it != inputWindowsManager.cursorPosMap_.end()) {
3276         it->second.displayDirection = DIRECTION0;
3277     }
3278     info.direction = DIRECTION90;
3279     it->second.direction = DIRECTION90;
3280 
3281     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3282 }
3283 
3284 /**
3285  * @tc.name: InputWindowsManagerTest_RotateScreen_006
3286  * @tc.desc: Verify else if (cursorPos_.direction == Direction::DIRECTION270)
3287  * @tc.type: FUNC
3288  * @tc.require:
3289  */
3290 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_006, TestSize.Level1)
3291 {
3292     CALL_TEST_DEBUG;
3293     PhysicalCoordinate coord;
3294     OLD::DisplayInfo info;
3295     InputWindowsManager inputWindowsManager;
3296 
3297     info.displayDirection = DIRECTION0;
3298     auto it = inputWindowsManager.cursorPosMap_.find(DEFAULT_GROUP_ID);
3299     if (it != inputWindowsManager.cursorPosMap_.end()) {
3300         it->second.displayDirection = DIRECTION0;
3301     }
3302     info.direction = DIRECTION270;
3303     inputWindowsManager.cursorPos_.direction = DIRECTION270;
3304 
3305     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3306 }
3307 
3308 /**
3309  * @tc.name: InputWindowsManagerTest_RotateScreen_007
3310  * @tc.desc: Verify if (direction == DIRECTION90)
3311  * @tc.type: FUNC
3312  * @tc.require:
3313  */
3314 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_007, TestSize.Level1)
3315 {
3316     CALL_TEST_DEBUG;
3317     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3318     PhysicalCoordinate coord;
3319     OLD::DisplayInfo info;
3320     InputWindowsManager inputWindowsManager;
3321     info.direction = DIRECTION90;
3322     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3323 }
3324 
3325 /**
3326  * @tc.name: InputWindowsManagerTest_RotateScreen_008
3327  * @tc.desc: Verify if (direction == DIRECTION90)
3328  * @tc.type: FUNC
3329  * @tc.require:
3330  */
3331 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_008, TestSize.Level1)
3332 {
3333     CALL_TEST_DEBUG;
3334     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3335     PhysicalCoordinate coord;
3336     OLD::DisplayInfo info;
3337     InputWindowsManager inputWindowsManager;
3338     info.direction = DIRECTION90;
3339     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3340 }
3341 
3342 /**
3343  * @tc.name: InputWindowsManagerTest_RotateScreen_009
3344  * @tc.desc: Verify if (direction == DIRECTION180)
3345  * @tc.type: FUNC
3346  * @tc.require:
3347  */
3348 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_009, TestSize.Level1)
3349 {
3350     CALL_TEST_DEBUG;
3351     PhysicalCoordinate coord;
3352     OLD::DisplayInfo info;
3353     InputWindowsManager inputWindowsManager;
3354     info.direction = DIRECTION180;
3355     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3356 }
3357 
3358 /**
3359  * @tc.name: InputWindowsManagerTest_RotateScreen_010
3360  * @tc.desc: Verify if (direction == DIRECTION270)
3361  * @tc.type: FUNC
3362  * @tc.require:
3363  */
3364 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_010, TestSize.Level1)
3365 {
3366     CALL_TEST_DEBUG;
3367     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3368     PhysicalCoordinate coord;
3369     OLD::DisplayInfo info;
3370     InputWindowsManager inputWindowsManager;
3371     info.direction = DIRECTION270;
3372     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3373 }
3374 
3375 /**
3376  * @tc.name: InputWindowsManagerTest_RotateScreen_011
3377  * @tc.desc: Verify if (direction == DIRECTION270)
3378  * @tc.type: FUNC
3379  * @tc.require:
3380  */
3381 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_011, TestSize.Level1)
3382 {
3383     CALL_TEST_DEBUG;
3384     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3385     PhysicalCoordinate coord;
3386     OLD::DisplayInfo info;
3387     InputWindowsManager inputWindowsManager;
3388     info.direction = DIRECTION270;
3389     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3390 }
3391 
3392 /**
3393  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_001
3394  * @tc.desc: Verify if (displayDirection == DIRECTION0)
3395  * @tc.type: FUNC
3396  * @tc.require:
3397  */
3398 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_001, TestSize.Level1)
3399 {
3400     CALL_TEST_DEBUG;
3401     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3402     PhysicalCoordinate coord;
3403     OLD::DisplayInfo info;
3404     InputWindowsManager inputWindowsManager;
3405 
3406     info.direction = DIRECTION0;
3407     info.displayDirection = DIRECTION0;
3408     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3409 }
3410 
3411 /**
3412  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_002
3413  * @tc.desc: Verify if (displayDirection == DIRECTION90)
3414  * @tc.type: FUNC
3415  * @tc.require:
3416  */
3417 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_002, TestSize.Level1)
3418 {
3419     CALL_TEST_DEBUG;
3420     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3421     PhysicalCoordinate coord;
3422     OLD::DisplayInfo info;
3423     InputWindowsManager inputWindowsManager;
3424 
3425     info.direction = DIRECTION90;
3426     info.displayDirection = DIRECTION0;
3427     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3428 }
3429 
3430 /**
3431  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_003
3432  * @tc.desc: Verify if (displayDirection == DIRECTION90)
3433  * @tc.type: FUNC
3434  * @tc.require:
3435  */
3436 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_003, TestSize.Level1)
3437 {
3438     CALL_TEST_DEBUG;
3439     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3440     PhysicalCoordinate coord;
3441     OLD::DisplayInfo info;
3442     InputWindowsManager inputWindowsManager;
3443 
3444     info.direction = DIRECTION90;
3445     info.displayDirection = DIRECTION0;
3446     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3447 }
3448 
3449 /**
3450  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_004
3451  * @tc.desc: Verify if (displayDirection == DIRECTION180)
3452  * @tc.type: FUNC
3453  * @tc.require:
3454  */
3455 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_004, TestSize.Level1)
3456 {
3457     CALL_TEST_DEBUG;
3458     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3459     PhysicalCoordinate coord;
3460     OLD::DisplayInfo info;
3461     InputWindowsManager inputWindowsManager;
3462 
3463     info.direction = DIRECTION180;
3464     info.displayDirection = DIRECTION0;
3465     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3466 }
3467 
3468 /**
3469  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_005
3470  * @tc.desc: Verify if (displayDirection == DIRECTION180)
3471  * @tc.type: FUNC
3472  * @tc.require:
3473  */
3474 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_005, TestSize.Level1)
3475 {
3476     CALL_TEST_DEBUG;
3477     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3478     PhysicalCoordinate coord;
3479     OLD::DisplayInfo info;
3480     InputWindowsManager inputWindowsManager;
3481 
3482     info.direction = DIRECTION180;
3483     info.displayDirection = DIRECTION0;
3484     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3485 }
3486 
3487 /**
3488  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_006
3489  * @tc.desc: Verify if (displayDirection == DIRECTION270)
3490  * @tc.type: FUNC
3491  * @tc.require:
3492  */
3493 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_006, TestSize.Level1)
3494 {
3495     CALL_TEST_DEBUG;
3496     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3497     PhysicalCoordinate coord;
3498     OLD::DisplayInfo info;
3499     InputWindowsManager inputWindowsManager;
3500 
3501     info.direction = DIRECTION270;
3502     info.displayDirection = DIRECTION0;
3503     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3504 }
3505 
3506 /**
3507  * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_007
3508  * @tc.desc: Verify if (displayDirection == DIRECTION270)
3509  * @tc.type: FUNC
3510  * @tc.require:
3511  */
3512 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_007, TestSize.Level1)
3513 {
3514     CALL_TEST_DEBUG;
3515     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3516     PhysicalCoordinate coord;
3517     OLD::DisplayInfo info;
3518     InputWindowsManager inputWindowsManager;
3519 
3520     info.direction = DIRECTION270;
3521     info.displayDirection = DIRECTION0;
3522     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3523 }
3524 
3525 /**
3526  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer
3527  * @tc.desc: Test the function IsNeedRefreshLayer
3528  * @tc.type: FUNC
3529  * @tc.require:
3530  */
3531 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer, TestSize.Level1)
3532 {
3533     CALL_TEST_DEBUG;
3534     int32_t displayId = -1;
3535     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3536     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3537     InputWindowsManager inputWindowsManager;
3538     int32_t windowId = 10;
3539     OLD::DisplayInfo displayInfo;
3540     WindowInfo winInfo;
3541     displayInfo.id = 100;
3542     displayInfo.x = 200;
3543     displayInfo.y = 200;
3544     winInfo.flags = 0;
3545     winInfo.id = 10;
3546     inputWindowsManager.mouseLocation_.displayId = 80;
3547     inputWindowsManager.mouseLocation_.physicalX = 100;
3548     inputWindowsManager.mouseLocation_.physicalY = 100;
3549     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3550     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3551     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3552         it->second.displaysInfo.push_back(displayInfo);
3553         it->second.windowsInfo.push_back(winInfo);
3554     }
3555     EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3556 }
3557 
3558 /**
3559  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_007
3560  * @tc.desc: Test the function IsNeedRefreshLayer
3561  * @tc.type: FUNC
3562  * @tc.require:
3563  */
3564 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_007, TestSize.Level1)
3565 {
3566     CALL_TEST_DEBUG;
3567     int32_t displayId = -1;
3568     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3569     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3570     InputWindowsManager inputWindowsManager;
3571     int32_t windowId = -1;
3572     OLD::DisplayInfo displayInfo;
3573     WindowInfo winInfo;
3574     displayInfo.id = 100;
3575     displayInfo.x = 200;
3576     displayInfo.y = 200;
3577     winInfo.flags = 0;
3578     winInfo.id = 10;
3579     inputWindowsManager.mouseLocation_.displayId = 80;
3580     inputWindowsManager.mouseLocation_.physicalX = 100;
3581     inputWindowsManager.mouseLocation_.physicalY = 100;
3582     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3583     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3584     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3585         it->second.displaysInfo.push_back(displayInfo);
3586         it->second.windowsInfo.push_back(winInfo);
3587     }
3588     EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3589 }
3590 
3591 /**
3592  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_008
3593  * @tc.desc: Test the function IsNeedRefreshLayer
3594  * @tc.type: FUNC
3595  * @tc.require:
3596  */
3597 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_008, TestSize.Level1)
3598 {
3599     CALL_TEST_DEBUG;
3600     int32_t displayId = -1;
3601     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3602     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3603     InputWindowsManager inputWindowsManager;
3604     int32_t windowId = 50;
3605     OLD::DisplayInfo displayInfo;
3606     WindowInfo winInfo;
3607     displayInfo.id = 100;
3608     displayInfo.x = 200;
3609     displayInfo.y = 200;
3610     winInfo.flags = 0;
3611     winInfo.id = 10;
3612     inputWindowsManager.mouseLocation_.displayId = 80;
3613     inputWindowsManager.mouseLocation_.physicalX = 100;
3614     inputWindowsManager.mouseLocation_.physicalY = 100;
3615     winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3616     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3617     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3618         it->second.displaysInfo.push_back(displayInfo);
3619         it->second.windowsInfo.push_back(winInfo);
3620     }
3621     EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3622 }
3623 
3624 /**
3625  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_009
3626  * @tc.desc: Test the function IsNeedRefreshLayer
3627  * @tc.type: FUNC
3628  * @tc.require:
3629  */
3630 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_009, TestSize.Level1)
3631 {
3632     CALL_TEST_DEBUG;
3633     int32_t displayId = -1;
3634     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3635     EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3636     InputWindowsManager inputWindowsManager;
3637     int32_t windowId = 50;
3638     OLD::DisplayInfo displayInfo;
3639     WindowInfo winInfo;
3640     displayInfo.id = 100;
3641     displayInfo.x = 200;
3642     displayInfo.y = 200;
3643     winInfo.flags = 0;
3644     inputWindowsManager.mouseLocation_.displayId = 80;
3645     inputWindowsManager.mouseLocation_.physicalX = 100;
3646     inputWindowsManager.mouseLocation_.physicalY = 100;
3647     winInfo.pointerHotAreas.push_back({ 100, 100, INT32_MAX, 1000 });
3648     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3649     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3650         it->second.displaysInfo.push_back(displayInfo);
3651         it->second.windowsInfo.push_back(winInfo);
3652     }
3653     EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3654 }
3655 
3656 /**
3657  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation
3658  * @tc.desc: Test the funcation AdjustDisplayRotation
3659  * @tc.type: FUNC
3660  * @tc.require:
3661  */
3662 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation, TestSize.Level1)
3663 {
3664     CALL_TEST_DEBUG;
3665     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3666     std::shared_ptr<InputWindowsManager> inputWindowsManager =
3667         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3668     OLD::DisplayInfo displayInfo;
3669     displayInfo.id = 100;
3670     displayInfo.direction = DIRECTION90;
3671     displayInfo.displayDirection = DIRECTION0;
3672     auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID);
3673     if (it != inputWindowsManager->cursorPosMap_.end()) {
3674         it->second.displayId = 100;
3675         it->second.direction = Direction::DIRECTION0;
3676         it->second.displayDirection = Direction::DIRECTION0;
3677     }
3678     auto iter = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3679     if (iter != inputWindowsManager->displayGroupInfoMap_.end()) {
3680         iter->second.displaysInfo.push_back(displayInfo);
3681     }
3682     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3683 }
3684 
3685 /**
3686  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_001
3687  * @tc.desc: Test the funcation AdjustDisplayRotation
3688  * @tc.type: FUNC
3689  * @tc.require:
3690  */
3691 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_001, TestSize.Level1)
3692 {
3693     CALL_TEST_DEBUG;
3694     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3695     std::shared_ptr<InputWindowsManager> inputWindowsManager =
3696         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3697     OLD::DisplayInfo displayInfo;
3698     displayInfo.id = 100;
3699     displayInfo.direction = DIRECTION90;
3700     displayInfo.displayDirection = DIRECTION0;
3701     auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID);
3702     if (it != inputWindowsManager->cursorPosMap_.end()) {
3703         it->second.displayId = 100;
3704         it->second.direction = Direction::DIRECTION90;
3705         it->second.displayDirection = Direction::DIRECTION0;
3706     }
3707     auto iter = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3708     if (iter != inputWindowsManager->displayGroupInfoMap_.end()) {
3709         iter->second.displaysInfo.push_back(displayInfo);
3710     }
3711     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3712 }
3713 
3714 /**
3715  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_002
3716  * @tc.desc: Test the funcation AdjustDisplayRotation
3717  * @tc.type: FUNC
3718  * @tc.require:
3719  */
3720 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_002, TestSize.Level1)
3721 {
3722     CALL_TEST_DEBUG;
3723     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
3724     InputWindowsManager inputWindowsManager;
3725     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.AdjustDisplayRotation());
3726 }
3727 
3728 /**
3729  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_003
3730  * @tc.desc: Test the funcation AdjustDisplayRotation
3731  * @tc.type: FUNC
3732  * @tc.require:
3733  */
3734 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_003, TestSize.Level1)
3735 {
3736     CALL_TEST_DEBUG;
3737     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3738     std::shared_ptr<InputWindowsManager> inputWindowsManager =
3739         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3740     OLD::DisplayInfo displayInfo;
3741     displayInfo.id = 100;
3742     displayInfo.direction = DIRECTION90;
3743     displayInfo.displayDirection = DIRECTION90;
3744     auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID);
3745     if (it != inputWindowsManager->cursorPosMap_.end()) {
3746         it->second.displayId = 100;
3747         it->second.direction = Direction::DIRECTION90;
3748         it->second.displayDirection = Direction::DIRECTION0;
3749     }
3750     auto iter = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3751     if (iter != inputWindowsManager->displayGroupInfoMap_.end()) {
3752         iter->second.displaysInfo.push_back(displayInfo);
3753     }
3754     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3755 }
3756 
3757 /**
3758  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_004
3759  * @tc.desc: Test the funcation AdjustDisplayRotation
3760  * @tc.type: FUNC
3761  * @tc.require:
3762  */
3763 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_004, TestSize.Level1)
3764 {
3765     CALL_TEST_DEBUG;
3766     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3767     std::shared_ptr<InputWindowsManager> inputWindowsManager =
3768         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3769     OLD::DisplayInfo displayInfo;
3770     displayInfo.id = 100;
3771     displayInfo.direction = DIRECTION90;
3772     displayInfo.displayDirection = DIRECTION90;
3773     auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID);
3774     if (it != inputWindowsManager->cursorPosMap_.end()) {
3775         it->second.displayId = 100;
3776         it->second.direction = Direction::DIRECTION0;
3777         it->second.displayDirection = Direction::DIRECTION0;
3778     }
3779     auto iter = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3780     if (iter != inputWindowsManager->displayGroupInfoMap_.end()) {
3781         iter->second.displaysInfo.push_back(displayInfo);
3782     }
3783     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3784 }
3785 
3786 /**
3787  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_001
3788  * @tc.desc: Test the funcation TouchPointToDisplayPoint
3789  * @tc.type: FUNC
3790  * @tc.require:
3791  */
3792 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_001, TestSize.Level1)
3793 {
3794     CALL_TEST_DEBUG;
3795     std::string uniq = "uniq";
3796     EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3797     InputWindowsManager inputWindowsManager;
3798     OLD::DisplayInfo displayInfo;
3799     int32_t deviceId = 100;
3800     libinput_event_touch touch {};
3801     EventTouch touchInfo;
3802     int32_t physicalDisplayId = 200;
3803     displayInfo.id = 100;
3804     displayInfo.uniq = "uniq";
3805     displayInfo.width = -1;
3806     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3807     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3808         it->second.displaysInfo.push_back(displayInfo);
3809     }
3810     EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3811 }
3812 
3813 /**
3814  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_002
3815  * @tc.desc: Test the funcation TouchPointToDisplayPoint
3816  * @tc.type: FUNC
3817  * @tc.require:
3818  */
3819 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_002, TestSize.Level1)
3820 {
3821     CALL_TEST_DEBUG;
3822     std::string uniq = "uniq";
3823     EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3824     InputWindowsManager inputWindowsManager;
3825     OLD::DisplayInfo displayInfo;
3826     int32_t deviceId = 100;
3827     libinput_event_touch touch {};
3828     EventTouch touchInfo;
3829     int32_t physicalDisplayId = 200;
3830     displayInfo.id = 100;
3831     displayInfo.uniq = "uniq";
3832     displayInfo.width = 100;
3833     displayInfo.height = -1;
3834     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3835     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3836         it->second.displaysInfo.push_back(displayInfo);
3837     }
3838     EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3839 }
3840 
3841 /**
3842  * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_003
3843  * @tc.desc: Test the funcation TouchPointToDisplayPoint
3844  * @tc.type: FUNC
3845  * @tc.require:
3846  */
3847 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_003, TestSize.Level1)
3848 {
3849     CALL_TEST_DEBUG;
3850     std::string uniq = "uniq";
3851     EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3852     InputWindowsManager inputWindowsManager;
3853     OLD::DisplayInfo displayInfo;
3854     int32_t deviceId = 100;
3855     libinput_event_touch touch {};
3856     EventTouch touchInfo;
3857     int32_t physicalDisplayId = 200;
3858     displayInfo.id = 100;
3859     displayInfo.uniq = "uniq";
3860     displayInfo.width = 100;
3861     displayInfo.height = 100;
3862     displayInfo.validWidth = displayInfo.width;
3863     displayInfo.validHeight = displayInfo.height;
3864     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
3865     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
3866         it->second.displaysInfo.push_back(displayInfo);
3867     }
3868     EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3869 }
3870 
3871 /**
3872  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo
3873  * @tc.desc: Test the funcation UpdateDisplayInfo
3874  * @tc.type: FUNC
3875  * @tc.require:
3876  */
3877 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo, TestSize.Level1)
3878 {
3879     CALL_TEST_DEBUG;
3880     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(true));
3881     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3882     InputWindowsManager inputWindowsManager;
3883     OLD::DisplayGroupInfo displayGroupInfo;
3884     OLD::DisplayInfo displayInfo;
3885     WindowInfo winInfo;
3886     winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN;
3887     displayGroupInfo.windowsInfo.push_back(winInfo);
3888     displayGroupInfo.displaysInfo.push_back(displayInfo);
3889     displayGroupInfo.currentUserId = 100;
3890     inputWindowsManager.currentUserId_ = 200;
3891     inputWindowsManager.pointerDrawFlag_ = true;
3892     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfo(displayGroupInfo));
3893 }
3894 
3895 /**
3896  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_001
3897  * @tc.desc: Test the funcation UpdateDisplayInfo
3898  * @tc.type: FUNC
3899  * @tc.require:
3900  */
3901 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_001, TestSize.Level1)
3902 {
3903     CALL_TEST_DEBUG;
3904     EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(false));
3905     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3906     InputWindowsManager inputWindowsManager;
3907     OLD::DisplayGroupInfo displayGroupInfo;
3908     OLD::DisplayInfo displayInfo;
3909     WindowInfo winInfo;
3910     winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN;
3911     displayGroupInfo.windowsInfo.push_back(winInfo);
3912     displayGroupInfo.displaysInfo.push_back(displayInfo);
3913     displayGroupInfo.currentUserId = 100;
3914     inputWindowsManager.currentUserId_ = 200;
3915     inputWindowsManager.pointerDrawFlag_ = true;
3916     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfo(displayGroupInfo));
3917 }
3918 
3919 /**
3920  * @tc.name: InputWindowsManagerTest_SetPointerStyle
3921  * @tc.desc: Test the funcation SetPointerStyle
3922  * @tc.type: FUNC
3923  * @tc.require:
3924  */
3925 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPointerStyle, TestSize.Level1)
3926 {
3927     CALL_TEST_DEBUG;
3928     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3929     InputWindowsManager inputWindowsManager;
3930     int32_t pid = 100;
3931     int32_t windowId = 100;
3932     PointerStyle pointerStyle;
3933     bool isUiExtension = false;
3934     EXPECT_NE(inputWindowsManager.SetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
3935 }
3936 
3937 /**
3938  * @tc.name: InputWindowsManagerTest_IsInHotArea
3939  * @tc.desc: Test the funcation IsInHotArea
3940  * @tc.type: FUNC
3941  * @tc.require:
3942  */
3943 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea, TestSize.Level1)
3944 {
3945     CALL_TEST_DEBUG;
3946     InputWindowsManager inputWindowsManager;
3947     int32_t x = 10;
3948     int32_t y = 300;
3949     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3950     WindowInfo window;
3951     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3952 }
3953 
3954 /**
3955  * @tc.name: InputWindowsManagerTest_IsInHotArea_001
3956  * @tc.desc: Test the funcation IsInHotArea
3957  * @tc.type: FUNC
3958  * @tc.require:
3959  */
3960 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_001, TestSize.Level1)
3961 {
3962     CALL_TEST_DEBUG;
3963     InputWindowsManager inputWindowsManager;
3964     int32_t x = 300;
3965     int32_t y = 300;
3966     std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
3967     WindowInfo window;
3968     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3969 }
3970 
3971 /**
3972  * @tc.name: InputWindowsManagerTest_IsInHotArea_002
3973  * @tc.desc: Test the funcation IsInHotArea
3974  * @tc.type: FUNC
3975  * @tc.require:
3976  */
3977 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_002, TestSize.Level1)
3978 {
3979     CALL_TEST_DEBUG;
3980     InputWindowsManager inputWindowsManager;
3981     int32_t x = 300;
3982     int32_t y = 10;
3983     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3984     WindowInfo window;
3985     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3986 }
3987 
3988 /**
3989  * @tc.name: InputWindowsManagerTest_IsInHotArea_003
3990  * @tc.desc: Test the funcation IsInHotArea
3991  * @tc.type: FUNC
3992  * @tc.require:
3993  */
3994 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_003, TestSize.Level1)
3995 {
3996     CALL_TEST_DEBUG;
3997     InputWindowsManager inputWindowsManager;
3998     int32_t x = 300;
3999     int32_t y = 300;
4000     std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
4001     WindowInfo window;
4002     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
4003 }
4004 
4005 /**
4006  * @tc.name: InputWindowsManagerTest_InWhichHotArea
4007  * @tc.desc: Test the funcation InWhichHotArea
4008  * @tc.type: FUNC
4009  * @tc.require:
4010  */
4011 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea, TestSize.Level1)
4012 {
4013     CALL_TEST_DEBUG;
4014     InputWindowsManager inputWindowsManager;
4015     int32_t x = 50;
4016     int32_t y = 300;
4017     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
4018     PointerStyle pointerStyle;
4019     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
4020 }
4021 
4022 /**
4023  * @tc.name: InputWindowsManagerTest_InWhichHotArea_001
4024  * @tc.desc: Test the funcation InWhichHotArea
4025  * @tc.type: FUNC
4026  * @tc.require:
4027  */
4028 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_001, TestSize.Level1)
4029 {
4030     CALL_TEST_DEBUG;
4031     InputWindowsManager inputWindowsManager;
4032     int32_t x = 300;
4033     int32_t y = 300;
4034     std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
4035     PointerStyle pointerStyle;
4036     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
4037 }
4038 
4039 /**
4040  * @tc.name: InputWindowsManagerTest_InWhichHotArea_002
4041  * @tc.desc: Test the funcation InWhichHotArea
4042  * @tc.type: FUNC
4043  * @tc.require:
4044  */
4045 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_002, TestSize.Level1)
4046 {
4047     CALL_TEST_DEBUG;
4048     InputWindowsManager inputWindowsManager;
4049     int32_t x = 300;
4050     int32_t y = 50;
4051     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
4052     PointerStyle pointerStyle;
4053     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
4054 }
4055 
4056 /**
4057  * @tc.name: InputWindowsManagerTest_InWhichHotArea_003
4058  * @tc.desc: Test the funcation InWhichHotArea
4059  * @tc.type: FUNC
4060  * @tc.require:
4061  */
4062 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_003, TestSize.Level1)
4063 {
4064     CALL_TEST_DEBUG;
4065     InputWindowsManager inputWindowsManager;
4066     int32_t x = 300;
4067     int32_t y = 300;
4068     std::vector<Rect> rects = { { 100, 100, 1000, 100 } };
4069     PointerStyle pointerStyle;
4070     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
4071 }
4072 
4073 /**
4074  * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas
4075  * @tc.desc: Test the funcation UpdatePointerChangeAreas
4076  * @tc.type: FUNC
4077  * @tc.require:
4078  */
4079 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas, TestSize.Level1)
4080 {
4081     CALL_TEST_DEBUG;
4082     InputWindowsManager inputWindowsManager;
4083     OLD::DisplayGroupInfo displayGroupInfo;
4084     WindowInfo winInfo;
4085     winInfo.id = 100;
4086     winInfo.area;
4087     displayGroupInfo.windowsInfo.push_back(winInfo);
4088     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerChangeAreas(displayGroupInfo));
4089 }
4090 
4091 /**
4092  * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas_001
4093  * @tc.desc: Test the funcation UpdatePointerChangeAreas
4094  * @tc.type: FUNC
4095  * @tc.require:
4096  */
4097 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_001, TestSize.Level1)
4098 {
4099     CALL_TEST_DEBUG;
4100     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
4101     InputWindowsManager inputWindowsManager;
4102     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerChangeAreas());
4103 }
4104 
4105 /**
4106  * @tc.name: InputWindowsManagerTest_GetWidthAndHeight
4107  * @tc.desc: Test the funcation GetWidthAndHeight
4108  * @tc.type: FUNC
4109  * @tc.require:
4110  */
4111 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight, TestSize.Level1)
4112 {
4113     CALL_TEST_DEBUG;
4114     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
4115     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
4116     InputWindowsManager inputWindowsManager;
4117     OLD::DisplayInfo displayInfo;
4118     int32_t width = 300;
4119     int32_t height = 300;
4120     displayInfo.direction = DIRECTION90;
4121     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetWidthAndHeight(&displayInfo, width, height));
4122 }
4123 
4124 /**
4125  * @tc.name: InputWindowsManagerTest_InWhichHotArea_004
4126  * @tc.desc: Test the funcation InWhichHotArea
4127  * @tc.type: FUNC
4128  * @tc.require:
4129  */
4130 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_004, TestSize.Level1)
4131 {
4132     CALL_TEST_DEBUG;
4133     InputWindowsManager inputWindowsManager;
4134     int32_t x = 50;
4135     int32_t y = 300;
4136     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
4137     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
4138 }
4139 
4140 /**
4141  * @tc.name: InputWindowsManagerTest_InWhichHotArea_005
4142  * @tc.desc: Test the funcation InWhichHotArea
4143  * @tc.type: FUNC
4144  * @tc.require:
4145  */
4146 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_005, TestSize.Level1)
4147 {
4148     CALL_TEST_DEBUG;
4149     InputWindowsManager inputWindowsManager;
4150     int32_t x = 300;
4151     int32_t y = 300;
4152     std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
4153     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
4154 }
4155 
4156 /**
4157  * @tc.name: InputWindowsManagerTest_InWhichHotArea_006
4158  * @tc.desc: Test the funcation InWhichHotArea
4159  * @tc.type: FUNC
4160  * @tc.require:
4161  */
4162 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_006, TestSize.Level1)
4163 {
4164     CALL_TEST_DEBUG;
4165     InputWindowsManager inputWindowsManager;
4166     int32_t x = 300;
4167     int32_t y = 50;
4168     std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
4169     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
4170 }
4171 
4172 /**
4173  * @tc.name: InputWindowsManagerTest_InWhichHotArea_007
4174  * @tc.desc: Test the funcation InWhichHotArea
4175  * @tc.type: FUNC
4176  * @tc.require:
4177  */
4178 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_007, TestSize.Level1)
4179 {
4180     CALL_TEST_DEBUG;
4181     InputWindowsManager inputWindowsManager;
4182     int32_t x = 300;
4183     int32_t y = 300;
4184     std::vector<Rect> rects = { { 100, 100, 1000, 100 } };
4185     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
4186 }
4187 
4188 /**
4189  * @tc.name: DrawTouchGraphic_004
4190  * @tc.desc: Test the function DrawTouchGraphic
4191  * @tc.type: FUNC
4192  * @tc.require:
4193  */
4194 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_004, TestSize.Level1)
4195 {
4196     CALL_TEST_DEBUG;
4197     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4198         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4199     ASSERT_NE(inputWindowsManager, nullptr);
4200     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4201     ASSERT_NE(pointerEvent, nullptr);
4202     int32_t displayId = 10;
4203     pointerEvent->SetTargetDisplayId(displayId);
4204 
4205     OLD::DisplayInfo displayInfo;
4206     displayInfo.id = 10;
4207     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4208     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4209         it->second.displaysInfo.push_back(displayInfo);
4210     }
4211 
4212     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
4213 }
4214 
4215 /**
4216  * @tc.name: SetWindowStateNotifyPid_001
4217  * @tc.desc: Test the function DrawTouchGraphic
4218  * @tc.type: FUNC
4219  * @tc.require:
4220  */
4221 HWTEST_F(InputWindowsManagerTest, SetWindowStateNotifyPid_001, TestSize.Level1)
4222 {
4223     CALL_TEST_DEBUG;
4224     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4225         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4226     ASSERT_NE(inputWindowsManager, nullptr);
4227 
4228     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
4229     int32_t pid = 0;
4230     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SetWindowStateNotifyPid(pid));
4231 
4232     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4233     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SetWindowStateNotifyPid(pid));
4234 }
4235 
4236 /**
4237  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_002
4238  * @tc.desc: Test the funcation SendUIExtentionPointerEvent
4239  * @tc.type: FUNC
4240  * @tc.require:
4241  */
4242 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_002, TestSize.Level1)
4243 {
4244     CALL_TEST_DEBUG;
4245     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
4246     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
4247     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
4248     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
4249     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4250         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4251     ASSERT_NE(inputWindowsManager, nullptr);
4252     int32_t logicalX = 100;
4253     int32_t logicalY = 200;
4254 
4255     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4256     ASSERT_NE(pointerEvent, nullptr);
4257     pointerEvent->pointerId_ = 1;
4258     PointerEvent::PointerItem item;
4259     item.pointerId_ = 1;
4260     pointerEvent->pointers_.push_back(item);
4261     int32_t displayId = 10;
4262     pointerEvent->SetTargetDisplayId(displayId);
4263 
4264     WindowInfo windowInfo;
4265     windowInfo.id = 1;
4266     windowInfo.pid = 11;
4267     windowInfo.transform.push_back(1.1);
4268 
4269     OLD::DisplayInfo displayInfo;
4270     displayInfo.id = 10;
4271     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4272     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4273         it->second.displaysInfo.push_back(displayInfo);
4274     }
4275 
4276     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
4277         (logicalX, logicalY, windowInfo, pointerEvent));
4278 }
4279 
4280 /**
4281  * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_003
4282  * @tc.desc: Test the funcation SendUIExtentionPointerEvent
4283  * @tc.type: FUNC
4284  * @tc.require:
4285  */
4286 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_003, TestSize.Level1)
4287 {
4288     CALL_TEST_DEBUG;
4289     EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillRepeatedly(Return(1));
4290     SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
4291     EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
4292     EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
4293     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4294         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4295     ASSERT_NE(inputWindowsManager, nullptr);
4296     int32_t logicalX = 100;
4297     int32_t logicalY = 200;
4298 
4299     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4300     ASSERT_NE(pointerEvent, nullptr);
4301     pointerEvent->pointerId_ = 1;
4302     PointerEvent::PointerItem item;
4303     item.pointerId_ = 1;
4304     pointerEvent->pointers_.push_back(item);
4305     int32_t displayId = 10;
4306     pointerEvent->SetTargetDisplayId(displayId);
4307 
4308     WindowInfo windowInfo;
4309     windowInfo.id = 1;
4310     windowInfo.pid = 11;
4311     windowInfo.transform.push_back(1.1);
4312 
4313     OLD::DisplayInfo displayInfo;
4314     displayInfo.id = 10;
4315     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4316     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4317         it->second.displaysInfo.push_back(displayInfo);
4318     }
4319 
4320     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
4321         (logicalX, logicalY, windowInfo, pointerEvent));
4322 }
4323 
4324 /**
4325  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_003
4326  * @tc.desc: Test the funcation SelectWindowInfo
4327  * @tc.type: FUNC
4328  * @tc.require:
4329  */
4330 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_003, TestSize.Level1)
4331 {
4332     CALL_TEST_DEBUG;
4333     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4334         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4335     ASSERT_NE(inputWindowsManager, nullptr);
4336     int32_t logicalX = 10;
4337     int32_t logicalY = 20;
4338     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4339     EXPECT_NE(pointerEvent, nullptr);
4340     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_DOWN;
4341     pointerEvent->SetDeviceId(CAST_INPUT_DEVICEID);
4342     inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
4343     PointerEvent::PointerItem pointerItem;
4344     pointerItem.targetWindowId_ = 2;
4345     inputWindowsManager->extraData_.appended = true;
4346     inputWindowsManager->extraData_.sourceType = PointerEvent::POINTER_ACTION_DOWN;
4347     WindowInfo windowInfo;
4348     windowInfo.id = 1;
4349     windowInfo.pid = 11;
4350     windowInfo.isSkipSelfWhenShowOnVirtualScreen = true;
4351     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4352     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4353         it->second.windowsInfo.push_back(windowInfo);
4354     }
4355     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
4356 }
4357 
4358 /**
4359  * @tc.name: InputWindowsManagerTest_SkipPrivacyProtectionWindow
4360  * @tc.desc: Test the funcation SkipPrivacyProtectionWindow
4361  * @tc.type: FUNC
4362  * @tc.require:
4363  */
4364 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipPrivacyProtectionWindow, TestSize.Level1)
4365 {
4366     CALL_TEST_DEBUG;
4367     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4368         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4369     ASSERT_NE(inputWindowsManager, nullptr);
4370     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4371     EXPECT_NE(pointerEvent, nullptr);
4372     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_DOWN;
4373     pointerEvent->SetDeviceId(CAST_INPUT_DEVICEID);
4374     inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
4375     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
4376     bool isSkip = true;
4377     EXPECT_FALSE(inputWindowsManager->SkipPrivacyProtectionWindow(pointerEvent, isSkip));
4378     inputWindowsManager->privacyProtection_.isOpen = true;
4379     EXPECT_TRUE(inputWindowsManager->isOpenPrivacyProtectionserver_);
4380     EXPECT_TRUE(inputWindowsManager->SkipPrivacyProtectionWindow(pointerEvent, isSkip));
4381     isSkip = false;
4382     EXPECT_FALSE(inputWindowsManager->SkipPrivacyProtectionWindow(pointerEvent, isSkip));
4383 }
4384 
4385 /**
4386  * @tc.name: InputWindowsManagerTest_GetActiveWindowTypeById
4387  * @tc.desc: Test the funcation GetActiveWindowTypeById
4388  * @tc.type: FUNC
4389  * @tc.require:
4390  */
4391 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetActiveWindowTypeById, TestSize.Level1)
4392 {
4393     CALL_TEST_DEBUG;
4394     std::shared_ptr<InputWindowsManager> inputWindowsManager = std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4395     ASSERT_NE(inputWindowsManager, nullptr);
4396     int32_t windowId = 1;
4397     int32_t pointerId = 0;
4398     auto windowTypeTemp = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4399     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetActiveWindowTypeById(windowId, windowTypeTemp));
4400 
4401     inputWindowsManager->activeTouchWinTypes_.emplace(
4402         windowId, InputWindowsManager::ActiveTouchWin{WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE, { pointerId }});
4403     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetActiveWindowTypeById(windowId, windowTypeTemp));
4404 }
4405 
4406 /**
4407  * @tc.name: InputWindowsManagerTest_AddActiveWindow_001
4408  * @tc.desc: Test the function AddActiveWindow_001
4409  * @tc.type: FUNC
4410  * @tc.require:
4411  */
4412 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AddActiveWindow_001, TestSize.Level1)
4413 {
4414     CALL_TEST_DEBUG;
4415     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4416         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4417     ASSERT_NE(inputWindowsManager, nullptr);
4418     int32_t windowId = 1;
4419     int32_t pointerId = 0;
4420     auto windowTypeTemp = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4421     inputWindowsManager->activeTouchWinTypes_.emplace(
4422         windowId, InputWindowsManager::ActiveTouchWin{WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE, { pointerId }});
4423     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AddActiveWindow(windowId, pointerId));
4424 }
4425 
4426 /**
4427  * @tc.name: InputWindowsManagerTest_AddActiveWindow_002
4428  * @tc.desc: Test the function AddActiveWindow_002
4429  * @tc.type: FUNC
4430  * @tc.require:
4431  */
4432 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AddActiveWindow_002, TestSize.Level1)
4433 {
4434     CALL_TEST_DEBUG;
4435     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4436         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4437     ASSERT_NE(inputWindowsManager, nullptr);
4438     int32_t windowId = 1;
4439     int32_t pointerId = 0;
4440     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AddActiveWindow(windowId, pointerId));
4441 
4442     WindowInfo windowInfo;
4443     windowInfo.id = 1;
4444     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4445     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4446     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4447         it->second.windowsInfo.push_back(windowInfo);
4448     }
4449     inputWindowsManager->AddActiveWindow(windowId, pointerId);
4450     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AddActiveWindow(windowId, pointerId));
4451 }
4452 
4453 /**
4454  * @tc.name: InputWindowsManagerTest_RemoveActiveWindow_001
4455  * @tc.desc: Test the function RemoveActiveWindow_001
4456  * @tc.type: FUNC
4457  * @tc.require:
4458  */
4459 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RemoveActiveWindow_001, TestSize.Level1)
4460 {
4461     CALL_TEST_DEBUG;
4462     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4463         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4464     ASSERT_NE(inputWindowsManager, nullptr);
4465     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4466     EXPECT_NE(pointerEvent, nullptr);
4467 
4468     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UP);
4469     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4470 
4471     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
4472     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4473 
4474     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
4475     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4476 
4477     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_THROW);
4478     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4479 }
4480 
4481 /**
4482  * @tc.name: InputWindowsManagerTest_RemoveActiveWindow_002
4483  * @tc.desc: Test the function RemoveActiveWindow_002
4484  * @tc.type: FUNC
4485  * @tc.require:
4486  */
4487 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RemoveActiveWindow_002, TestSize.Level1)
4488 {
4489     CALL_TEST_DEBUG;
4490     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4491         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4492     ASSERT_NE(inputWindowsManager, nullptr);
4493     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4494     EXPECT_NE(pointerEvent, nullptr);
4495     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
4496     int32_t windowId = 1;
4497     int32_t pointerIdA = 0;
4498     int32_t pointerIdB = 1;
4499     auto windowTypeTemp = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4500     inputWindowsManager->activeTouchWinTypes_.emplace(
4501         windowId, InputWindowsManager::ActiveTouchWin{WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE, { pointerIdA }});
4502 
4503     pointerEvent->SetPointerId(pointerIdB);
4504     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4505     pointerEvent->SetPointerId(pointerIdA);
4506     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->RemoveActiveWindow(pointerEvent));
4507 }
4508 
4509 #ifdef OHOS_BUILD_ENABLE_POINTER
4510 /**
4511  * @tc.name: InputWindowsManagerTest_HandleHardWareCursorTest001
4512  * @tc.desc: Test the function HandleHardWareCursor
4513  * @tc.type: FUNC
4514  * @tc.require:
4515  */
4516 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleHardWareCursorTest001, TestSize.Level1)
4517 {
4518     CALL_TEST_DEBUG;
4519     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4520         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4521     ASSERT_NE(inputWindowsManager, nullptr);
4522     std::shared_ptr<OLD::DisplayInfo> physicalDisplayInfo = std::make_shared<OLD::DisplayInfo>();
4523     ASSERT_NE(physicalDisplayInfo, nullptr);
4524     physicalDisplayInfo->direction = Direction::DIRECTION0;
4525     physicalDisplayInfo->displayDirection = Direction::DIRECTION0;
4526     physicalDisplayInfo->validWidth = 1024;
4527     physicalDisplayInfo->validHeight = 768;
4528 
4529     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
4530     std::vector<int32_t> result = inputWindowsManager->HandleHardwareCursor(physicalDisplayInfo.get(), 512, 384);
4531     EXPECT_EQ(result[0], 512);
4532     EXPECT_EQ(result[1], 384);
4533 }
4534 
4535 /**
4536  * @tc.name: InputWindowsManagerTest_HandleHardWareCursorTest002
4537  * @tc.desc: Test the function HandleHardWareCursor
4538  * @tc.type: FUNC
4539  * @tc.require:
4540  */
4541 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleHardWareCursorTest002, TestSize.Level1)
4542 {
4543     CALL_TEST_DEBUG;
4544     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4545         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4546     ASSERT_NE(inputWindowsManager, nullptr);
4547     std::shared_ptr<OLD::DisplayInfo> physicalDisplayInfo = std::make_shared<OLD::DisplayInfo>();
4548     ASSERT_NE(physicalDisplayInfo, nullptr);
4549     physicalDisplayInfo->direction = Direction::DIRECTION90;
4550     physicalDisplayInfo->displayDirection = Direction::DIRECTION0;
4551     physicalDisplayInfo->validWidth = 1024;
4552     physicalDisplayInfo->validHeight = 768;
4553 
4554     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4555     std::vector<int32_t> result = inputWindowsManager->HandleHardwareCursor(physicalDisplayInfo.get(), 512, 384);
4556 }
4557 
4558 
4559 /**
4560  * @tc.name: InputWindowsManagerTest_UpdateMouseTargetTest015
4561  * @tc.desc: Test the function UpdateMouseTarget
4562  * @tc.type: FUNC
4563  * @tc.require:
4564  */
4565 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest015, TestSize.Level1)
4566 {
4567     CALL_TEST_DEBUG;
4568     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4569         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4570     ASSERT_NE(inputWindowsManager, nullptr);
4571     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4572     ASSERT_NE(pointerEvent, nullptr);
4573     pointerEvent->SetTargetDisplayId(1);
4574     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
4575     OLD::DisplayInfo displayInfo;
4576     displayInfo.id = 1;
4577     displayInfo.x = 300;
4578     displayInfo.y = 500;
4579     displayInfo.width = 1024;
4580     displayInfo.height = 768;
4581     displayInfo.displayDirection = Direction::DIRECTION0;
4582     displayInfo.direction = Direction::DIRECTION180;
4583     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4584     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4585         it->second.displaysInfo.push_back(displayInfo);
4586     }
4587     PointerEvent::PointerItem item;
4588     item.SetPointerId(1);
4589     item.SetDisplayX(150);
4590     item.SetDisplayY(300);
4591     pointerEvent->AddPointerItem(item);
4592     pointerEvent->SetPointerId(1);
4593     EXPECT_CALL(*messageParcelMock_, UpdateDisplayId(_)).WillOnce(Return(true));
4594     EXPECT_CALL(*messageParcelMock_, SelectWindowInfo(_, _, _)).WillOnce(Return(std::nullopt));
4595     EXPECT_CALL(*messageParcelMock_, GetHardCursorEnabled()).WillRepeatedly(Return(true));
4596     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4597     EXPECT_EQ(inputWindowsManager->UpdateMouseTarget(pointerEvent), RET_ERR);
4598 }
4599 
4600 /**
4601  * @tc.name: InputWindowsManagerTest_UpdateMouseTargetTest016
4602  * @tc.desc: Test the function UpdateMouseTarget
4603  * @tc.type: FUNC
4604  * @tc.require:
4605  */
4606 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest016, TestSize.Level1)
4607 {
4608     CALL_TEST_DEBUG;
4609     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4610         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4611     ASSERT_NE(inputWindowsManager, nullptr);
4612     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4613     ASSERT_NE(pointerEvent, nullptr);
4614     pointerEvent->SetTargetDisplayId(1);
4615     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
4616     OLD::DisplayInfo displayInfo;
4617     displayInfo.id = 1;
4618     displayInfo.x = 300;
4619     displayInfo.y = 500;
4620     displayInfo.width = 1024;
4621     displayInfo.height = 768;
4622     displayInfo.displayDirection = Direction::DIRECTION0;
4623     displayInfo.direction = Direction::DIRECTION180;
4624     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4625     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4626         it->second.displaysInfo.push_back(displayInfo);
4627     }
4628     PointerEvent::PointerItem item;
4629     item.SetPointerId(1);
4630     item.SetDisplayX(150);
4631     item.SetDisplayY(300);
4632     pointerEvent->AddPointerItem(item);
4633     pointerEvent->SetPointerId(1);
4634     EXPECT_CALL(*messageParcelMock_, UpdateDisplayId(_)).WillOnce(Return(true));
4635     EXPECT_CALL(*messageParcelMock_, SelectWindowInfo(_, _, _)).WillOnce(Return(std::nullopt));
4636     EXPECT_CALL(*messageParcelMock_, GetHardCursorEnabled()).WillRepeatedly(Return(false));
4637     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4638     EXPECT_EQ(inputWindowsManager->UpdateMouseTarget(pointerEvent), RET_ERR);
4639 }
4640 
4641 /**
4642  * @tc.name: InputWindowsManagerTest_UpdateMouseTargetTest017
4643  * @tc.desc: Test the function UpdateMouseTarget
4644  * @tc.type: FUNC
4645  * @tc.require:
4646  */
4647 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest017, TestSize.Level1)
4648 {
4649     CALL_TEST_DEBUG;
4650     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4651         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4652     ASSERT_NE(inputWindowsManager, nullptr);
4653     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4654     ASSERT_NE(pointerEvent, nullptr);
4655     pointerEvent->SetTargetDisplayId(1);
4656     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
4657     OLD::DisplayInfo displayInfo;
4658     displayInfo.id = 1;
4659     displayInfo.x = 300;
4660     displayInfo.y = 500;
4661     displayInfo.width = 1024;
4662     displayInfo.height = 768;
4663     displayInfo.displayDirection = Direction::DIRECTION0;
4664     displayInfo.direction = Direction::DIRECTION180;
4665     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4666     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4667         it->second.displaysInfo.push_back(displayInfo);
4668     }
4669     PointerEvent::PointerItem item;
4670     item.SetPointerId(1);
4671     item.SetDisplayX(150);
4672     item.SetDisplayY(300);
4673     pointerEvent->AddPointerItem(item);
4674     pointerEvent->SetPointerId(1);
4675     EXPECT_CALL(*messageParcelMock_, UpdateDisplayId(_)).WillOnce(Return(true));
4676     EXPECT_CALL(*messageParcelMock_, SelectWindowInfo(_, _, _)).WillOnce(Return(std::nullopt));
4677     EXPECT_CALL(*messageParcelMock_, GetHardCursorEnabled()).WillRepeatedly(Return(true));
4678     EXPECT_CALL(*messageParcelMock_, HandleHardwareCursor(_, _, _)).WillOnce(Return(std::vector<int32_t>({ 1 })));
4679     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4680     EXPECT_EQ(inputWindowsManager->UpdateMouseTarget(pointerEvent), RET_ERR);
4681 }
4682 
4683 /**
4684  * @tc.name: InputWindowsManagerTest_UpdateMouseTargetTest018
4685  * @tc.desc: Test the function UpdateMouseTarget
4686  * @tc.type: FUNC
4687  * @tc.require:
4688  */
4689 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest018, TestSize.Level1)
4690 {
4691     CALL_TEST_DEBUG;
4692     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4693         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4694     ASSERT_NE(inputWindowsManager, nullptr);
4695     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4696     ASSERT_NE(pointerEvent, nullptr);
4697     pointerEvent->SetTargetDisplayId(1);
4698     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
4699     OLD::DisplayInfo displayInfo;
4700     displayInfo.id = 1;
4701     displayInfo.x = 300;
4702     displayInfo.y = 500;
4703     displayInfo.width = 1024;
4704     displayInfo.height = 768;
4705     displayInfo.displayDirection = Direction::DIRECTION0;
4706     displayInfo.direction = Direction::DIRECTION180;
4707     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4708     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4709         it->second.displaysInfo.push_back(displayInfo);
4710     }
4711     PointerEvent::PointerItem item;
4712     item.SetPointerId(1);
4713     item.SetDisplayX(150);
4714     item.SetDisplayY(300);
4715     pointerEvent->AddPointerItem(item);
4716     pointerEvent->SetPointerId(1);
4717     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY);
4718     EXPECT_CALL(*messageParcelMock_, UpdateDisplayId(_)).WillOnce(Return(true));
4719     EXPECT_CALL(*messageParcelMock_, SelectWindowInfo(_, _, _)).WillOnce(Return(std::nullopt));
4720     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
4721     EXPECT_EQ(inputWindowsManager->UpdateMouseTarget(pointerEvent), RET_ERR);
4722 }
4723 
4724 /**
4725  * @tc.name: InputWindowsManagerTest_UpdateMouseTargetTest019
4726  * @tc.desc: Test the function UpdateMouseTarget
4727  * @tc.type: FUNC
4728  * @tc.require:
4729  */
4730 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_019, TestSize.Level1)
4731 {
4732     CALL_TEST_DEBUG;
4733     EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
4734     EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
4735     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4736         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4737     ASSERT_NE(inputWindowsManager, nullptr);
4738     WindowInfo windowInfo;
4739     windowInfo.id = -1;
4740     windowInfo.pid = 11;
4741     windowInfo.transform.push_back(1.1);
4742     auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4743     if (it != inputWindowsManager->displayGroupInfoMap_.end()) {
4744         it->second.windowsInfo.push_back(windowInfo);
4745     }
4746     UDSServer udsServer;
4747     inputWindowsManager->udsServer_ = &udsServer;
4748     inputWindowsManager->mouseDownInfo_.id = 1;
4749     inputWindowsManager->dragFlag_ = true;
4750     inputWindowsManager->isDragBorder_ = true;
4751     inputWindowsManager->isUiExtension_ = false;
4752     it->second.focusWindowId = -1;
4753     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
4754     inputWindowsManager->captureModeInfo_.windowId = -1;
4755     inputWindowsManager->extraData_.appended = true;
4756     inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
4757     OLD::DisplayInfo displayInfo;
4758     displayInfo.id = 0;
4759     displayInfo.displayDirection = DIRECTION90;
4760     it->second.displaysInfo.push_back(displayInfo);
4761     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4762     ASSERT_NE(pointerEvent, nullptr);
4763     PointerEvent::PointerItem item;
4764     pointerEvent->AddPointerItem(item);
4765     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ENTER_WINDOW);
4766     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY);
4767     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
4768     it->second.displaysInfo.clear();
4769     inputWindowsManager->dragFlag_ = false;
4770     inputWindowsManager->isDragBorder_ = false;
4771     inputWindowsManager->isUiExtension_ = false;
4772     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
4773     inputWindowsManager->mouseDownInfo_.id = -1;
4774     inputWindowsManager->udsServer_ = nullptr;
4775     it->second.windowsInfo.clear();
4776     inputWindowsManager->extraData_.appended = false;
4777     inputWindowsManager->extraData_.sourceType = -1;
4778 }
4779 
4780 #endif /* OHOS_BUILD_ENABLE_POINTER */
4781 
4782 /**
4783  * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_006
4784  * @tc.desc: Test the funcation AdjustDisplayRotation
4785  * @tc.type: FUNC
4786  * @tc.require:
4787  */
4788 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_006, TestSize.Level1)
4789 {
4790     CALL_TEST_DEBUG;
4791     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4792         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4793     ASSERT_NE(inputWindowsManager, nullptr);
4794     CursorPosition cursorPosRef;
4795     auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID);
4796     if (it != inputWindowsManager->cursorPosMap_.end()) {
4797         cursorPosRef = it->second;
4798     }
4799     cursorPosRef.direction = Direction::DIRECTION0;
4800     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
4801     cursorPosRef.direction = Direction::DIRECTION90;
4802     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
4803     cursorPosRef.direction = Direction::DIRECTION180;
4804     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
4805     cursorPosRef.direction = Direction::DIRECTION270;
4806     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
4807 }
4808 
4809 /**
4810  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_010
4811  * @tc.desc: Test the function FoldScreenRotation
4812  * @tc.type: FUNC
4813  * @tc.require:
4814  */
4815 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_010, TestSize.Level1)
4816 {
4817     CALL_TEST_DEBUG;
4818     InputWindowsManager inputWindowsManager;
4819     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4820     ASSERT_NE(pointerEvent, nullptr);
4821     WindowInfoEX winInfoEx;
4822     OLD::DisplayInfo displayInfo;
4823     displayInfo.id = 10;
4824     pointerEvent->bitwise_ = 0x00000080;
4825     pointerEvent->SetPointerId(1);
4826     pointerEvent->SetTargetDisplayId(10);
4827     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4828     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
4829     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
4830     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
4831 }
4832 
4833 /**
4834  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_011
4835  * @tc.desc: Test the function FoldScreenRotation
4836  * @tc.type: FUNC
4837  * @tc.require:
4838  */
4839 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_011, TestSize.Level1)
4840 {
4841     CALL_TEST_DEBUG;
4842     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
4843     InputWindowsManager inputWindowsManager;
4844     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4845     ASSERT_NE(pointerEvent, nullptr);
4846     WindowInfoEX winInfoEx;
4847     OLD::DisplayInfo displayInfo;
4848     displayInfo.id = 10;
4849     pointerEvent->bitwise_ = 0x00000080;
4850     pointerEvent->SetPointerId(1);
4851     pointerEvent->SetTargetDisplayId(10);
4852     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4853     OLD::DisplayGroupInfo displayGroupInfoRef;
4854     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4855     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
4856         displayGroupInfoRef = it->second;
4857     }
4858     displayGroupInfoRef.displaysInfo.push_back(displayInfo);
4859     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
4860     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
4861 }
4862 
4863 /**
4864  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_012
4865  * @tc.desc: Test the function FoldScreenRotation
4866  * @tc.type: FUNC
4867  * @tc.require:
4868  */
4869 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_012, TestSize.Level1)
4870 {
4871     CALL_TEST_DEBUG;
4872     EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
4873     InputWindowsManager inputWindowsManager;
4874     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4875     ASSERT_NE(pointerEvent, nullptr);
4876     WindowInfoEX winInfoEx;
4877     OLD::DisplayInfo displayInfo;
4878     displayInfo.id = 10;
4879     pointerEvent->bitwise_ = 0x00000080;
4880     pointerEvent->SetPointerId(1);
4881     pointerEvent->SetTargetDisplayId(10);
4882     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4883     OLD::DisplayGroupInfo displayGroupInfoRef;
4884     auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID);
4885     if (it != inputWindowsManager.displayGroupInfoMap_.end()) {
4886         displayGroupInfoRef = it->second;
4887     }
4888     displayGroupInfoRef.displaysInfo.push_back(displayInfo);
4889     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
4890     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
4891 }
4892 
4893 /**
4894  * @tc.name: InputWindowsManagerTest_HandleHardWareCursorTest003
4895  * @tc.desc: Test the funcation HandleHardWareCursor
4896  * @tc.type: FUNC
4897  * @tc.require:
4898  */
4899 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleHardWareCursorTest003, TestSize.Level1)
4900 {
4901     CALL_TEST_DEBUG;
4902     std::shared_ptr<InputWindowsManager> inputWindowsManager =
4903         std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4904     ASSERT_NE(inputWindowsManager, nullptr);
4905     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleHardwareCursor(nullptr, 512, 384));
4906 }
4907 
4908 /* *
4909  * @tc.name: InputWindowsManagerTest_UpdateTargetTouchWinIds_001
4910  * @tc.desc: Test the funcation UpdateTargetTouchWinIds
4911  * @tc.type: FUNC
4912  * @tc.require:
4913  */
4914 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_NeedTouchTracking_001, TestSize.Level1)
4915 {
4916     CALL_TEST_DEBUG;
4917     std::shared_ptr<InputWindowsManager> inputWindowsManager = std::make_shared<InputWindowsManager>();
4918     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4919     ASSERT_NE(pointerEvent, nullptr);
4920     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->NeedTouchTracking(*pointerEvent));
4921 
4922     pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_ACCESSIBILITY;
4923     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->NeedTouchTracking(*pointerEvent));
4924 
4925     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_HOVER_CANCEL);
4926     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->NeedTouchTracking(*pointerEvent));
4927 
4928     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_HOVER_MOVE);
4929     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->NeedTouchTracking(*pointerEvent));
4930 }
4931 
4932 /* *
4933  * @tc.name: InputWindowsManagerTest_ShiftAppSimulateTouchPointerEvent001
4934  * @tc.desc: Test the funcation ShiftAppSimulateTouchPointerEvent
4935  * @tc.type: FUNC
4936  * @tc.require:
4937  */
4938 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppSimulateTouchPointerEvent001, TestSize.Level1)
4939 {
4940     CALL_TEST_DEBUG;
4941     std::shared_ptr<InputWindowsManager> inputWindowsManager = std::make_shared<InputWindowsManager>();
4942     ShiftWindowInfo shiftWindowInfo;
4943     shiftWindowInfo.fingerId = 1;
4944     PointerEvent::PointerItem item;
4945     int32_t pointerId = 0;
4946     item.SetPointerId(pointerId);
4947     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4948     ASSERT_NE(pointerEvent, nullptr);
4949     inputWindowsManager->lastTouchEvent_ = pointerEvent;
4950     pointerEvent->pointers_.push_back(item);
4951     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4952     shiftWindowInfo.fingerId = 0;
4953     item.pressed_ = false;
4954     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4955     item.pressed_ = true;
4956     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4957     shiftWindowInfo.x = -1;
4958     shiftWindowInfo.y = -1;
4959     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4960     shiftWindowInfo.x = 1;
4961     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4962     shiftWindowInfo.x = -1;
4963     shiftWindowInfo.y = 1;
4964     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->ShiftAppSimulateTouchPointerEvent(shiftWindowInfo));
4965 }
4966 
4967 /* *
4968  * @tc.name: InputWindowsManagerTest_TouchEnterLeaveEvent
4969  * @tc.desc: Test the funcation TouchEnterLeaveEvent
4970  * @tc.type: FUNC
4971  * @tc.require:
4972  */
4973 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchEnterLeaveEvent, TestSize.Level1)
4974 {
4975     CALL_TEST_DEBUG;
4976     std::shared_ptr<InputWindowsManager> inputWindowsManager = std::make_shared<InputWindowsManager>();
4977     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4978     ASSERT_NE(pointerEvent, nullptr);
4979     PointerEvent::PointerItem pointerItem;
4980     pointerItem.SetDisplayXPos(0.0);
4981     pointerItem.SetDisplayYPos(0.0);
4982     auto logicalX = 100;
4983     auto logicalY = 200;
4984     WindowInfo touchWindow;
4985     auto pointerId = 1;
4986     touchWindow.id = 1;
4987     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
4988     pointerEvent->targetWindowId_ = 1;
4989     pointerEvent->pointers_.clear();
4990     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
4991     pointerItem.SetPointerId(pointerId);
4992     pointerEvent->pointers_.push_back(pointerItem);
4993     EXPECT_EQ(pointerEvent->GetPointerCount(), pointerId);
4994     pointerEvent->SetPointerId(pointerId);
4995     EXPECT_TRUE(pointerEvent->GetPointerItem(pointerId, pointerItem));
4996     touchWindow.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
4997     inputWindowsManager->lastTouchWindowInfo_.id = touchWindow.id;
4998     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
4999 
5000     touchWindow.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5001     inputWindowsManager->lastTouchWindowInfo_.id = 5;
5002     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
5003 
5004     inputWindowsManager->lastTouchWindowInfo_.id = -1;
5005     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
5006 
5007     inputWindowsManager->lastTouchWindowInfo_.id = 5;
5008     touchWindow.windowInputType = WindowInputType::SLID_TOUCH_WINDOW;
5009     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
5010 }
5011 
5012 /**
5013  * @tc.name: InputWindowsManagerTest_GetClientFd_005
5014  * @tc.desc: Test the funcation GetClientFd
5015  * @tc.type: FUNC
5016  * @tc.require:
5017  */
5018 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_005, TestSize.Level1)
5019 {
5020     CALL_TEST_DEBUG;
5021     InputWindowsManager inputWindowsManager;
5022     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5023     ASSERT_NE(pointerEvent, nullptr);
5024     UDSServer udsServer;
5025     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5026     udsServer.idxPidMap_.insert(std::make_pair(-1, -1));
5027     inputWindowsManager.udsServer_ = &udsServer;
5028     WindowInfoEX winInfoEx;
5029     winInfoEx.flag = false;
5030     pointerEvent->SetPointerId(100);
5031     pointerEvent->bitwise_ = 0x00000080;
5032     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
5033     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
5034     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
5035     int32_t pointerId = 200;
5036     inputWindowsManager.touchItemDownInfos_.clear();
5037     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerId, winInfoEx));
5038     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), 1);
5039     winInfoEx.flag = true;
5040     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
5041     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), 1);
5042 }
5043 
5044 /**
5045  * @tc.name: InputWindowsManagerTest_GetClientFd_006
5046  * @tc.desc: Test the funcation GetClientFd
5047  * @tc.type: FUNC
5048  * @tc.require:
5049  */
5050 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_006, TestSize.Level1)
5051 {
5052     CALL_TEST_DEBUG;
5053     InputWindowsManager inputWindowsManager;
5054     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5055     ASSERT_NE(pointerEvent, nullptr);
5056     UDSServer udsServer;
5057     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5058     udsServer.idxPidMap_.insert(std::make_pair(-1, -1));
5059     inputWindowsManager.udsServer_ = &udsServer;
5060     WindowInfoEX winInfoEx;
5061     winInfoEx.flag = false;
5062     pointerEvent->SetPointerId(100);
5063     pointerEvent->bitwise_ = 0x00000000;
5064     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
5065     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
5066     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
5067 }
5068 
5069 /**
5070  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_011
5071  * @tc.desc: Test ShiftAppPointerEvent
5072  * @tc.type: FUNC
5073  * @tc.require:
5074  */
5075 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_011, TestSize.Level1)
5076 {
5077     CALL_TEST_DEBUG;
5078     InputWindowsManager inputWindowsManager;
5079     inputWindowsManager.lastTouchEvent_ = nullptr;
5080     int32_t sourceWindowId = 50;
5081     int32_t targetWindowId = 51;
5082     int32_t fingerId = 0;
5083     ShiftWindowParam param;
5084     param.sourceWindowId = sourceWindowId;
5085     param.targetWindowId = targetWindowId;
5086     param.sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
5087     param.fingerId = fingerId;
5088     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5089     EXPECT_NE(pointerEvent, nullptr);
5090     PointerEvent::PointerItem item;
5091     item.SetPointerId(0);
5092     item.SetOriginPointerId(1);
5093     pointerEvent->pointers_.push_back(item);
5094     pointerEvent->SetPointerId(0);
5095     pointerEvent->AddPointerItem(item);
5096     bool autoGenDown = true;
5097     int32_t displayId = 0;
5098     WindowGroupInfo windowGroupInfo;
5099     WindowInfo windowInfo;
5100     windowInfo.id = sourceWindowId;
5101     windowInfo.displayId = displayId;
5102     windowGroupInfo.windowsInfo.push_back(windowInfo);
5103     windowInfo.id = targetWindowId;
5104     windowGroupInfo.windowsInfo.push_back(windowInfo);
5105     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
5106     inputWindowsManager.lastTouchEvent_ = pointerEvent;
5107     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
5108     EXPECT_NE(ret, RET_OK);
5109 }
5110 
5111 /**
5112  * @tc.name: InputWindowsManagerTest_GetOriginPointerItem
5113  * @tc.desc: Test GetOriginPointerItem
5114  * @tc.type: FUNC
5115  * @tc.require:
5116  */
5117 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetOriginPointerItem, TestSize.Level1)
5118 {
5119     CALL_TEST_DEBUG;
5120     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5121     PointerEvent::PointerItem item1;
5122     PointerEvent::PointerItem item2;
5123     bool result = pointerEvent->GetOriginPointerItem(1, item2);
5124     EXPECT_FALSE(result);
5125     item1.SetOriginPointerId(1);
5126     pointerEvent->pointers_.push_back(item1);
5127     pointerEvent->SetPointerId(1);
5128     pointerEvent->AddPointerItem(item1);
5129     result = pointerEvent->GetOriginPointerItem(3, item2);
5130     EXPECT_FALSE(result);
5131     result = pointerEvent->GetOriginPointerItem(1, item2);
5132     EXPECT_TRUE(result);
5133 }
5134 
5135 /**
5136  * @tc.name: InputWindowsManagerTest_SendCancelEventWhenWindowChange_001
5137  * @tc.desc: Test the funcation SendCancelEventWhenWindowChange
5138  * @tc.type: FUNC
5139  * @tc.require:
5140  */
5141 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendCancelEventWhenWindowChange_001, TestSize.Level1)
5142 {
5143     CALL_TEST_DEBUG;
5144     std::shared_ptr<InputWindowsManager> inputWindowsManager = std::make_shared<InputWindowsManager>();
5145     int32_t pointerId = 100;
5146     inputWindowsManager->lastPointerEventforWindowChange_ = PointerEvent::Create();
5147     ASSERT_NE(inputWindowsManager->lastPointerEventforWindowChange_, nullptr);
5148     PointerEvent::PointerItem pointerItem;
5149     pointerItem.pointerId_ = pointerId;
5150     pointerItem.canceled_ = true;
5151     pointerItem.pressed_ = true;
5152     inputWindowsManager->lastPointerEventforWindowChange_->pointers_.push_back(pointerItem);
5153     EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendCancelEventWhenWindowChange(pointerId));
5154 }
5155 } // namespace MMI
5156 } // namespace OHOS