• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <cstdio>
17 #include <fstream>
18 #include <gtest/gtest.h>
19 
20 #include "event_filter_handler.h"
21 #include "input_device_manager.h"
22 #include "input_event_handler.h"
23 #include "input_windows_manager.h"
24 #include "i_pointer_drawing_manager.h"
25 #include "fingersense_wrapper.h"
26 #include "mmi_log.h"
27 #include "pointer_drawing_manager.h"
28 #include "proto.h"
29 #include "scene_board_judgement.h"
30 #include "struct_multimodal.h"
31 #include "uds_server.h"
32 #include "window_info.h"
33 
34 #undef MMI_LOG_TAG
35 #define MMI_LOG_TAG "InputWindowsManagerTest"
36 
37 namespace OHOS {
38 namespace MMI {
39 using namespace testing::ext;
40 namespace {
41 InputWindowsManager *g_instance;
42 constexpr uint32_t DEFAULT_ICON_COLOR { 0xFF };
43 constexpr int32_t MAX_PIXEL_MAP_WIDTH { 600 };
44 constexpr int32_t MAX_PIXEL_MAP_HEIGHT { 600 };
45 constexpr int32_t INT32_BYTE { 4 };
46 } // namespace
47 
48 #ifdef WIN_MGR
49 #undef WIN_MGR
50 #endif
51 #define WIN_MGR g_instance
52 
53 class InputWindowsManagerTest : public testing::Test {
54 public:
55     static void SetUpTestCase(void);
TearDownTestCase(void)56     static void TearDownTestCase(void) {};
57     static std::shared_ptr<Media::PixelMap> CreatePixelMap(int32_t width, int32_t height);
58     static SessionPtr CreateSessionPtr();
SetUp(void)59     void SetUp(void)
60     {
61         // 创建displayGroupInfo_
62         DisplayGroupInfo displayGroupInfo;
63         displayGroupInfo.width = 20;
64         displayGroupInfo.height = 20;
65         displayGroupInfo.focusWindowId = 1;
66         uint32_t num = 1;
67         for (uint32_t i = 0; i < num; i++) {
68             WindowInfo info;
69             info.id = 1;
70             info.pid = 1;
71             info.uid = 1;
72             info.area = {1, 1, 1, 1};
73             info.defaultHotAreas = { info.area };
74             info.pointerHotAreas = { info.area };
75             info.agentWindowId = 1;
76             info.flags = 1;
77             info.transform = {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
78             info.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 };
79             displayGroupInfo.windowsInfo.push_back(info);
80         }
81         for (uint32_t i = 0; i < num; i++) {
82             DisplayInfo info;
83             info.id = 1;
84             info.x =1;
85             info.y = 1;
86             info.width = 2;
87             info.height = 2;
88             info.dpi = 240;
89             info.name = "pp";
90             info.uniq = "pp";
91             info.direction = DIRECTION0;
92             displayGroupInfo.displaysInfo.push_back(info);
93         }
94         WIN_MGR->UpdateDisplayInfo(displayGroupInfo);
95         preHoverScrollState_ = WIN_MGR->GetHoverScrollState();
96     } // void SetUp(void)
97 
TearDown(void)98     void TearDown(void)
99     {
100         WIN_MGR->SetHoverScrollState(preHoverScrollState_);
101     }
102 
103 private:
104     bool preHoverScrollState_ { true };
105 };
106 
SetUpTestCase(void)107 void InputWindowsManagerTest::SetUpTestCase(void)
108 {
109     g_instance = static_cast<InputWindowsManager *>(IInputWindowsManager::GetInstance().get());
110 }
111 
FingersenseWrapperTest(int32_t num)112 void FingersenseWrapperTest(int32_t num) {}
113 
CreatePixelMap(int32_t width,int32_t height)114 std::shared_ptr<Media::PixelMap> InputWindowsManagerTest::CreatePixelMap(int32_t width, int32_t height)
115 {
116     CALL_DEBUG_ENTER;
117     if (width <= 0 || width > MAX_PIXEL_MAP_WIDTH || height <= 0 || height > MAX_PIXEL_MAP_HEIGHT) {
118         return nullptr;
119     }
120     Media::InitializationOptions opts;
121     opts.size.height = height;
122     opts.size.width = width;
123     opts.pixelFormat = Media::PixelFormat::BGRA_8888;
124     opts.alphaType = Media::AlphaType::IMAGE_ALPHA_TYPE_OPAQUE;
125     opts.scaleMode = Media::ScaleMode::FIT_TARGET_SIZE;
126 
127     int32_t colorLen = width * height;
128     uint32_t *pixelColors = new (std::nothrow) uint32_t[colorLen];
129     CHKPP(pixelColors);
130     int32_t colorByteCount = colorLen * INT32_BYTE;
131     errno_t ret = memset_s(pixelColors, colorByteCount, DEFAULT_ICON_COLOR, colorByteCount);
132     if (ret != EOK) {
133         delete[] pixelColors;
134         return nullptr;
135     }
136     std::shared_ptr<Media::PixelMap> pixelMap = Media::PixelMap::Create(pixelColors, colorLen, opts);
137     if (pixelMap == nullptr) {
138         delete[] pixelColors;
139         return nullptr;
140     }
141     delete[] pixelColors;
142     return pixelMap;
143 }
144 
CreateSessionPtr()145 SessionPtr InputWindowsManagerTest::CreateSessionPtr()
146 {
147     CALL_DEBUG_ENTER;
148     std::string programName = "uds_sesion_test";
149     int32_t moduleType = 3;
150         int32_t fd = -1;
151     int32_t uidRoot = 0;
152     int32_t pid = 9;
153     return std::make_shared<UDSSession>(programName, moduleType, fd, uidRoot, pid);
154 }
155 
156 /**
157  * @tc.name: InputWindowsManagerTest_GetClientFd_001
158  * @tc.desc: Test GetClientFd
159  * @tc.type: FUNC
160  * @tc.require:
161  */
162 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_001, TestSize.Level1)
163 {
164     CALL_TEST_DEBUG;
165     auto pointerEvent = PointerEvent::Create();
166     UDSServer udsServer;
167     WIN_MGR->Init(udsServer);
168     WIN_MGR->GetDisplayGroupInfo();
169     int32_t idNames = -1;
170     ASSERT_EQ(WIN_MGR->GetClientFd(pointerEvent), idNames);
171 }
172 
173 /**
174  * @tc.name: InputWindowsManagerTest_UpdateTarget_003
175  * @tc.desc: Test UpdateTarget
176  * @tc.type: FUNC
177  * @tc.require:
178  */
179 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTarget_003, TestSize.Level1)
180 {
181     CALL_TEST_DEBUG;
182     UDSServer udsServer;
183     WIN_MGR->Init(udsServer);
184     auto keyEvent = KeyEvent::Create();
185     ASSERT_NE(keyEvent, nullptr);
186     keyEvent->SetDeviceId(1);
187     keyEvent->SetTargetWindowId(1);
188     keyEvent->SetAgentWindowId(1);
189     EXPECT_NO_FATAL_FAILURE(WIN_MGR->UpdateTarget(keyEvent));
190 }
191 
192 /**
193  * @tc.name: InputWindowsManagerTest_HandleKeyEventWindowId_003
194  * @tc.desc: Test HandleKeyEventWindowId
195  * @tc.type: FUNC
196  * @tc.require:
197  */
198 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleKeyEventWindowId_001, TestSize.Level1)
199 {
200     CALL_TEST_DEBUG;
201     UDSServer udsServer;
202     WIN_MGR->Init(udsServer);
203     auto keyEvent = KeyEvent::Create();
204     ASSERT_NE(keyEvent, nullptr);
205     keyEvent->SetDeviceId(1);
206     keyEvent->SetTargetWindowId(1);
207     keyEvent->SetAgentWindowId(1);
208     WIN_MGR->HandleKeyEventWindowId(keyEvent);
209 }
210 
211 /**
212  * @tc.name: InputWindowsManagerTest_UpdateWindow_002
213  * @tc.desc: Test UpdateWindow
214  * @tc.type: FUNC
215  * @tc.require:
216  */
217 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindow_002, TestSize.Level1)
218 {
219     CALL_TEST_DEBUG;
220     WindowInfo window;
221     window.id = 11;
222     window.pid = 1221;
223     window.uid = 1;
224     window.area = {1, 1, 1, 1};
225     window.defaultHotAreas = { window.area };
226     window.pointerHotAreas = { window.area };
227     window.pointerChangeAreas = {1, 2, 1, 2};
228     window.displayId = 0;
229     window.agentWindowId = 1;
230     window.flags = 1;
231     window.action = WINDOW_UPDATE_ACTION::UNKNOWN;
232     WIN_MGR->UpdateWindowInfo({0, 11, {window}});
233     ASSERT_EQ(WIN_MGR->GetWindowPid(11), -1);
234 }
235 
236 /**
237  * @tc.name: InputWindowsManagerTest_UpdateTargetPointer_005
238  * @tc.desc: Test UpdateTargetPointer
239  * @tc.type: FUNC
240  * @tc.require:
241  */
242 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTargetPointer_005, TestSize.Level1)
243 {
244     CALL_TEST_DEBUG;
245     UDSServer udsServer;
246     WIN_MGR->Init(udsServer);
247     auto pointerEvent = PointerEvent::Create();
248     ASSERT_EQ(WIN_MGR->UpdateTargetPointer(pointerEvent), -1);
249 }
250 
251 /**
252  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_006
253  * @tc.desc: Test IsNeedRefreshLayer
254  * @tc.type: FUNC
255  * @tc.require:
256  */
257 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_006, TestSize.Level1)
258 {
259     CALL_TEST_DEBUG;
260     UDSServer udsServer;
261     WIN_MGR->Init(udsServer);
262     if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
263         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(-1), true);
264         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(0), true);
265         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(1), true);
266     } else {
267         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(-1), false);
268         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(0), false);
269         ASSERT_EQ(WIN_MGR->IsNeedRefreshLayer(1), false);
270     }
271 }
272 
273 /**
274  * @tc.name: InputWindowsManagerTest_SetMouseCaptureMode_008
275  * @tc.desc: Test SetMouseCaptureMode
276  * @tc.type: FUNC
277  * @tc.require:
278  */
279 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetMouseCaptureMode_008, TestSize.Level1)
280 {
281     CALL_TEST_DEBUG;
282     UDSServer udsServer;
283     WIN_MGR->Init(udsServer);
284     bool isCaptureMode = false;
285     ASSERT_EQ(WIN_MGR->SetMouseCaptureMode(-1, isCaptureMode), -1);
286     ASSERT_EQ(WIN_MGR->SetMouseCaptureMode(1, isCaptureMode), 0);
287     isCaptureMode = true;
288     ASSERT_EQ(WIN_MGR->SetMouseCaptureMode(1, isCaptureMode), 0);
289 }
290 
291 /**
292  * @tc.name: InputWindowsManagerTest_SetDisplayBind_009
293  * @tc.desc: Test SetDisplayBind
294  * @tc.type: FUNC
295  * @tc.require:
296  */
297 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetDisplayBind_009, TestSize.Level1)
298 {
299     CALL_TEST_DEBUG;
300     UDSServer udsServer;
301     WIN_MGR->Init(udsServer);
302     std::string sysUid = "james";
303     std::string devStatus = "add";
304     WIN_MGR->DeviceStatusChanged(2, sysUid, devStatus);
305     devStatus = "remove";
306     WIN_MGR->DeviceStatusChanged(2, sysUid, devStatus);
307     std::string msg = "There is in InputWindowsManagerTest_GetDisplayIdNames_009";
308     ASSERT_EQ(WIN_MGR->SetDisplayBind(-1, 1, msg), -1);
309 }
310 
311 /**
312  * @tc.name: InputWindowsManagerTest_SetHoverScrollState_010
313  * @tc.desc: Test SetHoverScrollState
314  * @tc.type: FUNC
315  * @tc.require:
316  */
317 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetHoverScrollState_010, TestSize.Level1)
318 {
319     CALL_TEST_DEBUG;
320     ASSERT_TRUE(WIN_MGR->SetHoverScrollState(false) == RET_OK);
321     WIN_MGR->SetHoverScrollState(true);
322 }
323 
324 /**
325  * @tc.name: InputWindowsManagerTest_GetHoverScrollState_011
326  * @tc.desc: Test GetHoverScrollState
327  * @tc.type: FUNC
328  * @tc.require:
329  */
330 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetHoverScrollState_011, TestSize.Level1)
331 {
332     CALL_TEST_DEBUG;
333     WIN_MGR->SetHoverScrollState(true);
334     ASSERT_TRUE(WIN_MGR->GetHoverScrollState());
335 }
336 
337 /**
338  * @tc.name: InputWindowsManagerTest_InitMouseDownInfo_001
339  * @tc.desc: Test initializing mouse down information
340  * @tc.type: FUNC
341  * @tc.require:
342  */
343 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InitMouseDownInfo_001, TestSize.Level1)
344 {
345     CALL_TEST_DEBUG;
346     WIN_MGR->InitMouseDownInfo();
347     EXPECT_EQ(WIN_MGR->mouseDownInfo_.id, -1);
348     EXPECT_EQ(WIN_MGR->mouseDownInfo_.pid, -1);
349     EXPECT_TRUE(WIN_MGR->mouseDownInfo_.defaultHotAreas.empty());
350     EXPECT_TRUE(WIN_MGR->mouseDownInfo_.pointerHotAreas.empty());
351 }
352 
353 /**
354  * @tc.name: InputWindowsManagerTest_InitMouseDownInfo_002
355  * @tc.desc: Test initializing mouse down information
356  * @tc.type: FUNC
357  * @tc.require:
358  */
359 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InitMouseDownInfo_002, TestSize.Level1)
360 {
361     CALL_TEST_DEBUG;
362     WIN_MGR->mouseDownInfo_.id = 1;
363     WIN_MGR->mouseDownInfo_.pid = 123;
364     WIN_MGR->mouseDownInfo_.defaultHotAreas.push_back({0, 0, 100, 100});
365     WIN_MGR->InitMouseDownInfo();
366     EXPECT_EQ(WIN_MGR->mouseDownInfo_.id, -1);
367     EXPECT_EQ(WIN_MGR->mouseDownInfo_.pid, -1);
368     EXPECT_TRUE(WIN_MGR->mouseDownInfo_.defaultHotAreas.empty());
369     EXPECT_TRUE(WIN_MGR->mouseDownInfo_.pointerHotAreas.empty());
370 }
371 
372 /**
373  * @tc.name: InputWindowsManagerTest_GetWindowGroupInfoByDisplayId_001
374  * @tc.desc: Test getting window group information by display ID
375  * @tc.type: FUNC
376  * @tc.require:
377  */
378 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowGroupInfoByDisplayId_001, TestSize.Level1)
379 {
380     CALL_TEST_DEBUG;
381     int32_t displayId = -1;
382     const std::vector<WindowInfo>& windowGroupInfo = WIN_MGR->GetWindowGroupInfoByDisplayId(displayId);
383     EXPECT_EQ(windowGroupInfo.size(), 1);
384 }
385 
386 /**
387  * @tc.name: InputWindowsManagerTest_GetWindowGroupInfoByDisplayId_002
388  * @tc.desc: Test getting window group information by display ID
389  * @tc.type: FUNC
390  * @tc.require:
391  */
392 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowGroupInfoByDisplayId_002, TestSize.Level1)
393 {
394     CALL_TEST_DEBUG;
395     int32_t displayId = 1;
396     const std::vector<WindowInfo>& windowGroupInfo = WIN_MGR->GetWindowGroupInfoByDisplayId(displayId);
397     EXPECT_FALSE(windowGroupInfo.empty());
398 }
399 
400 /**
401  * @tc.name: InputWindowsManagerTest_GetDisplayId_001
402  * @tc.desc: Test getting the display ID
403  * @tc.type: FUNC
404  * @tc.require:
405  */
406 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetDisplayId_001, TestSize.Level1)
407 {
408     CALL_TEST_DEBUG;
409     int32_t expectedDisplayId = 1;
410     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
411     EXPECT_NE(inputEvent, nullptr);
412     inputEvent->SetTargetDisplayId(expectedDisplayId);
413     int32_t ret = WIN_MGR->GetDisplayId(inputEvent);
414     EXPECT_EQ(ret, expectedDisplayId);
415 }
416 
417 /**
418  * @tc.name: InputWindowsManagerTest_GetPidAndUpdateTarget_001
419  * @tc.desc: Test getting PID and updating the target
420  * @tc.type: FUNC
421  * @tc.require:
422  */
423 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPidAndUpdateTarget_001, TestSize.Level1)
424 {
425     CALL_TEST_DEBUG;
426     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
427     EXPECT_NE(keyEvent, nullptr);
428     int32_t targetDisplayId = 0;
429     keyEvent->SetTargetDisplayId(targetDisplayId);
430     ASSERT_NO_FATAL_FAILURE(WIN_MGR->GetPidAndUpdateTarget(keyEvent));
431 }
432 
433 /**
434  * @tc.name: InputWindowsManagerTest_GetWindowPid_001
435  * @tc.desc: Test getting the process ID of a window
436  * @tc.type: FUNC
437  * @tc.require:
438  */
439 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowPid_001, TestSize.Level1)
440 {
441     CALL_TEST_DEBUG;
442     int32_t windowId = 100;
443     std::vector<WindowInfo> windowsInfo;
444     int32_t ret = WIN_MGR->GetWindowPid(windowId, windowsInfo);
445     EXPECT_EQ(ret, -1);
446 }
447 
448 /**
449  * @tc.name: InputWindowsManagerTest_CheckFocusWindowChange_001
450  * @tc.desc: Test checking focus window changes
451  * @tc.type: FUNC
452  * @tc.require:
453  */
454 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange_001, TestSize.Level1)
455 {
456     CALL_TEST_DEBUG;
457     DisplayGroupInfo displayGroupInfo;
458     displayGroupInfo.focusWindowId = 123;
459     ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckFocusWindowChange(displayGroupInfo));
460 }
461 
462 /**
463  * @tc.name: InputWindowsManagerTest_CheckFocusWindowChange_002
464  * @tc.desc: Test checking focus window changes
465  * @tc.type: FUNC
466  * @tc.require:
467  */
468 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange_002, TestSize.Level1)
469 {
470     CALL_TEST_DEBUG;
471     DisplayGroupInfo displayGroupInfo;
472     DisplayGroupInfo displayGroupInfo_;
473     displayGroupInfo.focusWindowId = 123;
474     displayGroupInfo_.focusWindowId = 456;
475     ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckFocusWindowChange(displayGroupInfo));
476     ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckFocusWindowChange(displayGroupInfo_));
477 }
478 
479 /**
480  * @tc.name: InputWindowsManagerTest_CheckZorderWindowChange_001
481  * @tc.desc: Test checking Z-order window changes
482  * @tc.type: FUNC
483  * @tc.require:
484  */
485 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckZorderWindowChange_001, TestSize.Level1)
486 {
487     CALL_TEST_DEBUG;
488     std::vector<WindowInfo> oldWindowsInfo = {{1}};
489     std::vector<WindowInfo> newWindowsInfo = {{2}};
490     ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckZorderWindowChange(oldWindowsInfo, newWindowsInfo));
491 }
492 
493 /**
494  * @tc.name: InputWindowsManagerTest_UpdateDisplayIdAndName_001
495  * @tc.desc: Test updating display ID and name
496  * @tc.type: FUNC
497  * @tc.require:
498  */
499 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName_001, TestSize.Level1)
500 {
501     CALL_TEST_DEBUG;
502     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayIdAndName());
503     assert(WIN_MGR->GetDisplayIdNames().size() == 2);
504     assert(WIN_MGR->IsDisplayAdd(1, "A"));
505     assert(WIN_MGR->IsDisplayAdd(2, "B"));
506     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayIdAndName());
507     assert(WIN_MGR->GetDisplayIdNames().size() == 2);
508     assert(WIN_MGR->IsDisplayAdd(1, "A"));
509     assert(WIN_MGR->IsDisplayAdd(3, "C"));
510     assert(!WIN_MGR->IsDisplayAdd(2, "B"));
511 }
512 
513 /**
514  * @tc.name: InputWindowsManagerTest_GetDisplayBindInfo_001
515  * @tc.desc: Test getting display binding information
516  * @tc.type: FUNC
517  * @tc.require:
518  */
519 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetDisplayBindInfo_001, TestSize.Level1)
520 {
521     CALL_TEST_DEBUG;
522     int32_t deviceId = 1;
523     int32_t displayId = 2;
524     DisplayBindInfos infos;
525     std::string msg;
526     int32_t ret = WIN_MGR->SetDisplayBind(deviceId, displayId, msg);
527     EXPECT_EQ(ret, -1);
528     ret = WIN_MGR->GetDisplayBindInfo(infos);
529     EXPECT_EQ(ret, 0);
530 }
531 
532 /**
533  * @tc.name: InputWindowsManagerTest_UpdateCaptureMode_001
534  * @tc.desc: Test updating capture mode
535  * @tc.type: FUNC
536  * @tc.require:
537  */
538 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_001, TestSize.Level1)
539 {
540     CALL_TEST_DEBUG;
541     DisplayGroupInfo displayGroupInfo;
542     displayGroupInfo.focusWindowId = 123;
543     WIN_MGR->UpdateCaptureMode(displayGroupInfo);
544     EXPECT_FALSE(WIN_MGR->captureModeInfo_.isCaptureMode);
545 }
546 
547 /**
548  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfoByIncrementalInfo_001
549  * @tc.desc: Test updating display information by incremental info
550  * @tc.type: FUNC
551  * @tc.require:
552  */
553 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoByIncrementalInfo_001, TestSize.Level1)
554 {
555     CALL_TEST_DEBUG;
556     DisplayGroupInfo displayGroupInfo;
557     displayGroupInfo.focusWindowId = 1;
558     WindowInfo window;
559     WIN_MGR->UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo);
560     EXPECT_EQ(displayGroupInfo.windowsInfo.size(), 0);
561 }
562 
563 /**
564  * @tc.name: InputWindowsManagerTest_UpdateWindowsInfoPerDisplay_001
565  * @tc.desc: Test updating window information for each display
566  * @tc.type: FUNC
567  * @tc.require:
568  */
569 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowsInfoPerDisplay_001, TestSize.Level1)
570 {
571     CALL_TEST_DEBUG;
572     DisplayGroupInfo displayGroupInfo;
573     displayGroupInfo.focusWindowId = 2;
574     WIN_MGR->UpdateWindowsInfoPerDisplay(displayGroupInfo);
575     WindowInfo window1{1};
576     WindowInfo window2{2};
577     displayGroupInfo.windowsInfo.push_back(window1);
578     displayGroupInfo.windowsInfo.push_back(window2);
579     WIN_MGR->UpdateDisplayInfo(displayGroupInfo);
580     ASSERT_EQ(displayGroupInfo.windowsInfo.size(), 2);
581     ASSERT_EQ(displayGroupInfo.windowsInfo[0].zOrder, 0);
582     ASSERT_EQ(displayGroupInfo.windowsInfo[1].zOrder, 0);
583 }
584 
585 /**
586  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_001
587  * @tc.desc: Test updating display information
588  * @tc.type: FUNC
589  * @tc.require:
590  */
591 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_001, TestSize.Level1)
592 {
593     CALL_TEST_DEBUG;
594     DisplayGroupInfo displayGroupInfo;
595     WindowInfo windowInfo1;
596     windowInfo1.zOrder = 1;
597     windowInfo1.action = WINDOW_UPDATE_ACTION::ADD_END;
598     WindowInfo windowInfo2;
599     windowInfo2.zOrder = 2;
600     windowInfo2.action = WINDOW_UPDATE_ACTION::ADD_END;
601     displayGroupInfo.windowsInfo.push_back(windowInfo1);
602     displayGroupInfo.windowsInfo.push_back(windowInfo2);
603     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
604 }
605 
606 /**
607  * @tc.name: InputWindowsManagerTest_NeedUpdatePointDrawFlag_001
608  * @tc.desc: Test whether the point draw flag needs to be updated
609  * @tc.type: FUNC
610  * @tc.require:
611  */
612 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_NeedUpdatePointDrawFlag_001, TestSize.Level1)
613 {
614     CALL_TEST_DEBUG;
615     std::vector<WindowInfo> windows1;
616     EXPECT_FALSE(WIN_MGR->NeedUpdatePointDrawFlag(windows1));
617     std::vector<WindowInfo> windows2;
618     windows2.push_back(WindowInfo());
619     windows2.back().action = OHOS::MMI::WINDOW_UPDATE_ACTION::ADD;
620     EXPECT_FALSE(WIN_MGR->NeedUpdatePointDrawFlag(windows2));
621     std::vector<WindowInfo> windows3;
622     windows3.push_back(WindowInfo());
623     windows3.back().action = OHOS::MMI::WINDOW_UPDATE_ACTION::ADD_END;
624     EXPECT_TRUE(WIN_MGR->NeedUpdatePointDrawFlag(windows3));
625 }
626 
627 /**
628  * @tc.name: InputWindowsManagerTest_DispatchPointer_001
629  * @tc.desc: Test dispatching pointer events
630  * @tc.type: FUNC
631  * @tc.require:
632  */
633 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchPointer_001, TestSize.Level1)
634 {
635     CALL_TEST_DEBUG;
636     int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
637     ASSERT_NO_FATAL_FAILURE(WIN_MGR->DispatchPointer(pointerAction));
638     pointerAction = PointerEvent::POINTER_ACTION_LEAVE_WINDOW;
639     ASSERT_NO_FATAL_FAILURE(WIN_MGR->DispatchPointer(pointerAction));
640     pointerAction = PointerEvent::POINTER_ACTION_MOVE;
641     ASSERT_NO_FATAL_FAILURE(WIN_MGR->DispatchPointer(pointerAction));
642 }
643 
644 /**
645  * @tc.name: InputWindowsManagerTest_NotifyPointerToWindow_001
646  * @tc.desc: Test notifying pointer events to window
647  * @tc.type: FUNC
648  * @tc.require:
649  */
650 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_NotifyPointerToWindow_001, TestSize.Level1)
651 {
652     CALL_TEST_DEBUG;
653     InputWindowsManager inputWindowsManager;
654     inputWindowsManager.lastPointerEvent_ = nullptr;
655     inputWindowsManager.NotifyPointerToWindow();
656     EXPECT_EQ(inputWindowsManager.lastWindowInfo_.id, -1);
657 }
658 
659 /**
660  * @tc.name: InputWindowsManagerTest_PrintWindowInfo_001
661  * @tc.desc: Test printing window information
662  * @tc.type: FUNC
663  * @tc.require:
664  */
665 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintWindowInfo_001, TestSize.Level1)
666 {
667     CALL_TEST_DEBUG;
668     WindowInfo windowInfo1;
669     windowInfo1.id = 1;
670     windowInfo1.pid = 100;
671     windowInfo1.uid = 200;
672     windowInfo1.area = {0, 0, 800, 600};
673     windowInfo1.defaultHotAreas = {{10, 10, 100, 100}, {200, 200, 50, 50}};
674     windowInfo1.pointerHotAreas = {{30, 30, 150, 150}, {400, 400, 70, 70}};
675     windowInfo1.agentWindowId = 10;
676     windowInfo1.flags = 1;
677     windowInfo1.displayId = 3;
678     windowInfo1.zOrder = 4.0f;
679     windowInfo1.pointerChangeAreas = {10, 20, 30};
680     windowInfo1.transform = {1.0f, 2.0f, 3.0f};
681     WindowInfo windowInfo2;
682     windowInfo2.id = 2;
683     windowInfo2.pid = 101;
684     windowInfo2.uid = 201;
685     windowInfo2.area = {800, 600, 1024, 768};
686     windowInfo2.defaultHotAreas = {{50, 50, 200, 200}, {600, 600, 100, 100}};
687     windowInfo2.pointerHotAreas = {{70, 70, 250, 250}, {800, 800, 120, 120}};
688     windowInfo2.agentWindowId = 20;
689     windowInfo2.flags = 2;
690     windowInfo2.displayId = 4;
691     windowInfo2.zOrder = 5.0f;
692     windowInfo2.pointerChangeAreas = {40, 50, 60};
693     windowInfo2.transform = {4.0f, 5.0f, 6.0f};
694     std::vector<WindowInfo> windowsInfo = {windowInfo1, windowInfo2};
695     ASSERT_NO_FATAL_FAILURE(WIN_MGR->PrintWindowInfo(windowsInfo));
696 }
697 
698 /**
699  * @tc.name: InputWindowsManagerTest_PrintWindowGroupInfo_001
700  * @tc.desc: Test printing window group information
701  * @tc.type: FUNC
702  * @tc.require:
703  */
704 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintWindowGroupInfo_001, TestSize.Level1)
705 {
706     CALL_TEST_DEBUG;
707     WindowGroupInfo testData;
708     testData.focusWindowId = 1;
709     testData.displayId = 2;
710     ASSERT_NO_FATAL_FAILURE(WIN_MGR->PrintWindowGroupInfo(testData));
711 }
712 
713 /**
714  * @tc.name: InputWindowsManagerTest_PrintDisplayInfo_001
715  * @tc.desc: Test printing display information
716  * @tc.type: FUNC
717  * @tc.require:
718  */
719 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintDisplayInfo_001, TestSize.Level1)
720 {
721     CALL_TEST_DEBUG;
722     InputWindowsManager manager;
723     manager.displayGroupInfo_.width = 1920;
724     manager.displayGroupInfo_.height = 1080;
725     manager.displayGroupInfo_.focusWindowId = 1;
726     manager.displayGroupInfo_.windowsInfo.push_back(WindowInfo());
727     manager.displayGroupInfo_.displaysInfo.push_back(DisplayInfo());
728     ASSERT_NO_FATAL_FAILURE(WIN_MGR->PrintDisplayGroupInfo(manager.displayGroupInfo_));
729 }
730 
731 /**
732  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplay_001
733  * @tc.desc: Test getting physical display information
734  * @tc.type: FUNC
735  * @tc.require:
736  */
737 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_001, TestSize.Level1)
738 {
739     CALL_TEST_DEBUG;
740     int32_t id = 1;
741     const DisplayInfo* displayInfo = WIN_MGR->GetPhysicalDisplay(id);
742     EXPECT_NE(displayInfo, nullptr);
743     EXPECT_EQ(displayInfo->id, id);
744 }
745 
746 /**
747  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplay_002
748  * @tc.desc: Test getting physical display information
749  * @tc.type: FUNC
750  * @tc.require:
751  */
752 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_002, TestSize.Level1)
753 {
754     CALL_TEST_DEBUG;
755     int32_t id = -1;
756     const DisplayInfo* displayInfo = WIN_MGR->GetPhysicalDisplay(id);
757     EXPECT_EQ(displayInfo, nullptr);
758 }
759 
760 /**
761  * @tc.name: InputWindowsManagerTest_FindPhysicalDisplayInfo_001
762  * @tc.desc: Test finding physical display information
763  * @tc.type: FUNC
764  * @tc.require:
765  */
766 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplayInfo_001, TestSize.Level1)
767 {
768     CALL_TEST_DEBUG;
769     InputWindowsManager manager;
770     ASSERT_EQ(manager.FindPhysicalDisplayInfo("test"), nullptr);
771     DisplayInfo info1;
772     info1.id = 123;
773     manager.displayGroupInfo_.displaysInfo.push_back(info1);
774     ASSERT_NE(manager.FindPhysicalDisplayInfo("test"), nullptr);
775     DisplayInfo info2;
776     info2.id = 456;
777     manager.displayGroupInfo_.displaysInfo.push_back(info2);
778     ASSERT_NE(manager.FindPhysicalDisplayInfo("test"), nullptr);
779     ASSERT_NE(manager.FindPhysicalDisplayInfo("not_matching"), nullptr);
780     ASSERT_NE(manager.FindPhysicalDisplayInfo("nonexistent"), nullptr);
781 }
782 
783 /**
784  * @tc.name: InputWindowsManagerTest_RotateScreen_001
785  * @tc.desc: Test rotating the screen
786  * @tc.type: FUNC
787  * @tc.require:
788  */
789 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, TestSize.Level1)
790 {
791     CALL_TEST_DEBUG;
792     DisplayInfo info;
793     PhysicalCoordinate coord;
794     info.direction = DIRECTION0;
795     coord.x = 10;
796     coord.y = 20;
797     WIN_MGR->RotateScreen(info, coord);
798     EXPECT_EQ(coord.x, 10);
799     EXPECT_EQ(coord.y, 20);
800 }
801 
802 /**
803  * @tc.name: InputWindowsManagerTest_RotateScreen_002
804  * @tc.desc: Test rotating the screen
805  * @tc.type: FUNC
806  * @tc.require:
807  */
808 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, TestSize.Level1)
809 {
810     CALL_TEST_DEBUG;
811     DisplayInfo info;
812     PhysicalCoordinate coord;
813     info.direction = DIRECTION90;
814     info.width = 800;
815     info.height = 600;
816     info.validWidth = info.width;
817     info.validHeight = info.height;
818     coord.x = 10;
819     coord.y = 20;
820     WIN_MGR->RotateScreen(info, coord);
821     EXPECT_EQ(coord.x, 580);
822     EXPECT_EQ(coord.y, 10);
823 }
824 
825 /**
826  * @tc.name: InputWindowsManagerTest_RotateScreen_003
827  * @tc.desc: Test rotating the screen
828  * @tc.type: FUNC
829  * @tc.require:
830  */
831 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, TestSize.Level1)
832 {
833     CALL_TEST_DEBUG;
834     DisplayInfo info;
835     PhysicalCoordinate coord;
836     info.direction = DIRECTION180;
837     info.width = 800;
838     info.height = 600;
839     info.validWidth = info.width;
840     info.validHeight = info.height;
841     coord.x = 10;
842     coord.y = 20;
843     WIN_MGR->RotateScreen(info, coord);
844     EXPECT_EQ(coord.x, 790);
845     EXPECT_EQ(coord.y, 580);
846 }
847 
848 /**
849  * @tc.name: InputWindowsManagerTest_RotateScreen_004
850  * @tc.desc: Test rotating the screen
851  * @tc.type: FUNC
852  * @tc.require:
853  */
854 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_004, TestSize.Level1)
855 {
856     CALL_TEST_DEBUG;
857     DisplayInfo info;
858     PhysicalCoordinate coord;
859     info.direction = DIRECTION270;
860     info.width = 800;
861     info.height = 600;
862     info.validWidth = info.width;
863     info.validHeight = info.height;
864     coord.x = 10;
865     coord.y = 20;
866     WIN_MGR->RotateScreen(info, coord);
867     EXPECT_EQ(coord.x, 20);
868     EXPECT_EQ(coord.y, 790);
869 }
870 
871 /**
872  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_001
873  * @tc.desc: Test whether layer refresh is needed
874  * @tc.type: FUNC
875  * @tc.require:
876  */
877 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_001, TestSize.Level1)
878 {
879     CALL_TEST_DEBUG;
880     EXPECT_FALSE(WIN_MGR->IsNeedRefreshLayer(1));
881     WIN_MGR->GetWindowInfo(0, 0)->id = 2;
882     EXPECT_FALSE(WIN_MGR->IsNeedRefreshLayer(GLOBAL_WINDOW_ID));
883     WIN_MGR->GetWindowInfo(0, 0)->id = 3;
884     EXPECT_FALSE(WIN_MGR->IsNeedRefreshLayer(1));
885 }
886 
887 /**
888  * @tc.name: InputWindowsManagerTest_OnSessionLost_001
889  * @tc.desc: Test handling when session is lost
890  * @tc.type: FUNC
891  * @tc.require:
892  */
893 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnSessionLost_001, TestSize.Level1)
894 {
895     CALL_TEST_DEBUG;
896     SessionPtr session = std::shared_ptr<UDSSession>();
897     WIN_MGR->OnSessionLost(session);
898     ASSERT_NO_FATAL_FAILURE(WIN_MGR->GetDisplayGroupInfo());
899 }
900 
901 /**
902  * @tc.name: InputWindowsManagerTest_UpdatePoinerStyle_001
903  * @tc.desc: Test updating pointer style
904  * @tc.type: FUNC
905  * @tc.require:
906  */
907 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePoinerStyle_001, TestSize.Level1)
908 {
909     CALL_TEST_DEBUG;
910     int32_t pid = 1;
911     int32_t windowId = 2;
912     PointerStyle pointerStyle;
913     int32_t ret = WIN_MGR->UpdatePoinerStyle(pid, windowId, pointerStyle);
914     EXPECT_EQ(ret, RET_OK);
915     pid = -1;
916     windowId = -2;
917     ret = WIN_MGR->UpdatePoinerStyle(pid, windowId, pointerStyle);
918     EXPECT_EQ(ret, 401);
919     pid = 1;
920     windowId = -2;
921     ret = WIN_MGR->UpdatePoinerStyle(pid, windowId, pointerStyle);
922     EXPECT_EQ(ret, RET_OK);
923 }
924 
925 /**
926  * @tc.name: InputWindowsManagerTest_UpdateSceneBoardPointerStyle_001
927  * @tc.desc: Test updating scene board pointer style
928  * @tc.type: FUNC
929  * @tc.require:
930  */
931 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateSceneBoardPointerStyle_001, TestSize.Level1)
932 {
933     CALL_TEST_DEBUG;
934     int32_t pid = 1;
935     int32_t windowId = 2;
936     PointerStyle pointerStyle;
937     pointerStyle.id = 3;
938     int32_t ret = WIN_MGR->UpdateSceneBoardPointerStyle(pid, windowId, pointerStyle);
939     EXPECT_EQ(ret, RET_OK);
940     pid = -1;
941     windowId = -2;
942     ret = WIN_MGR->UpdateSceneBoardPointerStyle(pid, windowId, pointerStyle);
943     EXPECT_EQ(ret, RET_OK);
944 }
945 
946 /**
947  * @tc.name: InputWindowsManagerTest_SetPointerStyle_001
948  * @tc.desc: Test setting pointer style
949  * @tc.type: FUNC
950  * @tc.require:
951  */
952 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPointerStyle_001, TestSize.Level1)
953 {
954     CALL_TEST_DEBUG;
955     int32_t pid = 1;
956     int32_t windowId = GLOBAL_WINDOW_ID;
957     PointerStyle pointerStyle;
958     pointerStyle.id = 1;
959     int32_t ret = WIN_MGR->SetPointerStyle(pid, windowId, pointerStyle);
960     EXPECT_EQ(ret, RET_OK);
961     EXPECT_EQ(WIN_MGR->globalStyle_.id, pointerStyle.id);
962     pid = 1;
963     windowId = 2;
964     ret = WIN_MGR->SetPointerStyle(pid, windowId, pointerStyle);
965     EXPECT_EQ(ret, WIN_MGR->UpdatePoinerStyle(pid, windowId, pointerStyle));
966     pid = 1;
967     windowId = 2;
968     ret = WIN_MGR->SetPointerStyle(pid, windowId, pointerStyle);
969     EXPECT_EQ(ret, WIN_MGR->UpdateSceneBoardPointerStyle(pid, windowId, pointerStyle));
970 }
971 
972 /**
973  * @tc.name: InputWindowsManagerTest_ClearWindowPointerStyle_001
974  * @tc.desc: Test clearing window pointer style
975  * @tc.type: FUNC
976  * @tc.require:
977  */
978 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ClearWindowPointerStyle_001, TestSize.Level1)
979 {
980     CALL_TEST_DEBUG;
981     int32_t pid = 123;
982     int32_t windowId = 678;
983     int32_t ret = WIN_MGR->ClearWindowPointerStyle(pid, windowId);
984     EXPECT_EQ(ret, RET_OK);
985 }
986 
987 /**
988  * @tc.name: InputWindowsManagerTest_GetPointerStyle_001
989  * @tc.desc: Test getting pointer style
990  * @tc.type: FUNC
991  * @tc.require:
992  */
993 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPointerStyle_001, TestSize.Level1)
994 {
995     CALL_TEST_DEBUG;
996     PointerStyle style;
997     int32_t ret = WIN_MGR->GetPointerStyle(1, GLOBAL_WINDOW_ID, style);
998     EXPECT_EQ(ret, RET_OK);
999     EXPECT_EQ(style.id, 1);
1000     ret = WIN_MGR->GetPointerStyle(3, 1, style);
1001     EXPECT_EQ(ret, RET_OK);
1002     EXPECT_EQ(style.id, 1);
1003     ret = WIN_MGR->GetPointerStyle(1, 1, style);
1004     EXPECT_EQ(ret, RET_OK);
1005     EXPECT_EQ(style.id, 1);
1006 }
1007 
1008 /**
1009  * @tc.name: InputWindowsManagerTest_IsInHotArea_001
1010  * @tc.desc: Test whether input is in the hot area
1011  * @tc.type: FUNC
1012  * @tc.require:
1013  */
1014 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_001, TestSize.Level1)
1015 {
1016     CALL_TEST_DEBUG;
1017     WIN_MGR->InitPointerStyle();
1018     int32_t x = 10;
1019     int32_t y = 20;
1020     std::vector<Rect> rects = {{0, 0, 30, 40}};
1021     WindowInfo window;
1022     bool ret = WIN_MGR->IsInHotArea(x, y, rects, window);
1023     EXPECT_TRUE(ret);
1024     x = -10;
1025     y = 20;
1026     ret = WIN_MGR->IsInHotArea(x, y, rects, window);
1027     EXPECT_FALSE(ret);
1028     x = 10;
1029     y = -10;
1030     ret = WIN_MGR->IsInHotArea(x, y, rects, window);
1031     EXPECT_FALSE(ret);
1032 }
1033 
1034 /**
1035  * @tc.name: InputWindowsManagerTest_InWhichHotArea_001
1036  * @tc.desc: Test which hot area the input is in
1037  * @tc.type: FUNC
1038  * @tc.require:
1039  */
1040 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_001, TestSize.Level1)
1041 {
1042     CALL_TEST_DEBUG;
1043     int32_t x = 50;
1044     int32_t y = 50;
1045     std::vector<Rect> rects = {{0, 0, 100, 100}, {100, 100, 200, 200}};
1046     PointerStyle pointerStyle;
1047     WIN_MGR->InWhichHotArea(x, y, rects, pointerStyle);
1048     ASSERT_EQ(pointerStyle.id, 6);
1049     x = 250;
1050     y = 250;
1051     WIN_MGR->InWhichHotArea(x, y, rects, pointerStyle);
1052     ASSERT_EQ(pointerStyle.id, 6);
1053 }
1054 
1055 /**
1056  * @tc.name: InputWindowsManagerTest_AdjustDisplayCoordinate_001
1057  * @tc.desc: Test adjusting display coordinates
1058  * @tc.type: FUNC
1059  * @tc.require:
1060  */
1061 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayCoordinate_001, TestSize.Level1)
1062 {
1063     CALL_TEST_DEBUG;
1064     DisplayInfo displayInfo;
1065     displayInfo.width = 10;
1066     displayInfo.height = 20;
1067     displayInfo.validWidth = displayInfo.width;
1068     displayInfo.validHeight = displayInfo.height;
1069     displayInfo.direction = DIRECTION90;
1070     double physicalX = -5;
1071     double physicalY = 15;
1072     WIN_MGR->AdjustDisplayCoordinate(displayInfo, physicalX, physicalY);
1073     EXPECT_EQ(physicalX, 0);
1074     EXPECT_EQ(physicalY, 9);
1075     displayInfo.width = 10;
1076     displayInfo.height = 20;
1077     displayInfo.validWidth = displayInfo.width;
1078     displayInfo.validHeight = displayInfo.height;
1079     displayInfo.direction = DIRECTION270;
1080     physicalX = 15;
1081     physicalY = 25;
1082     WIN_MGR->AdjustDisplayCoordinate(displayInfo, physicalX, physicalY);
1083     EXPECT_EQ(physicalX, 15);
1084     EXPECT_EQ(physicalY, 9);
1085     displayInfo.width = 10;
1086     displayInfo.height = 20;
1087     displayInfo.validWidth = displayInfo.width;
1088     displayInfo.validHeight = displayInfo.height;
1089     displayInfo.direction = DIRECTION270;
1090     physicalX = -5;
1091     physicalY = -15;
1092     WIN_MGR->AdjustDisplayCoordinate(displayInfo, physicalX, physicalY);
1093     EXPECT_EQ(physicalX, 0);
1094     EXPECT_EQ(physicalY, 0);
1095 }
1096 
1097 /**
1098  * @tc.name: InputWindowsManagerTest_IsTransparentWin
1099  * @tc.desc: Test IsTransparentWin
1100  * @tc.type: FUNC
1101  * @tc.require:
1102  */
1103 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsTransparentWin, TestSize.Level1)
1104 {
1105     CALL_TEST_DEBUG;
1106     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
1107     int32_t logicalX = 0;
1108     int32_t logicalY = 0;
1109     bool result = WIN_MGR->IsTransparentWin(pixelMap, logicalX, logicalY);
1110     EXPECT_FALSE(result);
1111 }
1112 
1113 /**
1114  * @tc.name: InputWindowsManagerTest_CheckWindowIdPermissionByPid
1115  * @tc.desc: Test CheckWindowIdPermissionByPid
1116  * @tc.type: FUNC
1117  * @tc.require:
1118  */
1119 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckWindowIdPermissionByPid, TestSize.Level1)
1120 {
1121     CALL_TEST_DEBUG;
1122     int32_t windowId = 12345;
1123     int32_t pid = 6789;
1124     int32_t result = WIN_MGR->CheckWindowIdPermissionByPid(windowId, pid);
1125     EXPECT_EQ(result, RET_ERR);
1126 }
1127 
1128 /**
1129  * @tc.name: InputWindowsManagerTest_IsWindowVisible
1130  * @tc.desc: Test IsWindowVisible
1131  * @tc.type: FUNC
1132  * @tc.require:
1133  */
1134 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsWindowVisible, TestSize.Level1)
1135 {
1136     CALL_TEST_DEBUG;
1137     int32_t pid = -1;
1138     bool result = WIN_MGR->IsWindowVisible(pid);
1139     EXPECT_TRUE(result);
1140 }
1141 
1142 /**
1143  * @tc.name: InputWindowsManagerTest_CoordinateCorrection_001
1144  * @tc.desc: Test CoordinateCorrection
1145  * @tc.type: FUNC
1146  * @tc.require:
1147  */
1148 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CoordinateCorrection_001, TestSize.Level1)
1149 {
1150     CALL_TEST_DEBUG;
1151     int32_t width = 100;
1152     int32_t height = 200;
1153     int32_t integerX = -1;
1154     int32_t integerY = 1;
1155     WIN_MGR->CoordinateCorrection(width, height, integerX, integerY);
1156     EXPECT_EQ(integerX, 0);
1157 }
1158 
1159 /**
1160  * @tc.name: InputWindowsManagerTest_CoordinateCorrection_002
1161  * @tc.desc: Test CoordinateCorrection
1162  * @tc.type: FUNC
1163  * @tc.require:
1164  */
1165 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CoordinateCorrection_002, TestSize.Level1)
1166 {
1167     CALL_TEST_DEBUG;
1168     int32_t width = 100;
1169     int32_t height = 200;
1170     int32_t integerX = 150;
1171     int32_t integerY = 100;
1172     WIN_MGR->CoordinateCorrection(width, height, integerX, integerY);
1173     EXPECT_EQ(integerX, 100);
1174 }
1175 
1176 /**
1177  * @tc.name: InputWindowsManagerTest_CoordinateCorrection_003
1178  * @tc.desc: Test CoordinateCorrection
1179  * @tc.type: FUNC
1180  * @tc.require:
1181  */
1182 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CoordinateCorrection_003, TestSize.Level1)
1183 {
1184     CALL_TEST_DEBUG;
1185     int32_t width = 100;
1186     int32_t height = 200;
1187     int32_t integerX = 1;
1188     int32_t integerY = -1;
1189     WIN_MGR->CoordinateCorrection(width, height, integerX, integerY);
1190     EXPECT_EQ(integerY, 0);
1191 }
1192 
1193 /**
1194  * @tc.name: InputWindowsManagerTest_CoordinateCorrection_004
1195  * @tc.desc: Test CoordinateCorrection
1196  * @tc.type: FUNC
1197  * @tc.require:
1198  */
1199 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CoordinateCorrection_004, TestSize.Level1)
1200 {
1201     CALL_TEST_DEBUG;
1202     int32_t width = 100;
1203     int32_t height = 200;
1204     int32_t integerX = 100;
1205     int32_t integerY = 250;
1206     WIN_MGR->CoordinateCorrection(width, height, integerX, integerY);
1207     EXPECT_EQ(integerY, 200);
1208 }
1209 
1210 /**
1211  * @tc.name: InputWindowsManagerTest_HandleWindowInputType_001
1212  * @tc.desc: Test HandleWindowInputType
1213  * @tc.type: FUNC
1214  * @tc.require:
1215  */
1216 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleWindowInputType_001, TestSize.Level1)
1217 {
1218     CALL_TEST_DEBUG;
1219     UDSServer udsServer;
1220     WIN_MGR->Init(udsServer);
1221     auto pointerEvent = PointerEvent::Create();
1222     ASSERT_NE(pointerEvent, nullptr);
1223     WindowInfo window;
1224     window.windowInputType = WindowInputType::NORMAL;
1225     ASSERT_FALSE(WIN_MGR->HandleWindowInputType(window, pointerEvent));
1226 }
1227 
1228 /**
1229  * @tc.name: InputWindowsManagerTest_HandleWindowInputType_002
1230  * @tc.desc: Test HandleWindowInputType
1231  * @tc.type: FUNC
1232  * @tc.require:
1233  */
1234 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleWindowInputType_002, TestSize.Level1)
1235 {
1236     CALL_TEST_DEBUG;
1237     UDSServer udsServer;
1238     WIN_MGR->Init(udsServer);
1239     auto pointerEvent = PointerEvent::Create();
1240     ASSERT_NE(pointerEvent, nullptr);
1241     WindowInfo window;
1242     window.windowInputType = WindowInputType::TRANSMIT_ALL;
1243     ASSERT_FALSE(WIN_MGR->HandleWindowInputType(window, pointerEvent));
1244 }
1245 
1246 /**
1247  * @tc.name: InputWindowsManagerTest_HandleWindowInputType_003
1248  * @tc.desc: Test HandleWindowInputType
1249  * @tc.type: FUNC
1250  * @tc.require:
1251  */
1252 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleWindowInputType_003, TestSize.Level1)
1253 {
1254     CALL_TEST_DEBUG;
1255     UDSServer udsServer;
1256     WIN_MGR->Init(udsServer);
1257     auto pointerEvent = PointerEvent::Create();
1258     ASSERT_NE(pointerEvent, nullptr);
1259     WindowInfo window;
1260     window.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
1261     ASSERT_FALSE(WIN_MGR->HandleWindowInputType(window, pointerEvent));
1262 }
1263 
1264 /**
1265  * @tc.name: InputWindowsManagerTest_UpdateDisplayId_001
1266  * @tc.desc: Test updating display ID
1267  * @tc.type: FUNC
1268  * @tc.require:
1269  */
1270 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayId_001, TestSize.Level1)
1271 {
1272     CALL_TEST_DEBUG;
1273     int32_t displayId = 1;
1274     bool ret = WIN_MGR->UpdateDisplayId(displayId);
1275     EXPECT_TRUE(ret);
1276     displayId = 0;
1277     ret = WIN_MGR->UpdateDisplayId(displayId);
1278     EXPECT_FALSE(ret);
1279     displayId = -1;
1280     ret = WIN_MGR->UpdateDisplayId(displayId);
1281     EXPECT_TRUE(ret);
1282 }
1283 
1284 /**
1285  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_001
1286  * @tc.desc: Test selecting window information
1287  * @tc.type: FUNC
1288  * @tc.require:
1289  */
1290 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_001, TestSize.Level1)
1291 {
1292     CALL_TEST_DEBUG;
1293     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1294     ASSERT_NE(pointerEvent, nullptr);
1295     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1296     pointerEvent->SetPressedKeys({1});
1297     pointerEvent->SetTargetDisplayId(0);
1298     pointerEvent->SetTargetWindowId(1);
1299     std::optional<WindowInfo> result = WIN_MGR->SelectWindowInfo(400, 300, pointerEvent);
1300     EXPECT_FALSE(result.has_value());
1301     int32_t ret1 = result->id;
1302     EXPECT_EQ(ret1, 0);
1303     int32_t ret2 = result->flags;
1304     EXPECT_EQ(ret2, 0);
1305     int32_t ret3 = result->pid;
1306     EXPECT_EQ(ret3, 0);
1307 }
1308 
1309 /**
1310  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_002
1311  * @tc.desc: Test selecting window information
1312  * @tc.type: FUNC
1313  * @tc.require:
1314  */
1315 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_002, TestSize.Level1)
1316 {
1317     CALL_TEST_DEBUG;
1318     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1319     ASSERT_NE(pointerEvent, nullptr);
1320     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1321     pointerEvent->SetPressedKeys({1});
1322     pointerEvent->SetTargetDisplayId(0);
1323     pointerEvent->SetTargetWindowId(1);
1324     std::optional<WindowInfo> result = WIN_MGR->SelectWindowInfo(-123, -456, pointerEvent);
1325     EXPECT_FALSE(result.has_value());
1326     int32_t ret1 = result->id;
1327     EXPECT_EQ(ret1, 0);
1328     int32_t ret2 = result->flags;
1329     EXPECT_EQ(ret2, 0);
1330     int32_t ret3 = result->pid;
1331     EXPECT_EQ(ret3, 0);
1332 }
1333 
1334 /**
1335  * @tc.name: InputWindowsManagerTest_GetWindowInfo_001
1336  * @tc.desc: Test getting window information
1337  * @tc.type: FUNC
1338  * @tc.require:
1339  */
1340 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowInfo_001, TestSize.Level1)
1341 {
1342     CALL_TEST_DEBUG;
1343     WindowInfo windowInfo1 = {1, WindowInfo::FLAG_BIT_UNTOUCHABLE, {}};
1344     WindowInfo windowInfo2 = {2, 0, {}};
1345     WIN_MGR->displayGroupInfo_.windowsInfo = {windowInfo1, windowInfo2};
1346     auto result = WIN_MGR->GetWindowInfo(0, 0);
1347     EXPECT_FALSE(result.has_value());
1348     int32_t ret1 = result->id;
1349     EXPECT_EQ(ret1, 0);
1350 }
1351 
1352 /**
1353  * @tc.name: InputWindowsManagerTest_SelectPointerChangeArea_001
1354  * @tc.desc: Test selecting pointer change area
1355  * @tc.type: FUNC
1356  * @tc.require:
1357  */
1358 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeArea_001, TestSize.Level1)
1359 {
1360     CALL_TEST_DEBUG;
1361     WindowInfo windowInfo;
1362     windowInfo.id = 1;
1363     PointerStyle pointerStyle;
1364     int32_t logicalX = 0;
1365     int32_t logicalY = 0;
1366     bool result = WIN_MGR->SelectPointerChangeArea(windowInfo, pointerStyle, logicalX, logicalY);
1367     EXPECT_FALSE(result);
1368 }
1369 
1370 /**
1371  * @tc.name: InputWindowsManagerTest_SelectPointerChangeArea_002
1372  * @tc.desc: Test selecting pointer change area
1373  * @tc.type: FUNC
1374  * @tc.require:
1375  */
1376 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeArea_002, TestSize.Level1)
1377 {
1378     CALL_TEST_DEBUG;
1379     WindowInfo windowInfo;
1380     windowInfo.id = 1;
1381     PointerStyle pointerStyle;
1382     int32_t logicalX = -1;
1383     int32_t logicalY = -2;
1384     bool result = WIN_MGR->SelectPointerChangeArea(windowInfo, pointerStyle, logicalX, logicalY);
1385     EXPECT_FALSE(result);
1386 }
1387 
1388 /**
1389  * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas_001
1390  * @tc.desc: Test updating pointer change areas
1391  * @tc.type: FUNC
1392  * @tc.require:
1393  */
1394 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_001, TestSize.Level1)
1395 {
1396     CALL_TEST_DEBUG;
1397     DisplayGroupInfo displayGroupInfo;
1398     WIN_MGR->UpdatePointerChangeAreas(displayGroupInfo);
1399     EXPECT_TRUE(WIN_MGR->windowsHotAreas_.empty());
1400 }
1401 
1402 /**
1403  * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas_002
1404  * @tc.desc: Test updating pointer change areas
1405  * @tc.type: FUNC
1406  * @tc.require:
1407  */
1408 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_002, TestSize.Level1)
1409 {
1410     CALL_TEST_DEBUG;
1411     DisplayGroupInfo displayGroupInfo;
1412     WIN_MGR->UpdatePointerChangeAreas();
1413     WIN_MGR->UpdatePointerChangeAreas(displayGroupInfo);
1414     EXPECT_EQ(WIN_MGR->windowsHotAreas_.size(), 0);
1415     EXPECT_EQ(WIN_MGR->windowsHotAreas_[1].size(), 0);
1416 }
1417 
1418 /**
1419  * @tc.name: InputWindowsManagerTest_UpdateTopBottomArea_001
1420  * @tc.desc: Test updating top-bottom area
1421  * @tc.type: FUNC
1422  * @tc.require:
1423  */
1424 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTopBottomArea_001, TestSize.Level1)
1425 {
1426     CALL_TEST_DEBUG;
1427     Rect windowArea = {0, 0, 100, 100};
1428     std::vector<int32_t> pointerChangeAreas = {10, 20, 30, 40, 50, 60, 70, 80};
1429     std::vector<Rect> windowHotAreas;
1430     WIN_MGR->UpdateTopBottomArea(windowArea, pointerChangeAreas, windowHotAreas);
1431     int32_t ret1 = windowHotAreas.size();
1432     EXPECT_EQ(ret1, 2);
1433     int32_t ret2 = windowHotAreas[0].x;
1434     EXPECT_EQ(ret2, 10);
1435     int32_t ret3 = windowHotAreas[0].y;
1436     EXPECT_EQ(ret3, -20);
1437     int32_t ret4 = windowHotAreas[0].width;
1438     EXPECT_EQ(ret4, 60);
1439     int32_t ret5 = windowHotAreas[0].height;
1440     EXPECT_EQ(ret5, 40);
1441     int32_t ret6 = windowHotAreas[1].x;
1442     EXPECT_EQ(ret6, 70);
1443     int32_t ret7 = windowHotAreas[1].y;
1444     EXPECT_EQ(ret7, 40);
1445     int32_t ret8 = windowHotAreas[1].width;
1446     EXPECT_EQ(ret8, -20);
1447     int32_t ret9 = windowHotAreas[1].height;
1448     EXPECT_EQ(ret9, 80);
1449 }
1450 
1451 /**
1452  * @tc.name: InputWindowsManagerTest_UpdateTopBottomArea_002
1453  * @tc.desc: Test updating top-bottom area
1454  * @tc.type: FUNC
1455  * @tc.require:
1456  */
1457 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTopBottomArea_002, TestSize.Level1)
1458 {
1459     CALL_TEST_DEBUG;
1460     Rect windowArea = {0, 0, 100, 100};
1461     std::vector<int32_t> pointerChangeAreas = {0, 0, 0, 0, 0, 0, 0, 0};
1462     std::vector<Rect> windowHotAreas;
1463     WIN_MGR->UpdateTopBottomArea(windowArea, pointerChangeAreas, windowHotAreas);
1464     int32_t ret1 = windowHotAreas.size();
1465     EXPECT_EQ(ret1, 2);
1466     int32_t ret2 = windowHotAreas[0].width;
1467     EXPECT_EQ(ret2, 0);
1468     int32_t ret3 = windowHotAreas[0].height;
1469     EXPECT_EQ(ret3, 0);
1470     int32_t ret4 = windowHotAreas[1].width;
1471     EXPECT_EQ(ret4, 0);
1472     int32_t ret5 = windowHotAreas[1].height;
1473     EXPECT_EQ(ret5, 0);
1474 }
1475 
1476 /**
1477  * @tc.name: InputWindowsManagerTest_UpdateLeftRightArea_001
1478  * @tc.desc: Test updating left-right area
1479  * @tc.type: FUNC
1480  * @tc.require:
1481  */
1482 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateLeftRightArea_001, TestSize.Level1)
1483 {
1484     CALL_TEST_DEBUG;
1485     Rect windowArea = {0, 0, 100, 100};
1486     std::vector<int32_t> pointerChangeAreas = {10, 20, 30, 40, 50, 60, 70, 80};
1487     std::vector<Rect> windowHotAreas;
1488     WIN_MGR->UpdateLeftRightArea(windowArea, pointerChangeAreas, windowHotAreas);
1489     int32_t ret1 = windowHotAreas.size();
1490     EXPECT_EQ(ret1, 2);
1491     int32_t ret2 = windowHotAreas[0].x;
1492     EXPECT_EQ(ret2, -20);
1493     int32_t ret3 = windowHotAreas[0].y;
1494     EXPECT_EQ(ret3, 10);
1495     int32_t ret4 = windowHotAreas[0].width;
1496     EXPECT_EQ(ret4, 100);
1497     int32_t ret5 = windowHotAreas[0].height;
1498     EXPECT_EQ(ret5, 20);
1499     int32_t ret6 = windowHotAreas[1].x;
1500     EXPECT_EQ(ret6, 60);
1501     int32_t ret7 = windowHotAreas[1].y;
1502     EXPECT_EQ(ret7, 30);
1503     int32_t ret8 = windowHotAreas[1].width;
1504     EXPECT_EQ(ret8, 60);
1505     int32_t ret9 = windowHotAreas[1].height;
1506     EXPECT_EQ(ret9, 20);
1507 }
1508 
1509 /**
1510  * @tc.name: InputWindowsManagerTest_UpdateLeftRightArea_002
1511  * @tc.desc: Test updating left-right area
1512  * @tc.type: FUNC
1513  * @tc.require:
1514  */
1515 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateLeftRightArea_002, TestSize.Level1)
1516 {
1517     CALL_TEST_DEBUG;
1518     Rect windowArea = {0, 0, 100, 100};
1519     std::vector<int32_t> pointerChangeAreas = {10, 0, 30, 40, 50, 60, 70, 80};
1520     std::vector<Rect> windowHotAreas;
1521     WIN_MGR->UpdateLeftRightArea(windowArea, pointerChangeAreas, windowHotAreas);
1522     int32_t ret1 = windowHotAreas.size();
1523     EXPECT_EQ(ret1, 2);
1524     int32_t ret2 = windowHotAreas[0].x;
1525     EXPECT_EQ(ret2, -20);
1526     int32_t ret3 = windowHotAreas[0].y;
1527     EXPECT_EQ(ret3, 10);
1528     int32_t ret4 = windowHotAreas[0].width;
1529     EXPECT_EQ(ret4, 100);
1530     int32_t ret5 = windowHotAreas[0].height;
1531     EXPECT_EQ(ret5, 20);
1532     int32_t ret6 = windowHotAreas[1].x;
1533     EXPECT_EQ(ret6, 60);
1534     int32_t ret7 = windowHotAreas[1].y;
1535     EXPECT_EQ(ret7, 30);
1536     int32_t ret8 = windowHotAreas[1].width;
1537     EXPECT_EQ(ret8, 60);
1538     int32_t ret9 = windowHotAreas[1].height;
1539     EXPECT_EQ(ret9, 20);
1540 }
1541 
1542 /**
1543  * @tc.name: InputWindowsManagerTest_UpdateInnerAngleArea_001
1544  * @tc.desc: Test updating inner angle area
1545  * @tc.type: FUNC
1546  * @tc.require:
1547  */
1548 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateInnerAngleArea_001, TestSize.Level1)
1549 {
1550     CALL_TEST_DEBUG;
1551     Rect windowArea;
1552     windowArea.x = 10;
1553     windowArea.y = 20;
1554     windowArea.width = 100;
1555     windowArea.height = 200;
1556     std::vector<int32_t> pointerChangeAreas(4, 10);
1557     std::vector<Rect> windowHotAreas;
1558     WIN_MGR->UpdateInnerAngleArea(windowArea, pointerChangeAreas, windowHotAreas);
1559     int32_t ret1 = windowHotAreas.size();
1560     EXPECT_EQ(ret1, 4);
1561     int32_t ret2 = windowHotAreas[0].x;
1562     EXPECT_EQ(ret2, -10);
1563     int32_t ret3 = windowHotAreas[0].y;
1564     EXPECT_EQ(ret3, 0);
1565     int32_t ret4 = windowHotAreas[0].width;
1566     EXPECT_EQ(ret4, 30);
1567     int32_t ret5 = windowHotAreas[0].height;
1568     EXPECT_EQ(ret5, 30);
1569     int32_t ret6 = windowHotAreas[1].x;
1570     EXPECT_EQ(ret6, 100);
1571     int32_t ret7 = windowHotAreas[1].y;
1572     EXPECT_EQ(ret7, 0);
1573     int32_t ret8 = windowHotAreas[1].width;
1574     EXPECT_EQ(ret8, 30);
1575     int32_t ret9 = windowHotAreas[1].height;
1576     EXPECT_EQ(ret9, 30);
1577     int32_t ret10 = windowHotAreas[2].x;
1578     EXPECT_EQ(ret10, -10);
1579     int32_t ret11 = windowHotAreas[2].y;
1580     EXPECT_NE(ret11, 110);
1581     int32_t ret12 = windowHotAreas[2].width;
1582     EXPECT_NE(ret12, 21);
1583     int32_t ret13 = windowHotAreas[2].height;
1584     EXPECT_EQ(ret13, 32);
1585 }
1586 
1587 /**
1588  * @tc.name: InputWindowsManagerTest_UpdatePointerEvent_001
1589  * @tc.desc: Test updating pointer event
1590  * @tc.type: FUNC
1591  * @tc.require:
1592  */
1593 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerEvent_001, TestSize.Level1)
1594 {
1595     CALL_TEST_DEBUG;
1596     InputWindowsManager inputWindowsManager;
1597     int32_t logicalX = 10;
1598     int32_t logicalY = 20;
1599     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1600     ASSERT_NE(pointerEvent, nullptr);
1601     WindowInfo touchWindow;
1602     touchWindow.id = 2;
1603     WIN_MGR->UpdatePointerEvent(logicalX, logicalY, pointerEvent, touchWindow);
1604     EXPECT_EQ(inputWindowsManager.lastLogicX_, RET_ERR);
1605     EXPECT_EQ(inputWindowsManager.lastLogicY_, RET_ERR);
1606 }
1607 
1608 /**
1609  * @tc.name: InputWindowsManagerTest_UpdatePointerEvent_002
1610  * @tc.desc: Test updating pointer event
1611  * @tc.type: FUNC
1612  * @tc.require:
1613  */
1614 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerEvent_002, TestSize.Level1)
1615 {
1616     CALL_TEST_DEBUG;
1617     InputWindowsManager inputWindowsManager;
1618     int32_t logicalX = 10;
1619     int32_t logicalY = 20;
1620     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1621     ASSERT_NE(pointerEvent, nullptr);
1622     WindowInfo touchWindow;
1623     touchWindow.id = 0;
1624     WIN_MGR->UpdatePointerEvent(logicalX, logicalY, pointerEvent, touchWindow);
1625     EXPECT_EQ(inputWindowsManager.lastLogicX_, RET_ERR);
1626     EXPECT_EQ(inputWindowsManager.lastLogicY_, RET_ERR);
1627 }
1628 
1629 /**
1630  * @tc.name: InputWindowsManagerTest_SetHoverScrollState_001
1631  * @tc.desc: Test setting hover scroll state
1632  * @tc.type: FUNC
1633  * @tc.require:
1634  */
1635 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetHoverScrollState_001, TestSize.Level1)
1636 {
1637     CALL_TEST_DEBUG;
1638     int32_t result = WIN_MGR->SetHoverScrollState(true);
1639     EXPECT_EQ(result, 0);
1640     result = WIN_MGR->SetHoverScrollState(false);
1641     EXPECT_EQ(result, 0);
1642 }
1643 
1644 /**
1645  * @tc.name: InputWindowsManagerTest_GetHoverScrollState_001
1646  * @tc.desc: Test getting hover scroll state
1647  * @tc.type: FUNC
1648  * @tc.require:
1649  */
1650 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetHoverScrollState_001, TestSize.Level1)
1651 {
1652     CALL_TEST_DEBUG;
1653     bool result = WIN_MGR->GetHoverScrollState();
1654     EXPECT_TRUE(result);
1655     result = WIN_MGR->GetHoverScrollState();
1656     EXPECT_TRUE(result);
1657 }
1658 
1659 /**
1660  * @tc.name: InputWindowsManagerTest_UpdateMouseTarget_001
1661  * @tc.desc: Test updating mouse target
1662  * @tc.type: FUNC
1663  * @tc.require:
1664  */
1665 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget_001, TestSize.Level1)
1666 {
1667     CALL_TEST_DEBUG;
1668     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1669     ASSERT_NE(pointerEvent, nullptr);
1670     int32_t result =WIN_MGR->UpdateMouseTarget(pointerEvent);
1671     WIN_MGR->SetMouseFlag(true);
1672     WIN_MGR->SetMouseFlag(false);
1673     auto ret = WIN_MGR->GetMouseFlag();
1674     EXPECT_FALSE(ret);
1675     EXPECT_EQ(result, RET_ERR);
1676 }
1677 
1678 /**
1679  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_001
1680  * @tc.desc: Test updating window information for each display
1681  * @tc.type: FUNC
1682  * @tc.require:
1683  */
1684 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_001, TestSize.Level1)
1685 {
1686     WIN_MGR->SetAntiMisTakeStatus(false);
1687     ASSERT_FALSE(WIN_MGR->SkipNavigationWindow(WindowInputType::ANTI_MISTAKE_TOUCH, PointerEvent::TOOL_TYPE_PEN));
1688 }
1689 
1690 /**
1691  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_002
1692  * @tc.desc: Test updating window information for each display
1693  * @tc.type: FUNC
1694  * @tc.require:
1695  */
1696 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_002, TestSize.Level1)
1697 {
1698     WIN_MGR->SetAntiMisTakeStatus(false);
1699     ASSERT_FALSE(WIN_MGR->SkipNavigationWindow(WindowInputType::NORMAL, PointerEvent::TOOL_TYPE_RUBBER));
1700 }
1701 
1702 /**
1703  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_003
1704  * @tc.desc: Test updating window information for each display
1705  * @tc.type: FUNC
1706  * @tc.require:
1707  */
1708 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_003, TestSize.Level1)
1709 {
1710     WIN_MGR->SetAntiMisTakeStatus(false);
1711     ASSERT_FALSE(WIN_MGR->SkipNavigationWindow(WindowInputType::NORMAL, PointerEvent::TOOL_TYPE_PEN));
1712 }
1713 
1714 /**
1715  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_004
1716  * @tc.desc: Test updating window information for each display
1717  * @tc.type: FUNC
1718  * @tc.require:
1719  */
1720 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_004, TestSize.Level1)
1721 {
1722     WIN_MGR->SetAntiMisTakeStatus(false);
1723     ASSERT_FALSE(WIN_MGR->SkipNavigationWindow(WindowInputType::ANTI_MISTAKE_TOUCH, PointerEvent::TOOL_TYPE_RUBBER));
1724 }
1725 
1726 /**
1727  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_005
1728  * @tc.desc: Test updating window information for each display
1729  * @tc.type: FUNC
1730  * @tc.require:
1731  */
1732 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_005, TestSize.Level1)
1733 {
1734     WIN_MGR->SetAntiMisTake(true);
1735     WIN_MGR->SetAntiMisTakeStatus(false);
1736     ASSERT_FALSE(WIN_MGR->SkipNavigationWindow(WindowInputType::ANTI_MISTAKE_TOUCH, PointerEvent::TOOL_TYPE_PEN));
1737 }
1738 
1739 /**
1740  * @tc.name: InputWindowsManagerTest_JudgMouseIsDownOrUp_001
1741  * @tc.desc: This test verifies the functionality of judging whether the mouse button is down or up
1742  * @tc.type: FUNC
1743  * @tc.require:
1744  */
1745 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_JudgMouseIsDownOrUp_001, TestSize.Level1)
1746 {
1747     CALL_TEST_DEBUG;
1748     WIN_MGR->JudgMouseIsDownOrUp(false);
1749     EXPECT_FALSE(WIN_MGR->GetMouseFlag());
1750     WIN_MGR->JudgMouseIsDownOrUp(true);
1751     EXPECT_FALSE(WIN_MGR->GetMouseFlag());
1752 }
1753 
1754 /**
1755  * @tc.name: InputWindowsManagerTest_SetMouseCaptureMode_001
1756  * @tc.desc: This test verifies the functionality of setting the mouse capture mode
1757  * @tc.type: FUNC
1758  * @tc.require:
1759  */
1760 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetMouseCaptureMode_001, TestSize.Level1)
1761 {
1762     CALL_TEST_DEBUG;
1763     int32_t windowId = -1;
1764     bool isCaptureMode = true;
1765     int32_t result = WIN_MGR->SetMouseCaptureMode(windowId, isCaptureMode);
1766     EXPECT_EQ(result, RET_ERR);
1767     windowId = 1;
1768     isCaptureMode = false;
1769     result = WIN_MGR->SetMouseCaptureMode(windowId, isCaptureMode);
1770     EXPECT_EQ(result, RET_OK);
1771     windowId = 1;
1772     isCaptureMode = true;
1773     result = WIN_MGR->SetMouseCaptureMode(windowId, isCaptureMode);
1774     EXPECT_EQ(result, RET_OK);
1775     EXPECT_TRUE(WIN_MGR->GetMouseIsCaptureMode());
1776 }
1777 
1778 /**
1779  * @tc.name: InputWindowsManagerTest_IsNeedDrawPointer_001
1780  * @tc.desc: This test verifies the functionality of determining whether to draw the pointer
1781  * @tc.type: FUNC
1782  * @tc.require:
1783  */
1784 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedDrawPointer_001, TestSize.Level1)
1785 {
1786     CALL_TEST_DEBUG;
1787     PointerEvent::PointerItem pointerItem;
1788     pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1789     pointerItem.SetDeviceId(1);
1790     bool result = WIN_MGR->IsNeedDrawPointer(pointerItem);
1791     EXPECT_FALSE(result);
1792 }
1793 
1794 /**
1795  * @tc.name: InputWindowsManagerTest_SkipAnnotationWindow_001
1796  * @tc.desc: This test verifies the functionality of determining whether to draw the pointer
1797  * @tc.type: FUNC
1798  * @tc.require:
1799  */
1800 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipAnnotationWindow_001, TestSize.Level1)
1801 {
1802     CALL_TEST_DEBUG;
1803     uint32_t flag = WindowInfo::FLAG_BIT_HANDWRITING;
1804     int32_t toolType = PointerEvent::TOOL_TYPE_FINGER;
1805     bool result = WIN_MGR->SkipAnnotationWindow(flag, toolType);
1806     EXPECT_TRUE(result);
1807     flag = WindowInfo::FLAG_BIT_HANDWRITING;
1808     toolType = PointerEvent::TOOL_TYPE_PEN;
1809     result = WIN_MGR->SkipAnnotationWindow(flag, toolType);
1810     EXPECT_FALSE(result);
1811     flag = 0;
1812     toolType = PointerEvent::TOOL_TYPE_FINGER;
1813     result = WIN_MGR->SkipAnnotationWindow(flag, toolType);
1814     EXPECT_FALSE(result);
1815     flag = 0;
1816     toolType = PointerEvent::TOOL_TYPE_PEN;
1817     result = WIN_MGR->SkipAnnotationWindow(flag, toolType);
1818     EXPECT_FALSE(result);
1819 }
1820 
1821 /**
1822  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_001
1823  * @tc.desc: This test verifies the functionality of updating the touch screen target
1824  * @tc.type: FUNC
1825  * @tc.require:
1826  */
1827 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_001, TestSize.Level1)
1828 {
1829     CALL_TEST_DEBUG;
1830     auto result = WIN_MGR->UpdateTouchScreenTarget(nullptr);
1831     EXPECT_NE(result, RET_ERR);
1832     auto pointerEvent = PointerEvent::Create();
1833     pointerEvent->SetTargetDisplayId(-1);
1834     result = WIN_MGR->UpdateTouchScreenTarget(pointerEvent);
1835     EXPECT_EQ(result, RET_ERR);
1836     pointerEvent->SetTargetDisplayId(1);
1837     pointerEvent->SetPointerId(1);
1838     result = WIN_MGR->UpdateTouchScreenTarget(pointerEvent);
1839     EXPECT_EQ(result, RET_ERR);
1840 }
1841 
1842 /**
1843  * @tc.name: InputWindowsManagerTest_PullEnterLeaveEvent_001
1844  * @tc.desc: This test verifies the functionality of pulling enter and leave events
1845  * @tc.type: FUNC
1846  * @tc.require:
1847  */
1848 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PullEnterLeaveEvent_001, TestSize.Level1)
1849 {
1850     CALL_TEST_DEBUG;
1851     int32_t logicalX = 100;
1852     int32_t logicalY = 200;
1853     auto pointerEvent = PointerEvent::Create();
1854     WindowInfo touchWindow;
1855     WIN_MGR->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow);
1856     logicalX = -123;
1857     logicalY = -456;
1858     WIN_MGR->PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow);
1859 }
1860 
1861 /**
1862  * @tc.name: InputWindowsManagerTest_DispatchTouch_001
1863  * @tc.desc: This test verifies the functionality of touch event dispatching
1864  * @tc.type: FUNC
1865  * @tc.require:
1866  */
1867 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchTouch_001, TestSize.Level1)
1868 {
1869     CALL_TEST_DEBUG;
1870     int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1871     ASSERT_NO_FATAL_FAILURE(WIN_MGR->DispatchTouch(pointerAction));
1872     pointerAction = PointerEvent::POINTER_ACTION_DOWN;
1873     ASSERT_NO_FATAL_FAILURE(WIN_MGR->DispatchTouch(pointerAction));
1874 }
1875 
1876 /**
1877  * @tc.name: InputWindowsManagerTest_UpdateTouchPadTarget_001
1878  * @tc.desc: This test verifies the functionality of updating the touchpad target
1879  * @tc.type: FUNC
1880  * @tc.require:
1881  */
1882 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchPadTarget_001, TestSize.Level1)
1883 {
1884     CALL_TEST_DEBUG;
1885     auto pointerEvent = PointerEvent::Create();
1886     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1887     int32_t result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1888     EXPECT_EQ(result, RET_ERR);
1889     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1890     result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1891     EXPECT_EQ(result, RET_ERR);
1892     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
1893     result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1894     EXPECT_EQ(result, RET_ERR);
1895     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
1896     result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1897     EXPECT_EQ(result, RET_ERR);
1898     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UP);
1899     result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1900     EXPECT_EQ(result, RET_ERR);
1901     pointerEvent->SetPointerAction(9999);
1902     result = WIN_MGR->UpdateTouchPadTarget(pointerEvent);
1903     EXPECT_EQ(result, RET_ERR);
1904 }
1905 
1906 /**
1907  * @tc.name: InputWindowsManagerTest_UpdateTargetPointer_001
1908  * @tc.desc: This test verifies the functionality of updating the target pointer
1909  * @tc.type: FUNC
1910  * @tc.require:
1911  */
1912 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTargetPointer_001, TestSize.Level1)
1913 {
1914     CALL_TEST_DEBUG;
1915     auto pointerEvent = PointerEvent::Create();
1916     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
1917     pointerEvent->SetPointerAction(1);
1918     int32_t result = WIN_MGR->UpdateTargetPointer(pointerEvent);
1919     EXPECT_EQ(result, RET_OK);
1920     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
1921     pointerEvent->SetPointerAction(1);
1922     result = WIN_MGR->UpdateTargetPointer(pointerEvent);
1923     EXPECT_EQ(result, RET_ERR);
1924     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
1925     pointerEvent->SetPointerAction(1);
1926     result = WIN_MGR->UpdateTargetPointer(pointerEvent);
1927     EXPECT_EQ(result, RET_ERR);
1928     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_JOYSTICK);
1929     pointerEvent->SetPointerAction(1);
1930     result = WIN_MGR->UpdateTargetPointer(pointerEvent);
1931     EXPECT_EQ(result, RET_OK);
1932     pointerEvent->SetSourceType(999);
1933     pointerEvent->SetPointerAction(1);
1934     result = WIN_MGR->UpdateTargetPointer(pointerEvent);
1935     EXPECT_EQ(result, RET_ERR);
1936 }
1937 
1938 /**
1939  * @tc.name: InputWindowsManagerTest_IsInsideDisplay_001
1940  * @tc.desc: This test verifies the functionality of determining whether it is inside the display area
1941  * @tc.type: FUNC
1942  * @tc.require:
1943  */
1944 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInsideDisplay_001, TestSize.Level1)
1945 {
1946     CALL_TEST_DEBUG;
1947     DisplayInfo displayInfo;
1948     displayInfo.width = 1920;
1949     displayInfo.height = 1080;
1950     displayInfo.validWidth = displayInfo.width;
1951     displayInfo.validHeight = displayInfo.height;
1952     int32_t physicalX = 500;
1953     int32_t physicalY = 10;
1954     bool result = WIN_MGR->IsInsideDisplay(displayInfo, physicalX, physicalY);
1955     EXPECT_TRUE(result);
1956     physicalX = -10;
1957     physicalY = 500;
1958     result = WIN_MGR->IsInsideDisplay(displayInfo, physicalX, physicalY);
1959     EXPECT_FALSE(result);
1960     physicalX = 500;
1961     physicalY = -10;
1962     result = WIN_MGR->IsInsideDisplay(displayInfo, physicalX, physicalY);
1963     EXPECT_FALSE(result);
1964     physicalX = -500;
1965     physicalY = -10;
1966     result = WIN_MGR->IsInsideDisplay(displayInfo, physicalX, physicalY);
1967     EXPECT_FALSE(result);
1968 }
1969 
1970 /**
1971  * @tc.name: InputWindowsManagerTest_FindPhysicalDisplay_001
1972  * @tc.desc: This test verifies the functionality of finding physical displays
1973  * @tc.type: FUNC
1974  * @tc.require:
1975  */
1976 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_001, TestSize.Level1)
1977 {
1978     CALL_TEST_DEBUG;
1979     DisplayInfo displayInfo = {10, 20};
1980     double physicalX, physicalY;
1981     int32_t displayId;
1982     WIN_MGR->FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
1983     EXPECT_EQ(physicalX, RET_OK);
1984     EXPECT_EQ(physicalY, RET_OK);
1985     EXPECT_EQ(displayId, RET_OK);
1986     displayInfo.x = INT32_MAX;
1987     displayInfo.y = INT32_MAX;
1988     WIN_MGR->FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
1989     EXPECT_EQ(physicalX, RET_OK);
1990     EXPECT_EQ(physicalY, RET_OK);
1991     EXPECT_EQ(displayId, RET_OK);
1992     displayInfo.x = 50;
1993     displayInfo.y = 60;
1994     WIN_MGR->FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
1995     EXPECT_EQ(physicalX, RET_OK);
1996     EXPECT_EQ(physicalY, RET_OK);
1997     EXPECT_EQ(displayId, RET_OK);
1998 }
1999 
2000 /**
2001  * @tc.name: InputWindowsManagerTest_GetWidthAndHeight_001
2002  * @tc.desc: Test the method for retrieving width and height
2003  * @tc.type: FUNC
2004  * @tc.require:
2005  */
2006 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight_001, TestSize.Level1)
2007 {
2008     CALL_TEST_DEBUG;
2009     DisplayInfo displayInfo;
2010     displayInfo.displayDirection = DIRECTION0;
2011     displayInfo.direction = DIRECTION0;
2012     int32_t width = 1920;
2013     int32_t height = 1080;
2014     WIN_MGR->GetWidthAndHeight(&displayInfo, width, height);
2015     EXPECT_EQ(width, RET_OK);
2016     EXPECT_EQ(height, RET_OK);
2017     displayInfo.direction = DIRECTION90;
2018     WIN_MGR->GetWidthAndHeight(&displayInfo, width, height);
2019     EXPECT_EQ(width, RET_OK);
2020     EXPECT_EQ(height, RET_OK);
2021     displayInfo.displayDirection = DIRECTION180;
2022     displayInfo.direction = DIRECTION0;
2023     WIN_MGR->GetWidthAndHeight(&displayInfo, width, height);
2024     EXPECT_EQ(width, RET_OK);
2025     EXPECT_EQ(height, RET_OK);
2026 }
2027 
2028 /**
2029  * @tc.name: InputWindowsManagerTest_ReverseRotateScreen_001
2030  * @tc.desc: Test the method for reversing screen rotation
2031  * @tc.type: FUNC
2032  * @tc.require:
2033  */
2034 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseRotateScreen_001, TestSize.Level1)
2035 {
2036     CALL_TEST_DEBUG;
2037     DisplayInfo info;
2038     Coordinate2D cursorPos;
2039     info.direction = DIRECTION0;
2040     info.width = 1920;
2041     info.height = 1080;
2042     info.validWidth = info.width;
2043     info.validHeight = info.height;
2044     WIN_MGR->ReverseRotateScreen(info, 100.0, 200.0, cursorPos);
2045     EXPECT_EQ(cursorPos.x, 100);
2046     EXPECT_EQ(cursorPos.y, 200);
2047     info.direction = DIRECTION90;
2048     WIN_MGR->ReverseRotateScreen(info, 100.0, 200.0, cursorPos);;
2049     EXPECT_EQ(cursorPos.x, 200);
2050     EXPECT_EQ(cursorPos.y, 1820);
2051     info.direction = DIRECTION180;
2052     WIN_MGR->ReverseRotateScreen(info, 100.0, 200.0, cursorPos);
2053     EXPECT_EQ(cursorPos.x, 1820);
2054     EXPECT_EQ(cursorPos.y, 880);
2055     info.direction = DIRECTION270;
2056     WIN_MGR->ReverseRotateScreen(info, 100.0, 200.0, cursorPos);
2057     EXPECT_EQ(cursorPos.x, 880);
2058     EXPECT_EQ(cursorPos.y, 100);
2059 }
2060 
2061 /**
2062  * @tc.name: InputWindowsManagerTest_UpdateAndAdjustMouseLocation_001
2063  * @tc.desc: Test the method for updating and adjusting mouse location
2064  * @tc.type: FUNC
2065  * @tc.require:
2066  */
2067 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLocation_001, TestSize.Level1)
2068 {
2069     CALL_TEST_DEBUG;
2070     int32_t displayId = 2;
2071     double x = 100.5;
2072     double y = 200.5;
2073     bool isRealData = true;
2074     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2075     ASSERT_NE(inputEvent, nullptr);
2076     WIN_MGR->UpdateAndAdjustMouseLocation(displayId, x, y, isRealData);
2077     auto ret = WIN_MGR->GetDisplayId(inputEvent);
2078     EXPECT_NE(displayId, ret);
2079     displayId = -1;
2080     x = 100.5;
2081     y = 200.5;
2082     isRealData = true;
2083     WIN_MGR->UpdateAndAdjustMouseLocation(displayId, x, y, isRealData);
2084     ret = WIN_MGR->GetDisplayId(inputEvent);
2085     EXPECT_NE(displayId, ret);
2086     displayId = 0;
2087     x = -100.5;
2088     y = -200.5;
2089     isRealData = true;
2090     WIN_MGR->UpdateAndAdjustMouseLocation(displayId, x, y, isRealData);
2091     ret = WIN_MGR->GetDisplayId(inputEvent);
2092     EXPECT_NE(displayId, ret);
2093     displayId = 0;
2094     x = 100.5;
2095     y = 200.5;
2096     isRealData = false;
2097     WIN_MGR->UpdateAndAdjustMouseLocation(displayId, x, y, isRealData);
2098     ret = WIN_MGR->GetDisplayId(inputEvent);
2099     EXPECT_NE(displayId, ret);
2100 }
2101 
2102 /**
2103  * @tc.name: InputWindowsManagerTest_GetMouseInfo_001
2104  * @tc.desc: Test the GetMouseInfo method
2105  * @tc.type: FUNC
2106  * @tc.require:
2107  */
2108 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetMouseInfo_001, TestSize.Level1)
2109 {
2110     CALL_TEST_DEBUG;
2111     DisplayGroupInfo displayGroupInfo;
2112     MouseLocation mouseLocation;
2113     displayGroupInfo.displaysInfo.clear();
2114     MouseLocation result = WIN_MGR->GetMouseInfo();
2115     DisplayInfo displayInfo;
2116     displayInfo.id = 1;
2117     displayInfo.width = 1920;
2118     displayInfo.height = 1080;
2119     displayGroupInfo.displaysInfo.push_back(displayInfo);
2120     mouseLocation.displayId = 0;
2121     result = WIN_MGR->GetMouseInfo();
2122     displayGroupInfo.displaysInfo.push_back(displayInfo);
2123     mouseLocation.displayId = -1;
2124     MouseLocation expectedResult;
2125     expectedResult.displayId = 1;
2126     expectedResult.physicalX = 960;
2127     expectedResult.physicalY = 540;
2128     ASSERT_NO_FATAL_FAILURE(WIN_MGR->GetMouseInfo());
2129 }
2130 
2131 /**
2132  * @tc.name: InputWindowsManagerTest_GetCursorPos_001
2133  * @tc.desc: Test the functionality of getting the cursor position
2134  * @tc.type: FUNC
2135  * @tc.require:
2136  */
2137 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos_001, TestSize.Level1)
2138 {
2139     CALL_TEST_DEBUG;
2140     InputWindowsManager manager;
2141     manager.cursorPos_.displayId = -1;
2142     manager.displayGroupInfo_.displaysInfo.push_back({0, 800, 600});
2143     CursorPosition result = WIN_MGR->GetCursorPos();
2144     EXPECT_EQ(result.displayId, 1);
2145     EXPECT_EQ(result.cursorPos.x, 0);
2146     EXPECT_EQ(result.cursorPos.y, 0);
2147     manager.cursorPos_.displayId = 1;
2148     manager.displayGroupInfo_.displaysInfo.push_back({1, 800, 600});
2149     result = WIN_MGR->GetCursorPos();
2150     EXPECT_EQ(result.displayId, 1);
2151     EXPECT_EQ(result.cursorPos.x, 0);
2152     EXPECT_EQ(result.cursorPos.y, 0);
2153 }
2154 
2155 /**
2156  * @tc.name: InputWindowsManagerTest_ResetCursorPos_001
2157  * @tc.desc: Test the functionality of resetting cursor position
2158  * @tc.type: FUNC
2159  * @tc.require:
2160  */
2161 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetCursorPos_001, TestSize.Level1)
2162 {
2163     CALL_TEST_DEBUG;
2164     InputWindowsManager manager;
2165     manager.displayGroupInfo_.displaysInfo.push_back({1, 800, 600});
2166     CursorPosition result = WIN_MGR->ResetCursorPos();
2167     EXPECT_EQ(result.displayId, 1);
2168     EXPECT_EQ(result.cursorPos.x, 0);
2169     EXPECT_EQ(result.cursorPos.y, 0);
2170     manager.displayGroupInfo_.displaysInfo.clear();
2171     result = WIN_MGR->ResetCursorPos();
2172     EXPECT_EQ(result.displayId, 1);
2173     EXPECT_EQ(result.cursorPos.x, 0);
2174     EXPECT_EQ(result.cursorPos.y, 0);
2175 }
2176 
2177 /**
2178  * @tc.name: InputWindowsManagerTest_AppendExtraData_001
2179  * @tc.desc: Test the functionality of appending extra data in the input window manager
2180  * @tc.type: FUNC
2181  * @tc.require:
2182  */
2183 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AppendExtraData_001, TestSize.Level1)
2184 {
2185     CALL_TEST_DEBUG;
2186     InputWindowsManager manager;
2187     ExtraData extraData;
2188     extraData.appended = true;
2189     extraData.buffer = std::vector<uint8_t>{1, 2, 3};
2190     extraData.pointerId = 12345;
2191     int32_t result = WIN_MGR->AppendExtraData(extraData);
2192     ASSERT_EQ(result, RET_OK);
2193     ASSERT_NE(manager.GetExtraData().appended, extraData.appended);
2194     ASSERT_NE(manager.GetExtraData().buffer, extraData.buffer);
2195     ASSERT_NE(manager.GetExtraData().pointerId, extraData.pointerId);
2196 }
2197 
2198 /**
2199  * @tc.name: InputWindowsManagerTest_ClearExtraData_001
2200  * @tc.desc: Test the functionality of clearing extra data
2201  * @tc.type: FUNC
2202  * @tc.require:
2203  */
2204 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ClearExtraData_001, TestSize.Level1)
2205 {
2206     CALL_TEST_DEBUG;
2207     InputWindowsManager manager;
2208     manager.extraData_.appended = true;
2209     manager.extraData_.buffer.push_back(1);
2210     manager.extraData_.sourceType = 0;
2211     manager.extraData_.pointerId = 1;
2212     WIN_MGR->ClearExtraData();
2213     EXPECT_TRUE(manager.extraData_.appended);
2214     EXPECT_FALSE(manager.extraData_.buffer.empty());
2215     EXPECT_NE(-1, manager.extraData_.sourceType);
2216     EXPECT_NE(-1, manager.extraData_.pointerId);
2217 }
2218 
2219 /**
2220  * @tc.name: InputWindowsManagerTest_GetExtraData_001
2221  * @tc.desc: Test the functionality of getting extra data in the input window manager
2222  * @tc.type: FUNC
2223  * @tc.require:
2224  */
2225 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetExtraData_001, TestSize.Level1)
2226 {
2227     CALL_TEST_DEBUG;
2228     ASSERT_NO_FATAL_FAILURE(WIN_MGR->GetExtraData());
2229 }
2230 
2231 /**
2232  * @tc.name: InputWindowsManagerTest_IsWindowVisible_001
2233  * @tc.desc: Test the window visibility functionality of the input window manager
2234  * @tc.type: FUNC
2235  * @tc.require:
2236  */
2237 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsWindowVisible_001, TestSize.Level1)
2238 {
2239     CALL_TEST_DEBUG;
2240     int32_t invalidPid = -1;
2241     bool result = WIN_MGR->IsWindowVisible(invalidPid);
2242     EXPECT_TRUE(result);
2243     int32_t visiblePid = 0;
2244     result = WIN_MGR->IsWindowVisible(visiblePid);
2245     EXPECT_FALSE(result);
2246     int32_t invisiblePid = 1;
2247     result = WIN_MGR->IsWindowVisible(invisiblePid);
2248     EXPECT_FALSE(result);
2249 }
2250 
2251 /**
2252  * @tc.name: InputWindowsManagerTest_UpdatePointerAction_001
2253  * @tc.desc: Test the update function of pointer action in Input Windows Manager
2254  * @tc.type: FUNC
2255  * @tc.require:
2256  */
2257 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerAction_001, TestSize.Level1)
2258 {
2259     CALL_TEST_DEBUG;
2260     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2261     ASSERT_NE(pointerEvent, nullptr);
2262     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2263     WIN_MGR->UpdatePointerAction(pointerEvent);
2264     EXPECT_EQ(pointerEvent->GetPointerAction(), PointerEvent::POINTER_ACTION_PULL_MOVE);
2265     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
2266     WIN_MGR->UpdatePointerAction(pointerEvent);
2267     EXPECT_EQ(pointerEvent->GetPointerAction(), PointerEvent::POINTER_ACTION_PULL_UP);
2268     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UP);
2269     WIN_MGR->UpdatePointerAction(pointerEvent);
2270     EXPECT_EQ(pointerEvent->GetPointerAction(), PointerEvent::POINTER_ACTION_PULL_UP);
2271     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ENTER_WINDOW);
2272     WIN_MGR->UpdatePointerAction(pointerEvent);
2273     EXPECT_EQ(pointerEvent->GetPointerAction(), PointerEvent::POINTER_ACTION_PULL_IN_WINDOW);
2274     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_LEAVE_WINDOW);
2275     WIN_MGR->UpdatePointerAction(pointerEvent);
2276     EXPECT_EQ(pointerEvent->GetPointerAction(), PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW);
2277     pointerEvent->SetPointerAction(100);
2278     WIN_MGR->UpdatePointerAction(pointerEvent);
2279     EXPECT_EQ(pointerEvent->GetPointerAction(), 100);
2280 }
2281 
2282 /**
2283  * @tc.name: InputWindowsManagerTest_Dump_001
2284  * @tc.desc: Test the dump function of the input window manager
2285  * @tc.type: FUNC
2286  * @tc.require:
2287  */
2288 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_Dump_001, TestSize.Level1)
2289 {
2290     CALL_TEST_DEBUG;
2291     int32_t fd = 1;
2292     std::vector<std::string> args;
2293     ASSERT_NO_FATAL_FAILURE(WIN_MGR->Dump(fd, args));
2294 }
2295 
2296 /**
2297  * @tc.name: InputWindowsManagerTest_TransformWindowXY_001
2298  * @tc.desc: Test the TransformWindowXY function of the input window manager
2299  * @tc.type: FUNC
2300  * @tc.require:
2301  */
2302 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformWindowXY_001, TestSize.Level1)
2303 {
2304     CALL_TEST_DEBUG;
2305     WindowInfo window;
2306     double logicX = 10.0;
2307     double logicY = 20.0;
2308     std::pair<double, double> result =WIN_MGR->TransformWindowXY(window, logicX, logicY);
2309     double ret = result.first;
2310     EXPECT_EQ(ret, logicX);
2311     double ret1 = result.second;
2312     EXPECT_EQ(ret1, logicY);
2313 }
2314 
2315 /**
2316  * @tc.name: InputWindowsManagerTest_IsValidZorderWindow_001
2317  * @tc.desc: Test the validity of the input window manager
2318  * @tc.type: FUNC
2319  * @tc.require:
2320  */
2321 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidZorderWindow_001, TestSize.Level1)
2322 {
2323     CALL_TEST_DEBUG;
2324     WindowInfo window;
2325     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2326     ASSERT_NE(pointerEvent, nullptr);
2327     pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SIMULATE);
2328     bool result = WIN_MGR->IsValidZorderWindow(window, pointerEvent);
2329     EXPECT_TRUE(result);
2330 }
2331 
2332 /**
2333  * @tc.name: InputWindowsManagerTest_HandleWindowInputType_004
2334  * @tc.desc: Test the functionality of handling window input types in the Input Windows Manage
2335  * @tc.type: FUNC
2336  * @tc.require:
2337  */
2338 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleWindowInputType_004, TestSize.Level1)
2339 {
2340     CALL_TEST_DEBUG;
2341     UDSServer udsServer;
2342     WIN_MGR->Init(udsServer);
2343     auto pointerEvent = PointerEvent::Create();
2344     ASSERT_NE(pointerEvent, nullptr);
2345     WindowInfo window;
2346     window.windowInputType = WindowInputType::TRANSMIT_EXCEPT_MOVE;
2347     ASSERT_FALSE(WIN_MGR->HandleWindowInputType(window, pointerEvent));
2348 }
2349 
2350 /**
2351  * @tc.name: InputWindowsManagerTest_GetWindowAndDisplayInfo_001
2352  * @tc.desc: Test the function of getting window and display information
2353  * @tc.type: FUNC
2354  * @tc.require:
2355  */
2356 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowAndDisplayInfo_001, TestSize.Level1)
2357 {
2358     CALL_TEST_DEBUG;
2359     int32_t windowId = 1;
2360     int32_t displayId = 1;
2361     auto result = WIN_MGR->GetWindowAndDisplayInfo(windowId, displayId);
2362     ASSERT_TRUE(result.has_value());
2363     EXPECT_EQ(result->id, windowId);
2364     windowId = -1;
2365     displayId = 1;
2366     result = WIN_MGR->GetWindowAndDisplayInfo(windowId, displayId);
2367     ASSERT_FALSE(result.has_value());
2368     windowId = 1;
2369     displayId = -1;
2370     result = WIN_MGR->GetWindowAndDisplayInfo(windowId, displayId);
2371     ASSERT_TRUE(result.has_value());
2372 }
2373 
2374 /**
2375  * @tc.name: InputWindowsManagerTest_GetTargetWindowIds_001
2376  * @tc.desc: Test the functionality of getting target window IDs
2377  * @tc.type: FUNC
2378  * @tc.require:
2379  */
2380 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetTargetWindowIds_001, TestSize.Level1)
2381 {
2382     CALL_TEST_DEBUG;
2383     std::vector<int32_t> windowIds;
2384     int32_t pointerItemId = 1;
2385     int32_t windowId = 100;
2386     int32_t sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
2387     WIN_MGR->AddTargetWindowIds(pointerItemId, sourceType, windowId);
2388     WIN_MGR->GetTargetWindowIds(pointerItemId, sourceType, windowIds);
2389     ASSERT_TRUE(!windowIds.empty());
2390     WIN_MGR->ClearTargetWindowId(pointerItemId);
2391 }
2392 
2393 /**
2394  * @tc.name: InputWindowsManagerTest_AddTargetWindowIds_001
2395  * @tc.desc: Test the functionality of adding target window IDs
2396  * @tc.type: FUNC
2397  * @tc.require:
2398  */
2399 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AddTargetWindowIds_001, TestSize.Level1)
2400 {
2401     CALL_TEST_DEBUG;
2402     InputWindowsManager manager;
2403     int32_t pointerItemId = 1;
2404     int32_t windowId = 100;
2405     int32_t sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
2406     WIN_MGR->AddTargetWindowIds(pointerItemId, sourceType, windowId);
2407     ASSERT_FALSE(manager.targetTouchWinIds_.find(pointerItemId) != manager.targetTouchWinIds_.end());
2408     ASSERT_EQ(manager.targetTouchWinIds_[pointerItemId].size(), 0);
2409 }
2410 
2411 /**
2412  * @tc.name: InputWindowsManagerTest_AddTargetWindowIds_002
2413  * @tc.desc: Test the functionality of adding target window IDs
2414  * @tc.type: FUNC
2415  * @tc.require:
2416  */
2417 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AddTargetWindowIds_002, TestSize.Level1)
2418 {
2419     CALL_TEST_DEBUG;
2420     InputWindowsManager manager;
2421     int32_t pointerItemId = 2;
2422     int32_t windowId1 = 200;
2423     int32_t windowId2 = 201;
2424     int32_t sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
2425     manager.targetTouchWinIds_[pointerItemId] = {windowId1};
2426     WIN_MGR->AddTargetWindowIds(pointerItemId, sourceType, windowId2);
2427     ASSERT_TRUE(manager.targetTouchWinIds_.find(pointerItemId) != manager.targetTouchWinIds_.end());
2428     ASSERT_EQ(manager.targetTouchWinIds_[pointerItemId].size(), 1);
2429     ASSERT_EQ(manager.targetTouchWinIds_[pointerItemId][0], windowId1);
2430     ASSERT_NE(manager.targetTouchWinIds_[pointerItemId][1], windowId2);
2431 }
2432 
2433 /**
2434  * @tc.name: InputWindowsManagerTest_CheckWindowIdPermissionByPid_002
2435  * @tc.desc: Test the functionality of checking window ID permission by process ID
2436  * @tc.type: FUNC
2437  * @tc.require:
2438  */
2439 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckWindowIdPermissionByPid_002, TestSize.Level1)
2440 {
2441     CALL_TEST_DEBUG;
2442     int32_t windowId = -123;
2443     int32_t pid = -456;
2444     int32_t result = WIN_MGR->CheckWindowIdPermissionByPid(windowId, pid);
2445     EXPECT_EQ(result, RET_ERR);
2446 }
2447 
2448 /**
2449  * @tc.name: InputWindowsManagerTest_IsTransparentWin_001
2450  * @tc.desc: Test the functionality of transparent windows
2451  * @tc.type: FUNC
2452  * @tc.require:
2453  */
2454 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsTransparentWin_001, TestSize.Level1)
2455 {
2456     CALL_TEST_DEBUG;
2457     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
2458     int32_t logicalX = 0;
2459     int32_t logicalY = 0;
2460     auto result = WIN_MGR->IsTransparentWin(pixelMap, logicalX, logicalY);
2461     EXPECT_FALSE(result);
2462 }
2463 
2464 /**
2465  * @tc.name: InputWindowsManagerTest_SetCurrentUser_001
2466  * @tc.desc: Test the functionality of setting the current user
2467  * @tc.type: FUNC
2468  * @tc.require:
2469  */
2470 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetCurrentUser_001, TestSize.Level1)
2471 {
2472     CALL_TEST_DEBUG;
2473     int32_t userId = 123;
2474     auto ret = WIN_MGR->SetCurrentUser(userId);
2475     EXPECT_EQ(ret, RET_OK);
2476     userId = -456;
2477     ret = WIN_MGR->SetCurrentUser(userId);
2478     EXPECT_EQ(ret, RET_OK);
2479 }
2480 
2481 /**
2482  * @tc.name: InputWindowsManagerTest_UpdatePointerAction_01
2483  * @tc.desc: Test UpdatePointerAction
2484  * @tc.type: FUNC
2485  * @tc.require:
2486  */
2487 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerAction_01, TestSize.Level1)
2488 {
2489     CALL_TEST_DEBUG;
2490     UDSServer udsServer;
2491     WIN_MGR->Init(udsServer);
2492     auto pointerEvent = PointerEvent::Create();
2493     ASSERT_NE(pointerEvent, nullptr);
2494     int32_t action = pointerEvent->GetPointerAction();
2495     action = PointerEvent::POINTER_ACTION_MOVE;
2496     WIN_MGR->UpdatePointerAction(pointerEvent);
2497     ASSERT_NO_FATAL_FAILURE(pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_MOVE));
2498 }
2499 
2500 /**
2501  * @tc.name: InputWindowsManagerTest_UpdatePointerAction_02
2502  * @tc.desc: Test UpdatePointerAction
2503  * @tc.type: FUNC
2504  * @tc.require:
2505  */
2506 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerAction_02, TestSize.Level1)
2507 {
2508     CALL_TEST_DEBUG;
2509     UDSServer udsServer;
2510     WIN_MGR->Init(udsServer);
2511     auto pointerEvent = PointerEvent::Create();
2512     ASSERT_NE(pointerEvent, nullptr);
2513     int32_t action = pointerEvent->GetPointerAction();
2514     action = PointerEvent::POINTER_ACTION_UP;
2515     WIN_MGR->UpdatePointerAction(pointerEvent);
2516     ASSERT_NO_FATAL_FAILURE(pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP));
2517 }
2518 
2519 /**
2520  * @tc.name: InputWindowsManagerTest_UpdatePointerAction_03
2521  * @tc.desc: Test UpdatePointerAction
2522  * @tc.type: FUNC
2523  * @tc.require:
2524  */
2525 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerAction_03, TestSize.Level1)
2526 {
2527     CALL_TEST_DEBUG;
2528     UDSServer udsServer;
2529     WIN_MGR->Init(udsServer);
2530     auto pointerEvent = PointerEvent::Create();
2531     ASSERT_NE(pointerEvent, nullptr);
2532     int32_t action = pointerEvent->GetPointerAction();
2533     action = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
2534     WIN_MGR->UpdatePointerAction(pointerEvent);
2535     ASSERT_NO_FATAL_FAILURE(pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_IN_WINDOW));
2536 }
2537 
2538 /**
2539  * @tc.name: InputWindowsManagerTest_UpdatePointerAction_04
2540  * @tc.desc: Test UpdatePointerAction
2541  * @tc.type: FUNC
2542  * @tc.require:
2543  */
2544 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerAction_04, TestSize.Level1)
2545 {
2546     CALL_TEST_DEBUG;
2547     UDSServer udsServer;
2548     WIN_MGR->Init(udsServer);
2549     auto pointerEvent = PointerEvent::Create();
2550     ASSERT_NE(pointerEvent, nullptr);
2551     int32_t action = pointerEvent->GetPointerAction();
2552     action = PointerEvent::POINTER_ACTION_LEAVE_WINDOW;
2553     WIN_MGR->UpdatePointerAction(pointerEvent);
2554     ASSERT_NO_FATAL_FAILURE(pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW));
2555 }
2556 
2557 /**
2558  * @tc.name: InputWindowsManagerTest_UpdateDisplayId_002
2559  * @tc.desc: Test UpdateDisplayId
2560  * @tc.type: FUNC
2561  * @tc.require:
2562  */
2563 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayId_002, TestSize.Level1)
2564 {
2565     auto pointerEvent = PointerEvent::Create();
2566     pointerEvent->SetTargetDisplayId(1);
2567     auto id = pointerEvent->GetTargetDisplayId();
2568     ASSERT_TRUE(WIN_MGR->UpdateDisplayId(id));
2569 }
2570 
2571 /**
2572  * @tc.name: InputWindowsManagerTest_UpdateDisplayId_003
2573  * @tc.desc: Test UpdateDisplayId
2574  * @tc.type: FUNC
2575  * @tc.require:
2576  */
2577 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayId_003, TestSize.Level1)
2578 {
2579     auto pointerEvent = PointerEvent::Create();
2580     pointerEvent->SetTargetDisplayId(10);
2581     auto id = pointerEvent->GetTargetDisplayId();
2582     ASSERT_FALSE(WIN_MGR->UpdateDisplayId(id));
2583 }
2584 
2585 /**
2586  * @tc.name: InputWindowsManagerTest_Init_001
2587  * @tc.desc: Test Init
2588  * @tc.type: FUNC
2589  * @tc.require:
2590  */
2591 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_Init_001, TestSize.Level1)
2592 {
2593     UDSServer udsServer;
2594     WIN_MGR->Init(udsServer);
2595     EXPECT_TRUE(true);
2596 }
2597 
2598 /**
2599  * @tc.name: InputWindowsManagerTest_UpdateCaptureMode_002
2600  * @tc.desc: Test UpdateCaptureMode
2601  * @tc.type: FUNC
2602  * @tc.require:
2603  */
2604 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_002, TestSize.Level1)
2605 {
2606     DisplayGroupInfo displayGroupInfo;
2607     DisplayInfo info;
2608     info.id = 1;
2609     info.x =1;
2610     info.y = 1;
2611     info.width = 2;
2612     info.height = 2;
2613     info.dpi = 240;
2614     info.name = "pp";
2615     info.uniq = "pp";
2616     info.direction = DIRECTION0;
2617     displayGroupInfo.displaysInfo.push_back(info);
2618     WIN_MGR->UpdateCaptureMode(displayGroupInfo);
2619     ASSERT_FALSE(WIN_MGR->captureModeInfo_.isCaptureMode);
2620 }
2621 
2622 /**
2623  * @tc.name: InputWindowsManagerTest_IsWindowVisible_002
2624  * @tc.desc: Test IsWindowVisible
2625  * @tc.type: FUNC
2626  * @tc.require:
2627  */
2628 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsWindowVisible_002, TestSize.Level1)
2629 {
2630     int32_t pid = 1000;
2631     auto ret = WIN_MGR->IsWindowVisible(pid);
2632     ASSERT_FALSE(ret);
2633 }
2634 
2635 /**
2636  * @tc.name: InputWindowsManagerTest_IsWindowVisible_003
2637  * @tc.desc: Test IsWindowVisible
2638  * @tc.type: FUNC
2639  * @tc.require:
2640  */
2641 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsWindowVisible_003, TestSize.Level1)
2642 {
2643     int32_t pid = -1;
2644     auto ret = WIN_MGR->IsWindowVisible(pid);
2645     ASSERT_TRUE(ret);
2646 }
2647 
2648 /**
2649  * @tc.name: InputWindowsManagerTest_GetWindowGroupInfoByDisplayId
2650  * @tc.desc: Test GetWindowGroupInfoByDisplayId
2651  * @tc.type: FUNC
2652  * @tc.require:
2653  */
2654 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowGroupInfoByDisplayId, TestSize.Level1)
2655 {
2656     CALL_TEST_DEBUG;
2657     InputWindowsManager inputWindowsManager;
2658     WindowGroupInfo windowGroupInfo;
2659     int32_t displayId = 1;
2660     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
2661     EXPECT_TRUE(inputWindowsManager.GetWindowGroupInfoByDisplayId(displayId).empty());
2662 
2663     WindowInfo windowInfo;
2664     displayId = 2;
2665     windowInfo.id = 1;
2666     windowGroupInfo.windowsInfo.push_back(windowInfo);
2667     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
2668     EXPECT_TRUE(!inputWindowsManager.GetWindowGroupInfoByDisplayId(displayId).empty());
2669 }
2670 
2671 /**
2672  * @tc.name: InputWindowsManagerTest_GetClientFd
2673  * @tc.desc: Test GetClientFd
2674  * @tc.type: FUNC
2675  * @tc.require:
2676  */
2677 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd, TestSize.Level1)
2678 {
2679     InputWindowsManager inputWindowsManager;
2680     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2681     EXPECT_NE(pointerEvent, nullptr);
2682     WindowInfoEX windowInfoEX;
2683     windowInfoEX.flag = false;
2684     pointerEvent->SetPointerId(0);
2685     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), windowInfoEX));
2686     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2687     pointerEvent->SetPointerId(1);
2688     pointerEvent->SetTargetDisplayId(10);
2689     pointerEvent->SetTargetWindowId(15);
2690     WindowGroupInfo windowGroupInfo;
2691     WindowInfo windowInfo;
2692     windowInfo.id = 0;
2693     windowInfo.pid = 5;
2694     windowGroupInfo.windowsInfo.push_back(windowInfo);
2695     windowInfo.id = 15;
2696     windowInfo.pid = 6;
2697     windowGroupInfo.windowsInfo.push_back(windowInfo);
2698     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(pointerEvent->GetTargetDisplayId(), windowGroupInfo));
2699     UDSServer udsServer;
2700     udsServer.idxPidMap_.insert(std::make_pair(6, 15));
2701     inputWindowsManager.udsServer_ = &udsServer;
2702     EXPECT_NE(inputWindowsManager.udsServer_, nullptr);
2703     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), 15);
2704     pointerEvent->SetTargetWindowId(20);
2705     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_LEAVE_WINDOW);
2706     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2707     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
2708     inputWindowsManager.touchItemDownInfos_.clear();
2709     windowInfoEX.flag = true;
2710     windowInfoEX.window.agentWindowId = 1;
2711     pointerEvent->SetPointerId(0);
2712     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2713     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), windowInfoEX));
2714     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2715     pointerEvent->SetPointerId(7);
2716     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2717     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2718     inputWindowsManager.mouseDownInfo_.pid = 1;
2719     inputWindowsManager.mouseDownInfo_.agentWindowId = 6;
2720     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2721     inputWindowsManager.mouseDownInfo_.pid = -1;
2722     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2723     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_JOYSTICK);
2724     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent), INVALID_FD);
2725 }
2726 
2727 /**
2728  * @tc.name: InputWindowsManagerTest_GetClientFd_002
2729  * @tc.desc: Test GetClientFd
2730  * @tc.type: FUNC
2731  * @tc.require:
2732  */
2733 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_002, TestSize.Level1)
2734 {
2735     CALL_TEST_DEBUG;
2736     InputWindowsManager inputWindowsManager;
2737     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2738     EXPECT_NE(pointerEvent, nullptr);
2739     UDSServer udsServer;
2740     int32_t udsPid = 20;
2741     int32_t udsFd = 15;
2742     udsServer.idxPidMap_.insert(std::make_pair(udsPid, udsFd));
2743     inputWindowsManager.udsServer_ = &udsServer;
2744     int32_t windowId = 15;
2745     EXPECT_NE(inputWindowsManager.udsServer_, nullptr);
2746     WindowGroupInfo widGroupInfo;
2747     WindowInfo windowInfo;
2748     pointerEvent->SetTargetDisplayId(15);
2749     windowInfo.id = 5;
2750     windowInfo.pid = 10;
2751     widGroupInfo.windowsInfo.push_back(windowInfo);
2752     windowInfo.id = 15;
2753     windowInfo.pid = 20;
2754     widGroupInfo.windowsInfo.push_back(windowInfo);
2755     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(pointerEvent->GetTargetDisplayId(), widGroupInfo));
2756     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent, windowId), udsFd);
2757     windowId = 7;
2758     EXPECT_EQ(inputWindowsManager.GetClientFd(pointerEvent, windowId), INVALID_FD);
2759 }
2760 
2761 /**
2762  * @tc.name: InputWindowsManagerTest_CheckFocusWindowChange
2763  * @tc.desc: Test CheckFocusWindowChange
2764  * @tc.type: FUNC
2765  * @tc.require:
2766  */
2767 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange, TestSize.Level1)
2768 {
2769     CALL_TEST_DEBUG;
2770     InputWindowsManager inputWindowsManager;
2771     DisplayGroupInfo displayGroupInfo;
2772     displayGroupInfo.focusWindowId = 1;
2773     inputWindowsManager.displayGroupInfo_.focusWindowId = 1;
2774     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CheckFocusWindowChange(displayGroupInfo));
2775 }
2776 
2777 /**
2778  * @tc.name: InputWindowsManagerTest_CheckZorderWindowChange
2779  * @tc.desc: Test CheckZorderWindowChange
2780  * @tc.type: FUNC
2781  * @tc.require:
2782  */
2783 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckZorderWindowChange, TestSize.Level1)
2784 {
2785     CALL_TEST_DEBUG;
2786     InputWindowsManager inputWindowsManager;
2787     std::vector<WindowInfo> oldWindowsInfo;
2788     std::vector<WindowInfo> newWindowsInfo;
2789     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CheckZorderWindowChange(oldWindowsInfo, newWindowsInfo));
2790 }
2791 
2792 /**
2793  * @tc.name: InputWindowsManagerTest_UpdateCaptureMode
2794  * @tc.desc: Test UpdateCaptureMode
2795  * @tc.type: FUNC
2796  * @tc.require:
2797  */
2798 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode, TestSize.Level1)
2799 {
2800     CALL_TEST_DEBUG;
2801     InputWindowsManager inputWindowsManager;
2802     DisplayGroupInfo displayGroupInfo;
2803     WindowInfo windowInfo;
2804     inputWindowsManager.captureModeInfo_.isCaptureMode = true;
2805     inputWindowsManager.displayGroupInfo_.focusWindowId = 25;
2806     displayGroupInfo.focusWindowId = 25;
2807     windowInfo.id = 10;
2808     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
2809     windowInfo.id = 11;
2810     displayGroupInfo.windowsInfo.push_back(windowInfo);
2811     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCaptureMode(displayGroupInfo));
2812 }
2813 
2814 /**
2815  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfoByIncrementalInfo
2816  * @tc.desc: Test UpdateDisplayInfoByIncrementalInfo
2817  * @tc.type: FUNC
2818  * @tc.require:
2819  */
2820 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoByIncrementalInfo, TestSize.Level1)
2821 {
2822     CALL_TEST_DEBUG;
2823     InputWindowsManager inputWindowsManager;
2824     WindowInfo window;
2825     DisplayGroupInfo displayGroupInfo;
2826     WindowInfo windowInfo;
2827     window.action = WINDOW_UPDATE_ACTION::ADD_END;
2828     window.id = 5;
2829     windowInfo.id = 10;
2830     displayGroupInfo.windowsInfo.push_back(windowInfo);
2831     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2832     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2833     window.id = 5;
2834     window.action = WINDOW_UPDATE_ACTION::DEL;
2835     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2836     window.action = WINDOW_UPDATE_ACTION::CHANGE;
2837     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2838     window.id = 10;
2839     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2840     window.action = WINDOW_UPDATE_ACTION::UNKNOWN;
2841     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo));
2842 }
2843 
2844 /**
2845  * @tc.name: InputWindowsManagerTest_UpdateDisplayMode
2846  * @tc.desc: Test UpdateDisplayMode
2847  * @tc.type: FUNC
2848  * @tc.require:
2849  */
2850 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayMode, TestSize.Level1)
2851 {
2852     CALL_TEST_DEBUG;
2853     InputWindowsManager inputWindowsManager;
2854     DisplayInfo displayInfo;
2855     displayInfo.displayMode = DisplayMode::FULL;
2856     inputWindowsManager.displayMode_ = DisplayMode::FULL;
2857     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2858     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayMode());
2859     inputWindowsManager.displayMode_ = DisplayMode::MAIN;
2860     FINGERSENSE_WRAPPER->sendFingerSenseDisplayMode_ = nullptr;
2861     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayMode());
2862     inputWindowsManager.displayMode_ = DisplayMode::MAIN;
2863     FINGERSENSE_WRAPPER->sendFingerSenseDisplayMode_ = FingersenseWrapperTest;
2864     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayMode());
2865 }
2866 
2867 /**
2868  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplay
2869  * @tc.desc: Test GetPhysicalDisplay
2870  * @tc.type: FUNC
2871  * @tc.require:
2872  */
2873 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay, TestSize.Level1)
2874 {
2875     CALL_TEST_DEBUG;
2876     InputWindowsManager inputWindowsManager;
2877     int32_t id = 1;
2878     DisplayInfo displayInfo;
2879     displayInfo.id = 0;
2880     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2881     displayInfo.id = 1;
2882     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2883     EXPECT_NE(inputWindowsManager.GetPhysicalDisplay(id), nullptr);
2884 }
2885 
2886 /**
2887  * @tc.name: InputWindowsManagerTest_FindPhysicalDisplayInfo
2888  * @tc.desc: Test FindPhysicalDisplayInfo
2889  * @tc.type: FUNC
2890  * @tc.require:
2891  */
2892 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplayInfo, TestSize.Level1)
2893 {
2894     CALL_TEST_DEBUG;
2895     InputWindowsManager inputWindowsManager;
2896     DisplayInfo displayInfo;
2897     std::string uniq = "uniq_test";
2898     displayInfo.uniq = "uniq_test";
2899     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2900     EXPECT_NE(inputWindowsManager.FindPhysicalDisplayInfo(uniq), nullptr);
2901 }
2902 
2903 /**
2904  * @tc.name: InputWindowsManagerTest_OnSessionLost
2905  * @tc.desc: Test OnSessionLost
2906  * @tc.type: FUNC
2907  * @tc.require:
2908  */
2909 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnSessionLost, TestSize.Level1)
2910 {
2911     CALL_TEST_DEBUG;
2912     InputWindowsManager inputWindowsManager;
2913     int32_t pointerStylePid = 10;
2914     int32_t uidRoot = 0;
2915     std::string programName = "uds_sesion_test";
2916     int32_t moduleType = 3;
2917     int32_t pid = 9;
2918     int32_t fd = -1;
2919     SessionPtr sess = std::make_shared<UDSSession>(programName, moduleType, fd, uidRoot, pid);
2920     int32_t windowId = 1;
2921     PointerStyle pointerStyle;
2922     pointerStyle.size = 1;
2923     pointerStyle.color = 2;
2924     pointerStyle.id = 3;
2925     std::map<int32_t, PointerStyle> pointerStyleMap;
2926     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
2927     inputWindowsManager.pointerStyle_.insert(std::make_pair(pointerStylePid, pointerStyleMap));
2928     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.OnSessionLost(sess));
2929 
2930     pid = 10;
2931     SessionPtr session = std::make_shared<UDSSession>(programName, moduleType, fd, uidRoot, pid);
2932     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.OnSessionLost(session));
2933 }
2934 
2935 /**
2936  * @tc.name: InputWindowsManagerTest_UpdatePoinerStyle
2937  * @tc.desc: Test UpdatePoinerStyle
2938  * @tc.type: FUNC
2939  * @tc.require:
2940  */
2941 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePoinerStyle, TestSize.Level1)
2942 {
2943     CALL_TEST_DEBUG;
2944     InputWindowsManager inputWindowsManager;
2945     int32_t pid = 1;
2946     int32_t windowId = 1;
2947     PointerStyle pointerStyle;
2948     pointerStyle.size = 1;
2949     pointerStyle.color = 2;
2950     pointerStyle.id = 3;
2951     std::map<int32_t, PointerStyle> pointerStyleMap;
2952     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
2953     inputWindowsManager.pointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
2954     windowId = 2;
2955     WindowInfo windowInfo;
2956     windowInfo.id = 3;
2957     windowInfo.pid = 6;
2958     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
2959     windowInfo.id = 2;
2960     windowInfo.pid = 1;
2961     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
2962     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePoinerStyle(pid, windowId, pointerStyle));
2963 }
2964 
2965 /**
2966  * @tc.name: InputWindowsManagerTest_UpdateSceneBoardPointerStyle
2967  * @tc.desc: Test UpdateSceneBoardPointerStyle
2968  * @tc.type: FUNC
2969  * @tc.require:
2970  */
2971 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateSceneBoardPointerStyle, TestSize.Level1)
2972 {
2973     CALL_TEST_DEBUG;
2974     InputWindowsManager inputWindowsManager;
2975     int32_t pid = 1000;
2976     int32_t windowId = 987654321;
2977     bool isUiExtension = true;
2978     PointerStyle style;
2979     style.id = 0;
2980     std::map<int32_t, PointerStyle> pointerStyleMap;
2981     pointerStyleMap.insert(std::make_pair(windowId, style));
2982     inputWindowsManager.uiExtensionPointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
2983     pid = 1001;
2984     EXPECT_EQ(inputWindowsManager.UpdateSceneBoardPointerStyle(pid, windowId, style, isUiExtension), RET_OK);
2985     pid = 1000;
2986     windowId = 123456789;
2987     EXPECT_EQ(inputWindowsManager.UpdateSceneBoardPointerStyle(pid, windowId, style, isUiExtension), RET_OK);
2988 }
2989 
2990 /**
2991  * @tc.name: InputWindowsManagerTest_SetGlobalDefaultPointerStyle
2992  * @tc.desc: Test SetGlobalDefaultPointerStyle
2993  * @tc.type: FUNC
2994  * @tc.require:
2995  */
2996 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetGlobalDefaultPointerStyle, TestSize.Level1)
2997 {
2998     CALL_TEST_DEBUG;
2999     InputWindowsManager inputWindowsManager;
3000     int32_t defaultPointerStyle = 0;
3001     int32_t cursorCircleStyle = 41;
3002     int32_t pid = 100;
3003     int32_t windowId = 1000;
3004     PointerStyle pointerStyle;
3005     pointerStyle.id = defaultPointerStyle;
3006     std::map<int32_t, PointerStyle> pointerStyleMap;
3007     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
3008     inputWindowsManager.pointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
3009     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SetGlobalDefaultPointerStyle());
3010 
3011     pointerStyle.id = cursorCircleStyle;
3012     inputWindowsManager.pointerStyle_[pid][windowId] = pointerStyle;
3013     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SetGlobalDefaultPointerStyle());
3014 }
3015 
3016 /**
3017  * @tc.name: InputWindowsManagerTest_SetPointerStyle
3018  * @tc.desc: Test SetPointerStyle
3019  * @tc.type: FUNC
3020  * @tc.require:
3021  */
3022 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPointerStyle, TestSize.Level1)
3023 {
3024     CALL_TEST_DEBUG;
3025     InputWindowsManager inputWindowsManager;
3026     bool isUiExtension = false;
3027     int32_t pid = 100;
3028     int32_t windowId = 1000;
3029     PointerStyle pointerStyle;
3030     pointerStyle.id = 0;
3031     std::map<int32_t, PointerStyle> pointerStyleMap;
3032     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
3033     inputWindowsManager.uiExtensionPointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
3034     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SetPointerStyle(pid, windowId, pointerStyle, isUiExtension));
3035 }
3036 
3037 /**
3038  * @tc.name: InputWindowsManagerTest_ClearWindowPointerStyle
3039  * @tc.desc: Test ClearWindowPointerStyle
3040  * @tc.type: FUNC
3041  * @tc.require:
3042  */
3043 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ClearWindowPointerStyle, TestSize.Level1)
3044 {
3045     CALL_TEST_DEBUG;
3046     InputWindowsManager inputWindowsManager;
3047     int32_t pid = 100;
3048     int32_t windowId = 1000;
3049     PointerStyle pointerStyle;
3050     pointerStyle.id = 0;
3051     std::map<int32_t, PointerStyle> pointerStyleMap;
3052     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
3053     inputWindowsManager.pointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
3054     windowId = 1001;
3055     EXPECT_EQ(inputWindowsManager.ClearWindowPointerStyle(pid, windowId), RET_OK);
3056     windowId = 1000;
3057     EXPECT_EQ(inputWindowsManager.ClearWindowPointerStyle(pid, windowId), RET_OK);
3058 }
3059 
3060 /**
3061  * @tc.name: InputWindowsManagerTest_GetPointerStyle
3062  * @tc.desc: Test GetPointerStyle
3063  * @tc.type: FUNC
3064  * @tc.require:
3065  */
3066 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPointerStyle, TestSize.Level1)
3067 {
3068     CALL_TEST_DEBUG;
3069     InputWindowsManager inputWindowsManager;
3070     bool isUiExtension = true;
3071     int32_t pid = 100;
3072     int32_t windowId = 1000;
3073     PointerStyle pointerStyle;
3074     pointerStyle.id = 0;
3075     std::map<int32_t, PointerStyle> pointerStyleMap;
3076     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
3077     inputWindowsManager.uiExtensionPointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
3078     pid = 101;
3079     EXPECT_EQ(inputWindowsManager.GetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
3080     pid = 100;
3081     windowId = 100;
3082     EXPECT_EQ(inputWindowsManager.GetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
3083     windowId = 1000;
3084     EXPECT_EQ(inputWindowsManager.GetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
3085 }
3086 
3087 /**
3088  * @tc.name: InputWindowsManagerTest_UpdateDisplayId
3089  * @tc.desc: Test UpdateDisplayId
3090  * @tc.type: FUNC
3091  * @tc.require:
3092  */
3093 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayId, TestSize.Level1)
3094 {
3095     CALL_TEST_DEBUG;
3096     InputWindowsManager inputWindowsManager;
3097     int32_t displayId = -1;
3098     DisplayInfo displayInfo;
3099     displayInfo.id = 10;
3100     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3101     EXPECT_TRUE(inputWindowsManager.UpdateDisplayId(displayId));
3102     EXPECT_TRUE(inputWindowsManager.UpdateDisplayId(displayId));
3103     displayId = 15;
3104     EXPECT_FALSE(inputWindowsManager.UpdateDisplayId(displayId));
3105 }
3106 
3107 /**
3108  * @tc.name: InputWindowsManagerTest_SelectWindowInfo
3109  * @tc.desc: Test SelectWindowInfo
3110  * @tc.type: FUNC
3111  * @tc.require:
3112  */
3113 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo, TestSize.Level1)
3114 {
3115     CALL_TEST_DEBUG;
3116     InputWindowsManager inputWindowsManager;
3117     int32_t desplayId = 10;
3118     int32_t logicalX = 200;
3119     int32_t logicalY = 200;
3120     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3121     EXPECT_NE(pointerEvent, nullptr);
3122     pointerEvent->SetTargetDisplayId(10);
3123     WindowInfo windowInfo;
3124     windowInfo.id = 10;
3125     WindowGroupInfo windowGroupInfo;
3126     windowGroupInfo.windowsInfo.push_back(windowInfo);
3127     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(desplayId, windowGroupInfo));
3128     inputWindowsManager.firstBtnDownWindowInfo_.first = 10;
3129     inputWindowsManager.extraData_.appended = false;
3130     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_UNKNOWN;
3131     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ROTATE_BEGIN);
3132     pointerEvent->SetButtonPressed(1);
3133     pointerEvent->SetButtonPressed(2);
3134     EXPECT_NE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
3135 }
3136 
3137 /**
3138  * @tc.name: InputWindowsManagerTest_GetWindowInfo
3139  * @tc.desc: Test GetWindowInfo
3140  * @tc.type: FUNC
3141  * @tc.require:
3142  */
3143 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowInfo, TestSize.Level1)
3144 {
3145     CALL_TEST_DEBUG;
3146     InputWindowsManager inputWindowsManager;
3147     int32_t logicalX = 200;
3148     int32_t logicalY = 200;
3149     WindowInfo windowInfo;
3150     windowInfo.flags = 1;
3151     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3152     EXPECT_EQ(inputWindowsManager.GetWindowInfo(logicalX, logicalY), std::nullopt);
3153 }
3154 
3155 /**
3156  * @tc.name: InputWindowsManagerTest_UpdateLeftRightArea
3157  * @tc.desc: Test UpdateLeftRightArea
3158  * @tc.type: FUNC
3159  * @tc.require:
3160  */
3161 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateLeftRightArea, TestSize.Level1)
3162 {
3163     CALL_TEST_DEBUG;
3164     InputWindowsManager inputWindowsManager;
3165     Rect windowArea;
3166     std::vector<int32_t> pointerChangeAreas {5, 0, 5, 0, 5, 0, 5, 0};
3167     std::vector<Rect> windowHotAreas;
3168     windowArea.x = 200;
3169     windowArea.y = 200;
3170     windowArea.height = 400;
3171     windowArea.width = 400;
3172     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateLeftRightArea(windowArea, pointerChangeAreas, windowHotAreas));
3173 }
3174 
3175 /**
3176  * @tc.name: InputWindowsManagerTest_UpdateInnerAngleArea
3177  * @tc.desc: Test UpdateInnerAngleArea
3178  * @tc.type: FUNC
3179  * @tc.require:
3180  */
3181 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateInnerAngleArea, TestSize.Level1)
3182 {
3183     CALL_TEST_DEBUG;
3184     InputWindowsManager inputWindowsManager;
3185     Rect windowArea;
3186     std::vector<int32_t> pointerChangeAreas {0, 16, 0, 16, 0, 16, 0, 16};
3187     std::vector<Rect> windowHotAreas;
3188     windowArea.x = 200;
3189     windowArea.y = 200;
3190     windowArea.height = 400;
3191     windowArea.width = 400;
3192     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateInnerAngleArea(windowArea, pointerChangeAreas, windowHotAreas));
3193 }
3194 
3195 /**
3196  * @tc.name: InputWindowsManagerTest_UpdatePointerEvent
3197  * @tc.desc: Test UpdatePointerEvent
3198  * @tc.type: FUNC
3199  * @tc.require:
3200  */
3201 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerEvent, TestSize.Level1)
3202 {
3203     CALL_TEST_DEBUG;
3204     InputWindowsManager inputWindowsManager;
3205     int32_t logicalX = 200;
3206     int32_t logicalY = 200;
3207     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3208     ASSERT_NE(pointerEvent, nullptr);
3209     WindowInfo touchWindow;
3210     touchWindow.id = 1;
3211     inputWindowsManager.lastWindowInfo_.id = 1;
3212     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerEvent(logicalX, logicalY, pointerEvent, touchWindow));
3213 }
3214 
3215 /**
3216  * @tc.name: InputWindowsManagerTest_UpdateMouseTarget
3217  * @tc.desc: Test UpdateMouseTarget
3218  * @tc.type: FUNC
3219  * @tc.require:
3220  */
3221 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget, TestSize.Level1)
3222 {
3223     CALL_TEST_DEBUG;
3224     InputWindowsManager inputWindowsManager;
3225     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3226     ASSERT_NE(pointerEvent, nullptr);
3227     pointerEvent->SetTargetDisplayId(-1);
3228     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3229 
3230     DisplayInfo displayInfo;
3231     displayInfo.id = 1;
3232     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3233     pointerEvent->SetPointerId(5);
3234     PointerEvent::PointerItem item;
3235     item.SetPointerId(10);
3236     pointerEvent->AddPointerItem(item);
3237     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3238 }
3239 
3240 /**
3241  * @tc.name: InputWindowsManagerTest_JudgMouseIsDownOrUp
3242  * @tc.desc: Test JudgMouseIsDownOrUp
3243  * @tc.type: FUNC
3244  * @tc.require:
3245  */
3246 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_JudgMouseIsDownOrUp, TestSize.Level1)
3247 {
3248     CALL_TEST_DEBUG;
3249     InputWindowsManager inputWindowsManager;
3250     bool dragState = false;
3251     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
3252     ASSERT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
3253     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
3254     inputWindowsManager.pointerActionFlag_ = PointerEvent::POINTER_ACTION_BUTTON_UP;
3255     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.JudgMouseIsDownOrUp(dragState));
3256 
3257     dragState = true;
3258     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
3259     inputWindowsManager.pointerActionFlag_ = PointerEvent::POINTER_ACTION_BUTTON_DOWN;
3260     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.JudgMouseIsDownOrUp(dragState));
3261 }
3262 
3263 /**
3264  * @tc.name: InputWindowsManagerTest_UpdateJoystickTarget
3265  * @tc.desc: Test UpdateJoystickTarget
3266  * @tc.type: FUNC
3267  * @tc.require:
3268  */
3269 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateJoystickTarget, TestSize.Level1)
3270 {
3271     CALL_TEST_DEBUG;
3272     InputWindowsManager inputWindowsManager;
3273     inputWindowsManager.displayGroupInfo_.focusWindowId = 150;
3274     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3275     ASSERT_NE(pointerEvent, nullptr);
3276     pointerEvent->SetTargetDisplayId(-1);
3277     WindowInfo windowInfo;
3278     windowInfo.id = 150;
3279     windowInfo.agentWindowId = 200;
3280     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3281     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateJoystickTarget(pointerEvent));
3282 }
3283 
3284 /**
3285  * @tc.name: InputWindowsManagerTest_UpdateAndAdjustMouseLocation
3286  * @tc.desc: Test UpdateAndAdjustMouseLocation
3287  * @tc.type: FUNC
3288  * @tc.require:
3289  */
3290 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLocation, TestSize.Level1)
3291 {
3292     CALL_TEST_DEBUG;
3293     InputWindowsManager inputWindowsManager;
3294     int32_t displayId = 1;
3295     double x = 200;
3296     double y = 200;
3297     bool isRealData = true;
3298     DisplayInfo displayInfo;
3299     displayInfo.id = 1;
3300     displayInfo.width = 500;
3301     displayInfo.height = 500;
3302     displayInfo.displayDirection = DIRECTION0;
3303     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3304     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateAndAdjustMouseLocation(displayId, x, y, isRealData));
3305     isRealData = false;
3306     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateAndAdjustMouseLocation(displayId, x, y, isRealData));
3307 }
3308 
3309 /**
3310  * @tc.name: InputWindowsManagerTest_GetMouseInfo
3311  * @tc.desc: Test GetMouseInfo
3312  * @tc.type: FUNC
3313  * @tc.require:
3314  */
3315 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetMouseInfo, TestSize.Level1)
3316 {
3317     CALL_TEST_DEBUG;
3318     InputWindowsManager inputWindowsManager;
3319     inputWindowsManager.mouseLocation_.displayId = -1;
3320     DisplayInfo displayInfo;
3321     displayInfo.id = 1;
3322     displayInfo.width = 600;
3323     displayInfo.height = 600;
3324     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3325     EXPECT_EQ(inputWindowsManager.GetMouseInfo().displayId, displayInfo.id);
3326 }
3327 
3328 /**
3329  * @tc.name: InputWindowsManagerTest_GetCursorPos
3330  * @tc.desc: Test GetCursorPos
3331  * @tc.type: FUNC
3332  * @tc.require:
3333  */
3334 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos, TestSize.Level1)
3335 {
3336     CALL_TEST_DEBUG;
3337     InputWindowsManager inputWindowsManager;
3338     inputWindowsManager.cursorPos_.displayId = -1;
3339     DisplayInfo displayInfo;
3340     displayInfo.id = 1;
3341     displayInfo.width = 300;
3342     displayInfo.height = 300;
3343     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3344     EXPECT_EQ(inputWindowsManager.GetCursorPos().displayId, displayInfo.id);
3345 }
3346 
3347 /**
3348  * @tc.name: InputWindowsManagerTest_ResetCursorPos
3349  * @tc.desc: Test ResetCursorPos
3350  * @tc.type: FUNC
3351  * @tc.require:
3352  */
3353 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetCursorPos, TestSize.Level1)
3354 {
3355     CALL_TEST_DEBUG;
3356     InputWindowsManager inputWindowsManager;
3357     DisplayInfo displayInfo;
3358     displayInfo.id = 1;
3359     displayInfo.width = 300;
3360     displayInfo.height = 300;
3361     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3362     EXPECT_EQ(inputWindowsManager.ResetCursorPos().displayId, displayInfo.id);
3363 }
3364 
3365 /**
3366  * @tc.name: InputWindowsManagerTest_GetTargetWindowIds
3367  * @tc.desc: Test GetTargetWindowIds
3368  * @tc.type: FUNC
3369  * @tc.require:
3370  */
3371 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetTargetWindowIds, TestSize.Level1)
3372 {
3373     CALL_TEST_DEBUG;
3374     InputWindowsManager inputWindowsManager;
3375     int32_t pointerItemId = 1;
3376     int32_t sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
3377     std::vector<int32_t> windowIds { 1, 2, 3 };
3378     inputWindowsManager.targetTouchWinIds_.insert(std::make_pair(pointerItemId, windowIds));
3379     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
3380 }
3381 
3382 /**
3383  * @tc.name: InputWindowsManagerTest_CheckWindowIdPermissionByPid_001
3384  * @tc.desc: Test CheckWindowIdPermissionByPid
3385  * @tc.type: FUNC
3386  * @tc.require:
3387  */
3388 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckWindowIdPermissionByPid_001, TestSize.Level1)
3389 {
3390     CALL_TEST_DEBUG;
3391     InputWindowsManager inputWindowsManager;
3392     int32_t windowId = 300;
3393     int32_t pid = 500;
3394     WindowInfo windowInfo;
3395     windowInfo.id = 300;
3396     windowInfo.pid = 500;
3397     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3398     EXPECT_EQ(inputWindowsManager.CheckWindowIdPermissionByPid(windowId, pid), RET_OK);
3399 }
3400 
3401 /**
3402  * @tc.name: InputWindowsManagerTest_FindPhysicalDisplay_002
3403  * @tc.desc: This test verifies the functionality of finding physical displays
3404  * @tc.type: FUNC
3405  * @tc.require:
3406  */
3407 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_002, TestSize.Level1)
3408 {
3409     CALL_TEST_DEBUG;
3410     InputWindowsManager inputWindowsManager;
3411     DisplayInfo displayInfo;
3412     DisplayInfo displaysInfo;
3413     double logicalX = 300;
3414     double logicalY = 400;
3415     double physicalX = 100;
3416     double physicalY = 200;
3417     int32_t displayId = -1;
3418     displayInfo.x = INT32_MAX;
3419     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId));
3420     displayInfo.x = 200;
3421     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3422     EXPECT_EQ(logicalX, physicalX + displayInfo.x);
3423     displayInfo.y = INT32_MAX ;
3424     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId));
3425     displayInfo.y = 200;
3426     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3427     EXPECT_EQ(logicalY, physicalY + displayInfo.y);
3428     displaysInfo.x = 100;
3429     displaysInfo.width = INT32_MAX;
3430     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3431     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId));
3432 }
3433 
3434 /**
3435  * @tc.name: InputWindowsManagerTest_FindPhysicalDisplay_003
3436  * @tc.desc: This test verifies the functionality of finding physical displays
3437  * @tc.type: FUNC
3438  * @tc.require:
3439  */
3440 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_003, TestSize.Level1)
3441 {
3442     CALL_TEST_DEBUG;
3443     InputWindowsManager inputWindowsManager;
3444     DisplayInfo displayInfo;
3445     DisplayInfo displaysInfo;
3446     double logicalX = 300;
3447     double logicalY = 400;
3448     double physicalX = 100;
3449     double physicalY = 200;
3450     int32_t displayMaxX = 300;
3451     int32_t displayMaxY = 400;
3452     int32_t displayId = -1;
3453     displayInfo.x = 200;
3454     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3455     EXPECT_EQ(logicalX, physicalX + displayInfo.x);
3456     displayInfo.y = 200;
3457     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3458     EXPECT_EQ(logicalY, physicalY + displayInfo.y);
3459     displaysInfo.x = 200;
3460     displaysInfo.width = 100;
3461     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3462     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3463     EXPECT_EQ(displayMaxX, displaysInfo.x + displaysInfo.width);
3464     displaysInfo.y = 100;
3465     displaysInfo.height = INT32_MAX;
3466     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3467     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId));
3468     displaysInfo.y = 200;
3469     displaysInfo.height = 200;
3470     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3471     inputWindowsManager.FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId);
3472     EXPECT_EQ(displayMaxY, displaysInfo.y + displaysInfo.height);
3473 }
3474 
3475 /**
3476  * @tc.name: InputWindowsManagerTest_IsInHotArea
3477  * @tc.desc: Test IsInHotArea
3478  * @tc.type: FUNC
3479  * @tc.require:
3480  */
3481 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea, TestSize.Level1)
3482 {
3483     CALL_TEST_DEBUG;
3484     InputWindowsManager inputWindowsManager;
3485     int32_t x = 200;
3486     int32_t y = 300;
3487     std::vector<Rect> rects;
3488     WindowInfo window;
3489     Rect rect;
3490     rect.x = 100;
3491     rect.width = INT32_MAX;
3492     rects.push_back(rect);
3493     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3494     rects.clear();
3495     rects = { {150, 100, 300, INT32_MAX} };
3496     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3497     rects.clear();
3498     rects = { {150, 250, 300, 500} };
3499     EXPECT_TRUE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3500     x = 100;
3501     y = 200;
3502     EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3503 }
3504 
3505 /**
3506  * @tc.name: InputWindowsManagerTest_InWhichHotArea
3507  * @tc.desc: Test InWhichHotArea
3508  * @tc.type: FUNC
3509  * @tc.require:
3510  */
3511 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea, TestSize.Level1)
3512 {
3513     CALL_TEST_DEBUG;
3514     InputWindowsManager inputWindowsManager;
3515     int32_t x = 500;
3516     int32_t y = 800;
3517     std::vector<Rect> rects;
3518     PointerStyle pointerStyle;
3519     rects = { { 100, 0, INT32_MAX, 0 } };
3520     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3521     rects.clear();
3522     rects = { { 150, 100, 300, INT32_MAX } };
3523     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3524     rects.clear();
3525     rects = { { 150, 250, 300, 500 } };
3526     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3527     x = 200;
3528     y = 300;
3529     EXPECT_TRUE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3530     int32_t cycleNum = 7;
3531     for (int32_t i = 0; i < cycleNum; ++i) {
3532         rects.insert(rects.begin(), { 1000, 1000, 1500, 1500 });
3533         EXPECT_TRUE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3534     }
3535 }
3536 
3537 /**
3538  * @tc.name: InputWindowsManagerTest_DispatchPointer
3539  * @tc.desc: Test DispatchPointer
3540  * @tc.type: FUNC
3541  * @tc.require:
3542  */
3543 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchPointer, TestSize.Level1)
3544 {
3545     CALL_TEST_DEBUG;
3546     InputWindowsManager inputWindowsManager;
3547     int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
3548     UDSServer udsServer;
3549     inputWindowsManager.udsServer_ = &udsServer;
3550     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointer(pointerAction));
3551     IPointerDrawingManager::GetInstance()->SetMouseDisplayState(true);
3552     inputWindowsManager.lastPointerEvent_ = nullptr;
3553     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointer(pointerAction));
3554     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
3555     EXPECT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
3556     PointerEvent::PointerItem item;
3557     item.SetPointerId(0);
3558     inputWindowsManager.lastPointerEvent_->AddPointerItem(item);
3559     inputWindowsManager.lastPointerEvent_->SetPointerId(1);
3560     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointer(pointerAction));
3561     inputWindowsManager.lastPointerEvent_->SetPointerId(0);
3562     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
3563     WindowInfo windowInfo;
3564     windowInfo.flags = WindowInfo::FLAG_BIT_HANDWRITING;
3565     windowInfo.pointerHotAreas.push_back({ 100, 0, INT32_MAX, 0 });
3566     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3567     inputWindowsManager.lastLogicX_ = 200;
3568     inputWindowsManager.lastLogicY_ = 200;
3569     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointer(pointerAction));
3570 }
3571 
3572 /**
3573  * @tc.name: InputWindowsManagerTest_NotifyPointerToWindow
3574  * @tc.desc: Test NotifyPointerToWindow
3575  * @tc.type: FUNC
3576  * @tc.require:
3577  */
3578 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_NotifyPointerToWindow, TestSize.Level1)
3579 {
3580     CALL_TEST_DEBUG;
3581     InputWindowsManager inputWindowsManager;
3582     UDSServer udsServer;
3583     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
3584     ASSERT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
3585     inputWindowsManager.lastLogicX_ = 200;
3586     inputWindowsManager.lastLogicY_ = 300;
3587     WindowInfo windowInfo;
3588     windowInfo.flags = WindowInfo::FLAG_BIT_HANDWRITING;
3589     windowInfo.pointerHotAreas.push_back({ 100, 100, INT32_MAX, 100 });
3590     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3591     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.NotifyPointerToWindow());
3592     windowInfo.id = 10;
3593     windowInfo.pointerHotAreas.clear();
3594     windowInfo.pointerHotAreas.push_back({ 150, 250, 300, 500 });
3595     inputWindowsManager.displayGroupInfo_.windowsInfo.insert(
3596         inputWindowsManager.displayGroupInfo_.windowsInfo.begin(), windowInfo);
3597     inputWindowsManager.lastWindowInfo_.id = 10;
3598     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.NotifyPointerToWindow());
3599     inputWindowsManager.lastWindowInfo_.id = 20;
3600     inputWindowsManager.lastWindowInfo_.pid = 50;
3601     int32_t udsFd = 100;
3602     udsServer.idxPidMap_.insert(std::make_pair(inputWindowsManager.lastWindowInfo_.pid, udsFd));
3603     inputWindowsManager.udsServer_ = &udsServer;
3604     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.NotifyPointerToWindow());
3605     inputWindowsManager.udsServer_ = nullptr;
3606     inputWindowsManager.lastWindowInfo_.id = 30;
3607     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.NotifyPointerToWindow());
3608     windowInfo.id = 50;
3609     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3610     inputWindowsManager.lastWindowInfo_.id = 50;
3611     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.NotifyPointerToWindow());
3612 }
3613 
3614 /**
3615  * @tc.name: InputWindowsManagerTest_GetMouseInfo_002
3616  * @tc.desc: Test the function GetMouseInfo
3617  * @tc.type: FUNC
3618  * @tc.require:
3619  */
3620 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetMouseInfo_002, TestSize.Level1)
3621 {
3622     CALL_TEST_DEBUG;
3623     InputWindowsManager inputWindowsManager;
3624     inputWindowsManager.mouseLocation_.displayId = -1;
3625     DisplayInfo displaysInfo;
3626     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetMouseInfo());
3627     displaysInfo.id = 2;
3628     displaysInfo.width = 20;
3629     displaysInfo.height = 30;
3630     displaysInfo.validWidth = displaysInfo.width;
3631     displaysInfo.validHeight = displaysInfo.height;
3632     displaysInfo.name = "name1";
3633     displaysInfo.uniq = "uniq1";
3634     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3635     MouseLocation result = inputWindowsManager.GetMouseInfo();
3636     EXPECT_EQ(result.displayId, 2);
3637     EXPECT_EQ(result.physicalX, 10);
3638     EXPECT_EQ(result.physicalY, 15);
3639 }
3640 
3641 /**
3642  * @tc.name: InputWindowsManagerTest_GetCursorPos_002
3643  * @tc.desc: Test the function GetCursorPos
3644  * @tc.type: FUNC
3645  * @tc.require:
3646  */
3647 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos_002, TestSize.Level1)
3648 {
3649     CALL_TEST_DEBUG;
3650     InputWindowsManager inputWindowsManager;
3651     inputWindowsManager.cursorPos_.displayId = -1;
3652     DisplayInfo displaysInfo;
3653     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetCursorPos());
3654     displaysInfo.id = 2;
3655     displaysInfo.width = 30;
3656     displaysInfo.height = 40;
3657     displaysInfo.validWidth = displaysInfo.width;
3658     displaysInfo.validHeight = displaysInfo.height;
3659     displaysInfo.name = "name2";
3660     displaysInfo.uniq = "uniq2";
3661     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3662     CursorPosition result = inputWindowsManager.GetCursorPos();
3663     EXPECT_EQ(result.displayId, 2);
3664     EXPECT_EQ(result.cursorPos.x, 15);
3665     EXPECT_EQ(result.cursorPos.y, 20);
3666 }
3667 
3668 /**
3669  * @tc.name: InputWindowsManagerTest_ResetCursorPos_002
3670  * @tc.desc: Test the function ResetCursorPos
3671  * @tc.type: FUNC
3672  * @tc.require:
3673  */
3674 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetCursorPos_002, TestSize.Level1)
3675 {
3676     CALL_TEST_DEBUG;
3677     InputWindowsManager inputWindowsManager;
3678     DisplayInfo displaysInfo;
3679     CursorPosition result = inputWindowsManager.ResetCursorPos();
3680     EXPECT_EQ(result.displayId, -1);
3681     displaysInfo.id = 3;
3682     displaysInfo.width = 40;
3683     displaysInfo.height = 50;
3684     displaysInfo.validWidth = displaysInfo.width;
3685     displaysInfo.validHeight = displaysInfo.height;
3686     displaysInfo.name = "name3";
3687     displaysInfo.uniq = "uniq3";
3688     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3689     result = inputWindowsManager.ResetCursorPos();
3690     EXPECT_EQ(result.displayId, 3);
3691     EXPECT_EQ(result.cursorPos.x, 20);
3692     EXPECT_EQ(result.cursorPos.y, 25);
3693 }
3694 
3695 /**
3696  * @tc.name: InputWindowsManagerTest_UpdateDisplayIdAndName_002
3697  * @tc.desc: Test updating display ID and name
3698  * @tc.type: FUNC
3699  * @tc.require:
3700  */
3701 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName_002, TestSize.Level1)
3702 {
3703     CALL_TEST_DEBUG;
3704     InputWindowsManager inputWindowsManager;
3705     DisplayInfo displaysInfo;
3706     displaysInfo.id = 1;
3707     displaysInfo.uniq = "abc";
3708     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3709     inputWindowsManager.bindInfo_.AddDisplay(2, "cde");
3710     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayIdAndName());
3711 }
3712 
3713 /**
3714  * @tc.name: InputWindowsManagerTest_UpdateDisplayIdAndName_003
3715  * @tc.desc: Test updating display ID and name
3716  * @tc.type: FUNC
3717  * @tc.require:
3718  */
3719 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName_003, TestSize.Level1)
3720 {
3721     CALL_TEST_DEBUG;
3722     InputWindowsManager inputWindowsManager;
3723     DisplayInfo displaysInfo;
3724     displaysInfo.id = 1;
3725     displaysInfo.uniq = "abc";
3726     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displaysInfo);
3727     inputWindowsManager.bindInfo_.AddDisplay(1, "abc");
3728     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayIdAndName());
3729 }
3730 
3731 /**
3732  * @tc.name: InputWindowsManagerTest_SendPointerEvent
3733  * @tc.desc: Test SendPointerEvent
3734  * @tc.type: FUNC
3735  * @tc.require:
3736  */
3737 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendPointerEvent, TestSize.Level1)
3738 {
3739     CALL_TEST_DEBUG;
3740     InputWindowsManager inputWindowsManager;
3741     int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
3742     UDSServer udsServer;
3743     WindowInfo windowInfo;
3744     inputWindowsManager.udsServer_ = &udsServer;
3745     windowInfo.pointerHotAreas.push_back({ 100, 100, INT32_MAX, 100 });
3746     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
3747     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SendPointerEvent(pointerAction));
3748     windowInfo.pointerHotAreas.clear();
3749     windowInfo.pointerHotAreas.push_back({ 150, 250, 300, 500 });
3750     windowInfo.area.x = 50;
3751     windowInfo.area.y = 50;
3752     windowInfo.id = 10;
3753     windowInfo.pid = 30;
3754     windowInfo.agentWindowId = 10;
3755     inputWindowsManager.displayGroupInfo_.windowsInfo.insert(
3756         inputWindowsManager.displayGroupInfo_.windowsInfo.begin(), windowInfo);
3757     inputWindowsManager.mouseLocation_.displayId = 1;
3758     inputWindowsManager.mouseLocation_.physicalX = 200;
3759     inputWindowsManager.mouseLocation_.physicalY = 300;
3760     inputWindowsManager.lastLogicX_ = 150;
3761     inputWindowsManager.lastLogicY_ = 150;
3762     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SendPointerEvent(pointerAction));
3763 }
3764 
3765 /**
3766  * @tc.name: InputWindowsManagerTest_UpdateMouseTarget001
3767  * @tc.desc: Test UpdateMouseTarget
3768  * @tc.type: FUNC
3769  * @tc.require:
3770  */
3771 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget001, TestSize.Level1)
3772 {
3773     CALL_TEST_DEBUG;
3774     InputWindowsManager inputWindowsManager;
3775     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3776     ASSERT_NE(pointerEvent, nullptr);
3777     pointerEvent->SetTargetDisplayId(1);
3778     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
3779     DisplayInfo displayInfo;
3780     displayInfo.id = 1;
3781     displayInfo.x = 300;
3782     displayInfo.y = 500;
3783     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3784     PointerEvent::PointerItem item;
3785     item.SetPointerId(1);
3786     item.SetDisplayX(INT32_MAX);
3787     pointerEvent->AddPointerItem(item);
3788     pointerEvent->SetPointerId(0);
3789     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3790 
3791     pointerEvent->SetPointerId(1);
3792     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3793 
3794     item.SetDisplayX(150);
3795     item.SetDisplayY(INT32_MAX);
3796     pointerEvent->UpdatePointerItem(pointerEvent->GetPointerId(), item);
3797     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3798     item.SetDisplayX(150);
3799     item.SetDisplayY(300);
3800     pointerEvent->UpdatePointerItem(pointerEvent->GetPointerId(), item);
3801 
3802     inputWindowsManager.firstBtnDownWindowInfo_.first = 5;
3803     WindowGroupInfo windowGroupInfo;
3804     WindowInfo windowInfo;
3805     windowInfo.id = 10;
3806     windowGroupInfo.windowsInfo.push_back(windowInfo);
3807     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(pointerEvent->GetTargetDisplayId(), windowGroupInfo));
3808     inputWindowsManager.mouseDownInfo_.id = -1;
3809     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3810 
3811     inputWindowsManager.firstBtnDownWindowInfo_.first = 10;
3812     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
3813     inputWindowsManager.SetHoverScrollState(false);
3814     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_OK);
3815 }
3816 
3817 /**
3818  * @tc.name: InputWindowsManagerTest_UpdateMouseTarget_002
3819  * @tc.desc: Test UpdateMouseTarget
3820  * @tc.type: FUNC
3821  * @tc.require:
3822  */
3823 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget_002, TestSize.Level1)
3824 {
3825     CALL_TEST_DEBUG;
3826     InputWindowsManager inputWindowsManager;
3827     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3828     ASSERT_NE(pointerEvent, nullptr);
3829     pointerEvent->SetTargetDisplayId(1);
3830     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
3831     DisplayInfo displayInfo;
3832     displayInfo.id = 1;
3833     displayInfo.x = 300;
3834     displayInfo.y = 500;
3835     displayInfo.width = 100;
3836     displayInfo.height = 100;
3837     displayInfo.displayDirection = DIRECTION0;
3838     displayInfo.direction = DIRECTION180;
3839     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3840     PointerEvent::PointerItem item;
3841     item.SetPointerId(1);
3842     item.SetDisplayX(150);
3843     item.SetDisplayY(300);
3844     pointerEvent->AddPointerItem(item);
3845     pointerEvent->SetPointerId(1);
3846     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3847 }
3848 
3849 /**
3850  * @tc.name: InputWindowsManagerTest_UpdateMouseTarget_003
3851  * @tc.desc: Test UpdateMouseTarget
3852  * @tc.type: FUNC
3853  * @tc.require:
3854  */
3855 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget_003, TestSize.Level1)
3856 {
3857     CALL_TEST_DEBUG;
3858     InputWindowsManager inputWindowsManager;
3859     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3860     ASSERT_NE(pointerEvent, nullptr);
3861     pointerEvent->SetTargetDisplayId(1);
3862     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
3863     DisplayInfo displayInfo;
3864     displayInfo.id = 1;
3865     displayInfo.x = 300;
3866     displayInfo.y = 500;
3867     displayInfo.width = 100;
3868     displayInfo.height = 100;
3869     displayInfo.displayDirection = DIRECTION180;
3870     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3871     PointerEvent::PointerItem item;
3872     item.SetPointerId(1);
3873     item.SetDisplayX(150);
3874     item.SetDisplayY(300);
3875     pointerEvent->AddPointerItem(item);
3876     pointerEvent->SetPointerId(1);
3877     EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR);
3878 }
3879 
3880 /**
3881  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget
3882  * @tc.desc: Test UpdateTouchScreenTarget
3883  * @tc.type: FUNC
3884  * @tc.require:
3885  */
3886 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget, TestSize.Level1)
3887 {
3888     CALL_TEST_DEBUG;
3889     InputWindowsManager inputWindowsManager;
3890     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3891     ASSERT_NE(pointerEvent, nullptr);
3892     pointerEvent->SetTargetDisplayId(1);
3893     pointerEvent->SetPointerId(0);
3894     DisplayInfo displayInfo;
3895     displayInfo.id = 1;
3896     displayInfo.width = 300;
3897     displayInfo.height = 300;
3898     displayInfo.displayDirection = DIRECTION0;
3899     displayInfo.x = INT32_MAX;
3900     displayInfo.y = 300;
3901     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3902     PointerEvent::PointerItem item;
3903     item.SetPointerId(1);
3904     item.SetDisplayX(100);
3905     item.SetDisplayY(100);
3906     item.SetDisplayXPos(100);
3907     item.SetDisplayYPos(100);
3908     item.SetTargetWindowId(-1);
3909     pointerEvent->AddPointerItem(item);
3910     EXPECT_EQ(inputWindowsManager.UpdateTouchScreenTarget(pointerEvent), RET_ERR);
3911 
3912     pointerEvent->SetPointerId(1);
3913     pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_SIMULATE;
3914     EXPECT_EQ(inputWindowsManager.UpdateTouchScreenTarget(pointerEvent), RET_ERR);
3915 
3916     pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_NONE;
3917     inputWindowsManager.displayGroupInfo_.displaysInfo[0].x = 300;
3918     inputWindowsManager.displayGroupInfo_.displaysInfo[0].y = INT32_MAX;
3919     EXPECT_EQ(inputWindowsManager.UpdateTouchScreenTarget(pointerEvent), RET_ERR);
3920 }
3921 
3922 /**
3923  * @tc.name: InputWindowsManagerTest_GetPidAndUpdateTarget_002
3924  * @tc.desc: Test getting PID and updating the target
3925  * @tc.type: FUNC
3926  * @tc.require:
3927  */
3928 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPidAndUpdateTarget_002, TestSize.Level1)
3929 {
3930     CALL_TEST_DEBUG;
3931     InputWindowsManager inputWindowsManager;
3932     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
3933     ASSERT_NE(keyEvent, nullptr);
3934     keyEvent->SetTargetDisplayId(10);
3935     inputWindowsManager.displayGroupInfo_.focusWindowId = 52;
3936     WindowGroupInfo windowGroupInfo;
3937     WindowInfo windowInfo;
3938     windowInfo.id = 2;
3939     windowGroupInfo.windowsInfo.push_back(windowInfo);
3940     windowInfo.id = 52;
3941     windowInfo.pid = 100;
3942     windowInfo.agentWindowId = 65;
3943     windowGroupInfo.windowsInfo.push_back(windowInfo);
3944     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(keyEvent->GetTargetDisplayId(), windowGroupInfo));
3945     ASSERT_NO_FATAL_FAILURE(inputWindowsManager.GetPidAndUpdateTarget(keyEvent));
3946 }
3947 
3948 /**
3949  * @tc.name: InputWindowsManagerTest_UpdateAndAdjustMouseLocation_002
3950  * @tc.desc: Test UpdateAndAdjustMouseLocation
3951  * @tc.type: FUNC
3952  * @tc.require:
3953  */
3954 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLocation_002, TestSize.Level1)
3955 {
3956     CALL_TEST_DEBUG;
3957     InputWindowsManager inputWindowsManager;
3958     int32_t displayId = 1;
3959     double x = 350;
3960     double y = 350;
3961     bool isRealData = true;
3962     DisplayInfo displayInfo;
3963     displayInfo.id = 1;
3964     displayInfo.x = 600;
3965     displayInfo.y = 600;
3966     displayInfo.width = 300;
3967     displayInfo.height = 300;
3968     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3969     displayInfo.id = 2;
3970     displayInfo.x = 500;
3971     displayInfo.y = 500;
3972     displayInfo.width = 600;
3973     displayInfo.height = 600;
3974     displayInfo.displayDirection = DIRECTION0;
3975     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3976     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateAndAdjustMouseLocation(displayId, x, y, isRealData));
3977 }
3978 
3979 /**
3980  * @tc.name: InputWindowsManagerTest_UpdateAndAdjustMouseLocation_003
3981  * @tc.desc: Test UpdateAndAdjustMouseLocation
3982  * @tc.type: FUNC
3983  * @tc.require:
3984  */
3985 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLocation_003, TestSize.Level1)
3986 {
3987     CALL_TEST_DEBUG;
3988     InputWindowsManager inputWindowsManager;
3989     int32_t displayId = 1;
3990     double x = 200;
3991     double y = 200;
3992     bool isRealData = false;
3993     DisplayInfo displayInfo;
3994     displayInfo.id = 1;
3995     displayInfo.x = 600;
3996     displayInfo.y = 600;
3997     displayInfo.width = 400;
3998     displayInfo.height = 400;
3999     displayInfo.displayDirection = DIRECTION90;
4000     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
4001     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateAndAdjustMouseLocation(displayId, x, y, isRealData));
4002     inputWindowsManager.displayGroupInfo_.displaysInfo[0].displayDirection = DIRECTION0;
4003     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateAndAdjustMouseLocation(displayId, x, y, isRealData));
4004 }
4005 
4006 /**
4007  * @tc.name: InputWindowsManagerTest_SkipNavigationWindow_006
4008  * @tc.desc: Test updating window information for each display
4009  * @tc.type: FUNC
4010  * @tc.require:
4011  */
4012 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipNavigationWindow_006, TestSize.Level1)
4013 {
4014     CALL_TEST_DEBUG;
4015     InputWindowsManager inputWindowsMgr;
4016     inputWindowsMgr.isOpenAntiMisTakeObserver_ = false;
4017     inputWindowsMgr.antiMistake_.isOpen = true;
4018     ASSERT_TRUE(inputWindowsMgr.SkipNavigationWindow(WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE,
4019         PointerEvent::TOOL_TYPE_PEN));
4020 
4021     inputWindowsMgr.isOpenAntiMisTakeObserver_ = true;
4022     inputWindowsMgr.antiMistake_.isOpen = false;
4023     ASSERT_FALSE(inputWindowsMgr.SkipNavigationWindow(WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE,
4024         PointerEvent::TOOL_TYPE_PEN));
4025 }
4026 
4027 /**
4028  * @tc.name: InputWindowsManagerTest_HandleWindowInputType_005
4029  * @tc.desc: Test HandleWindowInputType
4030  * @tc.type: FUNC
4031  * @tc.require:
4032  */
4033 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleWindowInputType_005, TestSize.Level1)
4034 {
4035     CALL_TEST_DEBUG;
4036     InputWindowsManager inputWindowsMgr;
4037     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4038     ASSERT_NE(pointerEvent, nullptr);
4039     PointerEvent::PointerItem item;
4040     item.SetPointerId(1);
4041     item.SetToolType(PointerEvent::TOOL_TYPE_MOUSE);
4042     pointerEvent->SetPointerId(1);
4043     pointerEvent->AddPointerItem(item);
4044     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
4045     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
4046     WindowInfo window;
4047     window.windowInputType = WindowInputType::NORMAL;
4048     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4049     window.windowInputType = WindowInputType::TRANSMIT_ALL;
4050     EXPECT_TRUE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4051     window.windowInputType = WindowInputType::TRANSMIT_EXCEPT_MOVE;
4052     EXPECT_TRUE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4053     window.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
4054     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4055     window.windowInputType = WindowInputType::TRANSMIT_AXIS_MOVE;
4056     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4057     window.windowInputType = WindowInputType::TRANSMIT_MOUSE_MOVE;
4058     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4059     window.windowInputType = WindowInputType::TRANSMIT_LEFT_RIGHT;
4060     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4061     window.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
4062     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4063     window.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4064     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4065     window.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
4066     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4067     window.windowInputType = static_cast<WindowInputType>(100);
4068     EXPECT_FALSE(inputWindowsMgr.HandleWindowInputType(window, pointerEvent));
4069 }
4070 
4071 /**
4072  * @tc.name: InputWindowsManagerTest_AddTargetWindowIds_003
4073  * @tc.desc: Test AddTargetWindowIds
4074  * @tc.type: FUNC
4075  * @tc.require:
4076  */
4077 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AddTargetWindowIds_003, TestSize.Level1)
4078 {
4079     CALL_TEST_DEBUG;
4080     InputWindowsManager inputWindowsMgr;
4081     int32_t pointerItemId = 1;
4082     int32_t sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
4083     int32_t windowId = 50;
4084     std::vector<int32_t> winIds;
4085     inputWindowsMgr.targetMouseWinIds_.insert(std::make_pair(pointerItemId, winIds));
4086     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.AddTargetWindowIds(pointerItemId, sourceType, windowId));
4087 
4088     pointerItemId = 2;
4089     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.AddTargetWindowIds(pointerItemId, sourceType, windowId));
4090 
4091     sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
4092     inputWindowsMgr.targetTouchWinIds_.insert(std::make_pair(pointerItemId, winIds));
4093     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.AddTargetWindowIds(pointerItemId, sourceType, windowId));
4094 }
4095 
4096 /**
4097  * @tc.name: InputWindowsManagerTest_ReverseXY
4098  * @tc.desc: Test ReverseXY
4099  * @tc.type: FUNC
4100  * @tc.require:
4101  */
4102 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseXY, TestSize.Level1)
4103 {
4104     CALL_TEST_DEBUG;
4105     InputWindowsManager inputWindowsMgr;
4106     int32_t x = 100;
4107     int32_t y = 100;
4108     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseXY(x, y));
4109 
4110     DisplayInfo displayInfo;
4111     displayInfo.direction = DIRECTION0;
4112     displayInfo.width = 200;
4113     displayInfo.height = 300;
4114     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
4115     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseXY(x, y));
4116 }
4117 
4118 /**
4119  * @tc.name: InputWindowsManagerTest_SendCancelEventWhenLock
4120  * @tc.desc: Test SendCancelEventWhenLock
4121  * @tc.type: FUNC
4122  * @tc.require:
4123  */
4124 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendCancelEventWhenLock, TestSize.Level1)
4125 {
4126     CALL_TEST_DEBUG;
4127     InputWindowsManager inputWindowsMgr;
4128     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
4129 }
4130 
4131 /**
4132  * @tc.name: InputWindowsManagerTest_FoldScreenRotation
4133  * @tc.desc: Test FoldScreenRotation
4134  * @tc.type: FUNC
4135  * @tc.require:
4136  */
4137 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation, TestSize.Level1)
4138 {
4139     CALL_TEST_DEBUG;
4140     InputWindowsManager inputWindowsMgr;
4141     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4142     EXPECT_NE(pointerEvent, nullptr);
4143     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.FoldScreenRotation(pointerEvent));
4144 }
4145 
4146 /**
4147  * @tc.name: InputWindowsManagerTest_PrintChangedWindowBySync
4148  * @tc.desc: Test PrintChangedWindowBySync
4149  * @tc.type: FUNC
4150  * @tc.require:
4151  */
4152 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintChangedWindowBySync, TestSize.Level1)
4153 {
4154     CALL_TEST_DEBUG;
4155     InputWindowsManager inputWindowsMgr;
4156     DisplayGroupInfo newDisplayInfo;
4157     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.PrintChangedWindowBySync(newDisplayInfo));
4158     WindowInfo windowInfo;
4159     windowInfo.id = 1;
4160     windowInfo.pid = 50;
4161     windowInfo.zOrder = 60;
4162     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(windowInfo);
4163     windowInfo.id = 2;
4164     newDisplayInfo.windowsInfo.push_back(windowInfo);
4165     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.PrintChangedWindowBySync(newDisplayInfo));
4166 }
4167 
4168 /**
4169  * @tc.name: InputWindowsManagerTest_GetClientFd_003
4170  * @tc.desc: Test the funcation GetClientFd
4171  * @tc.type: FUNC
4172  * @tc.require:
4173  */
4174 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_003, TestSize.Level1)
4175 {
4176     InputWindowsManager inputWindowsManager;
4177     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4178     EXPECT_NE(pointerEvent, nullptr);
4179     WindowInfoEX windowInfoEX;
4180     WindowInfo windowInfo;
4181     windowInfo.id = 1;
4182     windowInfo.pid = 5;
4183     std::vector<WindowInfo> windows;
4184     windows.push_back(windowInfo);
4185     windowInfoEX.window = windows [0];
4186     windowInfoEX.flag = false;
4187     pointerEvent->pointerId_ = 1;
4188     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, windowInfoEX));
4189     int32_t ret = inputWindowsManager.GetClientFd(pointerEvent);
4190     EXPECT_EQ(ret, -1);
4191     windowInfoEX.flag = true;
4192     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
4193     EXPECT_NE(inputEvent, nullptr);
4194     inputEvent->targetDisplayId_ = 5;
4195     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(10, windowInfoEX));
4196     ret = inputWindowsManager.GetClientFd(pointerEvent);
4197     EXPECT_EQ(ret, -1);
4198 }
4199 
4200 /**
4201  * @tc.name: InputWindowsManagerTest_GetPidAndUpdateTarget_003
4202  * @tc.desc: Test the funcation GetPidAndUpdateTarget
4203  * @tc.type: FUNC
4204  * @tc.require:
4205  */
4206 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPidAndUpdateTarget_003, TestSize.Level1)
4207 {
4208     CALL_TEST_DEBUG;
4209     InputWindowsManager inputWindowsManager;
4210     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
4211     ASSERT_NE(keyEvent, nullptr);
4212     inputWindowsManager.displayGroupInfo_.focusWindowId = 10;
4213     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
4214     EXPECT_NE(inputEvent, nullptr);
4215     inputEvent->targetDisplayId_ = 10;
4216     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPidAndUpdateTarget(keyEvent));
4217     inputEvent->targetDisplayId_ = 18;
4218     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPidAndUpdateTarget(keyEvent));
4219     WindowGroupInfo windowGroupInfo;
4220     WindowInfo windowInfo;
4221     windowInfo.id = 10;
4222     windowInfo.pid = 11;
4223     windowGroupInfo.windowsInfo.push_back(windowInfo);
4224     windowInfo.id = 10;
4225     windowInfo.pid = 11;
4226     windowInfo.agentWindowId = 12;
4227     windowGroupInfo.windowsInfo.push_back(windowInfo);
4228     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(10, windowGroupInfo));
4229     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPidAndUpdateTarget(keyEvent));
4230 }
4231 
4232 /**
4233  * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_002
4234  * @tc.desc: Test the funcation IsNeedRefreshLayer
4235  * @tc.type: FUNC
4236  * @tc.require:
4237  */
4238 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_002, TestSize.Level1)
4239 {
4240     CALL_TEST_DEBUG;
4241     InputWindowsManager inputWindowsManager;
4242     int32_t windowId = 1;
4243     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
4244     EXPECT_NE(inputEvent, nullptr);
4245     inputEvent->targetDisplayId_ = -11;
4246     bool ret = inputWindowsManager.IsNeedRefreshLayer(windowId);
4247     EXPECT_FALSE(ret);
4248     inputEvent->targetDisplayId_ = 11;
4249     EXPECT_FALSE(ret);
4250 }
4251 
4252 /**
4253  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_003
4254  * @tc.desc: Test the funcation SelectWindowInfo
4255  * @tc.type: FUNC
4256  * @tc.require:
4257  */
4258 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_003, TestSize.Level1)
4259 {
4260     CALL_TEST_DEBUG;
4261     InputWindowsManager inputWindowsManager;
4262     int32_t logicalX = 200;
4263     int32_t logicalY = 200;
4264     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4265     EXPECT_NE(pointerEvent, nullptr);
4266     inputWindowsManager.firstBtnDownWindowInfo_.first = -1;
4267     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_BUTTON_DOWN;
4268     PointerEvent::PointerItem pointerItem;
4269     pointerItem.targetWindowId_ = 0;
4270     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4271     pointerItem.targetWindowId_ = 2;
4272     WindowInfo windowInfo;
4273     windowInfo.flags = WindowInfo::FLAG_BIT_UNTOUCHABLE;
4274     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4275     windowInfo.flags = WindowInfo::FLAG_BIT_HANDWRITING;
4276     pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SIMULATE);
4277     inputWindowsManager.extraData_.appended = true;
4278     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
4279     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
4280     windowInfo.pointerHotAreas.push_back({ 150, 250, 300, 500 });
4281     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4282     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4283     inputWindowsManager.extraData_.appended = false;
4284     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
4285     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
4286     pointerItem.targetWindowId_ = -2;
4287     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4288     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
4289     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4290     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_AXIS_BEGIN;
4291     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4292     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_AXIS_UPDATE;
4293     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4294     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
4295     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4296     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_AXIS_END;
4297     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4298     pointerItem.targetWindowId_ = 10;
4299     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
4300     EXPECT_NE(inputEvent, nullptr);
4301     inputEvent->targetDisplayId_ = 11;
4302     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4303     pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_BUTTON_DOWN;
4304     inputWindowsManager.firstBtnDownWindowInfo_.first = 1;
4305     inputEvent->targetDisplayId_ = 1;
4306     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent));
4307 }
4308 
4309 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_CROWN)
4310 /**
4311  * @tc.name: InputWindowsManagerTest_UpdateCrownTarget_001
4312  * @tc.desc: Test the funcation UpdateCrownTarget
4313  * @tc.type: FUNC
4314  * @tc.require:
4315  */
4316 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCrownTarget_001, TestSize.Level1)
4317 {
4318     CALL_TEST_DEBUG;
4319     InputWindowsManager inputWindowsManager;
4320     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4321     EXPECT_NE(pointerEvent, nullptr);
4322     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
4323     EXPECT_NE(inputEvent, nullptr);
4324     inputEvent->targetDisplayId_ = -1;
4325     inputWindowsManager.displayGroupInfo_.focusWindowId = -1;
4326     int32_t ret = inputWindowsManager.UpdateCrownTarget(pointerEvent);
4327     EXPECT_NE(ret, RET_OK);
4328     inputEvent->targetDisplayId_ = 5;
4329     ret = inputWindowsManager.UpdateCrownTarget(pointerEvent);
4330     EXPECT_NE(ret, RET_OK);
4331     inputWindowsManager.displayGroupInfo_.focusWindowId = 5;
4332     ret = inputWindowsManager.UpdateCrownTarget(pointerEvent);
4333     EXPECT_NE(ret, RET_OK);
4334 }
4335 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_CROWN
4336 
4337 /**
4338  * @tc.name: InputWindowsManagerTest_PrintChangedWindowByEvent_001
4339  * @tc.desc: Test the funcation PrintChangedWindowByEvent
4340  * @tc.type: FUNC
4341  * @tc.require:
4342  */
4343 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintChangedWindowByEvent_001, TestSize.Level1)
4344 {
4345     CALL_TEST_DEBUG;
4346     InputWindowsManager inputWindowsManager;
4347     int32_t eventType = 1;
4348     WindowInfo newWindowInfo;
4349     newWindowInfo.id = 6;
4350     WindowInfo windowInfo;
4351     windowInfo.id = 1;
4352     windowInfo.pid = 5;
4353     windowInfo.uid = 1;
4354     inputWindowsManager.lastMatchedWindow_.insert(std::make_pair(1, windowInfo));
4355     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintChangedWindowByEvent(eventType, newWindowInfo));
4356     eventType = 10;
4357     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintChangedWindowByEvent(eventType, newWindowInfo));
4358     newWindowInfo.id = 1;
4359     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintChangedWindowByEvent(eventType, newWindowInfo));
4360 }
4361 
4362 /**
4363  * @tc.name: InputWindowsManagerTest_TransformDisplayXY_001
4364  * @tc.desc: Test the TransformDisplayXY function of the input window manager
4365  * @tc.type: FUNC
4366  * @tc.require:
4367  */
4368 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_001, TestSize.Level1)
4369 {
4370     CALL_TEST_DEBUG;
4371     DisplayInfo info;
4372     double logicX = 10.0;
4373     double logicY = 20.0;
4374     std::pair<double, double> result =WIN_MGR->TransformDisplayXY(info, logicX, logicY);
4375     double ret = result.first;
4376     EXPECT_EQ(ret, logicX);
4377     double ret1 = result.second;
4378     EXPECT_EQ(ret1, logicY);
4379 }
4380 
4381 /**
4382  * @tc.name: InputWindowsManagerTest_TransformDisplayXY_002
4383  * @tc.desc: Test the TransformDisplayXY function of the input window manager
4384  * @tc.type: FUNC
4385  * @tc.require:
4386  */
4387 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_002, TestSize.Level1)
4388 {
4389     CALL_TEST_DEBUG;
4390     DisplayInfo info;
4391     std::vector<float> transform = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
4392     info.transform = transform;
4393     double logicX = 10.0;
4394     double logicY = 20.0;
4395     std::pair<double, double> result =WIN_MGR->TransformDisplayXY(info, logicX, logicY);
4396     double ret = result.first;
4397     EXPECT_EQ(ret, logicX);
4398     double ret1 = result.second;
4399     EXPECT_EQ(ret1, logicY);
4400 }
4401 
4402 /**
4403  * @tc.name: InputWindowsManagerTest_TransformDisplayXY_003
4404  * @tc.desc: Test the TransformDisplayXY function of the input window manager
4405  * @tc.type: FUNC
4406  * @tc.require:
4407  */
4408 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_003, TestSize.Level1)
4409 {
4410     CALL_TEST_DEBUG;
4411     DisplayInfo info;
4412     std::vector<float> transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0};
4413     info.transform = transform;
4414     double logicX = 10.0;
4415     double logicY = 20.0;
4416     std::pair<double, double> result =WIN_MGR->TransformDisplayXY(info, logicX, logicY);
4417     double ret = result.first;
4418     EXPECT_EQ(ret, 320);
4419     double ret1 = result.second;
4420     EXPECT_EQ(ret1, 700);
4421 }
4422 
4423 /**
4424  * @tc.name: InputWindowsManagerTest_IsValidNavigationWindow_001
4425  * @tc.desc: Test IsValidNavigationWindow
4426  * @tc.type: FUNC
4427  * @tc.require:
4428  */
4429 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidNavigationWindow_001, TestSize.Level1)
4430 {
4431     CALL_TEST_DEBUG;
4432     WindowInfo windowInfo;
4433     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4434     double x = 10.0;
4435     double y = 20.0;
4436     Rect rect = {0, 0, 30, 40};
4437     windowInfo.defaultHotAreas.push_back(rect);
4438     EXPECT_TRUE(WIN_MGR->IsValidNavigationWindow(windowInfo, x, y));
4439 }
4440 
4441 /**
4442  * @tc.name: InputWindowsManagerTest_IsValidNavigationWindow_002
4443  * @tc.desc: Test IsValidNavigationWindow
4444  * @tc.type: FUNC
4445  * @tc.require:
4446  */
4447 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidNavigationWindow_002, TestSize.Level1)
4448 {
4449     CALL_TEST_DEBUG;
4450     WindowInfo windowInfo;
4451     windowInfo.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
4452     double x = 10.0;
4453     double y = 20.0;
4454     Rect rect = {0, 0, 30, 40};
4455     windowInfo.defaultHotAreas.push_back(rect);
4456     EXPECT_TRUE(WIN_MGR->IsValidNavigationWindow(windowInfo, x, y));
4457 }
4458 
4459 /**
4460  * @tc.name: InputWindowsManagerTest_IsValidNavigationWindow_003
4461  * @tc.desc: Test IsValidNavigationWindow
4462  * @tc.type: FUNC
4463  * @tc.require:
4464  */
4465 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidNavigationWindow_003, TestSize.Level1)
4466 {
4467     CALL_TEST_DEBUG;
4468     WindowInfo windowInfo;
4469     windowInfo.windowInputType = WindowInputType::NORMAL;
4470     double x = 10.0;
4471     double y = 20.0;
4472     Rect rect = {0, 0, 30, 40};
4473     windowInfo.defaultHotAreas.push_back(rect);
4474     EXPECT_FALSE(WIN_MGR->IsValidNavigationWindow(windowInfo, x, y));
4475 }
4476 
4477 /**
4478  * @tc.name: InputWindowsManagerTest_IsValidNavigationWindow_004
4479  * @tc.desc: Test IsValidNavigationWindow
4480  * @tc.type: FUNC
4481  * @tc.require:
4482  */
4483 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidNavigationWindow_004, TestSize.Level1)
4484 {
4485     CALL_TEST_DEBUG;
4486     WindowInfo windowInfo;
4487     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
4488     double x = -10.0;
4489     double y = 20.0;
4490     Rect rect = {0, 0, 30, 40};
4491     windowInfo.defaultHotAreas.push_back(rect);
4492     EXPECT_FALSE(WIN_MGR->IsValidNavigationWindow(windowInfo, x, y));
4493 }
4494 
4495 /**
4496  * @tc.name: InputWindowsManagerTest_IsValidNavigationWindow_005
4497  * @tc.desc: Test IsValidNavigationWindow
4498  * @tc.type: FUNC
4499  * @tc.require:
4500  */
4501 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsValidNavigationWindow_005, TestSize.Level1)
4502 {
4503     CALL_TEST_DEBUG;
4504     WindowInfo windowInfo;
4505     windowInfo.windowInputType = WindowInputType::TRANSMIT_ALL;
4506     double x = 10.0;
4507     double y = -20.0;
4508     Rect rect = {0, 0, 30, 40};
4509     windowInfo.defaultHotAreas.push_back(rect);
4510     EXPECT_FALSE(WIN_MGR->IsValidNavigationWindow(windowInfo, x, y));
4511 }
4512 
4513 /**
4514  * @tc.name: InputWindowsManagerTest_UpdateTransformDisplayXY_001
4515  * @tc.desc: Test UpdateTransformDisplayXY
4516  * @tc.type: FUNC
4517  * @tc.require:
4518  */
4519 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplayXY_001, TestSize.Level1)
4520 {
4521     CALL_TEST_DEBUG;
4522     auto pointerEvent = PointerEvent::Create();
4523     EXPECT_NE(pointerEvent, nullptr);
4524     PointerEvent::PointerItem item;
4525     item.SetPointerId(0);
4526     item.SetDisplayXPos(10);
4527     item.SetDisplayYPos(20);
4528     pointerEvent->UpdatePointerItem(0, item);
4529     std::vector<WindowInfo> windowsInfo;
4530     DisplayInfo info;
4531     WIN_MGR->UpdateTransformDisplayXY(pointerEvent, windowsInfo, info);
4532     int32_t pointerId = pointerEvent->GetPointerId();
4533     PointerEvent::PointerItem pointerItem;
4534     if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) {
4535         MMI_HILOG_DISPATCHE("Can't find pointer item, pointer:%{public}d", pointerId);
4536         return;
4537     }
4538     int32_t physicalX = pointerItem.GetDisplayX();
4539     int32_t physicalY = pointerItem.GetDisplayX();
4540     EXPECT_EQ(physicalX, 10);
4541     EXPECT_EQ(physicalY, 20);
4542 }
4543 
4544 /**
4545  * @tc.name: InputWindowsManagerTest_UpdateTransformDisplayXY_002
4546  * @tc.desc: Test UpdateTransformDisplayXY
4547  * @tc.type: FUNC
4548  * @tc.require:
4549  */
4550 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplayXY_002, TestSize.Level1)
4551 {
4552     CALL_TEST_DEBUG;
4553     auto pointerEvent = PointerEvent::Create();
4554     EXPECT_NE(pointerEvent, nullptr);
4555     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
4556     PointerEvent::PointerItem item;
4557     item.SetPointerId(0);
4558     item.SetDisplayXPos(10);
4559     item.SetDisplayYPos(20);
4560     pointerEvent->UpdatePointerItem(0, item);
4561     std::vector<WindowInfo> windowsInfo;
4562     WindowInfo windowInfo;
4563     DisplayInfo info;
4564     std::vector<float> transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0};
4565     info.transform = transform;
4566     windowInfo.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
4567     Rect rect = {0, 0, 30, 40};
4568     windowInfo.defaultHotAreas.push_back(rect);
4569     windowsInfo.push_back(windowInfo);
4570     WIN_MGR->UpdateTransformDisplayXY(pointerEvent, windowsInfo, info);
4571     int32_t pointerId = pointerEvent->GetPointerId();
4572     PointerEvent::PointerItem pointerItem;
4573     if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) {
4574         MMI_HILOG_DISPATCHE("Can't find pointer item, pointer:%{public}d", pointerId);
4575         return;
4576     }
4577     int32_t physicalX = pointerItem.GetDisplayX();
4578     int32_t physicalY = pointerItem.GetDisplayX();
4579     EXPECT_EQ(physicalX, 10);
4580     EXPECT_EQ(physicalY, 20);
4581 }
4582 
4583 /**
4584  * @tc.name: InputWindowsManagerTest_UpdateTransformDisplayXY_003
4585  * @tc.desc: Test UpdateTransformDisplayXY
4586  * @tc.type: FUNC
4587  * @tc.require:
4588  */
4589 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplayXY_003, TestSize.Level1)
4590 {
4591     CALL_TEST_DEBUG;
4592     auto pointerEvent = PointerEvent::Create();
4593     EXPECT_NE(pointerEvent, nullptr);
4594     PointerEvent::PointerItem item;
4595     item.SetPointerId(0);
4596     item.SetDisplayXPos(10);
4597     item.SetDisplayYPos(20);
4598     pointerEvent->UpdatePointerItem(0, item);
4599     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
4600     std::vector<WindowInfo> windowsInfo;
4601     WindowInfo windowInfo;
4602     DisplayInfo info;
4603     std::vector<float> transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0};
4604     info.transform = transform;
4605     windowInfo.windowInputType = WindowInputType::TRANSMIT_ALL;
4606     Rect rect = {0, 0, 30, 40};
4607     windowInfo.defaultHotAreas.push_back(rect);
4608     windowsInfo.push_back(windowInfo);
4609     WIN_MGR->UpdateTransformDisplayXY(pointerEvent, windowsInfo, info);
4610     int32_t pointerId = pointerEvent->GetPointerId();
4611     PointerEvent::PointerItem pointerItem;
4612     if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) {
4613         MMI_HILOG_DISPATCHE("Can't find pointer item, pointer:%{public}d", pointerId);
4614         return;
4615     }
4616     int32_t physicalX = pointerItem.GetDisplayX();
4617     int32_t physicalY = pointerItem.GetDisplayX();
4618     EXPECT_EQ(physicalX, 320);
4619     EXPECT_EQ(physicalY, 700);
4620 }
4621 
4622 /**
4623  * @tc.name: InputWindowsManagerTest_GetUIExtentionWindowInfo
4624  * @tc.desc: Test the funcation GetUIExtentionWindowInfo
4625  * @tc.type: FUNC
4626  * @tc.require:
4627  */
4628 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetUIExtentionWindowInfo, TestSize.Level1)
4629 {
4630     CALL_TEST_DEBUG;
4631     InputWindowsManager inputWinMgr;
4632     WindowInfo windowInfo;
4633     windowInfo.id = 5;
4634     std::vector<WindowInfo> uiExtentionWindowInfo;
4635     int32_t windowId = 10;
4636     WindowInfo *touchWindow;
4637     bool isUiExtentionWindow = false;
4638     uiExtentionWindowInfo.push_back(windowInfo);
4639     windowInfo.id = 10;
4640     uiExtentionWindowInfo.push_back(windowInfo);
4641     EXPECT_NO_FATAL_FAILURE(inputWinMgr.GetUIExtentionWindowInfo(uiExtentionWindowInfo, windowId,
4642         &touchWindow, isUiExtentionWindow));
4643 }
4644 
4645 /**
4646  * @tc.name: InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea
4647  * @tc.desc: Test the funcation CheckUIExtentionWindowDefaultHotArea
4648  * @tc.type: FUNC
4649  * @tc.require:
4650  */
4651 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea, TestSize.Level1)
4652 {
4653     CALL_TEST_DEBUG;
4654     InputWindowsManager inputWinMgr;
4655     int32_t logicalX = 150;
4656     int32_t logicalY = 150;
4657     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4658     ASSERT_NE(pointerEvent, nullptr);
4659     pointerEvent->SetPointerId(0);
4660     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4661     std::vector<WindowInfo> windowInfos;
4662     bool isHotArea = true;
4663     std::pair<int32_t, int32_t> logicalXY(std::make_pair(logicalX, logicalY));
4664     WindowInfo windowInfo;
4665     Rect rect;
4666     rect.x = INT32_MAX;
4667     rect.width = 100;
4668     windowInfo.defaultHotAreas.push_back(rect);
4669     windowInfos.push_back(windowInfo);
4670     WindowInfo touchWindow;
4671     touchWindow.id = 100;
4672     const WindowInfo* touchWindowInfo = &touchWindow;
4673     EXPECT_NO_FATAL_FAILURE(inputWinMgr.CheckUIExtentionWindowDefaultHotArea(logicalXY, isHotArea, pointerEvent,
4674         windowInfos, &touchWindowInfo));
4675 }
4676 
4677 /**
4678  * @tc.name: InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea_001
4679  * @tc.desc: Test the funcation CheckUIExtentionWindowDefaultHotArea
4680  * @tc.type: FUNC
4681  * @tc.require:
4682  */
4683 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea_001, TestSize.Level1)
4684 {
4685     CALL_TEST_DEBUG;
4686     InputWindowsManager inputWinMgr;
4687     int32_t logicalX = 150;
4688     int32_t logicalY = 150;
4689     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4690     ASSERT_NE(pointerEvent, nullptr);
4691     pointerEvent->SetPointerId(0);
4692     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4693     std::vector<WindowInfo> windowInfos;
4694     bool isHotArea = true;
4695     std::pair<int32_t, int32_t> logicalXY(std::make_pair(logicalX, logicalY));
4696     WindowInfo windowInfo;
4697     Rect rect;
4698     rect.x = 100;
4699     rect.y = 100;
4700     rect.width = 200;
4701     rect.height = 200;
4702     windowInfo.defaultHotAreas.push_back(rect);
4703     windowInfos.push_back(windowInfo);
4704     WindowInfo touchWindow;
4705     touchWindow.id = 100;
4706     const WindowInfo* touchWindowInfo = &touchWindow;
4707     EXPECT_NO_FATAL_FAILURE(inputWinMgr.CheckUIExtentionWindowDefaultHotArea(logicalXY, isHotArea, pointerEvent,
4708         windowInfos, &touchWindowInfo));
4709 }
4710 
4711 /**
4712  * @tc.name: InputWindowsManagerTest_IsKeyPressed
4713  * @tc.desc: Test the funcation IsKeyPressed
4714  * @tc.type: FUNC
4715  * @tc.require:
4716  */
4717 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsKeyPressed, TestSize.Level1)
4718 {
4719     CALL_TEST_DEBUG;
4720     InputWindowsManager inputWinMgr;
4721     KeyEvent::KeyItem item;
4722     int32_t pressedKey = 2024;
4723     std::vector<KeyEvent::KeyItem> keyItems;
4724     item.SetKeyCode(2018);
4725     item.SetPressed(false);
4726     keyItems.push_back(item);
4727     EXPECT_FALSE(inputWinMgr.IsKeyPressed(pressedKey, keyItems));
4728 }
4729 
4730 /**
4731  * @tc.name: InputWindowsManagerTest_IsKeyPressed_001
4732  * @tc.desc: Test the funcation IsKeyPressed
4733  * @tc.type: FUNC
4734  * @tc.require:
4735  */
4736 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsKeyPressed_001, TestSize.Level1)
4737 {
4738     CALL_TEST_DEBUG;
4739     InputWindowsManager inputWinMgr;
4740     KeyEvent::KeyItem item;
4741     int32_t pressedKey = 2024;
4742     std::vector<KeyEvent::KeyItem> keyItems;
4743     item.SetKeyCode(2024);
4744     item.SetPressed(true);
4745     keyItems.push_back(item);
4746     EXPECT_TRUE(inputWinMgr.IsKeyPressed(pressedKey, keyItems));
4747 }
4748 
4749 /**
4750  * @tc.name: InputWindowsManagerTest_IsOnTheWhitelist
4751  * @tc.desc: Test the funcation IsOnTheWhitelist
4752  * @tc.type: FUNC
4753  * @tc.require:
4754  */
4755 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsOnTheWhitelist, TestSize.Level1)
4756 {
4757     CALL_TEST_DEBUG;
4758     InputWindowsManager inputWinMgr;
4759     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
4760     ASSERT_NE(keyEvent, nullptr);
4761     KeyEvent::KeyItem item;
4762     SwitchFocusKey switchFocusKey;
4763     switchFocusKey.keyCode = 2024;
4764     switchFocusKey.pressedKey = -1;
4765     inputWinMgr.vecWhiteList_.push_back(switchFocusKey);
4766     keyEvent->SetKeyCode(2024);
4767     item.SetPressed(true);
4768     item.SetKeyCode(2024);
4769     keyEvent->AddKeyItem(item);
4770     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
4771     EXPECT_TRUE(inputWinMgr.IsOnTheWhitelist(keyEvent));
4772 
4773     inputWinMgr.vecWhiteList_[0].pressedKey = 2024;
4774     keyEvent->AddKeyItem(item);
4775     EXPECT_TRUE(inputWinMgr.IsOnTheWhitelist(keyEvent));
4776 
4777     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_UP);
4778     EXPECT_FALSE(inputWinMgr.IsOnTheWhitelist(keyEvent));
4779 
4780     keyEvent->SetKeyCode(2018);
4781     EXPECT_FALSE(inputWinMgr.IsOnTheWhitelist(keyEvent));
4782 }
4783 
4784 /**
4785  * @tc.name: InputWindowsManagerTest_IsOnTheWhitelist_001
4786  * @tc.desc: Test IsOnTheWhitelist
4787  * @tc.type: FUNC
4788  * @tc.require:
4789  */
4790 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsOnTheWhitelist_001, TestSize.Level1)
4791 {
4792     CALL_TEST_DEBUG;
4793     WIN_MGR->vecWhiteList_ = {{1}, {2}, {3}};
4794     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
4795     ASSERT_NE(keyEvent, nullptr);
4796     keyEvent->SetKeyCode(4);
4797     bool ret = WIN_MGR->IsOnTheWhitelist(keyEvent);
4798     ASSERT_FALSE(ret);
4799 }
4800 
4801 /**
4802  * @tc.name: InputWindowsManagerTest_IsOnTheWhitelist_002
4803  * @tc.desc: Test IsOnTheWhitelist
4804  * @tc.type: FUNC
4805  * @tc.require:
4806  */
4807 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsOnTheWhitelist_002, TestSize.Level1)
4808 {
4809     CALL_TEST_DEBUG;
4810     InputWindowsManager inputManager;
4811     SwitchFocusKey whitelistItem;
4812     whitelistItem.keyCode = 1;
4813     whitelistItem.pressedKey = -1;
4814     inputManager.vecWhiteList_.push_back(whitelistItem);
4815     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
4816     ASSERT_NE(keyEvent, nullptr);
4817     keyEvent->SetKeyCode(1);
4818     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
4819     KeyEvent::KeyItem item;
4820     item.SetKeyCode(KeyEvent::KEYCODE_HOME);
4821     keyEvent->AddKeyItem(item);
4822     bool ret = inputManager.IsOnTheWhitelist(keyEvent);
4823     ASSERT_TRUE(ret);
4824     whitelistItem.pressedKey = 2;
4825     ret = inputManager.IsOnTheWhitelist(keyEvent);
4826     ASSERT_TRUE(ret);
4827     whitelistItem.pressedKey = -1;
4828     item.SetDeviceId(100);
4829     item.SetKeyCode(KeyEvent::KEYCODE_PAGE_DOWN);
4830     item.SetDownTime(100);
4831     keyEvent->AddKeyItem(item);
4832     ret = inputManager.IsOnTheWhitelist(keyEvent);
4833     ASSERT_FALSE(ret);
4834 }
4835 
4836 /**
4837  * @tc.name: InputWindowsManagerTest_IsOnTheWhitelist_003
4838  * @tc.desc: Test IsOnTheWhitelist
4839  * @tc.type: FUNC
4840  * @tc.require:
4841  */
4842 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsOnTheWhitelist_003, TestSize.Level1)
4843 {
4844     CALL_TEST_DEBUG;
4845     InputWindowsManager inputManager;
4846     SwitchFocusKey whitelistItem;
4847     whitelistItem.keyCode = 1;
4848     whitelistItem.pressedKey = 1;
4849     inputManager.vecWhiteList_.push_back(whitelistItem);
4850     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
4851     ASSERT_NE(keyEvent, nullptr);
4852     keyEvent->SetKeyCode(1);
4853     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
4854     KeyEvent::KeyItem item;
4855     item.SetDeviceId(100);
4856     item.SetDownTime(100);
4857     keyEvent->AddKeyItem(item);
4858     item.pressed_ = true;
4859     bool ret = WIN_MGR->IsOnTheWhitelist(keyEvent);
4860     ASSERT_TRUE(ret);
4861 }
4862 
4863 /**
4864  * @tc.name: InputWindowsManagerTest_IsKeyPressed_002
4865  * @tc.desc: Test IsKeyPressed
4866  * @tc.type: FUNC
4867  * @tc.require:
4868  */
4869 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsKeyPressed_002, TestSize.Level1)
4870 {
4871     CALL_TEST_DEBUG;
4872     KeyEvent::KeyItem item;
4873     item.SetKeyCode(1);
4874     std::vector<KeyEvent::KeyItem> keyItems;
4875     keyItems.push_back(item);
4876     bool ret = WIN_MGR->IsKeyPressed(1, keyItems);
4877     ASSERT_FALSE(ret);
4878     ret = WIN_MGR->IsKeyPressed(2, keyItems);
4879     ASSERT_FALSE(ret);
4880     item.pressed_ = true;
4881     keyItems.push_back(item);
4882     ret = WIN_MGR->IsKeyPressed(1, keyItems);
4883     ASSERT_TRUE(ret);
4884 }
4885 
4886 /**
4887  * @tc.name: InputWindowsManagerTest_CheckUIExtentionWindowPointerHotArea_001
4888  * @tc.desc: Test CheckUIExtentionWindowPointerHotArea
4889  * @tc.type: FUNC
4890  * @tc.require:
4891  */
4892 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckUIExtentionWindowPointerHotArea_001, TestSize.Level1)
4893 {
4894     CALL_TEST_DEBUG;
4895     WindowInfo windowInfo;
4896     windowInfo.windowType = 2105;
4897     windowInfo.area.x = 10;
4898     windowInfo.area.y = 80;
4899     windowInfo.area.height = 90;
4900     std::vector<WindowInfo> windows;
4901     windows.push_back(windowInfo);
4902     int32_t windowId = 1;
4903     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowPointerHotArea(15, 20, windows, windowId));
4904     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowPointerHotArea(100, 200, windows, windowId));
4905     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowPointerHotArea(100, 200, {}, windowId));
4906 }
4907 
4908 /**
4909  * @tc.name: InputWindowsManagerTest_GetUIExtentionWindowInfo_001
4910  * @tc.desc: Test GetUIExtentionWindowInfo
4911  * @tc.type: FUNC
4912  * @tc.require:
4913  */
4914 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetUIExtentionWindowInfo_001, TestSize.Level1)
4915 {
4916     CALL_TEST_DEBUG;
4917     InputWindowsManager manager;
4918     std::vector<WindowInfo> windows = {{1}, {2}, {3}};
4919     WindowInfo *touchWindow = nullptr;
4920     bool isUiExtentionWindow = false;
4921     EXPECT_NO_FATAL_FAILURE(WIN_MGR->GetUIExtentionWindowInfo(windows, 2, &touchWindow, isUiExtentionWindow));
4922     EXPECT_NO_FATAL_FAILURE(WIN_MGR->GetUIExtentionWindowInfo(windows, 4, &touchWindow, isUiExtentionWindow));
4923     std::vector<WindowInfo> emptyWindows;
4924     EXPECT_NO_FATAL_FAILURE(WIN_MGR->GetUIExtentionWindowInfo(emptyWindows, 1, &touchWindow, isUiExtentionWindow));
4925 }
4926 
4927 /**
4928  * @tc.name: InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea_002
4929  * @tc.desc: Test CheckUIExtentionWindowDefaultHotArea
4930  * @tc.type: FUNC
4931  * @tc.require:
4932  */
4933 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckUIExtentionWindowDefaultHotArea_002, TestSize.Level1)
4934 {
4935     CALL_TEST_DEBUG;
4936     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4937     ASSERT_NE(pointerEvent, nullptr);
4938     pointerEvent->SetPointerId(0);
4939     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
4940     bool isHotArea = true;
4941     InputWindowsManager manager;
4942     WindowInfo windowInfo;
4943     windowInfo.windowType = 2105;
4944     windowInfo.area.x = 10;
4945     windowInfo.area.y = 100;
4946     windowInfo.area.height = 200;
4947     std::vector<WindowInfo> windows;
4948     windows.push_back(windowInfo);
4949     WindowInfo touchWindow;
4950     touchWindow.id = 100;
4951     const WindowInfo* touchWindowInfo = &touchWindow;
4952     std::pair<int32_t, int32_t> logicalXY(std::make_pair(15, 25));
4953     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowDefaultHotArea(logicalXY, isHotArea, pointerEvent,
4954         windows, &touchWindowInfo));
4955     std::pair<int32_t, int32_t> secondXY(std::make_pair(300, 300));
4956     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowDefaultHotArea(secondXY, isHotArea, pointerEvent,
4957         windows, &touchWindowInfo));
4958     EXPECT_NO_FATAL_FAILURE(WIN_MGR->CheckUIExtentionWindowDefaultHotArea(logicalXY, isHotArea, pointerEvent,
4959         {}, &touchWindowInfo));
4960 }
4961 
4962 /**
4963  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_003
4964  * @tc.desc: Test UpdateTouchScreenTarget
4965  * @tc.type: FUNC
4966  * @tc.require:
4967  */
4968 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_003, TestSize.Level1)
4969 {
4970     CALL_TEST_DEBUG;
4971     InputWindowsManager inputWindowsMgr;
4972     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4973     ASSERT_NE(pointerEvent, nullptr);
4974     DisplayInfo displayInfo;
4975     WindowGroupInfo winGroupInfo;
4976     WindowInfo winInfo;
4977     Rect rect;
4978     PointerEvent::PointerItem item;
4979     displayInfo.id = 100;
4980     displayInfo.x = 500;
4981     displayInfo.y = 500;
4982     pointerEvent->SetTargetDisplayId(-1);
4983     pointerEvent->SetPointerId(150);
4984     item.SetPointerId(150);
4985     item.SetDisplayXPos(500);
4986     item.SetDisplayYPos(500);
4987     item.SetTargetWindowId(200);
4988     item.SetToolType(PointerEvent::TOOL_TYPE_FINGER);
4989     pointerEvent->AddPointerItem(item);
4990     pointerEvent->SetZOrder(15.5f);
4991     pointerEvent->bitwise_ = 0x00000000;
4992     rect.x = 300;
4993     rect.width = 1200;
4994     rect.y = 300;
4995     rect.height = 1200;
4996     for (int32_t i = 0; i < 4; ++i) {
4997         winInfo.defaultHotAreas.push_back(rect);
4998     }
4999     winInfo.id = 0;
5000     winInfo.flags = 6;
5001     winInfo.pixelMap = nullptr;
5002     winGroupInfo.windowsInfo.push_back(winInfo);
5003     winInfo.id = 1;
5004     winInfo.flags = 0;
5005     winInfo.pixelMap = nullptr;
5006     winInfo.windowInputType = WindowInputType::NORMAL;
5007     winInfo.transform.push_back(100.5f);
5008     winInfo.defaultHotAreas.push_back(rect);
5009     winGroupInfo.windowsInfo.push_back(winInfo);
5010     inputWindowsMgr.extraData_.appended = true;
5011     inputWindowsMgr.extraData_.pointerId = 150;
5012     inputWindowsMgr.extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
5013     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
5014     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5015     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5016     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5017 }
5018 
5019 /**
5020  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_004
5021  * @tc.desc: Test UpdateTouchScreenTarget
5022  * @tc.type: FUNC
5023  * @tc.require:
5024  */
5025 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_004, TestSize.Level1)
5026 {
5027     CALL_TEST_DEBUG;
5028     InputWindowsManager inputWindowsMgr;
5029     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5030     ASSERT_NE(pointerEvent, nullptr);
5031     DisplayInfo displayInfo;
5032     WindowGroupInfo winGroupInfo;
5033     WindowInfo winInfo;
5034     Rect rect;
5035     PointerEvent::PointerItem item;
5036     displayInfo.id = 100;
5037     displayInfo.x = 500;
5038     displayInfo.y = 500;
5039     pointerEvent->SetTargetDisplayId(-1);
5040     pointerEvent->SetPointerId(150);
5041     item.SetPointerId(150);
5042     item.SetDisplayXPos(500);
5043     item.SetDisplayYPos(500);
5044     item.SetTargetWindowId(-1);
5045     item.SetToolType(PointerEvent::TOOL_TYPE_RUBBER);
5046     pointerEvent->AddPointerItem(item);
5047     pointerEvent->SetZOrder(15.5f);
5048     pointerEvent->bitwise_ = 0x00000000;
5049     rect.x = 300;
5050     rect.width = INT32_MAX;
5051     winInfo.id = 50;
5052     winInfo.defaultHotAreas.push_back(rect);
5053     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5054     rect.x = 300;
5055     rect.width = 1200;
5056     rect.y = 300;
5057     rect.height = 1200;
5058     winInfo.id = 1;
5059     winInfo.flags = 0;
5060     winInfo.pixelMap = nullptr;
5061     winInfo.windowInputType = WindowInputType::TRANSMIT_ALL;
5062     winInfo.defaultHotAreas.clear();
5063     winInfo.defaultHotAreas.push_back(rect);
5064     winGroupInfo.windowsInfo.push_back(winInfo);
5065     inputWindowsMgr.extraData_.appended = false;
5066     inputWindowsMgr.extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
5067     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5068     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5069     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5070     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5071 }
5072 
5073 /**
5074  * @tc.name: InputWindowsManagerTest_IgnoreTouchEvent_001
5075  * @tc.desc: Test IgnoreTouchEvent
5076  * @tc.type: FUNC
5077  * @tc.require:
5078  */
5079 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IgnoreTouchEvent_001, TestSize.Level1)
5080 {
5081     CALL_TEST_DEBUG;
5082     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5083     ASSERT_NE(pointerEvent, nullptr);
5084     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
5085     EXPECT_NO_FATAL_FAILURE(WIN_MGR->IgnoreTouchEvent(pointerEvent));
5086     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
5087     EXPECT_NO_FATAL_FAILURE(WIN_MGR->IgnoreTouchEvent(pointerEvent));
5088 }
5089 
5090 /**
5091  * @tc.name: InputWindowsManagerTest_ReissueCancelTouchEvent_001
5092  * @tc.desc: Test ReissueCancelTouchEvent
5093  * @tc.type: FUNC
5094  * @tc.require:
5095  */
5096 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReissueCancelTouchEvent_001, TestSize.Level1)
5097 {
5098     CALL_TEST_DEBUG;
5099     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5100     ASSERT_NE(pointerEvent, nullptr);
5101     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
5102     EXPECT_NO_FATAL_FAILURE(WIN_MGR->ReissueCancelTouchEvent(pointerEvent));
5103 }
5104 
5105 /**
5106  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_002
5107  * @tc.desc: Test UpdateTouchScreenTarget
5108  * @tc.type: FUNC
5109  * @tc.require:
5110  */
5111 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_002, TestSize.Level1)
5112 {
5113     CALL_TEST_DEBUG;
5114     InputWindowsManager inputWindowsMgr;
5115     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5116     ASSERT_NE(pointerEvent, nullptr);
5117     DisplayInfo displayInfo;
5118     WindowGroupInfo winGroupInfo;
5119     WindowInfo winInfo;
5120     PointerEvent::PointerItem item;
5121     displayInfo.id = 100;
5122     displayInfo.x = 500;
5123     displayInfo.y = 500;
5124     pointerEvent->SetTargetDisplayId(-1);
5125     pointerEvent->SetPointerId(150);
5126     item.SetPointerId(150);
5127     item.SetDisplayXPos(500);
5128     item.SetDisplayYPos(500);
5129     item.SetTargetWindowId(200);
5130     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5131     pointerEvent->AddPointerItem(item);
5132     pointerEvent->SetZOrder(15.5f);
5133     pointerEvent->bitwise_ = 0x00000000;
5134     winInfo.flags = 1;
5135     winGroupInfo.windowsInfo.push_back(winInfo);
5136     winInfo.flags = 0;
5137     winInfo.pixelMap = nullptr;
5138     winInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5139     winGroupInfo.windowsInfo.push_back(winInfo);
5140     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5141     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
5142     inputWindowsMgr.isOpenAntiMisTakeObserver_ = false;
5143     inputWindowsMgr.antiMistake_.isOpen = true;
5144     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5145     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5146     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5147 }
5148 
5149 /**
5150  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_005
5151  * @tc.desc: Test UpdateTouchScreenTarget
5152  * @tc.type: FUNC
5153  * @tc.require:
5154  */
5155 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_005, TestSize.Level1)
5156 {
5157     CALL_TEST_DEBUG;
5158     InputWindowsManager inputWindowsMgr;
5159     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5160     ASSERT_NE(pointerEvent, nullptr);
5161     DisplayInfo displayInfo;
5162     WindowGroupInfo winGroupInfo;
5163     WindowInfo winInfo;
5164     PointerEvent::PointerItem item;
5165     displayInfo.id = 100;
5166     displayInfo.x = 500;
5167     displayInfo.y = 500;
5168     pointerEvent->SetTargetDisplayId(-1);
5169     pointerEvent->SetPointerId(150);
5170     item.SetPointerId(150);
5171     item.SetDisplayXPos(500);
5172     item.SetDisplayYPos(500);
5173     item.SetTargetWindowId(200);
5174     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5175     pointerEvent->AddPointerItem(item);
5176     pointerEvent->SetZOrder(15.5f);
5177     pointerEvent->bitwise_ = 0x00000000;
5178     winInfo.flags = 0;
5179     winInfo.pixelMap = nullptr;
5180     winInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5181     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5182     winGroupInfo.windowsInfo.push_back(winInfo);
5183     winInfo.defaultHotAreas.clear();
5184     winInfo.defaultHotAreas = { { 300, 300, INT32_MAX, INT32_MAX } };
5185     winGroupInfo.windowsInfo.push_back(winInfo);
5186     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
5187     inputWindowsMgr.extraData_.appended = true;
5188     inputWindowsMgr.extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN;
5189     inputWindowsMgr.isOpenAntiMisTakeObserver_ = true;
5190     inputWindowsMgr.antiMistake_.isOpen = false;
5191     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5192     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5193     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5194 }
5195 
5196 /**
5197  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_008
5198  * @tc.desc: Test UpdateTouchScreenTarget
5199  * @tc.type: FUNC
5200  * @tc.require:
5201  */
5202 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_008, TestSize.Level1)
5203 {
5204     CALL_TEST_DEBUG;
5205     InputWindowsManager inputWindowsMgr;
5206     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5207     ASSERT_NE(pointerEvent, nullptr);
5208     DisplayInfo displayInfo;
5209     WindowGroupInfo winGroupInfo;
5210     WindowInfo winInfo;
5211     PointerEvent::PointerItem item;
5212     displayInfo.id = 100;
5213     displayInfo.x = 500;
5214     displayInfo.y = 500;
5215     pointerEvent->SetTargetDisplayId(-1);
5216     pointerEvent->SetPointerId(150);
5217     item.SetPointerId(150);
5218     item.SetDisplayXPos(500);
5219     item.SetDisplayYPos(500);
5220     item.SetTargetWindowId(-1);
5221     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5222     pointerEvent->AddPointerItem(item);
5223     pointerEvent->SetZOrder(15.5f);
5224     pointerEvent->bitwise_ = 0x00000000;
5225     winInfo.flags = 0;
5226     winInfo.pixelMap = nullptr;
5227     winInfo.windowInputType = WindowInputType::NORMAL;
5228     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5229     winInfo.id = 100;
5230     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5231     winGroupInfo.windowsInfo.push_back(winInfo);
5232     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5233     inputWindowsMgr.extraData_.appended = false;
5234     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5235     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5236     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5237 }
5238 
5239 /**
5240  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_009
5241  * @tc.desc: Test UpdateTouchScreenTarget
5242  * @tc.type: FUNC
5243  * @tc.require:
5244  */
5245 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_009, TestSize.Level1)
5246 {
5247     CALL_TEST_DEBUG;
5248     InputWindowsManager inputWindowsMgr;
5249     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5250     ASSERT_NE(pointerEvent, nullptr);
5251     DisplayInfo displayInfo;
5252     WindowGroupInfo winGroupInfo;
5253     WindowInfo winInfo;
5254     PointerEvent::PointerItem item;
5255     displayInfo.id = 100;
5256     displayInfo.x = 500;
5257     displayInfo.y = 500;
5258     pointerEvent->SetTargetDisplayId(-1);
5259     pointerEvent->SetPointerId(150);
5260     item.SetPointerId(150);
5261     item.SetDisplayXPos(500);
5262     item.SetDisplayYPos(500);
5263     item.SetTargetWindowId(-1);
5264     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5265     pointerEvent->AddPointerItem(item);
5266     pointerEvent->SetZOrder(15.5f);
5267     pointerEvent->bitwise_ = 0x00000000;
5268     winInfo.flags = 0;
5269     winInfo.pixelMap = nullptr;
5270     winInfo.windowInputType = WindowInputType::TRANSMIT_ALL;
5271     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5272     winInfo.id = -1;
5273     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5274     winGroupInfo.windowsInfo.push_back(winInfo);
5275     winInfo.windowInputType = WindowInputType::NORMAL;
5276     winGroupInfo.windowsInfo.push_back(winInfo);
5277     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5278     inputWindowsMgr.extraData_.appended = false;
5279     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5280     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5281     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5282 }
5283 
5284 /**
5285  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_010
5286  * @tc.desc: Test UpdateTouchScreenTarget
5287  * @tc.type: FUNC
5288  * @tc.require:
5289  */
5290 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_010, TestSize.Level1)
5291 {
5292     CALL_TEST_DEBUG;
5293     InputWindowsManager inputWindowsMgr;
5294     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5295     ASSERT_NE(pointerEvent, nullptr);
5296     DisplayInfo displayInfo;
5297     WindowGroupInfo winGroupInfo;
5298     WindowInfo winInfo;
5299     PointerEvent::PointerItem item;
5300     displayInfo.id = 100;
5301     displayInfo.x = 500;
5302     displayInfo.y = 500;
5303     pointerEvent->SetTargetDisplayId(-1);
5304     pointerEvent->SetPointerId(150);
5305     item.SetPointerId(150);
5306     item.SetDisplayXPos(500);
5307     item.SetDisplayYPos(500);
5308     item.SetTargetWindowId(-1);
5309     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5310     pointerEvent->AddPointerItem(item);
5311     pointerEvent->SetZOrder(15.5f);
5312     pointerEvent->bitwise_ = 0x00000000;
5313     winInfo.flags = 0;
5314     winInfo.pixelMap = nullptr;
5315     winInfo.windowInputType = WindowInputType::NORMAL;
5316     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5317     winInfo.id = -1;
5318     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5319     winGroupInfo.windowsInfo.push_back(winInfo);
5320     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5321     inputWindowsMgr.extraData_.appended = false;
5322     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5323     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5324     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5325 }
5326 
5327 /**
5328  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_011
5329  * @tc.desc: Test UpdateTouchScreenTarget
5330  * @tc.type: FUNC
5331  * @tc.require:
5332  */
5333 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_011, TestSize.Level1)
5334 {
5335     CALL_TEST_DEBUG;
5336     InputWindowsManager inputWindowsMgr;
5337     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5338     ASSERT_NE(pointerEvent, nullptr);
5339     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5340     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5341     DisplayInfo displayInfo;
5342     WindowGroupInfo winGroupInfo;
5343     WindowInfo winInfo;
5344     PointerEvent::PointerItem item;
5345     displayInfo.id = 100;
5346     displayInfo.x = 500;
5347     displayInfo.y = 500;
5348     pointerEvent->SetTargetDisplayId(-1);
5349     pointerEvent->SetPointerId(150);
5350     item.SetPointerId(150);
5351     item.SetDisplayXPos(500);
5352     item.SetDisplayYPos(500);
5353     item.SetTargetWindowId(200);
5354     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5355     pointerEvent->AddPointerItem(item);
5356     pointerEvent->SetZOrder(15.5f);
5357     pointerEvent->bitwise_ = 0x00000000;
5358     winInfo.flags = 0;
5359     winInfo.pixelMap = nullptr;
5360     winInfo.id = 200;
5361     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5362     winInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5363     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5364     winGroupInfo.windowsInfo.push_back(winInfo);
5365     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
5366     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
5367     inputWindowsMgr.extraData_.appended = false;
5368     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5369     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5370     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5371 }
5372 
5373 /**
5374  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_012
5375  * @tc.desc: Test UpdateTouchScreenTarget
5376  * @tc.type: FUNC
5377  * @tc.require:
5378  */
5379 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_012, TestSize.Level1)
5380 {
5381     CALL_TEST_DEBUG;
5382     InputWindowsManager inputWindowsMgr;
5383     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5384     ASSERT_NE(pointerEvent, nullptr);
5385     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5386     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5387     DisplayInfo displayInfo;
5388     WindowGroupInfo winGroupInfo;
5389     WindowInfo winInfo;
5390     PointerEvent::PointerItem item;
5391     displayInfo.id = 100;
5392     displayInfo.x = 500;
5393     displayInfo.y = 500;
5394     pointerEvent->SetTargetDisplayId(-1);
5395     pointerEvent->SetPointerId(150);
5396     item.SetPointerId(150);
5397     item.SetDisplayXPos(500);
5398     item.SetDisplayYPos(500);
5399     item.SetTargetWindowId(200);
5400     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5401     pointerEvent->AddPointerItem(item);
5402     pointerEvent->SetZOrder(15.5f);
5403     pointerEvent->bitwise_ = 0x00000000;
5404     winInfo.flags = 0;
5405     winInfo.pixelMap = nullptr;
5406     winInfo.id = 200;
5407     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5408     winInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5409     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5410     winGroupInfo.windowsInfo.push_back(winInfo);
5411     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5412     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
5413     inputWindowsMgr.extraData_.appended = false;
5414     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5415     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5416     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5417 }
5418 
5419 /**
5420  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_013
5421  * @tc.desc: Test UpdateTouchScreenTarget
5422  * @tc.type: FUNC
5423  * @tc.require:
5424  */
5425 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_013, TestSize.Level1)
5426 {
5427     CALL_TEST_DEBUG;
5428     InputWindowsManager inputWindowsMgr;
5429     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5430     ASSERT_NE(pointerEvent, nullptr);
5431     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5432     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5433     DisplayInfo displayInfo;
5434     WindowGroupInfo winGroupInfo;
5435     WindowInfo winInfo;
5436     PointerEvent::PointerItem item;
5437     displayInfo.id = 100;
5438     displayInfo.x = 500;
5439     displayInfo.y = 500;
5440     pointerEvent->SetTargetDisplayId(-1);
5441     pointerEvent->SetPointerId(150);
5442     item.SetPointerId(150);
5443     item.SetDisplayXPos(500);
5444     item.SetDisplayYPos(500);
5445     item.SetTargetWindowId(200);
5446     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5447     pointerEvent->AddPointerItem(item);
5448     pointerEvent->SetZOrder(15.5f);
5449     pointerEvent->bitwise_ = 0x00000000;
5450     winInfo.flags = 0;
5451     winInfo.pixelMap = nullptr;
5452     winInfo.id = 200;
5453     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5454     winInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
5455     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5456     winGroupInfo.windowsInfo.push_back(winInfo);
5457     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5458     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
5459     inputWindowsMgr.extraData_.appended = false;
5460     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5461     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5462     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5463 }
5464 
5465 /**
5466  * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_014
5467  * @tc.desc: Test UpdateTouchScreenTarget
5468  * @tc.type: FUNC
5469  * @tc.require:
5470  */
5471 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarget_014, TestSize.Level1)
5472 {
5473     CALL_TEST_DEBUG;
5474     InputWindowsManager inputWindowsMgr;
5475     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5476     ASSERT_NE(pointerEvent, nullptr);
5477     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5478     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5479     DisplayInfo displayInfo;
5480     WindowGroupInfo winGroupInfo;
5481     WindowInfo winInfo;
5482     PointerEvent::PointerItem item;
5483     displayInfo.id = 100;
5484     displayInfo.x = 500;
5485     displayInfo.y = 500;
5486     pointerEvent->SetTargetDisplayId(-1);
5487     pointerEvent->SetPointerId(150);
5488     item.SetPointerId(150);
5489     item.SetDisplayXPos(500);
5490     item.SetDisplayYPos(500);
5491     item.SetTargetWindowId(200);
5492     item.SetToolType(PointerEvent::TOOL_TYPE_PEN);
5493     pointerEvent->AddPointerItem(item);
5494     pointerEvent->SetZOrder(15.5f);
5495     pointerEvent->bitwise_ = 0x00000000;
5496     winInfo.flags = 0;
5497     winInfo.pixelMap = nullptr;
5498     winInfo.id = 200;
5499     winInfo.defaultHotAreas = { { 300, 300, 1000, 1000 } };
5500     winInfo.windowInputType = WindowInputType::NORMAL;
5501     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5502     winGroupInfo.windowsInfo.push_back(winInfo);
5503     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5504     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
5505     inputWindowsMgr.extraData_.appended = false;
5506     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5507     inputWindowsMgr.windowsPerDisplay_.insert(std::make_pair(100, winGroupInfo));
5508     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTouchScreenTarget(pointerEvent));
5509 }
5510 
5511 /**
5512  * @tc.name: InputWindowsManagerTest_SendCancelEventWhenLock_001
5513  * @tc.desc: Test the funcation SendCancelEventWhenLock
5514  * @tc.type: FUNC
5515  * @tc.require:
5516  */
5517 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendCancelEventWhenLock_001, TestSize.Level1)
5518 {
5519     CALL_TEST_DEBUG;
5520     InputWindowsManager inputWindowsMgr;
5521     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5522     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5523     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5524     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_UP);
5525     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5526     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
5527     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5528     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
5529     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5530     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5531     ASSERT_NE(pointerEvent, nullptr);
5532     WindowInfoEX windowInfoEX;
5533     windowInfoEX.flag = true;
5534     pointerEvent->SetPointerId(1);
5535     inputWindowsMgr.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), windowInfoEX));
5536     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerId(2);
5537     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5538     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerId(1);
5539     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5540 }
5541 
5542 /**
5543  * @tc.name: InputWindowsManagerTest_DrawTouchGraphic_001
5544  * @tc.desc: Test the funcation DrawTouchGraphic
5545  * @tc.type: FUNC
5546  * @tc.require:
5547  */
5548 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DrawTouchGraphic_001, TestSize.Level1)
5549 {
5550     CALL_TEST_DEBUG;
5551     InputWindowsManager inputWindowsMgr;
5552     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5553     ASSERT_NE(pointerEvent, nullptr);
5554     inputWindowsMgr.knuckleDrawMgr_ = nullptr;
5555     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DrawTouchGraphic(pointerEvent));
5556     inputWindowsMgr.knuckleDrawMgr_ = std::make_shared<KnuckleDrawingManager>();
5557     ASSERT_NE(inputWindowsMgr.knuckleDrawMgr_, nullptr);
5558     inputWindowsMgr.knuckleDynamicDrawingManager_ = nullptr;
5559     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DrawTouchGraphic(pointerEvent));
5560     inputWindowsMgr.knuckleDynamicDrawingManager_ = std::make_shared<KnuckleDynamicDrawingManager>();
5561     ASSERT_NE(inputWindowsMgr.knuckleDynamicDrawingManager_, nullptr);
5562     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DrawTouchGraphic(pointerEvent));
5563 }
5564 
5565 /**
5566  * @tc.name: InputWindowsManagerTest_IsMouseDrawing_001
5567  * @tc.desc: Test the funcation IsMouseDrawing
5568  * @tc.type: FUNC
5569  * @tc.require:
5570  */
5571 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsMouseDrawing_001, TestSize.Level1)
5572 {
5573     CALL_TEST_DEBUG;
5574     InputWindowsManager inputWindowsMgr;
5575     int32_t currentAction = 10;
5576     bool ret = inputWindowsMgr.IsMouseDrawing(currentAction);
5577     ASSERT_FALSE(ret);
5578     currentAction = 11;
5579     ret = inputWindowsMgr.IsMouseDrawing(currentAction);
5580     ASSERT_FALSE(ret);
5581     currentAction = 15;
5582     ret = inputWindowsMgr.IsMouseDrawing(currentAction);
5583     ASSERT_FALSE(ret);
5584     currentAction = 16;
5585     ret = inputWindowsMgr.IsMouseDrawing(currentAction);
5586     ASSERT_FALSE(ret);
5587     currentAction = 1;
5588     ret = inputWindowsMgr.IsMouseDrawing(currentAction);
5589     ASSERT_TRUE(ret);
5590 }
5591 
5592 /**
5593  * @tc.name: InputWindowsManagerTest_GetTargetWindowIds_002
5594  * @tc.desc: Test the funcation GetTargetWindowIds
5595  * @tc.type: FUNC
5596  * @tc.require:
5597  */
5598 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetTargetWindowIds_002, TestSize.Level1)
5599 {
5600     CALL_TEST_DEBUG;
5601     InputWindowsManager inputWindowsMgr;
5602     int32_t pointerItemId = 1;
5603     int32_t sourceType = 1;
5604     std::vector<int32_t> windowIds { 1, 2, 3 };
5605     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5606     inputWindowsMgr.targetMouseWinIds_.insert(std::make_pair(1, windowIds));
5607     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5608     sourceType = 2;
5609     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5610     pointerItemId = 5;
5611     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5612     inputWindowsMgr.targetMouseWinIds_.insert(std::make_pair(5, windowIds));
5613     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5614 }
5615 
5616 /**
5617  * @tc.name: InputWindowsManagerTest_UpdateTarget
5618  * @tc.desc: Test UpdateTouchScreenTarget
5619  * @tc.type: FUNC
5620  * @tc.require:
5621  */
5622 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTarget, TestSize.Level1)
5623 {
5624     CALL_TEST_DEBUG;
5625     InputWindowsManager inputWindowsMgr;
5626     std::shared_ptr<KeyEvent> keyEvent = nullptr;
5627     inputWindowsMgr.isParseConfig_ = true;
5628     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateTarget(keyEvent));
5629 }
5630 
5631 /**
5632  * @tc.name: InputWindowsManagerTest_HandleKeyEventWindowId
5633  * @tc.desc: Test HandleKeyEventWindowId
5634  * @tc.type: FUNC
5635  * @tc.require:
5636  */
5637 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleKeyEventWindowId, TestSize.Level1)
5638 {
5639     CALL_TEST_DEBUG;
5640     InputWindowsManager inputWindowsMgr;
5641     std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
5642     ASSERT_NE(keyEvent, nullptr);
5643     WindowInfo winInfo;
5644     keyEvent->SetTargetDisplayId(-1);
5645     inputWindowsMgr.displayGroupInfo_.focusWindowId = 50;
5646     winInfo.id = 50;
5647     winInfo.agentWindowId = 100;
5648     winInfo.privacyMode = SecureFlag::PRIVACY_MODE;
5649     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5650     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.HandleKeyEventWindowId(keyEvent));
5651 
5652     inputWindowsMgr.displayGroupInfo_.windowsInfo[0].privacyMode = SecureFlag::DEFAULT_MODE;
5653     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.HandleKeyEventWindowId(keyEvent));
5654 
5655     inputWindowsMgr.displayGroupInfo_.focusWindowId = 80;
5656     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.HandleKeyEventWindowId(keyEvent));
5657 }
5658 
5659 /**
5660  * @tc.name: InputWindowsManagerTest_GetDisplayId
5661  * @tc.desc: Test GetDisplayId
5662  * @tc.type: FUNC
5663  * @tc.require:
5664  */
5665 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetDisplayId, TestSize.Level1)
5666 {
5667     CALL_TEST_DEBUG;
5668     InputWindowsManager inputWindowsMgr;
5669     std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
5670     ASSERT_NE(inputEvent, nullptr);
5671     DisplayInfo displayInfo;
5672     displayInfo.id = 100;
5673     inputEvent->SetTargetDisplayId(-1);
5674     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5675     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetDisplayId(inputEvent));
5676 }
5677 
5678 /**
5679  * @tc.name: InputWindowsManagerTest_GetClientFd_004
5680  * @tc.desc: Test GetClientFd
5681  * @tc.type: FUNC
5682  * @tc.require:
5683  */
5684 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_004, TestSize.Level1)
5685 {
5686     CALL_TEST_DEBUG;
5687     InputWindowsManager inputWindowsMgr;
5688     int32_t windowId = 10;
5689     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5690     ASSERT_NE(pointerEvent, nullptr);
5691     WindowInfo winInfo;
5692     UDSServer udsServer;
5693     inputWindowsMgr.udsServer_ = &udsServer;
5694     pointerEvent->SetTargetDisplayId(-1);
5695     winInfo.id = 20;
5696     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5697     winInfo.id = 10;
5698     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5699     winInfo.pid = 50;
5700     winInfo.flags = 15;
5701     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5702     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetClientFd(pointerEvent, windowId));
5703     windowId = 100;
5704     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetClientFd(pointerEvent, windowId));
5705 }
5706 
5707 /**
5708  * @tc.name: InputWindowsManagerTest_GetPidAndUpdateTarget
5709  * @tc.desc: Test GetPidAndUpdateTarget
5710  * @tc.type: FUNC
5711  * @tc.require:
5712  */
5713 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPidAndUpdateTarget, TestSize.Level1)
5714 {
5715     CALL_TEST_DEBUG;
5716     InputWindowsManager inputWindowsMgr;
5717     std::shared_ptr<KeyEvent> keyEvent = nullptr;
5718     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetPidAndUpdateTarget(keyEvent));
5719 
5720     keyEvent = KeyEvent::Create();
5721     ASSERT_NE(keyEvent, nullptr);
5722     WindowInfo winInfo;
5723     winInfo.id = 10;
5724     winInfo.privacyUIFlag = true;
5725     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5726     keyEvent->SetTargetDisplayId(-1);
5727     inputWindowsMgr.displayGroupInfo_.focusWindowId = 10;
5728     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5729     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetPidAndUpdateTarget(keyEvent));
5730 
5731     inputWindowsMgr.displayGroupInfo_.windowsInfo[0].uiExtentionWindowInfo[0].privacyUIFlag = false;
5732     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetPidAndUpdateTarget(keyEvent));
5733 }
5734 
5735 /**
5736  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfoExtIfNeed
5737  * @tc.desc: Test UpdateDisplayInfoExtIfNeed
5738  * @tc.type: FUNC
5739  * @tc.require:
5740  */
5741 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoExtIfNeed, TestSize.Level1)
5742 {
5743     CALL_TEST_DEBUG;
5744     InputWindowsManager inputWindowsMgr;
5745     DisplayGroupInfo displayGroupInfo;
5746     bool needUpdateDisplayExt = true;
5747     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateDisplayInfoExtIfNeed(displayGroupInfo, needUpdateDisplayExt));
5748 }
5749 
5750 /**
5751  * @tc.name: InputWindowsManagerTest_GetPointerStyle_002
5752  * @tc.desc: Test GetPointerStyle
5753  * @tc.type: FUNC
5754  * @tc.require:
5755  */
5756 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPointerStyle_002, TestSize.Level1)
5757 {
5758     CALL_TEST_DEBUG;
5759     InputWindowsManager inputWindowsMgr;
5760     int32_t pid = 100;
5761     int32_t windowId = 200;
5762     PointerStyle pointerStyle;
5763     bool isUiExtension = false;
5764     std::map<int32_t, PointerStyle> pointerStyleMap;
5765     pointerStyleMap.insert(std::make_pair(windowId, pointerStyle));
5766     inputWindowsMgr.pointerStyle_.insert(std::make_pair(pid, pointerStyleMap));
5767     EXPECT_EQ(inputWindowsMgr.GetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
5768 }
5769 
5770 /**
5771  * @tc.name: InputWindowsManagerTest_SelectPointerChangeArea
5772  * @tc.desc: Test SelectPointerChangeArea
5773  * @tc.type: FUNC
5774  * @tc.require:
5775  */
5776 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeArea, TestSize.Level1)
5777 {
5778     CALL_TEST_DEBUG;
5779     InputWindowsManager inputWindowsMgr;
5780     WindowInfo windowInfo;
5781     PointerStyle pointerStyle;
5782     int32_t logicalX = 300;
5783     int32_t logicalY = 300;
5784     std::vector<Rect> areas;
5785     Rect rect {
5786         .x = 100,
5787         .y = 100,
5788         .width = 1000,
5789         .height = 1000,
5790     };
5791     areas.push_back(rect);
5792     windowInfo.id = 100;
5793     inputWindowsMgr.windowsHotAreas_.insert(std::make_pair(100, areas));
5794     EXPECT_TRUE(inputWindowsMgr.SelectPointerChangeArea(windowInfo, pointerStyle, logicalX, logicalY));
5795 }
5796 
5797 /**
5798  * @tc.name: InputWindowsManagerTest_DispatchUIExtentionPointerEvent
5799  * @tc.desc: Test DispatchUIExtentionPointerEvent
5800  * @tc.type: FUNC
5801  * @tc.require:
5802  */
5803 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchUIExtentionPointerEvent, TestSize.Level1)
5804 {
5805     CALL_TEST_DEBUG;
5806     InputWindowsManager inputWindowsMgr;
5807     int32_t logicalX = 300;
5808     int32_t logicalY = 300;
5809     WindowInfo winInfo;
5810     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5811     ASSERT_NE(pointerEvent, nullptr);
5812     pointerEvent->SetTargetDisplayId(-1);
5813     pointerEvent->SetTargetWindowId(100);
5814     winInfo.id = 10;
5815     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5816     winInfo.id = 100;
5817     winInfo.agentWindowId = 200;
5818     winInfo.uiExtentionWindowInfo.push_back(winInfo);
5819     winInfo.id = 300;
5820     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5821     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
5822 }
5823 
5824 /**
5825  * @tc.name: InputWindowsManagerTest_PullEnterLeaveEvent
5826  * @tc.desc: Test PullEnterLeaveEvent
5827  * @tc.type: FUNC
5828  * @tc.require:
5829  */
5830 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PullEnterLeaveEvent, TestSize.Level1)
5831 {
5832     CALL_TEST_DEBUG;
5833     InputWindowsManager inputWindowsMgr;
5834     int32_t logicalX = 100;
5835     int32_t logicalY = 100;
5836     WindowInfo touchWindow;
5837     UDSServer udsServer;
5838     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5839     ASSERT_NE(pointerEvent, nullptr);
5840     inputWindowsMgr.lastTouchEvent_ = PointerEvent::Create();
5841     ASSERT_NE(inputWindowsMgr.lastTouchEvent_, nullptr);
5842     PointerEvent::PointerItem lastPointerItem;
5843     touchWindow.id = 200;
5844     inputWindowsMgr.udsServer_ = &udsServer;
5845     inputWindowsMgr.lastTouchWindowInfo_.id = 100;
5846     inputWindowsMgr.lastTouchEvent_->SetPointerId(10);
5847     lastPointerItem.SetPointerId(10);
5848     inputWindowsMgr.lastTouchEvent_->AddPointerItem(lastPointerItem);
5849     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.PullEnterLeaveEvent(logicalX, logicalY, pointerEvent, &touchWindow));
5850 }
5851 
5852 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_CROWN)
5853 /**
5854  * @tc.name: InputWindowsManagerTest_UpdateCrownTarget
5855  * @tc.desc: Test UpdateCrownTarget
5856  * @tc.type: FUNC
5857  * @tc.require:
5858  */
5859 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCrownTarget, TestSize.Level1)
5860 {
5861     CALL_TEST_DEBUG;
5862     InputWindowsManager inputWindowsMgr;
5863     WindowInfo winInfo;
5864     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5865     ASSERT_NE(pointerEvent, nullptr);
5866     pointerEvent->SetTargetDisplayId(-1);
5867     inputWindowsMgr.displayGroupInfo_.focusWindowId = 100;
5868     winInfo.id = 200;
5869     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5870     winInfo.id = 100;
5871     winInfo.agentWindowId = 500;
5872     winInfo.privacyMode = SecureFlag::DEFAULT_MODE;
5873     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
5874     EXPECT_EQ(inputWindowsMgr.UpdateCrownTarget(pointerEvent), RET_OK);
5875 }
5876 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_CROWN
5877 
5878 /**
5879  * @tc.name: InputWindowsManagerTest_DrawTouchGraphic
5880  * @tc.desc: Test DrawTouchGraphic
5881  * @tc.type: FUNC
5882  * @tc.require:
5883  */
5884 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DrawTouchGraphic, TestSize.Level1)
5885 {
5886     CALL_TEST_DEBUG;
5887     InputWindowsManager inputWindowsMgr;
5888     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
5889     ASSERT_NE(pointerEvent, nullptr);
5890     inputWindowsMgr.knuckleDrawMgr_ = std::make_shared<KnuckleDrawingManager>();
5891     inputWindowsMgr.knuckleDynamicDrawingManager_ = std::make_shared<KnuckleDynamicDrawingManager>();
5892     pointerEvent->SetTargetDisplayId(100);
5893     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DrawTouchGraphic(pointerEvent));
5894 }
5895 
5896 /**
5897  * @tc.name: InputWindowsManagerTest_ReverseRotateScreen
5898  * @tc.desc: Test ReverseRotateScreen
5899  * @tc.type: FUNC
5900  * @tc.require:
5901  */
5902 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseRotateScreen, TestSize.Level1)
5903 {
5904     CALL_TEST_DEBUG;
5905     InputWindowsManager inputWindowsMgr;
5906     DisplayInfo info;
5907     double x = 100.5;
5908     double y = 100.5;
5909     Coordinate2D cursorPos;
5910     info.direction = static_cast<Direction>(10);
5911     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseRotateScreen(info, x, y, cursorPos));
5912 }
5913 
5914 /**
5915  * @tc.name: InputWindowsManagerTest_GetTargetWindowIds_003
5916  * @tc.desc: Test GetTargetWindowIds
5917  * @tc.type: FUNC
5918  * @tc.require:
5919  */
5920 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetTargetWindowIds_003, TestSize.Level1)
5921 {
5922     CALL_TEST_DEBUG;
5923     InputWindowsManager inputWindowsMgr;
5924     int32_t pointerItemId = 100;
5925     int32_t sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
5926     std::vector<int32_t> windowIds;
5927     inputWindowsMgr.targetMouseWinIds_.insert(std::make_pair(10, windowIds));
5928     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5929     inputWindowsMgr.targetMouseWinIds_.insert(std::make_pair(pointerItemId, windowIds));
5930     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5931     sourceType = PointerEvent::PointerEvent::SOURCE_TYPE_UNKNOWN;
5932     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetTargetWindowIds(pointerItemId, sourceType, windowIds));
5933 }
5934 
5935 /**
5936  * @tc.name: InputWindowsManagerTest_SetPrivacyModeFlag
5937  * @tc.desc: Test SetPrivacyModeFlag
5938  * @tc.type: FUNC
5939  * @tc.require:
5940  */
5941 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPrivacyModeFlag, TestSize.Level1)
5942 {
5943     CALL_TEST_DEBUG;
5944     InputWindowsManager inputWindowsMgr;
5945     SecureFlag privacyMode = SecureFlag::PRIVACY_MODE;
5946     std::shared_ptr<InputEvent> event = InputEvent::Create();
5947     ASSERT_NE(event, nullptr);
5948     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SetPrivacyModeFlag(privacyMode, event));
5949 }
5950 
5951 /**
5952  * @tc.name: InputWindowsManagerTest_ReverseXY_001
5953  * @tc.desc: Test ReverseXY
5954  * @tc.type: FUNC
5955  * @tc.require:
5956  */
5957 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseXY_001, TestSize.Level1)
5958 {
5959     CALL_TEST_DEBUG;
5960     InputWindowsManager inputWindowsMgr;
5961     int32_t x = 100;
5962     int32_t y = 100;
5963     DisplayInfo displayInfo;
5964     displayInfo.direction = static_cast<Direction>(-1);
5965     inputWindowsMgr.displayGroupInfo_.displaysInfo.push_back(displayInfo);
5966     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseXY(x, y));
5967     inputWindowsMgr.displayGroupInfo_.displaysInfo[0].direction = static_cast<Direction>(10);
5968     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseXY(x, y));
5969 }
5970 
5971 /**
5972  * @tc.name: InputWindowsManagerTest_SendCancelEventWhenLock_002
5973  * @tc.desc: Test SendCancelEventWhenLock
5974  * @tc.type: FUNC
5975  * @tc.require:
5976  */
5977 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendCancelEventWhenLock_002, TestSize.Level1)
5978 {
5979     CALL_TEST_DEBUG;
5980     InputWindowsManager inputWindowsMgr;
5981     inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create();
5982     ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr);
5983     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN);
5984     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5985     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
5986     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5987     inputWindowsMgr.lastTouchEventOnBackGesture_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
5988     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.SendCancelEventWhenLock());
5989 }
5990 
5991 /**
5992  * @tc.name: InputWindowsManagerTest_DispatchPointerCancel
5993  * @tc.desc: Test DispatchPointerCancel
5994  * @tc.type: FUNC
5995  * @tc.require:
5996  */
5997 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchPointerCancel, TestSize.Level1)
5998 {
5999     CALL_TEST_DEBUG;
6000     InputWindowsManager inputWindowsMgr;
6001     int32_t displayId = -1;
6002     WindowInfo winInfo;
6003     inputWindowsMgr.mouseDownInfo_.id = -1;
6004     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6005     inputWindowsMgr.mouseDownInfo_.id = 10;
6006     inputWindowsMgr.extraData_.appended = true;
6007     inputWindowsMgr.extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
6008     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6009     inputWindowsMgr.lastPointerEvent_ = nullptr;
6010     inputWindowsMgr.extraData_.appended = false;
6011     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6012     inputWindowsMgr.extraData_.appended = true;
6013     inputWindowsMgr.extraData_.sourceType = PointerEvent::SOURCE_TYPE_UNKNOWN;
6014     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6015     inputWindowsMgr.lastPointerEvent_ = PointerEvent::Create();
6016     ASSERT_NE(inputWindowsMgr.lastPointerEvent_, nullptr);
6017     winInfo.id = 10;
6018     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
6019     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6020     inputWindowsMgr.displayGroupInfo_.windowsInfo.clear();
6021     winInfo.id = 100;
6022     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
6023     EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.DispatchPointerCancel(displayId));
6024 }
6025 
6026 /**
6027  * @tc.name: InputWindowsManagerTest_GetPidByWindowId
6028  * @tc.desc: Test GetPidByWindowId
6029  * @tc.type: FUNC
6030  * @tc.require:
6031  */
6032 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPidByWindowId, TestSize.Level1)
6033 {
6034     CALL_TEST_DEBUG;
6035     InputWindowsManager inputWindowsMgr;
6036     int32_t id = 100;
6037     WindowInfo winInfo;
6038     winInfo.id = 100;
6039     winInfo.pid = 150;
6040     inputWindowsMgr.displayGroupInfo_.windowsInfo.push_back(winInfo);
6041     EXPECT_EQ(inputWindowsMgr.GetPidByWindowId(id), winInfo.pid);
6042     id = 300;
6043     EXPECT_EQ(inputWindowsMgr.GetPidByWindowId(id), RET_ERR);
6044 }
6045 
6046 /**
6047  * @tc.name: InputWindowsManagerTest_SetPixelMapData
6048  * @tc.desc: Test SetPixelMapData
6049  * @tc.type: FUNC
6050  * @tc.require:
6051  */
6052 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPixelMapData, TestSize.Level1)
6053 {
6054     CALL_TEST_DEBUG;
6055     InputWindowsManager inputWindowsMgr;
6056     int32_t infoId = -1;
6057     void *pixelMap = nullptr;
6058     EXPECT_EQ(inputWindowsMgr.SetPixelMapData(infoId, pixelMap), ERR_INVALID_VALUE);
6059     infoId = 100;
6060     EXPECT_EQ(inputWindowsMgr.SetPixelMapData(infoId, pixelMap), ERR_INVALID_VALUE);
6061 }
6062 
6063 /**
6064  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_002
6065  * @tc.desc: Test updating window & display information for each display in extended screen mode
6066  * @tc.type: FUNC
6067  * @tc.require:
6068  */
6069 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_002, TestSize.Level1)
6070 {
6071     CALL_TEST_DEBUG;
6072     DisplayGroupInfo displayGroupInfo;
6073     displayGroupInfo.width = 20;
6074     displayGroupInfo.height = 20;
6075     displayGroupInfo.focusWindowId = 1;
6076 
6077     WindowInfo windowInfo;
6078     windowInfo.id = 1;
6079     windowInfo.pid = 1;
6080     windowInfo.uid = 1;
6081     windowInfo.area = {1, 1, 1, 1};
6082     windowInfo.defaultHotAreas = { windowInfo.area };
6083     windowInfo.pointerHotAreas = { windowInfo.area };
6084     windowInfo.agentWindowId = 1;
6085     windowInfo.flags = 1;
6086     windowInfo.transform = {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
6087     windowInfo.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 };
6088     displayGroupInfo.windowsInfo.push_back(windowInfo);
6089 
6090     DisplayInfo displayInfo1;
6091     displayInfo1.id = 1;
6092     displayInfo1.x =1;
6093     displayInfo1.y = 1;
6094     displayInfo1.width = 2;
6095     displayInfo1.height = 2;
6096     displayInfo1.dpi = 240;
6097     displayInfo1.name = "pp";
6098     displayInfo1.uniq = "pp";
6099     displayInfo1.direction = DIRECTION0;
6100     displayGroupInfo.displaysInfo.push_back(displayInfo1);
6101 
6102     DisplayInfo displayInfo2;
6103     displayInfo2.id = 2;
6104     displayInfo2.x =1;
6105     displayInfo2.y = 1;
6106     displayInfo2.width = 2;
6107     displayInfo2.height = 2;
6108     displayInfo2.dpi = 240;
6109     displayInfo2.name = "pp";
6110     displayInfo2.uniq = "pp";
6111     displayInfo2.direction = DIRECTION0;
6112     displayGroupInfo.displaysInfo.push_back(displayInfo2);
6113 
6114     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6115 
6116     displayGroupInfo.displaysInfo.pop_back();
6117     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6118 }
6119 
6120 /**
6121  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_003
6122  * @tc.desc: Test updating window & display information for each display in extended screen mode
6123  * @tc.type: FUNC
6124  * @tc.require:
6125  */
6126 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_003, TestSize.Level1)
6127 {
6128     CALL_TEST_DEBUG;
6129     DisplayGroupInfo displayGroupInfo;
6130     displayGroupInfo.width = 20;
6131     displayGroupInfo.height = 20;
6132     displayGroupInfo.focusWindowId = 1;
6133 
6134     DisplayInfo displayInfo1;
6135     displayInfo1.id = 1;
6136     displayInfo1.x =1;
6137     displayInfo1.y = 1;
6138     displayInfo1.width = 2;
6139     displayInfo1.height = 2;
6140     displayInfo1.dpi = 240;
6141     displayInfo1.name = "pp";
6142     displayInfo1.uniq = "pp";
6143     displayInfo1.direction = DIRECTION0;
6144     displayGroupInfo.displaysInfo.push_back(displayInfo1);
6145 
6146     DisplayInfo displayInfo2;
6147     displayInfo2.id = 2;
6148     displayInfo2.x =1;
6149     displayInfo2.y = 1;
6150     displayInfo2.width = 2;
6151     displayInfo2.height = 2;
6152     displayInfo2.dpi = 240;
6153     displayInfo2.name = "pp";
6154     displayInfo2.uniq = "pp";
6155     displayInfo2.direction = DIRECTION0;
6156     displayGroupInfo.displaysInfo.push_back(displayInfo2);
6157 
6158     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6159 }
6160 
6161 /**
6162  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_004
6163  * @tc.desc: Test updating window & display information for each display
6164  * @tc.type: FUNC
6165  * @tc.require:
6166  */
6167 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_004, TestSize.Level1)
6168 {
6169     CALL_TEST_DEBUG;
6170     DisplayGroupInfo displayGroupInfo;
6171     displayGroupInfo.width = 20;
6172     displayGroupInfo.height = 20;
6173     displayGroupInfo.focusWindowId = 1;
6174 
6175     WindowInfo windowInfo;
6176     windowInfo.id = 1;
6177     windowInfo.pid = 1;
6178     windowInfo.uid = 1;
6179     windowInfo.area = {1, 1, 1, 1};
6180     windowInfo.defaultHotAreas = { windowInfo.area };
6181     windowInfo.pointerHotAreas = { windowInfo.area };
6182     windowInfo.agentWindowId = 1;
6183     windowInfo.flags = 1;
6184     windowInfo.transform = {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
6185     windowInfo.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 };
6186     displayGroupInfo.windowsInfo.push_back(windowInfo);
6187 
6188     DisplayInfo displayInfo1;
6189     displayInfo1.id = 1;
6190     displayInfo1.x =1;
6191     displayInfo1.y = 1;
6192     displayInfo1.width = 2;
6193     displayInfo1.height = 2;
6194     displayInfo1.dpi = 240;
6195     displayInfo1.name = "pp";
6196     displayInfo1.uniq = "pp";
6197     displayInfo1.direction = DIRECTION0;
6198     displayGroupInfo.displaysInfo.push_back(displayInfo1);
6199 
6200     DisplayInfo displayInfo2;
6201     displayInfo2.id = 2;
6202     displayInfo2.x =1;
6203     displayInfo2.y = 1;
6204     displayInfo2.width = 2;
6205     displayInfo2.height = 2;
6206     displayInfo2.dpi = 240;
6207     displayInfo2.name = "pp";
6208     displayInfo2.uniq = "pp";
6209     displayInfo2.direction = DIRECTION0;
6210     displayGroupInfo.displaysInfo.push_back(displayInfo2);
6211 
6212     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6213 
6214     displayGroupInfo.displaysInfo.erase(displayGroupInfo.displaysInfo.begin());
6215     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6216 }
6217 
6218 /**
6219  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_005
6220  * @tc.desc: Test updating window & display information for each display
6221  * @tc.type: FUNC
6222  * @tc.require:
6223  */
6224 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_005, TestSize.Level1)
6225 {
6226     CALL_TEST_DEBUG;
6227     DisplayGroupInfo displayGroupInfo;
6228     displayGroupInfo.width = 20;
6229     displayGroupInfo.height = 20;
6230     displayGroupInfo.focusWindowId = 1;
6231 
6232     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6233 }
6234 
6235 #ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR
6236 /**
6237  * @tc.name: InputWindowsManagerTest_UpdateKeyEventDisplayId_001
6238  * @tc.desc: Test the funcation UpdateKeyEventDisplayId
6239  * @tc.type: FUNC
6240  * @tc.require:
6241  */
6242 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateKeyEventDisplayId_001, TestSize.Level1)
6243 {
6244     CALL_TEST_DEBUG;
6245     InputWindowsManager inputWindowsManager;
6246     std::shared_ptr<KeyEvent> keyEvent = nullptr;
6247     int32_t focusWindowId = 1;
6248     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateKeyEventDisplayId(keyEvent, focusWindowId));
6249 
6250     WindowInfo windowInfo = {.displayId = 1};
6251     WindowGroupInfo windowGroupInfo = {.focusWindowId = 1, .displayId = 1, .windowsInfo = {windowInfo}};
6252     inputWindowsManager.windowsPerDisplay_.emplace(std::make_pair(1, windowGroupInfo));
6253     keyEvent = KeyEvent::Create();
6254     ASSERT_NE(keyEvent, nullptr);
6255     inputWindowsManager.UpdateKeyEventDisplayId(keyEvent, focusWindowId);
6256     EXPECT_EQ(keyEvent->GetTargetDisplayId(), 1);
6257 
6258     focusWindowId = 2;
6259     inputWindowsManager.UpdateKeyEventDisplayId(keyEvent, focusWindowId);
6260     EXPECT_EQ(keyEvent->GetTargetDisplayId(), 1);
6261 
6262     DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200};
6263     inputWindowsManager.displayGroupInfo_.displaysInfo.emplace_back(info1);
6264     inputWindowsManager.UpdateKeyEventDisplayId(keyEvent, focusWindowId);
6265     EXPECT_EQ(keyEvent->GetTargetDisplayId(), 0);
6266 }
6267 
6268 /**
6269  * @tc.name: InputWindowsManagerTest_OnDisplayRemovedOrCombiantionChanged_001
6270  * @tc.desc: Test the funcation OnDisplayRemovedOrCombiantionChanged
6271  * @tc.type: FUNC
6272  * @tc.require:
6273  */
6274 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnDisplayRemovedOrCombiantionChanged_001, TestSize.Level1)
6275 {
6276     CALL_TEST_DEBUG;
6277     InputWindowsManager inputWindowsManager;
6278     DisplayGroupInfo displayGroupInfo {};
6279     bool ret = inputWindowsManager.OnDisplayRemovedOrCombiantionChanged(displayGroupInfo);
6280     EXPECT_FALSE(ret);
6281 
6282     DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200};
6283     DisplayInfo info2 = {.id = 1, .x = 100, .y = 0, .width = 100, .height = 200};
6284     inputWindowsManager.displayGroupInfo_.displaysInfo = {info1, info2};
6285     displayGroupInfo.displaysInfo = {info2};
6286     ret = inputWindowsManager.OnDisplayRemovedOrCombiantionChanged(displayGroupInfo);
6287     EXPECT_TRUE(ret);
6288 }
6289 
6290 /**
6291  * @tc.name: InputWindowsManagerTest_UpdateWindowInfo_001
6292  * @tc.desc: Test the funcation UpdateWindowInfo
6293  * @tc.type: FUNC
6294  * @tc.require:
6295  */
6296 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowInfo_001, TestSize.Level1)
6297 {
6298     CALL_TEST_DEBUG;
6299     DisplayGroupInfo displayGroupInfo;
6300     displayGroupInfo.width = 20;
6301     displayGroupInfo.height = 20;
6302     displayGroupInfo.focusWindowId = 1;
6303 
6304     WindowInfo windowInfo;
6305     windowInfo.id = 1;
6306     windowInfo.pid = 1;
6307     windowInfo.uid = 1;
6308     windowInfo.area = {1, 1, 1, 1};
6309     windowInfo.defaultHotAreas = { windowInfo.area };
6310     windowInfo.pointerHotAreas = { windowInfo.area };
6311     windowInfo.agentWindowId = 1;
6312     windowInfo.flags = 1;
6313     windowInfo.transform = {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
6314     windowInfo.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 };
6315     windowInfo.action = WINDOW_UPDATE_ACTION::ADD;
6316     displayGroupInfo.windowsInfo.push_back(windowInfo);
6317 
6318     WINDOW_UPDATE_ACTION ret = WIN_MGR->UpdateWindowInfo(displayGroupInfo);
6319     ASSERT_EQ(ret, WINDOW_UPDATE_ACTION::ADD);
6320 }
6321 
6322 /**
6323  * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_PointerBackCenter_001
6324  * @tc.desc: Test moved screen , pointer back screen center
6325  * @tc.type: FUNC
6326  * @tc.require:
6327  */
6328 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_PointerBackCenter_001, TestSize.Level1)
6329 {
6330     CALL_TEST_DEBUG;
6331     DisplayGroupInfo displayGroupInfo;
6332     displayGroupInfo.width = 20;
6333     displayGroupInfo.height = 20;
6334     displayGroupInfo.focusWindowId = 1;
6335 
6336     DisplayInfo displayInfo1;
6337     displayInfo1.id = 1;
6338     displayInfo1.x =1;
6339     displayInfo1.y = 1;
6340     displayInfo1.width = 2;
6341     displayInfo1.height = 2;
6342     displayInfo1.dpi = 240;
6343     displayInfo1.name = "pp";
6344     displayInfo1.uniq = "pp";
6345     displayInfo1.direction = DIRECTION0;
6346     displayInfo1.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_MAIN;
6347 
6348     DisplayInfo displayInfo2;
6349     displayInfo2.id = 2;
6350     displayInfo2.x =1;
6351     displayInfo2.y = 1;
6352     displayInfo2.width = 2;
6353     displayInfo2.height = 2;
6354     displayInfo2.dpi = 240;
6355     displayInfo2.name = "pp";
6356     displayInfo2.uniq = "pp";
6357     displayInfo2.direction = DIRECTION0;
6358     displayInfo2.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_EXPAND;
6359     displayGroupInfo.displaysInfo.push_back(displayInfo2);
6360     displayGroupInfo.displaysInfo.push_back(displayInfo1);
6361 
6362     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6363 
6364     displayGroupInfo.displaysInfo.erase(displayGroupInfo.displaysInfo.begin());
6365     ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo));
6366     CursorPosition pointerPos = WIN_MGR->GetCursorPos();
6367     EXPECT_EQ(pointerPos.displayId, displayInfo1.id);
6368 }
6369 
6370 #endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR
6371 
6372 /**
6373  * @tc.name: InputWindowsManagerTest_IgnoreTouchEvent_002
6374  * @tc.desc: Test the funcation IgnoreTouchEvent
6375  * @tc.type: FUNC
6376  * @tc.require:
6377  */
6378 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IgnoreTouchEvent_002, TestSize.Level1)
6379 {
6380     CALL_TEST_DEBUG;
6381     InputWindowsManager inputWindowsManager;
6382     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6383     ASSERT_NE(pointerEvent, nullptr);
6384     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
6385     EXPECT_FALSE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6386     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6387     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL);
6388     EXPECT_FALSE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6389     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
6390     PointerEvent::PointerItem item;
6391     item.SetPointerId(10);
6392     item.SetLongAxis(-1);
6393     pointerEvent->SetPointerId(0);
6394     pointerEvent->AddPointerItem(item);
6395     EXPECT_FALSE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6396     pointerEvent->SetPointerId(10);
6397     inputWindowsManager.cancelTouchStatus_ = true;
6398     EXPECT_TRUE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6399     item.SetLongAxis(100);
6400     pointerEvent->UpdatePointerItem(10, item);
6401     EXPECT_FALSE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6402     EXPECT_FALSE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6403     item.SetLongAxis(-1);
6404     pointerEvent->UpdatePointerItem(10, item);
6405     EXPECT_TRUE(inputWindowsManager.IgnoreTouchEvent(pointerEvent));
6406 }
6407 
6408 /**
6409  * @tc.name: InputWindowsManagerTest_ReissueCancelTouchEvent
6410  * @tc.desc: Test the funcation ReissueCancelTouchEvent
6411  * @tc.type: FUNC
6412  * @tc.require:
6413  */
6414 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReissueCancelTouchEvent, TestSize.Level1)
6415 {
6416     CALL_TEST_DEBUG;
6417     InputWindowsManager inputWindowsManager;
6418     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6419     ASSERT_NE(pointerEvent, nullptr);
6420     PointerEvent::PointerItem item;
6421     item.SetPressed(false);
6422     pointerEvent->AddPointerItem(item);
6423     item.SetPointerId(100);
6424     item.SetPressed(true);
6425     pointerEvent->AddPointerItem(item);
6426     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueCancelTouchEvent(pointerEvent));
6427 }
6428 
6429 /**
6430  * @tc.name: InputWindowsManagerTest_SetPointerEvent
6431  * @tc.desc: Test the funcation SetPointerEvent
6432  * @tc.type: FUNC
6433  * @tc.require:
6434  */
6435 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPointerEvent, TestSize.Level1)
6436 {
6437     CALL_TEST_DEBUG;
6438     InputWindowsManager inputWindowsManager;
6439     int32_t pointerAction = PointerEvent::POINTER_ACTION_DOWN;
6440     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6441     ASSERT_NE(pointerEvent, nullptr);
6442     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
6443     ASSERT_NE(pointerEvent, nullptr);
6444     PointerEvent::PointerItem item;
6445     item.SetPointerId(100);
6446     item.SetPressed(true);
6447     item.SetDisplayX(50);
6448     item.SetDisplayY(50);
6449     inputWindowsManager.lastPointerEvent_->SetTargetDisplayId(150);
6450     inputWindowsManager.lastPointerEvent_->SetPointerId(100);
6451     inputWindowsManager.lastPointerEvent_->AddPointerItem(item);
6452     inputWindowsManager.lastWindowInfo_.id = 10;
6453     inputWindowsManager.mouseDownInfo_.id = 100;
6454     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SetPointerEvent(pointerAction, pointerEvent));
6455     item.SetPressed(false);
6456     inputWindowsManager.lastPointerEvent_->UpdatePointerItem(100, item);
6457     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.SetPointerEvent(pointerAction, pointerEvent));
6458 }
6459 
6460 /**
6461  * @tc.name: InputWindowsManagerTest_CheckUIExtentionWindowPointerHotArea
6462  * @tc.desc: Test the funcation CheckUIExtentionWindowPointerHotArea
6463  * @tc.type: FUNC
6464  * @tc.require:
6465  */
6466 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckUIExtentionWindowPointerHotArea, TestSize.Level1)
6467 {
6468     CALL_TEST_DEBUG;
6469     InputWindowsManager inputWindowsManager;
6470     WindowInfo winInfo;
6471     Rect rect {
6472         .x = 100,
6473         .y = 100,
6474         .width = 1000,
6475         .height = 1000,
6476     };
6477     int32_t logicalX = 300;
6478     int32_t logicalY = 300;
6479     std::vector<WindowInfo> windowInfos;
6480     int32_t windowId = 10;
6481     winInfo.id = 20;
6482     winInfo.pointerHotAreas.push_back(rect);
6483     windowInfos.push_back(winInfo);
6484     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CheckUIExtentionWindowPointerHotArea(logicalX, logicalY,
6485         windowInfos, windowId));
6486 }
6487 
6488 /**
6489  * @tc.name: InputWindowsManagerTest_UpdateTargetPointer
6490  * @tc.desc: Test the funcation UpdateTargetPointer
6491  * @tc.type: FUNC
6492  * @tc.require:
6493  */
6494 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTargetPointer, TestSize.Level1)
6495 {
6496     CALL_TEST_DEBUG;
6497     InputWindowsManager inputWindowsManager;
6498     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6499     ASSERT_NE(pointerEvent, nullptr);
6500     int32_t longAxis = 1U << 27U;
6501     inputWindowsManager.IsFoldable_ = true;
6502     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6503     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
6504     PointerEvent::PointerItem item;
6505     item.SetPointerId(10);
6506     item.SetLongAxis(longAxis);
6507     pointerEvent->SetPointerId(10);
6508     pointerEvent->AddPointerItem(item);
6509     inputWindowsManager.cancelTouchStatus_ = true;
6510     EXPECT_EQ(inputWindowsManager.UpdateTargetPointer(pointerEvent), RET_OK);
6511 }
6512 
6513 /**
6514  * @tc.name: InputWindowsManagerTest_CleanInvalidPiexMap
6515  * @tc.desc: Test the funcation CleanInvalidPiexMap
6516  * @tc.type: FUNC
6517  * @tc.require:
6518  */
6519 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CleanInvalidPiexMap, TestSize.Level1)
6520 {
6521     CALL_TEST_DEBUG;
6522     InputWindowsManager inputWindowsManager;
6523     int32_t windowId = 100;
6524     WindowInfo winInfo;
6525     winInfo.id = 10;
6526     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
6527     inputWindowsManager.transparentWins_.insert_or_assign(windowId, std::move(pixelMap));
6528     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
6529     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CleanInvalidPiexMap());
6530 }
6531 
6532 /**
6533  * @tc.name: InputWindowsManagerTest_CleanInvalidPiexMap_001
6534  * @tc.desc: Test the funcation CleanInvalidPiexMap
6535  * @tc.type: FUNC
6536  * @tc.require:
6537  */
6538 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CleanInvalidPiexMap_001, TestSize.Level1)
6539 {
6540     CALL_TEST_DEBUG;
6541     InputWindowsManager inputWindowsManager;
6542     int32_t windowId = 10;
6543     WindowInfo winInfo;
6544     winInfo.id = 10;
6545     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
6546     inputWindowsManager.transparentWins_.insert_or_assign(windowId, std::move(pixelMap));
6547     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
6548     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CleanInvalidPiexMap());
6549 }
6550 
6551 /**
6552  * @tc.name: InputWindowsManagerTest_GetCancelEventFlag
6553  * @tc.desc: Test the funcation GetCancelEventFlag
6554  * @tc.type: FUNC
6555  * @tc.require:
6556  */
6557 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCancelEventFlag, TestSize.Level1)
6558 {
6559     CALL_TEST_DEBUG;
6560     InputWindowsManager inputWindowsManager;
6561     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6562     ASSERT_NE(pointerEvent, nullptr);
6563     WindowInfoEX winInfoEx;
6564     winInfoEx.flag = true;
6565     int32_t pointerId = 100;
6566     pointerEvent->SetPointerId(100);
6567     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6568     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerId, winInfoEx));
6569     EXPECT_TRUE(inputWindowsManager.GetCancelEventFlag(pointerEvent));
6570 
6571     pointerEvent->SetPointerId(200);
6572     EXPECT_TRUE(inputWindowsManager.GetCancelEventFlag(pointerEvent));
6573 }
6574 
6575 /**
6576  * @tc.name: InputWindowsManagerTest_GetCancelEventFlag_001
6577  * @tc.desc: Test the funcation GetCancelEventFlag
6578  * @tc.type: FUNC
6579  * @tc.require:
6580  */
6581 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCancelEventFlag_001, TestSize.Level1)
6582 {
6583     CALL_TEST_DEBUG;
6584     InputWindowsManager inputWindowsManager;
6585     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6586     ASSERT_NE(pointerEvent, nullptr);
6587     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
6588     inputWindowsManager.mouseDownInfo_.pid = 100;
6589     EXPECT_FALSE(inputWindowsManager.GetCancelEventFlag(pointerEvent));
6590 
6591     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
6592     inputWindowsManager.mouseDownInfo_.pid = -1;
6593     EXPECT_TRUE(inputWindowsManager.GetCancelEventFlag(pointerEvent));
6594 
6595     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
6596     EXPECT_FALSE(inputWindowsManager.GetCancelEventFlag(pointerEvent));
6597 }
6598 
6599 /**
6600  * @tc.name: InputWindowsManagerTest_DispatchPointerCancel_001
6601  * @tc.desc: Test the funcation DispatchPointerCancel
6602  * @tc.type: FUNC
6603  * @tc.require:
6604  */
6605 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchPointerCancel_001, TestSize.Level1)
6606 {
6607     CALL_TEST_DEBUG;
6608     InputWindowsManager inputWindowsManager;
6609     int32_t displayId = -1;
6610     WindowGroupInfo winGroupInfo;
6611     WindowInfo winInfo;
6612     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
6613     ASSERT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
6614     inputWindowsManager.mouseDownInfo_.id = 10;
6615     inputWindowsManager.extraData_.appended = false;
6616     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_UNKNOWN;
6617     inputWindowsManager.firstBtnDownWindowInfo_.first = -1;
6618     inputWindowsManager.firstBtnDownWindowInfo_.second = 10;
6619     winInfo.id = 10;
6620     winGroupInfo.windowsInfo.push_back(winInfo);
6621     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(10, winGroupInfo));
6622     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointerCancel(displayId));
6623 }
6624 
6625 /**
6626  * @tc.name: InputWindowsManagerTest_DispatchPointerCancel_002
6627  * @tc.desc: Test the funcation DispatchPointerCancel
6628  * @tc.type: FUNC
6629  * @tc.require:
6630  */
6631 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchPointerCancel_002, TestSize.Level1)
6632 {
6633     CALL_TEST_DEBUG;
6634     InputWindowsManager inputWindowsManager;
6635     int32_t displayId = -1;
6636     WindowGroupInfo winGroupInfo;
6637     WindowInfo winInfo;
6638     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
6639     ASSERT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
6640     inputWindowsManager.mouseDownInfo_.id = 50;
6641     inputWindowsManager.extraData_.appended = false;
6642     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_UNKNOWN;
6643     inputWindowsManager.firstBtnDownWindowInfo_.first = -1;
6644     inputWindowsManager.firstBtnDownWindowInfo_.second = 10;
6645     winInfo.id = 10;
6646     winGroupInfo.windowsInfo.push_back(winInfo);
6647     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(10, winGroupInfo));
6648     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.DispatchPointerCancel(displayId));
6649 }
6650 
6651 /**
6652  * @tc.name: InputWindowsManagerTest_UpdateWindowsInfoPerDisplay
6653  * @tc.desc: Test the funcation UpdateWindowsInfoPerDisplay
6654  * @tc.type: FUNC
6655  * @tc.require:
6656  */
6657 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowsInfoPerDisplay, TestSize.Level1)
6658 {
6659     CALL_TEST_DEBUG;
6660     InputWindowsManager inputWindowsManager;
6661     DisplayGroupInfo displayGroupInfo;
6662     WindowGroupInfo winGroupInfo;
6663     WindowInfo winInfo;
6664     int32_t displayId = 100;
6665     winInfo.displayId = 100;
6666     winInfo.id = 200;
6667     winInfo.windowType = -1;
6668     displayGroupInfo.focusWindowId = 300;
6669     displayGroupInfo.windowsInfo.push_back(winInfo);
6670     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, winGroupInfo));
6671     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateWindowsInfoPerDisplay(displayGroupInfo));
6672 
6673     winInfo.windowType = static_cast<int32_t>(Rosen::WindowType::WINDOW_TYPE_TRANSPARENT_VIEW);
6674     displayGroupInfo.windowsInfo.push_back(winInfo);
6675     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateWindowsInfoPerDisplay(displayGroupInfo));
6676 }
6677 
6678 /**
6679  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_004
6680  * @tc.desc: Test SelectWindowInfo
6681  * @tc.type: FUNC
6682  * @tc.require:
6683  */
6684 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_004, TestSize.Level1)
6685 {
6686     CALL_TEST_DEBUG;
6687     InputWindowsManager inputWindowsManager;
6688     int32_t windowId = 150;
6689     int32_t logicalX = 200;
6690     int32_t logicalY = 200;
6691     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6692     EXPECT_NE(pointerEvent, nullptr);
6693     Rect rect {
6694         .x = 100,
6695         .y = 100,
6696         .width = 1000,
6697         .height = 1000,
6698     };
6699     WindowInfo windowInfo;
6700     WindowGroupInfo windowGroupInfo;
6701     pointerEvent->bitwise_ = 0x00000000;
6702     pointerEvent->SetZOrder(15.5f);
6703     pointerEvent->SetTargetDisplayId(-1);
6704     pointerEvent->SetTargetWindowId(100);
6705     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
6706     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
6707     windowInfo.id = 150;
6708     windowInfo.displayId = 300;
6709     windowInfo.flags = 0;
6710     windowInfo.pointerHotAreas.push_back(rect);
6711     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
6712     inputWindowsManager.extraData_.appended = true;
6713     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
6714     windowInfo.uiExtentionWindowInfo.push_back(windowInfo);
6715     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
6716     windowInfo.windowInputType = WindowInputType::NORMAL;
6717     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
6718     inputWindowsManager.firstBtnDownWindowInfo_.first = 150;
6719     inputWindowsManager.transparentWins_.insert_or_assign(windowId, std::move(pixelMap));
6720     EXPECT_NE(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
6721 }
6722 
6723 /**
6724  * @tc.name: InputWindowsManagerTest_SelectWindowInfo_005
6725  * @tc.desc: Test SelectWindowInfo
6726  * @tc.type: FUNC
6727  * @tc.require:
6728  */
6729 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_005, TestSize.Level1)
6730 {
6731     CALL_TEST_DEBUG;
6732     InputWindowsManager inputWindowsManager;
6733     int32_t windowId = 50;
6734     int32_t logicalX = 200;
6735     int32_t logicalY = 200;
6736     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
6737     EXPECT_NE(pointerEvent, nullptr);
6738     Rect rect {
6739         .x = 100,
6740         .y = 100,
6741         .width = 1000,
6742         .height = 1000,
6743     };
6744     WindowInfo windowInfo;
6745     WindowGroupInfo windowGroupInfo;
6746     inputWindowsManager.firstBtnDownWindowInfo_.first = -1;
6747     pointerEvent->SetTargetDisplayId(-1);
6748     pointerEvent->SetTargetWindowId(-1);
6749     std::unique_ptr<Media::PixelMap> pixelMap = nullptr;
6750     windowInfo.id = 150;
6751     windowInfo.displayId = 300;
6752     windowInfo.flags = 0;
6753     windowInfo.pointerHotAreas.push_back(rect);
6754     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
6755     inputWindowsManager.extraData_.appended = false;
6756     inputWindowsManager.extraData_.sourceType = PointerEvent::SOURCE_TYPE_UNKNOWN;
6757     windowInfo.uiExtentionWindowInfo.push_back(windowInfo);
6758     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
6759     inputWindowsManager.transparentWins_.insert_or_assign(windowId, std::move(pixelMap));
6760     EXPECT_EQ(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
6761     pointerEvent->SetButtonPressed(2024);
6762     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
6763     EXPECT_EQ(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
6764     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
6765     EXPECT_EQ(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
6766     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
6767     EXPECT_EQ(inputWindowsManager.SelectWindowInfo(logicalX, logicalY, pointerEvent), std::nullopt);
6768 }
6769 
6770 /**
6771  * @tc.name: InputWindowsManagerTest_ReissueEvent_001
6772  * @tc.desc: Verify if (keyEvent->GetKeyAction() != KeyEvent::KEY_ACTION_CANCEL && focusWindowId_ != -1 &&
6773  * focusWindowId_ != focusWindowId && keyEvent->IsRepeatKey())
6774  * @tc.type: FUNC
6775  * @tc.require:
6776  */
6777 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReissueEvent_001, TestSize.Level1)
6778 {
6779     CALL_TEST_DEBUG;
6780     auto keyEvent = KeyEvent::Create();
6781     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_CANCEL);
6782     InputWindowsManager inputWindowsManager;
6783     int32_t focusWindowId = 0;
6784     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueEvent(keyEvent, focusWindowId));
6785 
6786     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
6787     focusWindowId = -1;
6788     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueEvent(keyEvent, focusWindowId));
6789 
6790     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
6791     focusWindowId = 0;
6792     inputWindowsManager.focusWindowId_ = 0;
6793     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueEvent(keyEvent, focusWindowId));
6794 
6795     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
6796     focusWindowId = 0;
6797     inputWindowsManager.focusWindowId_ = -1;
6798     keyEvent->SetRepeatKey(true);
6799     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueEvent(keyEvent, focusWindowId));
6800 
6801     keyEvent->SetKeyAction(KeyEvent::KEY_ACTION_DOWN);
6802     focusWindowId = 0;
6803     inputWindowsManager.focusWindowId_ = -1;
6804     keyEvent->SetRepeatKey(false);
6805     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ReissueEvent(keyEvent, focusWindowId));
6806 }
6807 
6808 /**
6809  * @tc.name: InputWindowsManagerTest_JudgeCaramaInFore_001
6810  * @tc.desc: Verify if (udsServer_ == nullptr)
6811  * @tc.type: FUNC
6812  * @tc.require:
6813  */
6814 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_JudgeCaramaInFore_001, TestSize.Level1)
6815 {
6816     CALL_TEST_DEBUG;
6817     InputWindowsManager inputWindowsManager;
6818     EXPECT_EQ(inputWindowsManager.JudgeCaramaInFore(), false);
6819 
6820     UDSServer udsServer;
6821     inputWindowsManager.udsServer_ = &udsServer;
6822     EXPECT_NE(inputWindowsManager.udsServer_, nullptr);
6823     EXPECT_EQ(inputWindowsManager.JudgeCaramaInFore(), false);
6824 
6825     int32_t udsPid = 20;
6826     int32_t udsFd = 15;
6827     udsServer.idxPidMap_.insert(std::make_pair(udsPid, udsFd));
6828     SessionPtr session = CreateSessionPtr();
6829     udsServer.sessionsMap_.insert(std::make_pair(udsPid, session));
6830 
6831     WindowInfo windowInfo;
6832     windowInfo.id = 20;
6833     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
6834     inputWindowsManager.displayGroupInfo_.focusWindowId = 20;
6835     EXPECT_EQ(inputWindowsManager.JudgeCaramaInFore(), false);
6836 }
6837 
6838 /**
6839  * @tc.name: InputWindowsManagerTest_SelectPointerChangeArea_003
6840  * @tc.desc: Test SelectPointerChangeArea
6841  * @tc.type: FUNC
6842  * @tc.require:
6843  */
6844 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeArea_003, TestSize.Level1)
6845 {
6846     CALL_TEST_DEBUG;
6847     InputWindowsManager inputWindowsMgr;
6848     std::vector<Rect> areas;
6849     Rect rect {
6850         .x = 100,
6851         .y = 100,
6852         .width = 1000,
6853         .height = 1000,
6854     };
6855     areas.push_back(rect);
6856     inputWindowsMgr.windowsHotAreas_.insert(std::make_pair(100, areas));
6857 
6858     int32_t windowId = 100;
6859     int32_t logicalX = 300;
6860     int32_t logicalY = 300;
6861     EXPECT_TRUE(inputWindowsMgr.SelectPointerChangeArea(windowId, logicalX, logicalY));
6862 }
6863 
6864 /**
6865  * @tc.name: InputWindowsManagerTest_SelectPointerChangeArea_004
6866  * @tc.desc: Test SelectPointerChangeArea
6867  * @tc.type: FUNC
6868  * @tc.require:
6869  */
6870 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeArea_004, TestSize.Level1)
6871 {
6872     CALL_TEST_DEBUG;
6873     InputWindowsManager inputWindowsMgr;
6874     int32_t windowId = 100;
6875     int32_t logicalX = 300;
6876     int32_t logicalY = 300;
6877     EXPECT_FALSE(inputWindowsMgr.SelectPointerChangeArea(windowId, logicalX, logicalY));
6878 }
6879 
6880 /**
6881  * @tc.name: InputWindowsManagerTest_InWhichHotArea_002
6882  * @tc.desc: Test InWhichHotArea
6883  * @tc.type: FUNC
6884  * @tc.require:
6885  */
6886 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_002, TestSize.Level1)
6887 {
6888     CALL_TEST_DEBUG;
6889     InputWindowsManager inputWindowsManager;
6890     int32_t x = 500;
6891     int32_t y = 800;
6892     std::vector<Rect> rects;
6893     rects = { { 100, 0, INT32_MAX, 0 } };
6894     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
6895     rects.clear();
6896     rects = { { 150, 100, 300, INT32_MAX } };
6897     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
6898     rects.clear();
6899     rects = { { 150, 250, 300, 500 } };
6900     EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
6901     x = 200;
6902     y = 300;
6903     EXPECT_TRUE(inputWindowsManager.InWhichHotArea(x, y, rects));
6904     int32_t cycleNum = 7;
6905     for (int32_t i = 0; i < cycleNum; ++i) {
6906         rects.insert(rects.begin(), { 1000, 1000, 1500, 1500 });
6907         EXPECT_TRUE(inputWindowsManager.InWhichHotArea(x, y, rects));
6908     }
6909 }
6910 
6911 /**
6912  * @tc.name: InputWindowsManagerTest_HandleGestureInjection_001
6913  * @tc.desc: Verify if (!gestureInject)
6914  * @tc.type: FUNC
6915  * @tc.require:
6916  */
6917 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleGestureInjection_001, TestSize.Level1)
6918 {
6919     CALL_TEST_DEBUG;
6920     InputWindowsManager inputWindowsManager;
6921     bool gestureInject = false;
6922     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.HandleGestureInjection(gestureInject));
6923 
6924     gestureInject = true;
6925     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.HandleGestureInjection(gestureInject));
6926 }
6927 
6928 /**
6929  * @tc.name: InputWindowsManagerTest_GetPhysicalDisplay_003
6930  * @tc.desc: Test GetPhysicalDisplay
6931  * @tc.type: FUNC
6932  * @tc.require:
6933  */
6934 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_003, TestSize.Level1)
6935 {
6936     CALL_TEST_DEBUG;
6937     InputWindowsManager inputWindowsManager;
6938     int32_t id = 1;
6939     DisplayInfo displayInfo;
6940     displayInfo.id = 0;
6941     DisplayGroupInfo displayGroupInfo;
6942     displayGroupInfo.displaysInfo.push_back(displayInfo);
6943     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPhysicalDisplay(id, displayGroupInfo));
6944 
6945     displayInfo.id = 1;
6946     displayGroupInfo.displaysInfo.push_back(displayInfo);
6947     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPhysicalDisplay(id, displayGroupInfo));
6948 }
6949 
6950 /**
6951  * @tc.name: InputWindowsManagerTest_AdjustFingerFlag_001
6952  * @tc.desc: Test if (pointerEvent->GetSourceType() != PointerEvent::SOURCE_TYPE_TOUCHSCREEN)
6953  * @tc.type: FUNC
6954  * @tc.require:
6955  */
6956 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustFingerFlag_001, TestSize.Level1)
6957 {
6958     CALL_TEST_DEBUG;
6959     auto pointerEvent = PointerEvent::Create();
6960     ASSERT_NE(pointerEvent, nullptr);
6961     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
6962     InputWindowsManager inputWindowsManager;
6963     EXPECT_FALSE(inputWindowsManager.AdjustFingerFlag(pointerEvent));
6964 
6965     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6966     EXPECT_FALSE(inputWindowsManager.AdjustFingerFlag(pointerEvent));
6967 }
6968 
6969 /**
6970  * @tc.name: InputWindowsManagerTest_AdjustFingerFlag_002
6971  * @tc.desc: Test if (pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SHELL))
6972  * @tc.type: FUNC
6973  * @tc.require:
6974  */
6975 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustFingerFlag_002, TestSize.Level1)
6976 {
6977     CALL_TEST_DEBUG;
6978     auto pointerEvent = PointerEvent::Create();
6979     ASSERT_NE(pointerEvent, nullptr);
6980     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6981     uint32_t flag = 0x00000080;
6982     pointerEvent->bitwise_ |= flag;
6983     InputWindowsManager inputWindowsManager;
6984     EXPECT_FALSE(inputWindowsManager.AdjustFingerFlag(pointerEvent));
6985 }
6986 
6987 /**
6988  * @tc.name: InputWindowsManagerTest_AdjustFingerFlag_003
6989  * @tc.desc: Test if (pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SHELL))
6990  * @tc.type: FUNC
6991  * @tc.require:
6992  */
6993 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustFingerFlag_003, TestSize.Level1)
6994 {
6995     CALL_TEST_DEBUG;
6996     auto pointerEvent = PointerEvent::Create();
6997     ASSERT_NE(pointerEvent, nullptr);
6998     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
6999     uint32_t flag = 0x00000080;
7000     pointerEvent->bitwise_ |= flag;
7001     InputWindowsManager inputWindowsManager;
7002     EXPECT_FALSE(inputWindowsManager.AdjustFingerFlag(pointerEvent));
7003 }
7004 
7005 /**
7006  * @tc.name: InputWindowsManagerTest_AdjustFingerFlag_004
7007  * @tc.desc: Test AdjustFingerFlag
7008  * @tc.type: FUNC
7009  * @tc.require:
7010  */
7011 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustFingerFlag_004, TestSize.Level1)
7012 {
7013     CALL_TEST_DEBUG;
7014     auto pointerEvent = PointerEvent::Create();
7015     ASSERT_NE(pointerEvent, nullptr);
7016     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7017     uint32_t flag = 0x00000100;
7018     pointerEvent->bitwise_ |= flag;
7019     InputWindowsManager inputWindowsManager;
7020     EXPECT_FALSE(inputWindowsManager.AdjustFingerFlag(pointerEvent));
7021 }
7022 
7023 /**
7024  * @tc.name: InputWindowsManagerTest_GetClientFd_007
7025  * @tc.desc: Test GetClientFd
7026  * @tc.type: FUNC
7027  * @tc.require:
7028  */
7029 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_007, TestSize.Level1)
7030 {
7031     CALL_TEST_DEBUG;
7032     InputWindowsManager inputWindowsManager;
7033     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7034     ASSERT_NE(pointerEvent, nullptr);
7035     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7036     uint32_t flag = 0x00000100;
7037     pointerEvent->bitwise_ |= flag;
7038     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetClientFd(pointerEvent));
7039 }
7040 
7041 /**
7042  * @tc.name: InputWindowsManagerTest_GetClientFd_008
7043  * @tc.desc: Test if (iter != touchItemDownInfos_.end() && !(iter->second.flag))
7044  * @tc.type: FUNC
7045  * @tc.require:
7046  */
7047 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_008, TestSize.Level1)
7048 {
7049     CALL_TEST_DEBUG;
7050     InputWindowsManager inputWindowsManager;
7051     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7052     ASSERT_NE(pointerEvent, nullptr);
7053 
7054     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7055     uint32_t flag = 0x00000100;
7056     pointerEvent->bitwise_ |= flag;
7057     WindowInfoEX winInfoEx;
7058     winInfoEx.flag = true;
7059     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
7060 
7061     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetClientFd(pointerEvent));
7062 }
7063 
7064 /**
7065  * @tc.name: InputWindowsManagerTest_GetClientFd_009
7066  * @tc.desc: Test if (iter != touchItemDownInfos_.end() && !(iter->second.flag))
7067  * @tc.type: FUNC
7068  * @tc.require:
7069  */
7070 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_009, TestSize.Level1)
7071 {
7072     CALL_TEST_DEBUG;
7073     InputWindowsManager inputWindowsManager;
7074     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7075     ASSERT_NE(pointerEvent, nullptr);
7076 
7077     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7078     uint32_t flag = 0x00000100;
7079     pointerEvent->bitwise_ |= flag;
7080     WindowInfoEX winInfoEx;
7081     winInfoEx.flag = false;
7082     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
7083 
7084     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetClientFd(pointerEvent));
7085 }
7086 
7087 /**
7088  * @tc.name: InputWindowsManagerTest_GetClientFd_010
7089  * @tc.desc: Test if (uiExtentionWindowInfo.id == pointerEvent->GetTargetWindowId())
7090  * @tc.type: FUNC
7091  * @tc.require:
7092  */
7093 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_010, TestSize.Level1)
7094 {
7095     CALL_TEST_DEBUG;
7096     InputWindowsManager inputWindowsManager;
7097     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7098     ASSERT_NE(pointerEvent, nullptr);
7099     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
7100     int32_t id = 1;
7101     pointerEvent->SetTargetWindowId(id);
7102 
7103     WindowInfo windowInfo1;
7104     windowInfo1.id = 1;
7105     windowInfo1.uiExtentionWindowInfo.push_back(windowInfo1);
7106     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo1);
7107 
7108     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetClientFd(pointerEvent));
7109 }
7110 
7111 /**
7112  * @tc.name: InputWindowsManagerTest_GetClientFd_011
7113  * @tc.desc: Test if (uiExtentionWindowInfo.id == pointerEvent->GetTargetWindowId())
7114  * @tc.type: FUNC
7115  * @tc.require:
7116  */
7117 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_011, TestSize.Level1)
7118 {
7119     CALL_TEST_DEBUG;
7120     InputWindowsManager inputWindowsManager;
7121     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7122     ASSERT_NE(pointerEvent, nullptr);
7123     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
7124     int32_t id = 2;
7125     pointerEvent->SetTargetWindowId(id);
7126 
7127     WindowInfo windowInfo1;
7128     windowInfo1.id = 1;
7129     windowInfo1.uiExtentionWindowInfo.push_back(windowInfo1);
7130     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo1);
7131 
7132     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetClientFd(pointerEvent));
7133 }
7134 
7135 /**
7136  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_001
7137  * @tc.desc: Test FoldScreenRotation
7138  * @tc.type: FUNC
7139  * @tc.require:
7140  */
7141 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_001, TestSize.Level1)
7142 {
7143     CALL_TEST_DEBUG;
7144     auto pointerEvent = PointerEvent::Create();
7145     ASSERT_NE(pointerEvent, nullptr);
7146     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7147     uint32_t flag = 0x00000100;
7148     pointerEvent->bitwise_ |= flag;
7149     InputWindowsManager inputWindowsManager;
7150     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
7151 }
7152 
7153 /**
7154  * @tc.name: InputWindowsManagerTest_FoldScreenRotation_002
7155  * @tc.desc: Test if (iter == touchItemDownInfos_.end())
7156  * @tc.type: FUNC
7157  * @tc.require:
7158  */
7159 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_002, TestSize.Level1)
7160 {
7161     CALL_TEST_DEBUG;
7162     auto pointerEvent = PointerEvent::Create();
7163     ASSERT_NE(pointerEvent, nullptr);
7164     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7165     uint32_t flag = 0x00000100;
7166     pointerEvent->bitwise_ |= flag;
7167 
7168     InputWindowsManager inputWindowsManager;
7169     WindowInfoEX winInfoEx;
7170     inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(pointerEvent->GetPointerId(), winInfoEx));
7171 
7172     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
7173 }
7174 
7175 /**
7176  * @tc.name: InputWindowsManagerTest_GetWindowPid_002
7177  * @tc.desc: Test if (uiExtentionWindow.id == windowId)
7178  * @tc.type: FUNC
7179  * @tc.require:
7180  */
7181 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowPid_002, TestSize.Level1)
7182 {
7183     CALL_TEST_DEBUG;
7184     InputWindowsManager inputWindowsManager;
7185     int32_t windowId = 1;
7186     WindowInfo windowInfo1;
7187     windowInfo1.id = 2;
7188     WindowInfo windowInfo2;
7189     windowInfo2.id = 1;
7190     windowInfo1.uiExtentionWindowInfo.push_back(windowInfo2);
7191     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo1);
7192 
7193     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetWindowPid(windowId));
7194 }
7195 
7196 /**
7197  * @tc.name: InputWindowsManagerTest_GetWindowPid_003
7198  * @tc.desc: Test if (uiExtentionWindow.id == windowId)
7199  * @tc.type: FUNC
7200  * @tc.require:
7201  */
7202 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowPid_003, TestSize.Level1)
7203 {
7204     CALL_TEST_DEBUG;
7205     InputWindowsManager inputWindowsManager;
7206     int32_t windowId = 1;
7207     WindowInfo windowInfo1;
7208     windowInfo1.id = 2;
7209     WindowInfo windowInfo2;
7210     windowInfo2.id = 3;
7211     windowInfo1.uiExtentionWindowInfo.push_back(windowInfo2);
7212     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo1);
7213 
7214     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetWindowPid(windowId));
7215 }
7216 
7217 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH)
7218 /**
7219  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_001
7220  * @tc.desc: Test ShiftAppPointerEvent failed for sourceWindowInfo not exist
7221  * @tc.type: FUNC
7222  * @tc.require:
7223  */
7224 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_001, TestSize.Level1)
7225 {
7226     CALL_TEST_DEBUG;
7227     InputWindowsManager inputWindowsManager;
7228     inputWindowsManager.lastPointerEvent_ = nullptr;
7229     int32_t sourceWindowId = 50;
7230     int32_t targetWindowId = 51;
7231     ShiftWindowParam param {
7232 	.sourceWindowId = sourceWindowId,
7233 	.targetWindowId = targetWindowId,
7234     };
7235     bool autoGenDown = true;
7236     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7237     EXPECT_NE(pointerEvent, nullptr);
7238     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7239     PointerEvent::PointerItem item;
7240     item.SetPointerId(0);
7241     pointerEvent->SetPointerId(0);
7242     pointerEvent->AddPointerItem(item);
7243     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7244     EXPECT_NE(ret, RET_OK);
7245 }
7246 
7247 /**
7248  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_002
7249  * @tc.desc: Test ShiftAppPointerEvent failed for targetWindowInfo not exist
7250  * @tc.type: FUNC
7251  * @tc.require:
7252  */
7253 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_002, TestSize.Level1)
7254 {
7255     CALL_TEST_DEBUG;
7256     InputWindowsManager inputWindowsManager;
7257     inputWindowsManager.lastPointerEvent_ = nullptr;
7258     int32_t sourceWindowId = 50;
7259     int32_t targetWindowId = 51;
7260     ShiftWindowParam param {
7261 	.sourceWindowId = sourceWindowId,
7262 	.targetWindowId = targetWindowId,
7263     };
7264     bool autoGenDown = true;
7265     int32_t displayId = 0;
7266     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7267     EXPECT_NE(pointerEvent, nullptr);
7268     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7269     PointerEvent::PointerItem item;
7270     item.SetPointerId(0);
7271     pointerEvent->SetPointerId(0);
7272     pointerEvent->AddPointerItem(item);
7273     WindowGroupInfo windowGroupInfo;
7274     WindowInfo windowInfo;
7275     windowInfo.id = sourceWindowId;
7276     windowInfo.displayId = displayId;
7277     windowGroupInfo.windowsInfo.push_back(windowInfo);
7278     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
7279     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7280     EXPECT_NE(ret, RET_OK);
7281 }
7282 
7283 /**
7284  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_003
7285  * @tc.desc: Test ShiftAppPointerEvent failed for displayId invalid
7286  * @tc.type: FUNC
7287  * @tc.require:
7288  */
7289 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_003, TestSize.Level1)
7290 {
7291     CALL_TEST_DEBUG;
7292     InputWindowsManager inputWindowsManager;
7293     inputWindowsManager.lastPointerEvent_ = nullptr;
7294     int32_t sourceWindowId = 50;
7295     int32_t targetWindowId = 51;
7296     ShiftWindowParam param {
7297 	.sourceWindowId = sourceWindowId,
7298 	.targetWindowId = targetWindowId,
7299     };
7300     bool autoGenDown = true;
7301     int32_t displayId = -1;
7302     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7303     EXPECT_NE(pointerEvent, nullptr);
7304     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7305     PointerEvent::PointerItem item;
7306     item.SetPointerId(0);
7307     pointerEvent->SetPointerId(0);
7308     pointerEvent->AddPointerItem(item);
7309     WindowGroupInfo windowGroupInfo;
7310     WindowInfo windowInfo;
7311     windowInfo.id = sourceWindowId;
7312     windowInfo.displayId = displayId;
7313     windowGroupInfo.windowsInfo.push_back(windowInfo);
7314     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
7315     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7316     EXPECT_NE(ret, RET_OK);
7317 }
7318 
7319 /**
7320  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_004
7321  * @tc.desc: Test ShiftAppPointerEvent failed for sourceWindowId untouchtable
7322  * @tc.type: FUNC
7323  * @tc.require:
7324  */
7325 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_004, TestSize.Level1)
7326 {
7327     CALL_TEST_DEBUG;
7328     InputWindowsManager inputWindowsManager;
7329     inputWindowsManager.lastPointerEvent_ = nullptr;
7330     int32_t sourceWindowId = 50;
7331     int32_t targetWindowId = 51;
7332     ShiftWindowParam param {
7333 	.sourceWindowId = sourceWindowId,
7334 	.targetWindowId = targetWindowId,
7335     };
7336     bool autoGenDown = true;
7337     int32_t displayId = 0;
7338     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7339     EXPECT_NE(pointerEvent, nullptr);
7340     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7341     PointerEvent::PointerItem item;
7342     item.SetPointerId(0);
7343     pointerEvent->SetPointerId(0);
7344     pointerEvent->AddPointerItem(item);
7345     pointerEvent->SetButtonPressed(PointerEvent::MOUSE_BUTTON_LEFT);
7346     WindowGroupInfo windowGroupInfo;
7347     WindowInfo windowInfo;
7348     windowInfo.id = sourceWindowId;
7349     windowInfo.displayId = displayId;
7350     windowGroupInfo.windowsInfo.push_back(windowInfo);
7351     windowInfo.flags &= WindowInfo::FLAG_BIT_UNTOUCHABLE;
7352     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
7353     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7354     EXPECT_NE(ret, RET_OK);
7355 }
7356 
7357 /**
7358  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_005
7359  * @tc.desc: Test ShiftAppPointerEvent failed for sourceWindowId transparent
7360  * @tc.type: FUNC
7361  * @tc.require:
7362  */
7363 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_005, TestSize.Level1)
7364 {
7365     CALL_TEST_DEBUG;
7366     InputWindowsManager inputWindowsManager;
7367     inputWindowsManager.lastPointerEvent_ = nullptr;
7368     int32_t sourceWindowId = 50;
7369     int32_t targetWindowId = 51;
7370     ShiftWindowParam param {
7371 	.sourceWindowId = sourceWindowId,
7372 	.targetWindowId = targetWindowId,
7373     };
7374     bool autoGenDown = true;
7375     int32_t displayId = 0;
7376     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7377     EXPECT_NE(pointerEvent, nullptr);
7378     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7379     PointerEvent::PointerItem item;
7380     item.SetPointerId(0);
7381     pointerEvent->SetPointerId(0);
7382     pointerEvent->AddPointerItem(item);
7383     pointerEvent->SetButtonPressed(PointerEvent::MOUSE_BUTTON_LEFT);
7384     WindowGroupInfo windowGroupInfo;
7385     WindowInfo windowInfo;
7386     windowInfo.id = sourceWindowId;
7387     windowInfo.displayId = displayId;
7388     windowGroupInfo.windowsInfo.push_back(windowInfo);
7389     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
7390     inputWindowsManager.transparentWins_[sourceWindowId];
7391     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7392     EXPECT_NE(ret, RET_OK);
7393 }
7394 
7395 /**
7396  * @tc.name: InputWindowsManagerTest_ShiftAppPointerEvent_006
7397  * @tc.desc: Test ShiftAppPointerEvent failed for null lastPointerEvent_
7398  * @tc.type: FUNC
7399  * @tc.require:
7400  */
7401 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_006, TestSize.Level1)
7402 {
7403     CALL_TEST_DEBUG;
7404     InputWindowsManager inputWindowsManager;
7405     inputWindowsManager.lastPointerEvent_ = nullptr;
7406     int32_t sourceWindowId = 50;
7407     int32_t targetWindowId = 51;
7408     ShiftWindowParam param {
7409 	.sourceWindowId = sourceWindowId,
7410 	.targetWindowId = targetWindowId,
7411     };
7412     bool autoGenDown = true;
7413     int32_t displayId = 0;
7414     WindowGroupInfo windowGroupInfo;
7415     WindowInfo windowInfo;
7416     windowInfo.id = sourceWindowId;
7417     windowInfo.displayId = displayId;
7418     windowGroupInfo.windowsInfo.push_back(windowInfo);
7419     windowInfo.id = targetWindowId;
7420     windowGroupInfo.windowsInfo.push_back(windowInfo);
7421     inputWindowsManager.windowsPerDisplay_.insert(std::make_pair(displayId, windowGroupInfo));
7422     int32_t ret = inputWindowsManager.ShiftAppPointerEvent(param, autoGenDown);
7423     EXPECT_NE(ret, RET_OK);
7424 }
7425 
7426 /**
7427  * @tc.name: InputWindowsManagerTest_ResetPointerPositionIfOutValidDisplay_001
7428  * @tc.desc: Test if (isOut && isChange)
7429  * @tc.type: FUNC
7430  * @tc.require:
7431  */
7432 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetPointerPositionIfOutValidDisplay_001, TestSize.Level1)
7433 {
7434     CALL_TEST_DEBUG;
7435     DisplayGroupInfo displayGroupInfo;
7436     DisplayInfo displayInfo;
7437     displayInfo.id = 1;
7438     displayInfo.width = 1920;
7439     displayInfo.height = 1080;
7440     displayGroupInfo.displaysInfo.push_back(displayInfo);
7441 
7442     InputWindowsManager inputWindowsManager;
7443     inputWindowsManager.cursorPos_.displayId = 1;
7444     inputWindowsManager.cursorPos_.cursorPos.x = -1;
7445     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
7446 
7447     // isOut = true, isChange = false
7448     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ResetPointerPositionIfOutValidDisplay(displayGroupInfo));
7449 
7450     displayGroupInfo.displaysInfo.clear();
7451     displayInfo.offsetX = 1;
7452     displayGroupInfo.displaysInfo.push_back(displayInfo);
7453     // isOut = true, isChange = true
7454     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ResetPointerPositionIfOutValidDisplay(displayGroupInfo));
7455 
7456     inputWindowsManager.cursorPos_.cursorPos.x = 10;
7457     inputWindowsManager.cursorPos_.cursorPos.y = 10;
7458     displayGroupInfo.displaysInfo.clear();
7459     displayInfo.validWidth = 11;
7460     displayInfo.validHeight = 11;
7461     displayGroupInfo.displaysInfo.push_back(displayInfo);
7462     // isOut = false, isChange = true
7463     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ResetPointerPositionIfOutValidDisplay(displayGroupInfo));
7464 
7465     displayGroupInfo.displaysInfo.clear();
7466     displayInfo.offsetX = 0;
7467     displayGroupInfo.displaysInfo.push_back(displayInfo);
7468     inputWindowsManager.displayGroupInfo_.displaysInfo.clear();
7469     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
7470     // isOut = false, isChange = false
7471     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ResetPointerPositionIfOutValidDisplay(displayGroupInfo));
7472 }
7473 
7474 /**
7475  * @tc.name: InputWindowsManagerTest_IsPositionOutValidDisplay_001
7476  * @tc.desc: Test if (!isOut && isPhysicalPos)
7477  * @tc.type: FUNC
7478  * @tc.require:
7479  */
7480 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsPositionOutValidDisplay_001, TestSize.Level1)
7481 {
7482     CALL_TEST_DEBUG;
7483     DisplayInfo displayInfo;
7484     displayInfo.id = 1;
7485     displayInfo.width = 1;
7486     displayInfo.height = 1;
7487 
7488     Coordinate2D position;
7489     position.x = -1;
7490 
7491     // isOut = true, isChange = false
7492     bool isPhysicalPos = false;
7493     InputWindowsManager inputWindowsManager;
7494     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.IsPositionOutValidDisplay(position, displayInfo, isPhysicalPos));
7495 
7496     position.x = 1;
7497     position.y = 1;
7498     displayInfo.validWidth = 1;
7499     displayInfo.validHeight = 1;
7500     // isOut = false, isChange = true, currentDisplay.fixedDirection = DIRECTION0
7501     isPhysicalPos = true;
7502     displayInfo.fixedDirection = DIRECTION0;
7503     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.IsPositionOutValidDisplay(position, displayInfo, isPhysicalPos));
7504 
7505     displayInfo.fixedDirection = DIRECTION90;
7506     // isOut = false, isChange = true, currentDisplay.fixedDirection = DIRECTION90
7507     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.IsPositionOutValidDisplay(position, displayInfo, isPhysicalPos));
7508 
7509     displayInfo.fixedDirection = DIRECTION180;
7510     // isOut = false, isChange = true, currentDisplay.fixedDirection = DIRECTION180
7511     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.IsPositionOutValidDisplay(position, displayInfo, isPhysicalPos));
7512 
7513     displayInfo.fixedDirection = DIRECTION270;
7514     // isOut = false, isChange = true, currentDisplay.fixedDirection = DIRECTION270
7515     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.IsPositionOutValidDisplay(position, displayInfo, isPhysicalPos));
7516 }
7517 
7518 /**
7519  * @tc.name: InputWindowsManagerTest_CancelTouchScreenEventIfValidDisplayChange_001
7520  * @tc.desc: Test if (lastPointerEventforGesture_->GetSourceType() != PointerEvent::SOURCE_TYPE_TOUCHSCREEN)
7521  * @tc.type: FUNC
7522  * @tc.require:
7523  */
7524 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEventIfValidDisplayChange_001,
7525     TestSize.Level1)
7526 {
7527     CALL_TEST_DEBUG;
7528     DisplayInfo displayInfo;
7529     displayInfo.id = 1;
7530     DisplayGroupInfo displayGroupInfo;
7531     displayGroupInfo.displaysInfo.push_back(displayInfo);
7532 
7533     InputWindowsManager inputWindowsManager;
7534     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7535     EXPECT_NE(pointerEvent, nullptr);
7536     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7537     inputWindowsManager.lastPointerEventforGesture_ = pointerEvent;
7538     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7539 
7540     inputWindowsManager.lastPointerEventforGesture_->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
7541     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7542 }
7543 
7544 /**
7545  * @tc.name: InputWindowsManagerTest_CancelTouchScreenEventIfValidDisplayChange_002
7546  * @tc.desc: Test if (touchDisplayId == currentDisplay.id && IsValidDisplayChange(currentDisplay))
7547  * @tc.type: FUNC
7548  * @tc.require:
7549  */
7550 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEventIfValidDisplayChange_002,
7551     TestSize.Level1)
7552 {
7553     CALL_TEST_DEBUG;
7554     DisplayInfo displayInfo;
7555     displayInfo.id = 1;
7556     DisplayGroupInfo displayGroupInfo;
7557     displayGroupInfo.displaysInfo.push_back(displayInfo);
7558 
7559     InputWindowsManager inputWindowsManager;
7560     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7561     EXPECT_NE(pointerEvent, nullptr);
7562     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7563     inputWindowsManager.lastPointerEventforGesture_ = pointerEvent;
7564     inputWindowsManager.lastPointerEventforGesture_->SetTargetDisplayId(displayInfo.id);
7565     inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
7566     // true false
7567     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7568 
7569     // false false
7570     inputWindowsManager.lastPointerEventforGesture_->SetTargetDisplayId(0);
7571     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7572 
7573     // false true
7574     displayGroupInfo.displaysInfo.clear();
7575     displayInfo.offsetX = 1;
7576     displayGroupInfo.displaysInfo.push_back(displayInfo);
7577     inputWindowsManager.lastPointerEventforGesture_->SetTargetDisplayId(0);
7578     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7579 
7580     // true true
7581     inputWindowsManager.lastPointerEventforGesture_->SetTargetDisplayId(displayInfo.id);
7582     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo));
7583 }
7584 
7585 /**
7586  * @tc.name: InputWindowsManagerTest_CancelMouseEvent_001
7587  * @tc.desc: Test if (lastPointerEvent_ == nullptr)
7588  * @tc.type: FUNC
7589  * @tc.require:
7590  */
7591 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelMouseEvent_001, TestSize.Level1)
7592 {
7593     CALL_TEST_DEBUG;
7594     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7595     EXPECT_NE(pointerEvent, nullptr);
7596 
7597     InputWindowsManager inputWindowsManager;
7598     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7599     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7600 
7601     inputWindowsManager.lastPointerEvent_ = nullptr;
7602     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7603 }
7604 
7605 /**
7606  * @tc.name: InputWindowsManagerTest_CancelMouseEvent_002
7607  * @tc.desc: Test if (lastPointerEvent_->GetSourceType() == PointerEvent::SOURCE_TYPE_MOUSE &&
7608              !lastPointerEvent_->GetPressedButtons().empty())
7609  * @tc.type: FUNC
7610  * @tc.require:
7611  */
7612 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelMouseEvent_002, TestSize.Level1)
7613 {
7614     CALL_TEST_DEBUG;
7615     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7616     EXPECT_NE(pointerEvent, nullptr);
7617 
7618     InputWindowsManager inputWindowsManager;
7619     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7620     // true false
7621     inputWindowsManager.lastPointerEvent_->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
7622     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7623 
7624     // true true
7625     inputWindowsManager.lastPointerEvent_->pressedButtons_.insert(0);
7626     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7627 
7628     // false true
7629     inputWindowsManager.lastPointerEvent_->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7630     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7631 
7632     // false false
7633     inputWindowsManager.lastPointerEvent_->pressedButtons_.clear();
7634     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelMouseEvent());
7635 }
7636 
7637 /**
7638  * @tc.name: InputWindowsManagerTest_UpdatePointerDrawingManagerWindowInfo_001
7639  * @tc.desc: Test if (lastPointerEvent_->GetPointerAction() != PointerEvent::POINTER_ACTION_DOWN &&
7640         (lastPointerEvent_->GetPointerAction() == PointerEvent::POINTER_ACTION_BUTTON_UP ||
7641         lastPointerEvent_->GetPointerAction() == PointerEvent::POINTER_ACTION_PULL_UP ||
7642         lastPointerEvent_->GetPressedButtons().empty()))
7643  * @tc.type: FUNC
7644  * @tc.require:
7645  */
7646 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingManagerWindowInfo_001, TestSize.Level1)
7647 {
7648     CALL_TEST_DEBUG;
7649     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7650     EXPECT_NE(pointerEvent, nullptr);
7651 
7652     InputWindowsManager inputWindowsManager;
7653     inputWindowsManager.lastPointerEvent_ = pointerEvent;
7654     // true false
7655     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_UP);
7656     inputWindowsManager.lastPointerEvent_->pressedButtons_.insert(0);
7657     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7658 
7659     // true true
7660     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
7661     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7662     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
7663     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7664     inputWindowsManager.lastPointerEvent_->pressedButtons_.clear();
7665     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7666 
7667     // false true
7668     inputWindowsManager.lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
7669     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7670 
7671     // false false
7672     inputWindowsManager.lastPointerEvent_->pressedButtons_.insert(0);
7673     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerDrawingManagerWindowInfo());
7674 }
7675 
7676 /**
7677  * @tc.name: InputWindowsManagerTest_PrintHighZorder_001
7678  * @tc.desc: Test if (!info)
7679  * @tc.type: FUNC
7680  * @tc.require:
7681  */
7682 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintHighZorder_001, TestSize.Level1)
7683 {
7684     CALL_TEST_DEBUG;
7685     WindowInfo windowInfo;
7686     windowInfo.id = 0;
7687     windowInfo.flags = 2;;
7688     WindowGroupInfo windowGroupInfo;
7689     windowGroupInfo.displayId = 0;
7690     windowGroupInfo.windowsInfo.push_back(windowInfo);
7691 
7692     InputWindowsManager inputWindowsManager;
7693     inputWindowsManager.windowsPerDisplay_[0] = windowGroupInfo;
7694     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7695         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7696 
7697     inputWindowsManager.windowsPerDisplay_.clear();
7698     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7699         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7700 }
7701 
7702 /**
7703  * @tc.name: InputWindowsManagerTest_PrintHighZorder_002
7704  * @tc.desc: Test if (MMI_GNE(windowInfo.zOrder, targetWindow.zOrder) && !windowInfo.flags &&
7705             pointerAction == PointerEvent::POINTER_ACTION_AXIS_BEGIN &&
7706             windowInfo.windowInputType != WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE &&
7707             windowInfo.windowInputType != WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE &&
7708             windowInfo.windowInputType != WindowInputType::TRANSMIT_ALL)
7709  * @tc.type: FUNC
7710  * @tc.require:
7711  */
7712 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintHighZorder_002, TestSize.Level1)
7713 {
7714     CALL_TEST_DEBUG;
7715     WindowInfo windowInfo;
7716     windowInfo.id = 0;
7717     windowInfo.flags = 2;
7718     windowInfo.zOrder = 1;
7719     WindowGroupInfo windowGroupInfo;
7720     windowGroupInfo.displayId = 0;
7721     windowGroupInfo.windowsInfo.push_back(windowInfo);
7722 
7723     InputWindowsManager inputWindowsManager;
7724     inputWindowsManager.windowsPerDisplay_[0] = windowGroupInfo;
7725 
7726     windowGroupInfo.windowsInfo.clear();
7727     windowInfo.flags = 0;
7728     windowInfo.zOrder = 10;
7729     windowInfo.windowInputType = WindowInputType::NORMAL;
7730     windowGroupInfo.windowsInfo.push_back(windowInfo);
7731     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7732         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7733 
7734     windowGroupInfo.windowsInfo.clear();
7735     windowInfo.windowInputType = WindowInputType::TRANSMIT_ALL;
7736     windowGroupInfo.windowsInfo.push_back(windowInfo);
7737     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7738         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7739 
7740     windowGroupInfo.windowsInfo.clear();
7741     windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
7742     windowGroupInfo.windowsInfo.push_back(windowInfo);
7743     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7744         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7745 
7746     windowGroupInfo.windowsInfo.clear();
7747     windowInfo.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
7748     windowGroupInfo.windowsInfo.push_back(windowInfo);
7749     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7750         PointerEvent::POINTER_ACTION_AXIS_BEGIN, windowInfo.id, 0, 0));
7751 
7752     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7753         PointerEvent::POINTER_ACTION_AXIS_UPDATE, windowInfo.id, 0, 0));
7754 
7755     windowGroupInfo.windowsInfo.clear();
7756     windowInfo.flags = 2;
7757     windowGroupInfo.windowsInfo.push_back(windowInfo);
7758     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7759         PointerEvent::POINTER_ACTION_AXIS_UPDATE, windowInfo.id, 0, 0));
7760 }
7761 
7762 /**
7763  * @tc.name: InputWindowsManagerTest_PrintHighZorder_003
7764  * @tc.desc: Test if (MMI_GNE(windowInfo.zOrder, targetWindow.zOrder) && !windowInfo.flags &&
7765             pointerAction == PointerEvent::POINTER_ACTION_AXIS_BEGIN &&
7766             windowInfo.windowInputType != WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE &&
7767             windowInfo.windowInputType != WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE &&
7768             windowInfo.windowInputType != WindowInputType::TRANSMIT_ALL)
7769  * @tc.type: FUNC
7770  * @tc.require:
7771  */
7772 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintHighZorder_003, TestSize.Level1)
7773 {
7774     CALL_TEST_DEBUG;
7775     WindowInfo windowInfo;
7776     windowInfo.id = 0;
7777     windowInfo.flags = 2;
7778     windowInfo.zOrder = 1;
7779     WindowGroupInfo windowGroupInfo;
7780     windowGroupInfo.displayId = 0;
7781     windowGroupInfo.windowsInfo.push_back(windowInfo);
7782 
7783     InputWindowsManager inputWindowsManager;
7784     inputWindowsManager.windowsPerDisplay_[0] = windowGroupInfo;
7785 
7786     windowGroupInfo.windowsInfo.clear();
7787     windowInfo.zOrder = 0;
7788     windowGroupInfo.windowsInfo.push_back(windowInfo);
7789     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.PrintHighZorder(windowGroupInfo.windowsInfo,
7790         PointerEvent::POINTER_ACTION_AXIS_UPDATE, windowInfo.id, 0, 0));
7791 }
7792 
7793 /**
7794  * @tc.name: InputWindowsManagerTest_UpdateCustomStyle_001
7795  * @tc.desc: Test if (pointerStyle.id != MOUSE_ICON::DEVELOPER_DEFINED_ICON
7796  * @tc.type: FUNC
7797  * @tc.require:
7798  */
7799 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCustomStyle_001, TestSize.Level1)
7800 {
7801     CALL_TEST_DEBUG;
7802     int32_t windowId = 0;
7803     PointerStyle pointerStyle;
7804     pointerStyle.id = MOUSE_ICON::DEVELOPER_DEFINED_ICON;
7805     InputWindowsManager inputWindowsManager;
7806     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCustomStyle(windowId, pointerStyle));
7807 
7808     pointerStyle.id = MOUSE_ICON::TRANSPARENT_ICON;
7809     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCustomStyle(windowId, pointerStyle));
7810 }
7811 
7812 /**
7813  * @tc.name: InputWindowsManagerTest_UpdateCustomStyle_002
7814  * @tc.desc: Test if (innerIt.first != windowId && innerIt.second.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON)
7815  * @tc.type: FUNC
7816  * @tc.require:
7817  */
7818 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCustomStyle_002, TestSize.Level1)
7819 {
7820     CALL_TEST_DEBUG;
7821     int32_t windowId = 0;
7822     PointerStyle pointerStyle;
7823     pointerStyle.id = MOUSE_ICON::DEVELOPER_DEFINED_ICON;
7824 
7825     std::map<int32_t, PointerStyle> pointerStyles;
7826     pointerStyles[1] = pointerStyle;
7827 
7828     InputWindowsManager inputWindowsManager;
7829     inputWindowsManager.pointerStyle_[0] = pointerStyles;
7830     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCustomStyle(windowId, pointerStyle));
7831 
7832     windowId = 1;
7833     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCustomStyle(windowId, pointerStyle));
7834 
7835     windowId = 0;
7836     PointerStyle pointerStyle1;
7837     pointerStyle1.id = MOUSE_ICON::TRANSPARENT_ICON;
7838     pointerStyles[1] = pointerStyle1;
7839     inputWindowsManager.pointerStyle_[0] = pointerStyles;
7840     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateCustomStyle(windowId, pointerStyle));
7841 }
7842 
7843 #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE
7844 /**
7845  * @tc.name: InputWindowsManagerTest_UpdatePointerItemInOneHandMode_001
7846  * @tc.desc: Test if (pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SIMULATE))
7847  * @tc.type: FUNC
7848  * @tc.require:
7849  */
7850 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOneHandMode_001, TestSize.Level1)
7851 {
7852     CALL_TEST_DEBUG;
7853     InputWindowsManager inputWindowsManager;
7854     DisplayInfo displayInfo;
7855     displayInfo.oneHandY = 10;
7856     displayInfo.height = 11;
7857 
7858     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7859     EXPECT_NE(pointerEvent, nullptr);
7860     PointerEvent::PointerItem pointerItem;
7861     pointerItem.SetPointerId(0);
7862     pointerEvent->AddPointerItem(pointerItem);
7863     pointerEvent->SetPointerId(0);
7864     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerItemInOneHandMode(displayInfo, pointerEvent));
7865 
7866     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
7867     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerItemInOneHandMode(displayInfo, pointerEvent));
7868 }
7869 
7870 /**
7871  * @tc.name: InputWindowsManagerTest_UpdatePointerItemInOneHandMode_002
7872  * @tc.desc: Test if (autoToVirtualScreen)
7873  * @tc.type: FUNC
7874  * @tc.require:
7875  */
7876 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOneHandMode_002, TestSize.Level1)
7877 {
7878     CALL_TEST_DEBUG;
7879     InputWindowsManager inputWindowsManager;
7880     DisplayInfo displayInfo;
7881     displayInfo.oneHandY = 10;
7882     displayInfo.height = 11;
7883 
7884     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7885     EXPECT_NE(pointerEvent, nullptr);
7886     PointerEvent::PointerItem pointerItem;
7887     pointerItem.SetPointerId(0);
7888     pointerEvent->AddPointerItem(pointerItem);
7889     pointerEvent->SetPointerId(0);
7890     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
7891     pointerEvent->SetAutoToVirtualScreen(true);
7892     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerItemInOneHandMode(displayInfo, pointerEvent));
7893 
7894     pointerEvent->SetAutoToVirtualScreen(false);
7895     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerItemInOneHandMode(displayInfo, pointerEvent));
7896 }
7897 #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE
7898 
7899 /**
7900  * @tc.name: InputWindowsManagerTest_ShiftAppMousePointerEvent_001
7901  * @tc.desc: Test if (!lastPointerEvent_ || !lastPointerEvent_->IsButtonPressed(PointerEvent::MOUSE_BUTTON_LEFT))
7902  * @tc.type: FUNC
7903  * @tc.require:
7904  */
7905 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppMousePointerEvent_001, TestSize.Level1)
7906 {
7907     CALL_TEST_DEBUG;
7908     InputWindowsManager inputWindowsManager;
7909     inputWindowsManager.lastPointerEvent_ = nullptr;
7910     ShiftWindowInfo shiftWindowInfo;
7911     bool autoGenDown = false;
7912     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ShiftAppMousePointerEvent(shiftWindowInfo, autoGenDown));
7913 
7914     inputWindowsManager.lastPointerEvent_ = PointerEvent::Create();
7915     EXPECT_NE(inputWindowsManager.lastPointerEvent_, nullptr);
7916     inputWindowsManager.lastPointerEvent_->SetButtonPressed(PointerEvent::MOUSE_BUTTON_RIGHT);
7917     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.ShiftAppMousePointerEvent(shiftWindowInfo, autoGenDown));
7918 }
7919 
7920 /**
7921  * @tc.name: InputWindowsManagerTest_CancelTouch_001
7922  * @tc.desc: Test if ((iter != touchItemDownInfos_.end()) && iter->second.flag)
7923  * @tc.type: FUNC
7924  * @tc.require:
7925  */
7926 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouch_001, TestSize.Level1)
7927 {
7928     CALL_TEST_DEBUG;
7929     InputWindowsManager inputWindowsManager;
7930     int32_t touch = 0;
7931     WindowInfoEX windowInfoEX;
7932     windowInfoEX.flag = true;
7933     inputWindowsManager.touchItemDownInfos_[0] = windowInfoEX;
7934     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouch(touch));
7935 
7936     windowInfoEX.flag = false;
7937     inputWindowsManager.touchItemDownInfos_[0] = windowInfoEX;
7938     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouch(touch));
7939 
7940     touch = 1;
7941     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelTouch(touch));
7942 }
7943 
7944 /**
7945  * @tc.name: InputWindowsManagerTest_CancelAllTouches_001
7946  * @tc.desc: Test if (!item.IsPressed())
7947  * @tc.type: FUNC
7948  * @tc.require:
7949  */
7950 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelAllTouches_001, TestSize.Level1)
7951 {
7952     CALL_TEST_DEBUG;
7953     InputWindowsManager inputWindowsManager;
7954     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7955     EXPECT_NE(pointerEvent, nullptr);
7956     PointerEvent::PointerItem pointerItem;
7957     pointerItem.SetPointerId(0);
7958     pointerItem.SetPressed(false);
7959     pointerEvent->AddPointerItem(pointerItem);
7960     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelAllTouches(pointerEvent));
7961 }
7962 
7963 /**
7964  * @tc.name: InputWindowsManagerTest_CancelAllTouches_002
7965  * @tc.desc: Test if (AdjustFingerFlag(pointerEvent))
7966  * @tc.type: FUNC
7967  * @tc.require:
7968  */
7969 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelAllTouches_002, TestSize.Level1)
7970 {
7971     CALL_TEST_DEBUG;
7972     InputWindowsManager inputWindowsManager;
7973     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
7974     EXPECT_NE(pointerEvent, nullptr);
7975     PointerEvent::PointerItem pointerItem;
7976     pointerItem.SetPointerId(0);
7977     pointerItem.SetPressed(true);
7978     pointerEvent->AddPointerItem(pointerItem);
7979     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
7980 
7981     WindowInfoEX windowInfoEX;
7982     windowInfoEX.flag = false;
7983     inputWindowsManager.touchItemDownInfos_[0] = windowInfoEX;
7984     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelAllTouches(pointerEvent));
7985 
7986     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
7987     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelAllTouches(pointerEvent));
7988 }
7989 
7990 /**
7991  * @tc.name: InputWindowsManagerTest_CancelAllTouches_003
7992  * @tc.desc: Test if (winOpt)
7993  * @tc.type: FUNC
7994  * @tc.require:
7995  */
7996 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelAllTouches_003, TestSize.Level1)
7997 {
7998     CALL_TEST_DEBUG;
7999     InputWindowsManager inputWindowsManager;
8000     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
8001     EXPECT_NE(pointerEvent, nullptr);
8002     PointerEvent::PointerItem pointerItem;
8003     pointerItem.SetPointerId(0);
8004     pointerItem.SetPressed(true);
8005     pointerItem.SetTargetWindowId(0);
8006     pointerEvent->AddPointerItem(pointerItem);
8007     pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD);
8008     pointerEvent->SetTargetDisplayId(-1);
8009 
8010     WindowInfo windowInfo;
8011     windowInfo.id = 0;
8012     inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(windowInfo);
8013     EXPECT_NO_FATAL_FAILURE(inputWindowsManager.CancelAllTouches(pointerEvent));
8014 }
8015 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH
8016 } // namespace MMI
8017 } // namespace OHOS
8018