1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 #include <linux/input.h>
19
20 #include "input_windows_manager.h"
21 #include "mmi_matrix3.h"
22 #include "mock.h"
23 #include "window_info.h"
24
25 namespace OHOS {
26 namespace MMI {
27 namespace {
28 using namespace testing::ext;
29 using namespace testing;
30 const std::string PROGRAM_NAME = "uds_session_test";
31 constexpr int32_t MODULE_TYPE = 1;
32 constexpr int32_t UDS_FD = 1;
33 constexpr int32_t UDS_UID = 100;
34 constexpr int32_t UDS_PID = 100;
35 } // namespace
36
37 class InputWindowsManagerTest : public testing::Test {
38 public:
39 static void SetUpTestCase(void);
40 static void TearDownTestCase();
SetUp()41 void SetUp() {}
TearDown()42 void TearDown() {}
43
44 static inline std::shared_ptr<MessageParcelMock> messageParcelMock_ = nullptr;
45 };
46
SetUpTestCase(void)47 void InputWindowsManagerTest::SetUpTestCase(void)
48 {
49 messageParcelMock_ = std::make_shared<MessageParcelMock>();
50 MessageParcelMock::messageParcel = messageParcelMock_;
51 }
TearDownTestCase()52 void InputWindowsManagerTest::TearDownTestCase()
53 {
54 IInputWindowsManager::instance_.reset();
55 IInputWindowsManager::instance_ = nullptr;
56 MessageParcelMock::messageParcel = nullptr;
57 messageParcelMock_ = nullptr;
58 }
59
60 #ifdef OHOS_BUILD_ENABLE_KEYBOARD
61 /**
62 * @tc.name: UpdateTarget_001
63 * @tc.desc: Test the function UpdateTarget
64 * @tc.type: FUNC
65 * @tc.require:
66 */
67 HWTEST_F(InputWindowsManagerTest, UpdateTarget_001, TestSize.Level1)
68 {
69 CALL_TEST_DEBUG;
70 std::shared_ptr<InputWindowsManager> inputWindowsManager =
71 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
72 ASSERT_NE(inputWindowsManager, nullptr);
73 std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
74 ASSERT_NE(keyEvent, nullptr);
75 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
76 }
77
78 /**
79 * @tc.name: UpdateTarget_002
80 * @tc.desc: Test the function UpdateTarget
81 * @tc.type: FUNC
82 * @tc.require:
83 */
84 HWTEST_F(InputWindowsManagerTest, UpdateTarget_002, TestSize.Level1)
85 {
86 CALL_TEST_DEBUG;
87 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(-1));
88 std::shared_ptr<InputWindowsManager> inputWindowsManager =
89 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
90 ASSERT_NE(inputWindowsManager, nullptr);
91 UDSServer udsServer;
92 inputWindowsManager->udsServer_ = &udsServer;
93 inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
94 WindowInfo windowInfo;
95 windowInfo.id = 1;
96 windowInfo.pid = 11;
97 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
98 std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
99 ASSERT_NE(keyEvent, nullptr);
100 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
101 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
102 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
103 inputWindowsManager->udsServer_ = nullptr;
104 }
105
106 /**
107 * @tc.name: UpdateTarget_003
108 * @tc.desc: Test the function UpdateTarget
109 * @tc.type: FUNC
110 * @tc.require:
111 */
112 HWTEST_F(InputWindowsManagerTest, UpdateTarget_003, TestSize.Level1)
113 {
114 CALL_TEST_DEBUG;
115 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
116 std::shared_ptr<InputWindowsManager> inputWindowsManager =
117 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
118 ASSERT_NE(inputWindowsManager, nullptr);
119 UDSServer udsServer;
120 inputWindowsManager->udsServer_ = &udsServer;
121 inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
122 WindowInfo windowInfo;
123 windowInfo.id = 1;
124 windowInfo.pid = 11;
125 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
126 std::shared_ptr<KeyEvent> keyEvent = KeyEvent::Create();
127 ASSERT_NE(keyEvent, nullptr);
128 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTarget(keyEvent));
129 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
130 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
131 inputWindowsManager->udsServer_ = nullptr;
132 }
133 #endif // OHOS_BUILD_ENABLE_KEYBOARD
134
135 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING)
136 /**
137 * @tc.name: PointerDrawingManagerOnDisplayInfo_001
138 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
139 * @tc.type: FUNC
140 * @tc.require:
141 */
142 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_001, TestSize.Level1)
143 {
144 CALL_TEST_DEBUG;
145 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(false));
146 std::shared_ptr<InputWindowsManager> inputWindowsManager =
147 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
148 ASSERT_NE(inputWindowsManager, nullptr);
149 DisplayGroupInfo displayGroupInfo;
150 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
151 }
152
153 /**
154 * @tc.name: PointerDrawingManagerOnDisplayInfo_002
155 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
156 * @tc.type: FUNC
157 * @tc.require:
158 */
159 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_002, TestSize.Level1)
160 {
161 CALL_TEST_DEBUG;
162 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
163 std::shared_ptr<InputWindowsManager> inputWindowsManager =
164 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
165 ASSERT_NE(inputWindowsManager, nullptr);
166 DisplayInfo displayInfo;
167 displayInfo.id = 0;
168 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
169 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
170 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
171 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
172 DisplayGroupInfo displayGroupInfo;
173 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
174 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
175 inputWindowsManager->lastPointerEvent_.reset();
176 inputWindowsManager->lastPointerEvent_ = nullptr;
177 }
178
179 /**
180 * @tc.name: PointerDrawingManagerOnDisplayInfo_003
181 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
182 * @tc.type: FUNC
183 * @tc.require:
184 */
185 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_003, TestSize.Level1)
186 {
187 CALL_TEST_DEBUG;
188 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
189 std::shared_ptr<InputWindowsManager> inputWindowsManager =
190 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
191 ASSERT_NE(inputWindowsManager, nullptr);
192 DisplayInfo displayInfo;
193 displayInfo.id = 0;
194 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
195 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
196 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
197 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
198 inputWindowsManager->lastPointerEvent_->SetButtonPressed(1);
199 DisplayGroupInfo displayGroupInfo;
200 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
201 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
202 inputWindowsManager->lastPointerEvent_.reset();
203 inputWindowsManager->lastPointerEvent_ = nullptr;
204 }
205
206 /**
207 * @tc.name: PointerDrawingManagerOnDisplayInfo_004
208 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
209 * @tc.type: FUNC
210 * @tc.require:
211 */
212 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_004, TestSize.Level1)
213 {
214 CALL_TEST_DEBUG;
215 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
216 std::shared_ptr<InputWindowsManager> inputWindowsManager =
217 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
218 ASSERT_NE(inputWindowsManager, nullptr);
219 DisplayInfo displayInfo;
220 displayInfo.id = 0;
221 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
222 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
223 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
224 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
225 DisplayGroupInfo displayGroupInfo;
226 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
227 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
228 inputWindowsManager->lastPointerEvent_.reset();
229 inputWindowsManager->lastPointerEvent_ = nullptr;
230 }
231
232 /**
233 * @tc.name: PointerDrawingManagerOnDisplayInfo_005
234 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
235 * @tc.type: FUNC
236 * @tc.require:
237 */
238 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_005, TestSize.Level1)
239 {
240 CALL_TEST_DEBUG;
241 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
242 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
243 std::shared_ptr<InputWindowsManager> inputWindowsManager =
244 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
245 ASSERT_NE(inputWindowsManager, nullptr);
246 DisplayInfo displayInfo;
247 displayInfo.id = 0;
248 displayInfo.x = 8;
249 displayInfo.y = 8;
250 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
251 WindowInfo windowInfo;
252 windowInfo.id = 1;
253 windowInfo.pid = 11;
254 windowInfo.transform.push_back(1.1);
255 Rect rect;
256 rect.x = 5;
257 rect.y = 5;
258 rect.width = 10;
259 rect.height = 10;
260 windowInfo.pointerHotAreas.push_back(rect);
261 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
262 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
263 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
264 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
265 DisplayGroupInfo displayGroupInfo;
266 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
267 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
268 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
269 inputWindowsManager->lastPointerEvent_.reset();
270 inputWindowsManager->lastPointerEvent_ = nullptr;
271 }
272
273 /**
274 * @tc.name: PointerDrawingManagerOnDisplayInfo_006
275 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
276 * @tc.type: FUNC
277 * @tc.require:
278 */
279 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_006, TestSize.Level1)
280 {
281 CALL_TEST_DEBUG;
282 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
283 std::shared_ptr<InputWindowsManager> inputWindowsManager =
284 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
285 ASSERT_NE(inputWindowsManager, nullptr);
286 DisplayInfo displayInfo;
287 displayInfo.id = 0;
288 displayInfo.x = 8;
289 displayInfo.y = 8;
290 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
291 WindowInfo windowInfo;
292 windowInfo.id = 1;
293 windowInfo.pid = 11;
294 windowInfo.transform.push_back(1.1);
295 Rect rect;
296 rect.x = 5;
297 rect.y = 5;
298 rect.width = 10;
299 rect.height = 10;
300 windowInfo.pointerHotAreas.push_back(rect);
301 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
302 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
303 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
304 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
305 inputWindowsManager->isDragBorder_ = true;
306 inputWindowsManager->dragFlag_ = true;
307 DisplayGroupInfo displayGroupInfo;
308 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
309 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
310 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
311 inputWindowsManager->lastPointerEvent_.reset();
312 inputWindowsManager->lastPointerEvent_ = nullptr;
313 inputWindowsManager->isDragBorder_ = false;
314 inputWindowsManager->dragFlag_ = false;
315 }
316
317 /**
318 * @tc.name: PointerDrawingManagerOnDisplayInfo_007
319 * @tc.desc: Test the function PointerDrawingManagerOnDisplayInfo
320 * @tc.type: FUNC
321 * @tc.require:
322 */
323 HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_007, TestSize.Level1)
324 {
325 CALL_TEST_DEBUG;
326 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillOnce(Return(true));
327 std::shared_ptr<InputWindowsManager> inputWindowsManager =
328 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
329 ASSERT_NE(inputWindowsManager, nullptr);
330 DisplayInfo displayInfo;
331 displayInfo.id = 0;
332 displayInfo.x = 8;
333 displayInfo.y = 8;
334 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
335 WindowInfo windowInfo;
336 windowInfo.id = 1;
337 windowInfo.pid = 11;
338 windowInfo.transform.push_back(1.1);
339 Rect rect;
340 rect.x = 5;
341 rect.y = 5;
342 rect.width = 10;
343 rect.height = 10;
344 windowInfo.pointerHotAreas.push_back(rect);
345 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
346 inputWindowsManager->lastPointerEvent_ = PointerEvent::Create();
347 ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr);
348 inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
349 inputWindowsManager->isDragBorder_ = true;
350 inputWindowsManager->dragFlag_ = true;
351 DisplayGroupInfo displayGroupInfo;
352 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo));
353 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
354 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
355 inputWindowsManager->lastPointerEvent_.reset();
356 inputWindowsManager->lastPointerEvent_ = nullptr;
357 inputWindowsManager->isDragBorder_ = false;
358 inputWindowsManager->dragFlag_ = false;
359 }
360 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING
361
362 /**
363 * @tc.name: SendPointerEvent_001
364 * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
365 * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
366 * @tc.type: FUNC
367 * @tc.require:
368 */
369 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_001, TestSize.Level1)
370 {
371 CALL_TEST_DEBUG;
372 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
373 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
374 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
375 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
376 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
377
378 std::shared_ptr<InputWindowsManager> inputWindowsManager =
379 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
380 ASSERT_NE(inputWindowsManager, nullptr);
381 UDSServer udsServer;
382 inputWindowsManager->udsServer_ = &udsServer;
383 int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
384 DisplayInfo displayInfo;
385 displayInfo.id = 10;
386 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
387 inputWindowsManager->extraData_.appended = true;
388 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
389 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
390 inputWindowsManager->udsServer_ = nullptr;
391 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
392 inputWindowsManager->extraData_.appended = false;
393 inputWindowsManager->extraData_.sourceType = -1;
394 }
395
396 /**
397 * @tc.name: SendPointerEvent_002
398 * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
399 * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
400 * @tc.type: FUNC
401 * @tc.require:
402 */
403 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_002, TestSize.Level1)
404 {
405 CALL_TEST_DEBUG;
406 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
407 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
408 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
409 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
410 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
411
412 std::shared_ptr<InputWindowsManager> inputWindowsManager =
413 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
414 ASSERT_NE(inputWindowsManager, nullptr);
415 UDSServer udsServer;
416 inputWindowsManager->udsServer_ = &udsServer;
417 int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW ;
418 DisplayInfo displayInfo;
419 displayInfo.id = 10;
420 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
421 inputWindowsManager->extraData_.appended = false;
422 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
423 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
424 inputWindowsManager->udsServer_ = nullptr;
425 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
426 inputWindowsManager->extraData_.sourceType = -1;
427 }
428
429 /**
430 * @tc.name: SendPointerEvent_003
431 * @tc.desc: Verify if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
432 * Rosen::SceneBoardJudgement::IsSceneBoardEnabled())
433 * @tc.type: FUNC
434 * @tc.require:
435 */
436 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_003, TestSize.Level1)
437 {
438 CALL_TEST_DEBUG;
439 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
440 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
441 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
442 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
443 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
444
445 std::shared_ptr<InputWindowsManager> inputWindowsManager =
446 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
447 ASSERT_NE(inputWindowsManager, nullptr);
448 UDSServer udsServer;
449 inputWindowsManager->udsServer_ = &udsServer;
450 int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
451 DisplayInfo displayInfo;
452 displayInfo.id = 10;
453 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
454 inputWindowsManager->extraData_.appended = false;
455 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
456 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
457 inputWindowsManager->udsServer_ = nullptr;
458 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
459 inputWindowsManager->extraData_.sourceType = -1;
460 }
461
462 /**
463 * @tc.name: SendPointerEvent_004
464 * @tc.desc: Verify if (!UpdateDisplayId(displayId))
465 * @tc.type: FUNC
466 * @tc.require:
467 */
468 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_004, TestSize.Level1)
469 {
470 CALL_TEST_DEBUG;
471 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
472 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
473 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
474 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
475 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
476
477 std::shared_ptr<InputWindowsManager> inputWindowsManager =
478 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
479 ASSERT_NE(inputWindowsManager, nullptr);
480 UDSServer udsServer;
481 inputWindowsManager->udsServer_ = &udsServer;
482 int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW;
483 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
484 inputWindowsManager->udsServer_ = nullptr;
485 }
486
487 /**
488 * @tc.name: SendPointerEvent_005
489 * @tc.desc: Verify if (extraData_.appended && extraData_.sourceType == PointerEvent::SOURCE_TYPE_MOUSE)
490 * @tc.type: FUNC
491 * @tc.require:
492 */
493 HWTEST_F(InputWindowsManagerTest, SendPointerEvent_005, TestSize.Level1)
494 {
495 CALL_TEST_DEBUG;
496 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
497 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
498 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
499 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
500 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
501
502 std::shared_ptr<InputWindowsManager> inputWindowsManager =
503 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
504 ASSERT_NE(inputWindowsManager, nullptr);
505 UDSServer udsServer;
506 inputWindowsManager->udsServer_ = &udsServer;
507 int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN;
508 DisplayInfo displayInfo;
509 displayInfo.id = 10;
510 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
511 inputWindowsManager->extraData_.appended = true;
512 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
513 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendPointerEvent(pointerAction));
514 inputWindowsManager->udsServer_ = nullptr;
515 inputWindowsManager->extraData_.appended = false;
516 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
517 inputWindowsManager->extraData_.sourceType = -1;
518 }
519
520 /**
521 * @tc.name: SkipNavigationWindow_001
522 * @tc.desc: Test the function SkipNavigationWindow
523 * @tc.type: FUNC
524 * @tc.require:
525 */
526 HWTEST_F(InputWindowsManagerTest, SkipNavigationWindow_001, TestSize.Level1)
527 {
528 CALL_TEST_DEBUG;
529 std::shared_ptr<InputWindowsManager> inputWindowsManager =
530 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
531 ASSERT_NE(inputWindowsManager, nullptr);
532 WindowInputType windowType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
533 int32_t toolType = PointerEvent::TOOL_TYPE_FINGER;
534 EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
535
536 toolType = PointerEvent::TOOL_TYPE_PEN;
537 inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
538 inputWindowsManager->antiMistake_.isOpen = true;
539 EXPECT_TRUE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
540
541 inputWindowsManager->isOpenAntiMisTakeObserver_ = true;
542 inputWindowsManager->antiMistake_.isOpen = false;
543 EXPECT_FALSE(inputWindowsManager->SkipNavigationWindow(windowType, toolType));
544 inputWindowsManager->isOpenAntiMisTakeObserver_ = false;
545 }
546
547 /**
548 * @tc.name: TransformTipPoint_001
549 * @tc.desc: Test the function TransformTipPoint
550 * @tc.type: FUNC
551 * @tc.require:
552 */
553 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_001, TestSize.Level1)
554 {
555 CALL_TEST_DEBUG;
556 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
557 std::shared_ptr<InputWindowsManager> inputWindowsManager =
558 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
559 ASSERT_NE(inputWindowsManager, nullptr);
560 DisplayInfo displayInfo;
561 displayInfo.id = 0;
562 displayInfo.uniq = "default0";
563 displayInfo.direction = DIRECTION90;
564 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
565 libinput_event_tablet_tool event {};
566 PhysicalCoordinate coord;
567 int32_t displayId;
568 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
569 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
570 }
571
572 /**
573 * @tc.name: TransformTipPoint_002
574 * @tc.desc: Test the function TransformTipPoint
575 * @tc.type: FUNC
576 * @tc.require:
577 */
578 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_002, TestSize.Level1)
579 {
580 CALL_TEST_DEBUG;
581 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
582 std::shared_ptr<InputWindowsManager> inputWindowsManager =
583 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
584 ASSERT_NE(inputWindowsManager, nullptr);
585 DisplayInfo displayInfo;
586 displayInfo.id = 0;
587 displayInfo.uniq = "default0";
588 displayInfo.direction = DIRECTION270;
589 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
590 libinput_event_tablet_tool event {};
591 PhysicalCoordinate coord;
592 int32_t displayId;
593 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
594 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
595 }
596
597 /**
598 * @tc.name: TransformTipPoint_003
599 * @tc.desc: Test the function TransformTipPoint
600 * @tc.type: FUNC
601 * @tc.require:
602 */
603 HWTEST_F(InputWindowsManagerTest, TransformTipPoint_003, TestSize.Level1)
604 {
605 CALL_TEST_DEBUG;
606 std::shared_ptr<InputWindowsManager> inputWindowsManager =
607 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
608 ASSERT_NE(inputWindowsManager, nullptr);
609 DisplayInfo displayInfo;
610 displayInfo.id = 0;
611 displayInfo.uniq = "default0";
612 displayInfo.direction = DIRECTION0;
613 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
614 libinput_event_tablet_tool event {};
615 PhysicalCoordinate coord;
616 int32_t displayId;
617 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformTipPoint(&event, coord, displayId));
618 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
619 }
620
621 /**
622 * @tc.name: InputWindowsManagerTest_TransformTipPoint_004
623 * @tc.desc: Test the function TransformTipPoint
624 * @tc.type: FUNC
625 * @tc.require:
626 */
627 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_004, TestSize.Level1)
628 {
629 CALL_TEST_DEBUG;
630 std::shared_ptr<InputWindowsManager> inputWindowsManager =
631 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
632 ASSERT_NE(inputWindowsManager, nullptr);
633 libinput_event_tablet_tool event {};
634 Direction direction;
635 direction = DIRECTION90;
636 PhysicalCoordinate coord;
637 coord.x = 5.5;
638 coord.y = 3.2;
639 int32_t displayId = 2;
640 bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
641 EXPECT_FALSE(ret);
642 }
643
644 /**
645 * @tc.name: InputWindowsManagerTest_TransformTipPoint_005
646 * @tc.desc: Test the function TransformTipPoint
647 * @tc.type: FUNC
648 * @tc.require:
649 */
650 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_005, TestSize.Level1)
651 {
652 CALL_TEST_DEBUG;
653 std::shared_ptr<InputWindowsManager> inputWindowsManager =
654 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
655 ASSERT_NE(inputWindowsManager, nullptr);
656 libinput_event_tablet_tool event {};
657 Direction direction;
658 direction = DIRECTION270;
659 PhysicalCoordinate coord;
660 coord.x = 6.5;
661 coord.y = 8.2;
662 int32_t displayId = 3;
663 bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
664 EXPECT_FALSE(ret);
665 }
666
667 /**
668 * @tc.name: InputWindowsManagerTest_TransformTipPoint_006
669 * @tc.desc: Test the function TransformTipPoint
670 * @tc.type: FUNC
671 * @tc.require:
672 */
673 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformTipPoint_006, TestSize.Level1)
674 {
675 CALL_TEST_DEBUG;
676 std::shared_ptr<InputWindowsManager> inputWindowsManager =
677 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
678 ASSERT_NE(inputWindowsManager, nullptr);
679 libinput_event_tablet_tool event {};
680 Direction direction;
681 direction = DIRECTION0;
682 PhysicalCoordinate coord;
683 coord.x = 6.5;
684 coord.y = 8.2;
685 int32_t displayId = 3;
686 bool ret = inputWindowsManager->TransformTipPoint(&event, coord, displayId);
687 EXPECT_FALSE(ret);
688 }
689
690 /**
691 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_001
692 * @tc.desc: Test the function IsNeedRefreshLayer
693 * @tc.type: FUNC
694 * @tc.require:
695 */
696 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_001, TestSize.Level1)
697 {
698 CALL_TEST_DEBUG;
699 std::shared_ptr<InputWindowsManager> inputWindowsManager =
700 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
701 ASSERT_NE(inputWindowsManager, nullptr);
702 int32_t windowId = 2;
703 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(true));
704
705 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
706 EXPECT_TRUE(ret);
707 }
708
709 /**
710 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_002
711 * @tc.desc: Test the function IsNeedRefreshLayer
712 * @tc.type: FUNC
713 * @tc.require:
714 */
715 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_002, TestSize.Level1)
716 {
717 CALL_TEST_DEBUG;
718 std::shared_ptr<InputWindowsManager> inputWindowsManager =
719 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
720 ASSERT_NE(inputWindowsManager, nullptr);
721 int32_t windowId = 3;
722 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
723
724 int32_t displayId = MouseEventHdr->GetDisplayId();
725 EXPECT_FALSE(displayId < 0);
726
727 std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(5, 7);
728 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
729 EXPECT_FALSE(ret);
730 }
731
732 /**
733 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_003
734 * @tc.desc: Test the function IsNeedRefreshLayer
735 * @tc.type: FUNC
736 * @tc.require:
737 */
738 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_003, TestSize.Level1)
739 {
740 CALL_TEST_DEBUG;
741 std::shared_ptr<InputWindowsManager> inputWindowsManager =
742 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
743 ASSERT_NE(inputWindowsManager, nullptr);
744 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
745 int32_t displayId = MouseEventHdr->GetDisplayId();
746 EXPECT_FALSE(displayId < 0);
747
748 std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(6, 8);
749 int32_t windowId = GLOBAL_WINDOW_ID;
750 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
751 EXPECT_FALSE(ret);
752 }
753
754 /**
755 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_004
756 * @tc.desc: Test the function IsNeedRefreshLayer
757 * @tc.type: FUNC
758 * @tc.require:
759 */
760 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_004, TestSize.Level1)
761 {
762 CALL_TEST_DEBUG;
763 std::shared_ptr<InputWindowsManager> inputWindowsManager =
764 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
765 ASSERT_NE(inputWindowsManager, nullptr);
766 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
767 int32_t displayId = MouseEventHdr->GetDisplayId();
768 EXPECT_FALSE(displayId < 0);
769
770 std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(2, 3);
771 touchWindow = std::nullopt;
772 int32_t windowId = GLOBAL_WINDOW_ID;
773 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
774 EXPECT_FALSE(ret);
775 }
776
777 /**
778 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_005
779 * @tc.desc: Test the function IsNeedRefreshLayer
780 * @tc.type: FUNC
781 * @tc.require:
782 */
783 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_005, TestSize.Level1)
784 {
785 CALL_TEST_DEBUG;
786 std::shared_ptr<InputWindowsManager> inputWindowsManager =
787 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
788 ASSERT_NE(inputWindowsManager, nullptr);
789 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillOnce(Return(false));
790 int32_t displayId = MouseEventHdr->GetDisplayId();
791 EXPECT_FALSE(displayId < 0);
792
793 std::optional<WindowInfo> touchWindow = inputWindowsManager->GetWindowInfo(3, 5);
794 touchWindow->id = GLOBAL_WINDOW_ID;
795 touchWindow->pid = 2;
796 touchWindow->uid = 3;
797 int32_t windowId = GLOBAL_WINDOW_ID;
798 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
799 EXPECT_FALSE(ret);
800 }
801
802 /**
803 * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_01
804 * @tc.desc: Cover if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) branch
805 * @tc.type: FUNC
806 * @tc.require:
807 */
808 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_01, TestSize.Level1)
809 {
810 CALL_TEST_DEBUG;
811 std::shared_ptr<InputWindowsManager> inputWindowsMgr =
812 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
813 ASSERT_NE(inputWindowsMgr, nullptr);
814
815 std::shared_ptr<PointerEvent> pointer = PointerEvent::Create();
816 ASSERT_NE(pointer, nullptr);
817 pointer->pointerId_ = 2;
818
819 PointerEvent::PointerItem pointerItem;
820 pointerItem.SetPointerId(1);
821 bool ret = pointer->GetPointerItem(pointer->pointerId_, pointerItem);
822 EXPECT_FALSE(ret);
823
824 int32_t logicalX = 300;
825 int32_t logicalY = 500;
826 WindowInfo windowInfo;
827 windowInfo.id = 1;
828 windowInfo.pid = 2;
829 windowInfo.transform.push_back(1.1);
830 EXPECT_FALSE(windowInfo.transform.empty());
831 EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->SendUIExtentionPointerEvent(logicalX, logicalY, windowInfo, pointer));
832 }
833
834 /**
835 * @tc.name: InputWindowsManagerTest_GetPhysicalDisplayCoord_01
836 * @tc.desc: Test the function GetPhysicalDisplayCoord
837 * @tc.type: FUNC
838 * @tc.require:
839 */
840 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoord_01, TestSize.Level1)
841 {
842 CALL_TEST_DEBUG;
843 std::shared_ptr<InputWindowsManager> inputWindowsMgr =
844 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
845 ASSERT_NE(inputWindowsMgr, nullptr);
846 libinput_event_touch *touch = nullptr;
847 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
848
849 DisplayInfo info;
850 info.direction = DIRECTION90;
851 info.direction = DIRECTION270;
852
853 EventTouch touchInfo;
854 touchInfo.point.x = 125;
855 touchInfo.point.y = 300;
856 touchInfo.toolRect.point.x = 300;
857 touchInfo.toolRect.point.y = 600;
858 touchInfo.toolRect.width = 720;
859 touchInfo.toolRect.height = 1000;
860 EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->GetPhysicalDisplayCoord(touch, info, touchInfo));
861 }
862
863 /**
864 * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_01
865 * @tc.desc: Test the function TouchPointToDisplayPoint
866 * @tc.type: FUNC
867 * @tc.require:
868 */
869 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_01, TestSize.Level1)
870 {
871 CALL_TEST_DEBUG;
872 std::shared_ptr<InputWindowsManager> inputWindowsMgr =
873 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
874 ASSERT_NE(inputWindowsMgr, nullptr);
875 libinput_event_touch *touch = nullptr;
876 int32_t deviceId = 1;
877 EventTouch touchInfo;
878 touchInfo.point.x = 125;
879 touchInfo.point.y = 300;
880 touchInfo.toolRect.point.x = 300;
881 touchInfo.toolRect.point.y = 600;
882 touchInfo.toolRect.width = 720;
883 touchInfo.toolRect.height = 1000;
884 int32_t physicalDisplayId = 2;
885 EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->TouchPointToDisplayPoint(deviceId, touch, touchInfo, physicalDisplayId));
886 }
887
888 /**
889 * @tc.name: CalculateTipPoint_001
890 * @tc.desc: Test the function CalculateTipPoint
891 * @tc.type: FUNC
892 * @tc.require:
893 */
894 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_001, TestSize.Level1)
895 {
896 CALL_TEST_DEBUG;
897 std::shared_ptr<InputWindowsManager> inputWindowsManager =
898 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
899 ASSERT_NE(inputWindowsManager, nullptr);
900 libinput_event_tablet_tool event {};
901 PhysicalCoordinate coord;
902 int32_t displayId;
903 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
904 }
905
906 /**
907 * @tc.name: CalculateTipPoint_002
908 * @tc.desc: Test the function CalculateTipPoint
909 * @tc.type: FUNC
910 * @tc.require:
911 */
912 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_002, TestSize.Level1)
913 {
914 CALL_TEST_DEBUG;
915 std::shared_ptr<InputWindowsManager> inputWindowsManager =
916 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
917 ASSERT_NE(inputWindowsManager, nullptr);
918 DisplayInfo displayInfo;
919 displayInfo.id = 0;
920 displayInfo.uniq = "default0";
921 displayInfo.direction = DIRECTION0;
922 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
923 libinput_event_tablet_tool event {};
924 PhysicalCoordinate coord;
925 int32_t displayId;
926 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CalculateTipPoint(&event, displayId, coord));
927 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
928 }
929
930 /**
931 * @tc.name: CalculateTipPoint_003
932 * @tc.desc: Test the function CalculateTipPoint
933 * @tc.type: FUNC
934 * @tc.require:
935 */
936 HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_003, TestSize.Level1)
937 {
938 CALL_TEST_DEBUG;
939 std::shared_ptr<InputWindowsManager> inputWindowsManager =
940 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
941 ASSERT_NE(inputWindowsManager, nullptr);
942
943 libinput_event_tablet_tool event {};
944 int32_t targetDisplayId = 3;
945 PhysicalCoordinate coord;
946 coord.x = 3.5;
947 coord.y = 5.2;
948 bool result = inputWindowsManager->TransformTipPoint(&event, coord, targetDisplayId);
949 EXPECT_FALSE(result);
950 bool ret = inputWindowsManager->CalculateTipPoint(&event, targetDisplayId, coord);
951 EXPECT_FALSE(ret);
952 }
953
954 /**
955 * @tc.name: UpdateMouseTarget_001
956 * @tc.desc: Test the function UpdateMouseTarget
957 * @tc.type: FUNC
958 * @tc.require:
959 */
960 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_001, TestSize.Level1)
961 {
962 CALL_TEST_DEBUG;
963 std::shared_ptr<InputWindowsManager> inputWindowsManager =
964 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
965 ASSERT_NE(inputWindowsManager, nullptr);
966 DisplayInfo displayInfo;
967 displayInfo.id = 0;
968 displayInfo.displayDirection = DIRECTION0;
969 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
970 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
971 ASSERT_NE(pointerEvent, nullptr);
972 PointerEvent::PointerItem item;
973 pointerEvent->AddPointerItem(item);
974 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
975 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
976 }
977
978 /**
979 * @tc.name: UpdateMouseTarget_002
980 * @tc.desc: Test the function UpdateMouseTarget
981 * @tc.type: FUNC
982 * @tc.require:
983 */
984 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_002, TestSize.Level1)
985 {
986 CALL_TEST_DEBUG;
987 std::shared_ptr<InputWindowsManager> inputWindowsManager =
988 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
989 ASSERT_NE(inputWindowsManager, nullptr);
990 DisplayInfo displayInfo;
991 displayInfo.id = 0;
992 displayInfo.displayDirection = DIRECTION0;
993 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
994 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
995 ASSERT_NE(pointerEvent, nullptr);
996 PointerEvent::PointerItem item;
997 pointerEvent->AddPointerItem(item);
998 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
999 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1000 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1001 }
1002
1003 /**
1004 * @tc.name: UpdateMouseTarget_003
1005 * @tc.desc: Test the function UpdateMouseTarget
1006 * @tc.type: FUNC
1007 * @tc.require:
1008 */
1009 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_003, TestSize.Level1)
1010 {
1011 CALL_TEST_DEBUG;
1012 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1013 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1014 ASSERT_NE(inputWindowsManager, nullptr);
1015 inputWindowsManager->mouseDownInfo_.id = 1;
1016 DisplayInfo displayInfo;
1017 displayInfo.id = 0;
1018 displayInfo.displayDirection = DIRECTION0;
1019 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1020 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1021 ASSERT_NE(pointerEvent, nullptr);
1022 PointerEvent::PointerItem item;
1023 pointerEvent->AddPointerItem(item);
1024 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1025 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1026 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1027 inputWindowsManager->mouseDownInfo_.id = -1;
1028 }
1029
1030 /**
1031 * @tc.name: UpdateMouseTarget_004
1032 * @tc.desc: Test the function UpdateMouseTarget
1033 * @tc.type: FUNC
1034 * @tc.require:
1035 */
1036 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_004, TestSize.Level1)
1037 {
1038 CALL_TEST_DEBUG;
1039 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1040 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1041 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1042 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1043 ASSERT_NE(inputWindowsManager, nullptr);
1044 UDSServer udsServer;
1045 inputWindowsManager->udsServer_ = &udsServer;
1046 inputWindowsManager->mouseDownInfo_.id = 1;
1047 DisplayInfo displayInfo;
1048 displayInfo.id = 0;
1049 displayInfo.displayDirection = DIRECTION0;
1050 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1051 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1052 ASSERT_NE(pointerEvent, nullptr);
1053 PointerEvent::PointerItem item;
1054 pointerEvent->AddPointerItem(item);
1055 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1056 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1057 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1058 inputWindowsManager->mouseDownInfo_.id = -1;
1059 inputWindowsManager->udsServer_ = nullptr;
1060 }
1061
1062 /**
1063 * @tc.name: UpdateMouseTarget_005
1064 * @tc.desc: Test the function UpdateMouseTarget
1065 * @tc.type: FUNC
1066 * @tc.require:
1067 */
1068 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_005, TestSize.Level1)
1069 {
1070 CALL_TEST_DEBUG;
1071 EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillOnce(Return(false));
1072 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1073 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1074 ASSERT_NE(inputWindowsManager, nullptr);
1075 WindowInfo windowInfo;
1076 windowInfo.id = -1;
1077 windowInfo.pid = 11;
1078 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1079 UDSServer udsServer;
1080 inputWindowsManager->udsServer_ = &udsServer;
1081 inputWindowsManager->mouseDownInfo_.id = 1;
1082 inputWindowsManager->displayGroupInfo_.focusWindowId = 1;
1083 DisplayInfo displayInfo;
1084 displayInfo.id = 0;
1085 displayInfo.displayDirection = DIRECTION0;
1086 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1087 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1088 ASSERT_NE(pointerEvent, nullptr);
1089 PointerEvent::PointerItem item;
1090 pointerEvent->AddPointerItem(item);
1091 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1092 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1093 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1094 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1095 inputWindowsManager->mouseDownInfo_.id = -1;
1096 inputWindowsManager->udsServer_ = nullptr;
1097 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1098 }
1099
1100 /**
1101 * @tc.name: UpdateMouseTarget_006
1102 * @tc.desc: Test the function UpdateMouseTarget
1103 * @tc.type: FUNC
1104 * @tc.require:
1105 */
1106 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_006, TestSize.Level1)
1107 {
1108 CALL_TEST_DEBUG;
1109 EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
1110 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1111 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1112 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1113 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1114 ASSERT_NE(inputWindowsManager, nullptr);
1115 WindowInfo windowInfo;
1116 windowInfo.id = -1;
1117 windowInfo.pid = 11;
1118 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1119 UDSServer udsServer;
1120 inputWindowsManager->udsServer_ = &udsServer;
1121 inputWindowsManager->mouseDownInfo_.id = 1;
1122 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1123 DisplayInfo displayInfo;
1124 displayInfo.id = 0;
1125 displayInfo.displayDirection = DIRECTION0;
1126 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1127 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1128 ASSERT_NE(pointerEvent, nullptr);
1129 PointerEvent::PointerItem item;
1130 pointerEvent->AddPointerItem(item);
1131 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1132 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1133 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1134 inputWindowsManager->mouseDownInfo_.id = -1;
1135 inputWindowsManager->udsServer_ = nullptr;
1136 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1137 }
1138
1139 /**
1140 * @tc.name: UpdateMouseTarget_007
1141 * @tc.desc: Test the function UpdateMouseTarget
1142 * @tc.type: FUNC
1143 * @tc.require:
1144 */
1145 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_007, TestSize.Level1)
1146 {
1147 CALL_TEST_DEBUG;
1148 EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
1149 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
1150 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(false));
1151 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1152 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1153 ASSERT_NE(inputWindowsManager, nullptr);
1154 WindowInfo windowInfo;
1155 windowInfo.id = -1;
1156 windowInfo.pid = 11;
1157 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1158 UDSServer udsServer;
1159 inputWindowsManager->udsServer_ = &udsServer;
1160 inputWindowsManager->mouseDownInfo_.id = 1;
1161 DisplayInfo displayInfo;
1162 displayInfo.id = 0;
1163 displayInfo.displayDirection = DIRECTION0;
1164 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1165 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1166 ASSERT_NE(pointerEvent, nullptr);
1167 PointerEvent::PointerItem item;
1168 pointerEvent->AddPointerItem(item);
1169 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1170 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1171 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1172 inputWindowsManager->mouseDownInfo_.id = -1;
1173 inputWindowsManager->udsServer_ = nullptr;
1174 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1175 }
1176
1177 /**
1178 * @tc.name: UpdateMouseTarget_008
1179 * @tc.desc: Test the function UpdateMouseTarget
1180 * @tc.type: FUNC
1181 * @tc.require:
1182 */
1183 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_008, TestSize.Level1)
1184 {
1185 CALL_TEST_DEBUG;
1186 EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(true));
1187 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
1188 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1189 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1190 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1191 ASSERT_NE(inputWindowsManager, nullptr);
1192 WindowInfo windowInfo;
1193 windowInfo.id = -1;
1194 windowInfo.pid = 11;
1195 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1196 UDSServer udsServer;
1197 inputWindowsManager->udsServer_ = &udsServer;
1198 inputWindowsManager->mouseDownInfo_.id = 1;
1199 DisplayInfo displayInfo;
1200 displayInfo.id = 0;
1201 displayInfo.displayDirection = DIRECTION0;
1202 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1203 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1204 ASSERT_NE(pointerEvent, nullptr);
1205 PointerEvent::PointerItem item;
1206 pointerEvent->AddPointerItem(item);
1207 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1208 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1209 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1210 inputWindowsManager->mouseDownInfo_.id = -1;
1211 inputWindowsManager->udsServer_ = nullptr;
1212 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1213 }
1214
1215 /**
1216 * @tc.name: UpdateMouseTarget_009
1217 * @tc.desc: Test the function UpdateMouseTarget
1218 * @tc.type: FUNC
1219 * @tc.require:
1220 */
1221 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_009, TestSize.Level1)
1222 {
1223 CALL_TEST_DEBUG;
1224 EXPECT_CALL(*messageParcelMock_, GetBoolValue(_, _)).WillRepeatedly(Return(false));
1225 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1226 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1227 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1228 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1229 ASSERT_NE(inputWindowsManager, nullptr);
1230 WindowInfo windowInfo;
1231 windowInfo.id = -1;
1232 windowInfo.pid = 11;
1233 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1234 UDSServer udsServer;
1235 inputWindowsManager->udsServer_ = &udsServer;
1236 inputWindowsManager->mouseDownInfo_.id = 1;
1237 inputWindowsManager->isUiExtension_ = true;
1238 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1239 DisplayInfo displayInfo;
1240 displayInfo.id = 0;
1241 displayInfo.displayDirection = DIRECTION0;
1242 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1243 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1244 ASSERT_NE(pointerEvent, nullptr);
1245 PointerEvent::PointerItem item;
1246 pointerEvent->AddPointerItem(item);
1247 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
1248 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1249 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1250 inputWindowsManager->isUiExtension_ = false;
1251 inputWindowsManager->mouseDownInfo_.id = -1;
1252 inputWindowsManager->udsServer_ = nullptr;
1253 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1254 }
1255
1256 /**
1257 * @tc.name: UpdateMouseTarget_010
1258 * @tc.desc: Test the function UpdateMouseTarget
1259 * @tc.type: FUNC
1260 * @tc.require:
1261 */
1262 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_010, TestSize.Level1)
1263 {
1264 CALL_TEST_DEBUG;
1265 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1266 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1267 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1268 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1269 ASSERT_NE(inputWindowsManager, nullptr);
1270 WindowInfo windowInfo;
1271 windowInfo.id = -1;
1272 windowInfo.pid = 11;
1273 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1274 UDSServer udsServer;
1275 inputWindowsManager->udsServer_ = &udsServer;
1276 inputWindowsManager->mouseDownInfo_.id = 1;
1277 inputWindowsManager->dragFlag_ = true;
1278 inputWindowsManager->isDragBorder_ = true;
1279 inputWindowsManager->isUiExtension_ = true;
1280 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1281 DisplayInfo displayInfo;
1282 displayInfo.id = 0;
1283 displayInfo.displayDirection = DIRECTION0;
1284 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1285 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1286 ASSERT_NE(pointerEvent, nullptr);
1287 PointerEvent::PointerItem item;
1288 pointerEvent->AddPointerItem(item);
1289 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN);
1290 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1291 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1292 inputWindowsManager->dragFlag_ = false;
1293 inputWindowsManager->isDragBorder_ = false;
1294 inputWindowsManager->isUiExtension_ = false;
1295 inputWindowsManager->mouseDownInfo_.id = -1;
1296 inputWindowsManager->udsServer_ = nullptr;
1297 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1298 }
1299
1300 /**
1301 * @tc.name: UpdateMouseTarget_011
1302 * @tc.desc: Test the function UpdateMouseTarget
1303 * @tc.type: FUNC
1304 * @tc.require:
1305 */
1306 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_011, TestSize.Level1)
1307 {
1308 CALL_TEST_DEBUG;
1309 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1310 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1311 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1312 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1313 ASSERT_NE(inputWindowsManager, nullptr);
1314 WindowInfo windowInfo;
1315 windowInfo.id = -1;
1316 windowInfo.pid = 11;
1317 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1318 UDSServer udsServer;
1319 inputWindowsManager->udsServer_ = &udsServer;
1320 inputWindowsManager->mouseDownInfo_.id = 1;
1321 inputWindowsManager->dragFlag_ = true;
1322 inputWindowsManager->isDragBorder_ = true;
1323 inputWindowsManager->isUiExtension_ = false;
1324 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1325 DisplayInfo displayInfo;
1326 displayInfo.id = 0;
1327 displayInfo.displayDirection = DIRECTION90;
1328 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1329 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1330 ASSERT_NE(pointerEvent, nullptr);
1331 PointerEvent::PointerItem item;
1332 pointerEvent->AddPointerItem(item);
1333 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1334 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1335 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1336 inputWindowsManager->dragFlag_ = false;
1337 inputWindowsManager->isDragBorder_ = false;
1338 inputWindowsManager->isUiExtension_ = false;
1339 inputWindowsManager->mouseDownInfo_.id = -1;
1340 inputWindowsManager->udsServer_ = nullptr;
1341 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1342 }
1343
1344 /**
1345 * @tc.name: UpdateMouseTarget_012
1346 * @tc.desc: Test the function UpdateMouseTarget
1347 * @tc.type: FUNC
1348 * @tc.require:
1349 */
1350 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_012, TestSize.Level1)
1351 {
1352 CALL_TEST_DEBUG;
1353 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1354 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1355 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1356 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1357 ASSERT_NE(inputWindowsManager, nullptr);
1358 WindowInfo windowInfo;
1359 windowInfo.id = -1;
1360 windowInfo.pid = 11;
1361 windowInfo.transform.push_back(1.1);
1362 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1363 UDSServer udsServer;
1364 inputWindowsManager->udsServer_ = &udsServer;
1365 inputWindowsManager->mouseDownInfo_.id = 1;
1366 inputWindowsManager->dragFlag_ = true;
1367 inputWindowsManager->isDragBorder_ = true;
1368 inputWindowsManager->isUiExtension_ = false;
1369 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1370 inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1371 inputWindowsManager->captureModeInfo_.windowId = 1;
1372 inputWindowsManager->extraData_.appended = true;
1373 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1374 DisplayInfo displayInfo;
1375 displayInfo.id = 0;
1376 displayInfo.displayDirection = DIRECTION90;
1377 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1378 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1379 ASSERT_NE(pointerEvent, nullptr);
1380 PointerEvent::PointerItem item;
1381 pointerEvent->AddPointerItem(item);
1382 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP);
1383 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1384 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1385 inputWindowsManager->dragFlag_ = false;
1386 inputWindowsManager->isDragBorder_ = false;
1387 inputWindowsManager->isUiExtension_ = false;
1388 inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1389 inputWindowsManager->captureModeInfo_.windowId = -1;
1390 inputWindowsManager->mouseDownInfo_.id = -1;
1391 inputWindowsManager->udsServer_ = nullptr;
1392 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1393 inputWindowsManager->extraData_.appended = false;
1394 inputWindowsManager->extraData_.sourceType = -1;
1395 }
1396
1397 /**
1398 * @tc.name: UpdateMouseTarget_013
1399 * @tc.desc: Test the function UpdateMouseTarget
1400 * @tc.type: FUNC
1401 * @tc.require:
1402 */
1403 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_013, TestSize.Level1)
1404 {
1405 CALL_TEST_DEBUG;
1406 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1407 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1408 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1409 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1410 ASSERT_NE(inputWindowsManager, nullptr);
1411 WindowInfo windowInfo;
1412 windowInfo.id = -1;
1413 windowInfo.pid = 11;
1414 windowInfo.transform.push_back(1.1);
1415 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1416 UDSServer udsServer;
1417 inputWindowsManager->udsServer_ = &udsServer;
1418 inputWindowsManager->mouseDownInfo_.id = 1;
1419 inputWindowsManager->dragFlag_ = true;
1420 inputWindowsManager->isDragBorder_ = true;
1421 inputWindowsManager->isUiExtension_ = false;
1422 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1423 inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1424 inputWindowsManager->captureModeInfo_.windowId = -1;
1425 inputWindowsManager->extraData_.appended = true;
1426 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
1427 DisplayInfo displayInfo;
1428 displayInfo.id = 0;
1429 displayInfo.displayDirection = DIRECTION90;
1430 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1431 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1432 ASSERT_NE(pointerEvent, nullptr);
1433 PointerEvent::PointerItem item;
1434 pointerEvent->AddPointerItem(item);
1435 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1436 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1437 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1438 inputWindowsManager->dragFlag_ = false;
1439 inputWindowsManager->isDragBorder_ = false;
1440 inputWindowsManager->isUiExtension_ = false;
1441 inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1442 inputWindowsManager->mouseDownInfo_.id = -1;
1443 inputWindowsManager->udsServer_ = nullptr;
1444 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1445 inputWindowsManager->extraData_.appended = false;
1446 inputWindowsManager->extraData_.sourceType = -1;
1447 }
1448
1449 /**
1450 * @tc.name: UpdateMouseTarget_014
1451 * @tc.desc: Test the function UpdateMouseTarget
1452 * @tc.type: FUNC
1453 * @tc.require:
1454 */
1455 HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_014, TestSize.Level1)
1456 {
1457 CALL_TEST_DEBUG;
1458 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
1459 EXPECT_CALL(*messageParcelMock_, GetMouseDisplayState()).WillRepeatedly(Return(true));
1460 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1461 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1462 ASSERT_NE(inputWindowsManager, nullptr);
1463 WindowInfo windowInfo;
1464 windowInfo.id = -1;
1465 windowInfo.pid = 11;
1466 windowInfo.transform.push_back(1.1);
1467 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1468 UDSServer udsServer;
1469 inputWindowsManager->udsServer_ = &udsServer;
1470 inputWindowsManager->mouseDownInfo_.id = 1;
1471 inputWindowsManager->dragFlag_ = true;
1472 inputWindowsManager->isDragBorder_ = true;
1473 inputWindowsManager->isUiExtension_ = false;
1474 inputWindowsManager->displayGroupInfo_.focusWindowId = -1;
1475 inputWindowsManager->captureModeInfo_.isCaptureMode = true;
1476 inputWindowsManager->captureModeInfo_.windowId = -1;
1477 inputWindowsManager->extraData_.appended = false;
1478 inputWindowsManager->extraData_.sourceType = -1;
1479 DisplayInfo displayInfo;
1480 displayInfo.id = 0;
1481 displayInfo.displayDirection = DIRECTION90;
1482 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
1483 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1484 ASSERT_NE(pointerEvent, nullptr);
1485 PointerEvent::PointerItem item;
1486 pointerEvent->AddPointerItem(item);
1487 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
1488 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateMouseTarget(pointerEvent));
1489 inputWindowsManager->displayGroupInfo_.displaysInfo.clear();
1490 inputWindowsManager->dragFlag_ = false;
1491 inputWindowsManager->isDragBorder_ = false;
1492 inputWindowsManager->isUiExtension_ = false;
1493 inputWindowsManager->captureModeInfo_.isCaptureMode = false;
1494 inputWindowsManager->mouseDownInfo_.id = -1;
1495 inputWindowsManager->udsServer_ = nullptr;
1496 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1497 }
1498
1499 /**
1500 * @tc.name: IsNeedDrawPointer_001
1501 * @tc.desc: Test the function IsNeedDrawPointer
1502 * @tc.type: FUNC
1503 * @tc.require:
1504 */
1505 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_001, TestSize.Level1)
1506 {
1507 CALL_TEST_DEBUG;
1508 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1509 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1510 ASSERT_NE(inputWindowsManager, nullptr);
1511 PointerEvent::PointerItem pointerItem;
1512 pointerItem.SetToolType(PointerEvent::TOOL_TYPE_FINGER);
1513 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1514 }
1515
1516 /**
1517 * @tc.name: IsNeedDrawPointer_002
1518 * @tc.desc: Test the function IsNeedDrawPointer
1519 * @tc.type: FUNC
1520 * @tc.require:
1521 */
1522 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_002, TestSize.Level1)
1523 {
1524 CALL_TEST_DEBUG;
1525 EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(nullptr));
1526 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1527 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1528 ASSERT_NE(inputWindowsManager, nullptr);
1529 PointerEvent::PointerItem pointerItem;
1530 pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1531 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1532 }
1533
1534 /**
1535 * @tc.name: IsNeedDrawPointer_003
1536 * @tc.desc: Test the function IsNeedDrawPointer
1537 * @tc.type: FUNC
1538 * @tc.require:
1539 */
1540 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_003, TestSize.Level1)
1541 {
1542 CALL_TEST_DEBUG;
1543 std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1544 inputDevice->SetBus(BUS_USB);
1545 EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1546 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1547 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1548 ASSERT_NE(inputWindowsManager, nullptr);
1549 PointerEvent::PointerItem pointerItem;
1550 pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1551 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1552 }
1553
1554 /**
1555 * @tc.name: IsNeedDrawPointer_004
1556 * @tc.desc: Test the function IsNeedDrawPointer
1557 * @tc.type: FUNC
1558 * @tc.require:
1559 */
1560 HWTEST_F(InputWindowsManagerTest, IsNeedDrawPointer_004, TestSize.Level1)
1561 {
1562 CALL_TEST_DEBUG;
1563 std::shared_ptr<InputDevice> inputDevice = std::make_shared<InputDevice>();
1564 inputDevice->SetBus(BUS_HIL);
1565 EXPECT_CALL(*messageParcelMock_, GetInputDevice(_, _)).WillOnce(Return(inputDevice));
1566 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1567 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1568 ASSERT_NE(inputWindowsManager, nullptr);
1569 PointerEvent::PointerItem pointerItem;
1570 pointerItem.SetToolType(PointerEvent::TOOL_TYPE_PEN);
1571 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsNeedDrawPointer(pointerItem));
1572 }
1573
1574 /**
1575 * @tc.name: DispatchTouch_001
1576 * @tc.desc: Test the function DispatchTouch
1577 * @tc.type: FUNC
1578 * @tc.require:
1579 */
1580 HWTEST_F(InputWindowsManagerTest, DispatchTouch_001, TestSize.Level1)
1581 {
1582 CALL_TEST_DEBUG;
1583 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1584 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1585 ASSERT_NE(inputWindowsManager, nullptr);
1586 UDSServer udsServer;
1587 inputWindowsManager->udsServer_ = &udsServer;
1588 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1589 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1590 WindowInfo windowInfo;
1591 windowInfo.id = 1;
1592 windowInfo.pid = 11;
1593 windowInfo.flags = 1;
1594 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1595 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1596 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1597 inputWindowsManager->udsServer_ = nullptr;
1598 inputWindowsManager->lastTouchEvent_ = nullptr;
1599 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1600 }
1601
1602 /**
1603 * @tc.name: DispatchTouch_002
1604 * @tc.desc: Test the function DispatchTouch
1605 * @tc.type: FUNC
1606 * @tc.require:
1607 */
1608 HWTEST_F(InputWindowsManagerTest, DispatchTouch_002, TestSize.Level1)
1609 {
1610 CALL_TEST_DEBUG;
1611 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1612 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1613 ASSERT_NE(inputWindowsManager, nullptr);
1614 UDSServer udsServer;
1615 inputWindowsManager->udsServer_ = &udsServer;
1616 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1617 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1618 WindowInfo windowInfo;
1619 windowInfo.id = 1;
1620 windowInfo.pid = 11;
1621 windowInfo.flags = 0;
1622 windowInfo.transform.push_back(1.1);
1623 Rect rect;
1624 rect.x = 5;
1625 rect.y = 5;
1626 rect.width = 10;
1627 rect.height = 10;
1628 windowInfo.defaultHotAreas.push_back(rect);
1629 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1630 inputWindowsManager->lastTouchLogicX_ = 8;
1631 inputWindowsManager->lastTouchLogicY_ = 8;
1632 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1633 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1634 inputWindowsManager->udsServer_ = nullptr;
1635 inputWindowsManager->lastTouchEvent_ = nullptr;
1636 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1637 inputWindowsManager->lastTouchLogicX_ = -1;
1638 inputWindowsManager->lastTouchLogicY_ = -1;
1639 inputWindowsManager->lastTouchWindowInfo_.id = -1;
1640 inputWindowsManager->lastTouchWindowInfo_.pid = -1;
1641 inputWindowsManager->lastTouchWindowInfo_.uid = -1;
1642 inputWindowsManager->lastTouchWindowInfo_.agentWindowId = -1;
1643 inputWindowsManager->lastTouchWindowInfo_.area = { 0, 0, 0, 0 };
1644 inputWindowsManager->lastTouchWindowInfo_.flags = -1;
1645 inputWindowsManager->lastTouchWindowInfo_.windowType = 0;
1646 }
1647
1648 /**
1649 * @tc.name: DispatchTouch_003
1650 * @tc.desc: Test the function DispatchTouch
1651 * @tc.type: FUNC
1652 * @tc.require:
1653 */
1654 HWTEST_F(InputWindowsManagerTest, DispatchTouch_003, TestSize.Level1)
1655 {
1656 CALL_TEST_DEBUG;
1657 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1658 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(nullptr));
1659 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1660 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1661 ASSERT_NE(inputWindowsManager, nullptr);
1662 UDSServer udsServer;
1663 inputWindowsManager->udsServer_ = &udsServer;
1664 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1665 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1666 PointerEvent::PointerItem item;
1667 item.SetPointerId(1);
1668 inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1669 inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1670 WindowInfo windowInfo;
1671 windowInfo.id = -1;
1672 windowInfo.pid = 11;
1673 windowInfo.flags = 0;
1674 windowInfo.transform.push_back(1.1);
1675 Rect rect;
1676 rect.x = 5;
1677 rect.y = 5;
1678 rect.width = 10;
1679 rect.height = 10;
1680 windowInfo.defaultHotAreas.push_back(rect);
1681 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1682 inputWindowsManager->lastTouchLogicX_ = 8;
1683 inputWindowsManager->lastTouchLogicY_ = 8;
1684 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1685 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1686 inputWindowsManager->udsServer_ = nullptr;
1687 inputWindowsManager->lastTouchEvent_ = nullptr;
1688 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1689 inputWindowsManager->lastTouchLogicX_ = -1;
1690 inputWindowsManager->lastTouchLogicY_ = -1;
1691 }
1692
1693 /**
1694 * @tc.name: DispatchTouch_004
1695 * @tc.desc: Test the function DispatchTouch
1696 * @tc.type: FUNC
1697 * @tc.require:
1698 */
1699 HWTEST_F(InputWindowsManagerTest, DispatchTouch_004, TestSize.Level1)
1700 {
1701 CALL_TEST_DEBUG;
1702 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1703 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1704 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
1705 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
1706 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1707 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1708 ASSERT_NE(inputWindowsManager, nullptr);
1709 UDSServer udsServer;
1710 inputWindowsManager->udsServer_ = &udsServer;
1711 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1712 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1713 PointerEvent::PointerItem item;
1714 item.SetPointerId(1);
1715 inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1716 inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1717 WindowInfo windowInfo;
1718 windowInfo.id = -1;
1719 windowInfo.pid = 11;
1720 windowInfo.flags = 0;
1721 windowInfo.transform.push_back(1.1);
1722 Rect rect;
1723 rect.x = 5;
1724 rect.y = 5;
1725 rect.width = 10;
1726 rect.height = 10;
1727 windowInfo.defaultHotAreas.push_back(rect);
1728 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1729 inputWindowsManager->lastTouchLogicX_ = 8;
1730 inputWindowsManager->lastTouchLogicY_ = 8;
1731 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1732 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1733 inputWindowsManager->udsServer_ = nullptr;
1734 inputWindowsManager->lastTouchEvent_ = nullptr;
1735 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1736 inputWindowsManager->lastTouchLogicX_ = -1;
1737 inputWindowsManager->lastTouchLogicY_ = -1;
1738 }
1739
1740 /**
1741 * @tc.name: DispatchTouch_005
1742 * @tc.desc: Test the function DispatchTouch
1743 * @tc.type: FUNC
1744 * @tc.require:
1745 */
1746 HWTEST_F(InputWindowsManagerTest, DispatchTouch_005, TestSize.Level1)
1747 {
1748 CALL_TEST_DEBUG;
1749 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
1750 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
1751 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
1752 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
1753 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1754 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1755 ASSERT_NE(inputWindowsManager, nullptr);
1756 UDSServer udsServer;
1757 inputWindowsManager->udsServer_ = &udsServer;
1758 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1759 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1760 PointerEvent::PointerItem item;
1761 item.SetPointerId(1);
1762 inputWindowsManager->lastTouchEvent_->AddPointerItem(item);
1763 inputWindowsManager->lastTouchEvent_->SetPointerId(1);
1764 WindowInfo windowInfo;
1765 windowInfo.id = -1;
1766 windowInfo.pid = 11;
1767 windowInfo.flags = 0;
1768 windowInfo.transform.push_back(1.1);
1769 Rect rect;
1770 rect.x = 5;
1771 rect.y = 5;
1772 rect.width = 10;
1773 rect.height = 10;
1774 windowInfo.defaultHotAreas.push_back(rect);
1775 inputWindowsManager->displayGroupInfo_.windowsInfo.push_back(windowInfo);
1776 inputWindowsManager->lastTouchLogicX_ = 8;
1777 inputWindowsManager->lastTouchLogicY_ = 8;
1778 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1779 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1780 inputWindowsManager->udsServer_ = nullptr;
1781 inputWindowsManager->lastTouchEvent_ = nullptr;
1782 inputWindowsManager->displayGroupInfo_.windowsInfo.clear();
1783 inputWindowsManager->lastTouchLogicX_ = -1;
1784 inputWindowsManager->lastTouchLogicY_ = -1;
1785 }
1786
1787 /**
1788 * @tc.name: DispatchTouch_006
1789 * @tc.desc: Test the function DispatchTouch
1790 * @tc.type: FUNC
1791 * @tc.require:
1792 */
1793 HWTEST_F(InputWindowsManagerTest, DispatchTouch_006, TestSize.Level1)
1794 {
1795 CALL_TEST_DEBUG;
1796 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1797 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1798 ASSERT_NE(inputWindowsManager, nullptr);
1799 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1800 ASSERT_NE(pointerEvent, nullptr);
1801
1802 UDSServer udsServer;
1803 inputWindowsManager->udsServer_ = &udsServer;
1804 ASSERT_NE(inputWindowsManager->udsServer_, nullptr);
1805
1806 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1807 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1808
1809 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_IN_WINDOW;
1810 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1811 }
1812
1813 /**
1814 * @tc.name: DispatchTouch_007
1815 * @tc.desc: Test the function DispatchTouch
1816 * @tc.type: FUNC
1817 * @tc.require:
1818 */
1819 HWTEST_F(InputWindowsManagerTest, DispatchTouch_007, TestSize.Level1)
1820 {
1821 CALL_TEST_DEBUG;
1822 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1823 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1824 ASSERT_NE(inputWindowsManager, nullptr);
1825 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1826 ASSERT_NE(pointerEvent, nullptr);
1827
1828 UDSServer udsServer;
1829 inputWindowsManager->udsServer_ = &udsServer;
1830 ASSERT_NE(inputWindowsManager->udsServer_, nullptr);
1831
1832 inputWindowsManager->lastTouchEvent_ = PointerEvent::Create();
1833 ASSERT_NE(inputWindowsManager->lastTouchEvent_, nullptr);
1834
1835 int32_t pointerAction = PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW;
1836 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchTouch(pointerAction));
1837 }
1838
1839 /**
1840 * @tc.name: TransformWindowXY_001
1841 * @tc.desc: Test the function TransformWindowXY
1842 * @tc.type: FUNC
1843 * @tc.require:
1844 */
1845 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_001, TestSize.Level1)
1846 {
1847 CALL_TEST_DEBUG;
1848 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1849 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1850 ASSERT_NE(inputWindowsManager, nullptr);
1851 WindowInfo window;
1852 window.transform = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
1853 double logicX = 1.1;
1854 double logicY = 1.1;
1855 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1856 }
1857
1858 /**
1859 * @tc.name: TransformWindowXY_002
1860 * @tc.desc: Test the function TransformWindowXY
1861 * @tc.type: FUNC
1862 * @tc.require:
1863 */
1864 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_002, TestSize.Level1)
1865 {
1866 CALL_TEST_DEBUG;
1867 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1868 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1869 ASSERT_NE(inputWindowsManager, nullptr);
1870 WindowInfo window;
1871 window.transform = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 };
1872 double logicX = 1.1;
1873 double logicY = 1.1;
1874 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1875 }
1876
1877 /**
1878 * @tc.name: TransformWindowXY_003
1879 * @tc.desc: Test the function TransformWindowXY
1880 * @tc.type: FUNC
1881 * @tc.require:
1882 */
1883 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_003, TestSize.Level1)
1884 {
1885 CALL_TEST_DEBUG;
1886 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1887 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1888 ASSERT_NE(inputWindowsManager, nullptr);
1889
1890 WindowInfo window;
1891 window.transform = { 1.0, 2.0, 3.0 };
1892 Matrix3f transforms(window.transform);
1893
1894 EXPECT_TRUE(window.transform.size() == 3);
1895 bool ret = transforms.IsIdentity();
1896 EXPECT_FALSE(ret);
1897
1898 double logicX = 1.1;
1899 double logicY = 2.1;
1900 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1901 }
1902
1903 /**
1904 * @tc.name: TransformWindowXY_004
1905 * @tc.desc: Test the function TransformWindowXY
1906 * @tc.type: FUNC
1907 * @tc.require:
1908 */
1909 HWTEST_F(InputWindowsManagerTest, TransformWindowXY_004, TestSize.Level1)
1910 {
1911 CALL_TEST_DEBUG;
1912 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1913 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1914 ASSERT_NE(inputWindowsManager, nullptr);
1915
1916 WindowInfo window;
1917 window.transform = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
1918 Matrix3f transforms(window.transform);
1919
1920 EXPECT_TRUE(window.transform.size() == 9);
1921 bool ret = transforms.IsIdentity();
1922 EXPECT_FALSE(ret);
1923
1924 double logicX = 3.2;
1925 double logicY = 5.1;
1926 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TransformWindowXY(window, logicX, logicY));
1927 }
1928
1929 /**
1930 * @tc.name: IsValidZorderWindow_001
1931 * @tc.desc: Test the function IsValidZorderWindow
1932 * @tc.type: FUNC
1933 * @tc.require:
1934 */
1935 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_001, TestSize.Level1)
1936 {
1937 CALL_TEST_DEBUG;
1938 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1939 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1940 ASSERT_NE(inputWindowsManager, nullptr);
1941 WindowInfo window;
1942 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1943 ASSERT_NE(pointerEvent, nullptr);
1944 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
1945 pointerEvent->SetZOrder(-6.6);
1946 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1947 }
1948
1949 /**
1950 * @tc.name: IsValidZorderWindow_002
1951 * @tc.desc: Test the function IsValidZorderWindow
1952 * @tc.type: FUNC
1953 * @tc.require:
1954 */
1955 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_002, TestSize.Level1)
1956 {
1957 CALL_TEST_DEBUG;
1958 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1959 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1960 ASSERT_NE(inputWindowsManager, nullptr);
1961 WindowInfo window;
1962 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1963 ASSERT_NE(pointerEvent, nullptr);
1964 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NO_MONITOR);
1965 pointerEvent->SetZOrder(6.6);
1966 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1967 }
1968
1969 /**
1970 * @tc.name: IsValidZorderWindow_003
1971 * @tc.desc: Test the function IsValidZorderWindow
1972 * @tc.type: FUNC
1973 * @tc.require:
1974 */
1975 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_003, TestSize.Level1)
1976 {
1977 CALL_TEST_DEBUG;
1978 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1979 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
1980 ASSERT_NE(inputWindowsManager, nullptr);
1981 WindowInfo window;
1982 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1983 ASSERT_NE(pointerEvent, nullptr);
1984 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
1985 pointerEvent->SetZOrder(-6.6);
1986 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
1987 }
1988
1989 /**
1990 * @tc.name: IsValidZorderWindow_004
1991 * @tc.desc: Test the function IsValidZorderWindow
1992 * @tc.type: FUNC
1993 * @tc.require:
1994 */
1995 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_004, TestSize.Level1)
1996 {
1997 CALL_TEST_DEBUG;
1998 std::shared_ptr<InputWindowsManager> inputWindowsManager =
1999 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2000 ASSERT_NE(inputWindowsManager, nullptr);
2001 WindowInfo window;
2002 window.zOrder = 8.8;
2003 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2004 ASSERT_NE(pointerEvent, nullptr);
2005 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
2006 pointerEvent->SetZOrder(6.6);
2007 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2008 }
2009
2010 /**
2011 * @tc.name: IsValidZorderWindow_005
2012 * @tc.desc: Test the function IsValidZorderWindow
2013 * @tc.type: FUNC
2014 * @tc.require:
2015 */
2016 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_005, TestSize.Level1)
2017 {
2018 CALL_TEST_DEBUG;
2019 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2020 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2021 ASSERT_NE(inputWindowsManager, nullptr);
2022 WindowInfo window;
2023 window.zOrder = 1.1;
2024 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2025 ASSERT_NE(pointerEvent, nullptr);
2026 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
2027 pointerEvent->SetZOrder(6.6);
2028 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->IsValidZorderWindow(window, pointerEvent));
2029 }
2030
2031 /**
2032 * @tc.name: IsValidZorderWindow_006
2033 * @tc.desc: Test the function IsValidZorderWindow
2034 * @tc.type: FUNC
2035 * @tc.require:
2036 */
2037 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_006, TestSize.Level1)
2038 {
2039 CALL_TEST_DEBUG;
2040 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2041 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2042 ASSERT_NE(inputWindowsManager, nullptr);
2043
2044 uint32_t flag;
2045 WindowInfo window;
2046 window.zOrder = 1.1;
2047 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2048 ASSERT_NE(pointerEvent, nullptr);
2049 flag = InputEvent::EVENT_FLAG_SIMULATE;
2050 EXPECT_FALSE(pointerEvent->HasFlag(flag));
2051
2052 bool ret = inputWindowsManager->IsValidZorderWindow(window, pointerEvent);
2053 EXPECT_TRUE(ret);
2054 }
2055
2056 /**
2057 * @tc.name: IsValidZorderWindow_007
2058 * @tc.desc: Test the function IsValidZorderWindow
2059 * @tc.type: FUNC
2060 * @tc.require:
2061 */
2062 HWTEST_F(InputWindowsManagerTest, IsValidZorderWindow_007, TestSize.Level1)
2063 {
2064 CALL_TEST_DEBUG;
2065 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2066 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2067 ASSERT_NE(inputWindowsManager, nullptr);
2068
2069 uint32_t flag;
2070 WindowInfo window;
2071 window.zOrder = 3.2;
2072 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2073 ASSERT_NE(pointerEvent, nullptr);
2074 flag = InputEvent::EVENT_FLAG_TOUCHPAD_POINTER;
2075 EXPECT_FALSE(pointerEvent->HasFlag(flag));
2076
2077 bool ret = inputWindowsManager->IsValidZorderWindow(window, pointerEvent);
2078 EXPECT_TRUE(ret);
2079 }
2080
2081 /**
2082 * @tc.name: HandleWindowInputType_001
2083 * @tc.desc: Test the function HandleWindowInputType
2084 * @tc.type: FUNC
2085 * @tc.require:
2086 */
2087 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_001, TestSize.Level1)
2088 {
2089 CALL_TEST_DEBUG;
2090 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2091 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2092 ASSERT_NE(inputWindowsManager, nullptr);
2093 WindowInfo window;
2094 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2095 ASSERT_NE(pointerEvent, nullptr);
2096 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2097 }
2098
2099 /**
2100 * @tc.name: HandleWindowInputType_002
2101 * @tc.desc: Test the function HandleWindowInputType
2102 * @tc.type: FUNC
2103 * @tc.require:
2104 */
2105 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_002, TestSize.Level1)
2106 {
2107 CALL_TEST_DEBUG;
2108 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2109 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2110 ASSERT_NE(inputWindowsManager, nullptr);
2111 WindowInfo window;
2112 window.windowInputType = WindowInputType::NORMAL;
2113 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2114 ASSERT_NE(pointerEvent, nullptr);
2115 PointerEvent::PointerItem item;
2116 item.SetPointerId(1);
2117 pointerEvent->AddPointerItem(item);
2118 pointerEvent->SetPointerId(1);
2119 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2120 }
2121
2122 /**
2123 * @tc.name: HandleWindowInputType_003
2124 * @tc.desc: Test the function HandleWindowInputType
2125 * @tc.type: FUNC
2126 * @tc.require:
2127 */
2128 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_003, TestSize.Level1)
2129 {
2130 CALL_TEST_DEBUG;
2131 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2132 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2133 ASSERT_NE(inputWindowsManager, nullptr);
2134 WindowInfo window;
2135 window.windowInputType = WindowInputType::TRANSMIT_ALL;
2136 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2137 ASSERT_NE(pointerEvent, nullptr);
2138 PointerEvent::PointerItem item;
2139 item.SetPointerId(1);
2140 pointerEvent->AddPointerItem(item);
2141 pointerEvent->SetPointerId(1);
2142 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2143 }
2144
2145 /**
2146 * @tc.name: HandleWindowInputType_004
2147 * @tc.desc: Test the function HandleWindowInputType
2148 * @tc.type: FUNC
2149 * @tc.require:
2150 */
2151 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_004, TestSize.Level1)
2152 {
2153 CALL_TEST_DEBUG;
2154 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2155 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2156 ASSERT_NE(inputWindowsManager, nullptr);
2157 WindowInfo window;
2158 window.windowInputType = WindowInputType::TRANSMIT_EXCEPT_MOVE;
2159 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2160 ASSERT_NE(pointerEvent, nullptr);
2161 PointerEvent::PointerItem item;
2162 item.SetPointerId(1);
2163 pointerEvent->AddPointerItem(item);
2164 pointerEvent->SetPointerId(1);
2165 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2166 }
2167
2168 /**
2169 * @tc.name: HandleWindowInputType_005
2170 * @tc.desc: Test the function HandleWindowInputType
2171 * @tc.type: FUNC
2172 * @tc.require:
2173 */
2174 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_005, TestSize.Level1)
2175 {
2176 CALL_TEST_DEBUG;
2177 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2178 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2179 ASSERT_NE(inputWindowsManager, nullptr);
2180 WindowInfo window;
2181 window.windowInputType = WindowInputType::ANTI_MISTAKE_TOUCH;
2182 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2183 ASSERT_NE(pointerEvent, nullptr);
2184 PointerEvent::PointerItem item;
2185 item.SetPointerId(1);
2186 pointerEvent->AddPointerItem(item);
2187 pointerEvent->SetPointerId(1);
2188 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2189 }
2190
2191 /**
2192 * @tc.name: HandleWindowInputType_006
2193 * @tc.desc: Test the function HandleWindowInputType
2194 * @tc.type: FUNC
2195 * @tc.require:
2196 */
2197 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_006, TestSize.Level1)
2198 {
2199 CALL_TEST_DEBUG;
2200 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2201 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2202 ASSERT_NE(inputWindowsManager, nullptr);
2203 WindowInfo window;
2204 window.windowInputType = WindowInputType::TRANSMIT_AXIS_MOVE;
2205 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2206 ASSERT_NE(pointerEvent, nullptr);
2207 PointerEvent::PointerItem item;
2208 item.SetPointerId(1);
2209 pointerEvent->AddPointerItem(item);
2210 pointerEvent->SetPointerId(1);
2211 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2212 }
2213
2214 /**
2215 * @tc.name: HandleWindowInputType_007
2216 * @tc.desc: Test the function HandleWindowInputType
2217 * @tc.type: FUNC
2218 * @tc.require:
2219 */
2220 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_007, TestSize.Level1)
2221 {
2222 CALL_TEST_DEBUG;
2223 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2224 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2225 ASSERT_NE(inputWindowsManager, nullptr);
2226 WindowInfo window;
2227 window.windowInputType = WindowInputType::TRANSMIT_MOUSE_MOVE;
2228 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2229 ASSERT_NE(pointerEvent, nullptr);
2230 PointerEvent::PointerItem item;
2231 item.SetPointerId(1);
2232 pointerEvent->AddPointerItem(item);
2233 pointerEvent->SetPointerId(1);
2234 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2235 }
2236
2237 /**
2238 * @tc.name: HandleWindowInputType_008
2239 * @tc.desc: Test the function HandleWindowInputType
2240 * @tc.type: FUNC
2241 * @tc.require:
2242 */
2243 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_008, TestSize.Level1)
2244 {
2245 CALL_TEST_DEBUG;
2246 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2247 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2248 ASSERT_NE(inputWindowsManager, nullptr);
2249 WindowInfo window;
2250 window.windowInputType = WindowInputType::TRANSMIT_LEFT_RIGHT;
2251 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2252 ASSERT_NE(pointerEvent, nullptr);
2253 PointerEvent::PointerItem item;
2254 item.SetPointerId(1);
2255 pointerEvent->AddPointerItem(item);
2256 pointerEvent->SetPointerId(1);
2257 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2258 }
2259
2260 /**
2261 * @tc.name: HandleWindowInputType_009
2262 * @tc.desc: Test the function HandleWindowInputType
2263 * @tc.type: FUNC
2264 * @tc.require:
2265 */
2266 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_009, TestSize.Level1)
2267 {
2268 CALL_TEST_DEBUG;
2269 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2270 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2271 ASSERT_NE(inputWindowsManager, nullptr);
2272 WindowInfo window;
2273 window.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2274 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2275 ASSERT_NE(pointerEvent, nullptr);
2276 PointerEvent::PointerItem item;
2277 item.SetPointerId(1);
2278 pointerEvent->AddPointerItem(item);
2279 pointerEvent->SetPointerId(1);
2280 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2281 }
2282
2283 /**
2284 * @tc.name: HandleWindowInputType_010
2285 * @tc.desc: Test the function HandleWindowInputType
2286 * @tc.type: FUNC
2287 * @tc.require:
2288 */
2289 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_010, TestSize.Level1)
2290 {
2291 CALL_TEST_DEBUG;
2292 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2293 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2294 ASSERT_NE(inputWindowsManager, nullptr);
2295 WindowInfo window;
2296 window.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2297 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2298 ASSERT_NE(pointerEvent, nullptr);
2299 PointerEvent::PointerItem item;
2300 item.SetPointerId(1);
2301 pointerEvent->AddPointerItem(item);
2302 pointerEvent->SetPointerId(1);
2303 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2304 }
2305
2306 /**
2307 * @tc.name: HandleWindowInputType_011
2308 * @tc.desc: Test the function HandleWindowInputType
2309 * @tc.type: FUNC
2310 * @tc.require:
2311 */
2312 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_011, TestSize.Level1)
2313 {
2314 CALL_TEST_DEBUG;
2315 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2316 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2317 ASSERT_NE(inputWindowsManager, nullptr);
2318 WindowInfo window;
2319 window.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE;
2320 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2321 ASSERT_NE(pointerEvent, nullptr);
2322 PointerEvent::PointerItem item;
2323 item.SetPointerId(1);
2324 pointerEvent->AddPointerItem(item);
2325 pointerEvent->SetPointerId(1);
2326 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2327 }
2328
2329 /**
2330 * @tc.name: HandleWindowInputType_012
2331 * @tc.desc: Test the function HandleWindowInputType
2332 * @tc.type: FUNC
2333 * @tc.require:
2334 */
2335 HWTEST_F(InputWindowsManagerTest, HandleWindowInputType_012, TestSize.Level1)
2336 {
2337 CALL_TEST_DEBUG;
2338 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2339 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2340 ASSERT_NE(inputWindowsManager, nullptr);
2341 WindowInfo window;
2342 window.windowInputType = static_cast<WindowInputType>(8);
2343 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2344 ASSERT_NE(pointerEvent, nullptr);
2345 PointerEvent::PointerItem item;
2346 item.SetPointerId(1);
2347 pointerEvent->AddPointerItem(item);
2348 pointerEvent->SetPointerId(1);
2349 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->HandleWindowInputType(window, pointerEvent));
2350 }
2351
2352 /**
2353 * @tc.name: DrawTouchGraphic_001
2354 * @tc.desc: Test the function DrawTouchGraphic
2355 * @tc.type: FUNC
2356 * @tc.require:
2357 */
2358 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_001, TestSize.Level1)
2359 {
2360 CALL_TEST_DEBUG;
2361 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2362 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2363 ASSERT_NE(inputWindowsManager, nullptr);
2364 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2365 ASSERT_NE(pointerEvent, nullptr);
2366
2367 inputWindowsManager->knuckleDrawMgr_ = nullptr;
2368 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
2369 }
2370
2371 /**
2372 * @tc.name: DrawTouchGraphic_002
2373 * @tc.desc: Test the function DrawTouchGraphic
2374 * @tc.type: FUNC
2375 * @tc.require:
2376 */
2377 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_002, TestSize.Level1)
2378 {
2379 CALL_TEST_DEBUG;
2380 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2381 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2382 ASSERT_NE(inputWindowsManager, nullptr);
2383 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2384 ASSERT_NE(pointerEvent, nullptr);
2385
2386 inputWindowsManager->knuckleDrawMgr_ = std::make_shared<KnuckleDrawingManager>();
2387 ASSERT_NE(inputWindowsManager->knuckleDrawMgr_, nullptr);
2388 inputWindowsManager->knuckleDynamicDrawingManager_ = nullptr;
2389 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
2390 }
2391
2392 /**
2393 * @tc.name: DrawTouchGraphic_003
2394 * @tc.desc: Test the function DrawTouchGraphic
2395 * @tc.type: FUNC
2396 * @tc.require:
2397 */
2398 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_003, TestSize.Level1)
2399 {
2400 CALL_TEST_DEBUG;
2401 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2402 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2403 ASSERT_NE(inputWindowsManager, nullptr);
2404 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2405 ASSERT_NE(pointerEvent, nullptr);
2406
2407 inputWindowsManager->knuckleDrawMgr_ = std::make_shared<KnuckleDrawingManager>();
2408 ASSERT_NE(inputWindowsManager->knuckleDrawMgr_, nullptr);
2409
2410 inputWindowsManager->knuckleDynamicDrawingManager_ = std::make_shared<KnuckleDynamicDrawingManager>();
2411 ASSERT_NE(inputWindowsManager->knuckleDynamicDrawingManager_, nullptr);
2412 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
2413 }
2414
2415 /**
2416 * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent
2417 * @tc.desc: Cover if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) branch
2418 * @tc.type: FUNC
2419 * @tc.require:
2420 */
2421 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent, TestSize.Level1)
2422 {
2423 CALL_TEST_DEBUG;
2424 std::shared_ptr<InputWindowsManager> inputWindowsMgr =
2425 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2426 ASSERT_NE(inputWindowsMgr, nullptr);
2427 std::shared_ptr<PointerEvent> pointer = PointerEvent::Create();
2428 ASSERT_NE(pointer, nullptr);
2429 int32_t logicalX = 500;
2430 int32_t logicalY = 500;
2431 WindowInfo windowInfo;
2432 pointer->SetPointerId(0);
2433 PointerEvent::PointerItem item;
2434 item.SetPointerId(1);
2435 pointer->AddPointerItem(item);
2436 EXPECT_NO_FATAL_FAILURE(inputWindowsMgr->SendUIExtentionPointerEvent(logicalX, logicalY, windowInfo, pointer));
2437 }
2438
2439 /**
2440 * @tc.name: InputWindowsManagerTest_GetPhysicalDisplayCoord_001
2441 * @tc.desc: Test the funcation GetPhysicalDisplayCoord
2442 * @tc.type: FUNC
2443 * @tc.require:
2444 */
2445 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoord_001, TestSize.Level1)
2446 {
2447 CALL_TEST_DEBUG;
2448 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2449 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2450 ASSERT_NE(inputWindowsManager, nullptr);
2451 libinput_event_touch touch {};
2452 DisplayInfo info;
2453 EventTouch touchInfo;
2454 info.direction = DIRECTION90;
2455 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2456 info.direction = DIRECTION270;
2457 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2458 info.direction = DIRECTION180;
2459 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo));
2460 }
2461
2462 /**
2463 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_006
2464 * @tc.desc: Test the function IsNeedRefreshLayer
2465 * @tc.type: FUNC
2466 * @tc.require:
2467 */
2468 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_006, TestSize.Level1)
2469 {
2470 CALL_TEST_DEBUG;
2471 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2472 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2473 ASSERT_NE(inputWindowsManager, nullptr);
2474 int32_t windowId = -1;
2475 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
2476 std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2477 EXPECT_NE(inputEvent, nullptr);
2478 inputEvent->targetDisplayId_ = -1;
2479 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2480 EXPECT_FALSE(ret);
2481 inputEvent->targetDisplayId_ = 2;
2482 DisplayInfo displayInfo;
2483 displayInfo.id = 2;
2484 displayInfo.x = 2;
2485 displayInfo.y = 3;
2486 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2487 ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2488 EXPECT_FALSE(ret);
2489 windowId = 5;
2490 ret = inputWindowsManager->IsNeedRefreshLayer(windowId);
2491 EXPECT_FALSE(ret);
2492 }
2493
2494 /**
2495 @tc.name: InputWindowsManagerTest_UpdateTransformDisplayXY_001
2496 * @tc.desc: Test the funcation UpdateTransformDisplayXY
2497 * @tc.type: FUNC
2498 * @tc.require:
2499 */
2500 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplayXY_001, TestSize.Level1)
2501 {
2502 CALL_TEST_DEBUG;
2503 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2504 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2505 ASSERT_NE(inputWindowsManager, nullptr);
2506 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2507 ASSERT_NE(pointerEvent, nullptr);
2508 std::vector<WindowInfo> windowsInfo;
2509 DisplayInfo displayInfo;
2510 pointerEvent->pointerId_ = 1;
2511 PointerEvent::PointerItem item;
2512 item.pointerId_ = 1;
2513 pointerEvent->pointers_.push_back(item);
2514 WindowInfo windowInfo;
2515 windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2516 item.displayX_ = 10;
2517 item.displayY_ = 20;
2518 Rect rect = {0, 0, 30, 40};
2519 windowInfo.defaultHotAreas.push_back(rect);
2520 windowsInfo.push_back(windowInfo);
2521 pointerEvent->bitwise_ = 1;
2522 pointerEvent->zOrder_ = -1.0f;
2523 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2524 pointerEvent->bitwise_ = 0;
2525 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2526 pointerEvent->bitwise_ = 0x00000200;
2527 pointerEvent->zOrder_ = 1.0f;
2528 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2529 pointerEvent->bitwise_ = 0x00000100;
2530 pointerEvent->zOrder_ = 1.0f;
2531 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdateTransformDisplayXY(pointerEvent, windowsInfo, displayInfo));
2532 }
2533
2534 /**
2535 * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_001
2536 * @tc.desc: Test the funcation SendUIExtentionPointerEvent
2537 * @tc.type: FUNC
2538 * @tc.require:
2539 */
2540 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_001, TestSize.Level1)
2541 {
2542 CALL_TEST_DEBUG;
2543 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2544 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2545 ASSERT_NE(inputWindowsManager, nullptr);
2546 int32_t logicalX = 100;
2547 int32_t logicalY = 200;
2548 WindowInfo windowInfo;
2549 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2550 ASSERT_NE(pointerEvent, nullptr);
2551 pointerEvent->pointerId_ = 1;
2552 PointerEvent::PointerItem item;
2553 item.pointerId_ = -1;
2554 pointerEvent->pointers_.push_back(item);
2555 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2556 (logicalX, logicalY, windowInfo, pointerEvent));
2557 item.pointerId_ = 1;
2558 pointerEvent->pointers_.push_back(item);
2559 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2560 (logicalX, logicalY, windowInfo, pointerEvent));
2561 windowInfo.id = 1;
2562 windowInfo.pid = 11;
2563 windowInfo.transform.push_back(1.1);
2564 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
2565 (logicalX, logicalY, windowInfo, pointerEvent));
2566 }
2567
2568 /**
2569 * @tc.name: InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001
2570 * @tc.desc: Test the funcation DispatchUIExtentionPointerEvent
2571 * @tc.type: FUNC
2572 * @tc.require:
2573 */
2574 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_DispatchUIExtentionPointerEvent_001, TestSize.Level1)
2575 {
2576 CALL_TEST_DEBUG;
2577 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2578 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2579 ASSERT_NE(inputWindowsManager, nullptr);
2580 int32_t logicalX = 400;
2581 int32_t logicalY = 600;
2582 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2583 ASSERT_NE(pointerEvent, nullptr);
2584 std::shared_ptr<InputEvent> inputEvent = InputEvent::Create();
2585 EXPECT_NE(inputEvent, nullptr);
2586 inputEvent->targetDisplayId_ = 2;
2587 PointerEvent::PointerItem pointerItem;
2588 pointerItem.targetWindowId_ = 2;
2589 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2590 pointerItem.targetWindowId_ = 3;
2591 WindowInfo windowInfo;
2592 windowInfo.id = 3;
2593 windowInfo.uiExtentionWindowInfo.push_back(windowInfo);
2594 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2595 pointerItem.targetWindowId_ = 6;
2596 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DispatchUIExtentionPointerEvent(logicalX, logicalY, pointerEvent));
2597 }
2598
2599 /**
2600 * @tc.name: InputWindowsManagerTest_SelectWindowInfo_001
2601 * @tc.desc: Test the funcation SelectWindowInfo
2602 * @tc.type: FUNC
2603 * @tc.require:
2604 */
2605 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_001, TestSize.Level1)
2606 {
2607 CALL_TEST_DEBUG;
2608 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2609 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2610 ASSERT_NE(inputWindowsManager, nullptr);
2611 int32_t logicalX = 10;
2612 int32_t logicalY = 20;
2613 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2614 EXPECT_NE(pointerEvent, nullptr);
2615 pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2616 inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
2617 PointerEvent::PointerItem pointerItem;
2618 pointerItem.targetWindowId_ = 2;
2619 inputWindowsManager->extraData_.appended = true;
2620 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE;
2621 WindowInfo windowInfo;
2622 windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2623 windowInfo.windowInputType = WindowInputType::MIX_LEFT_RIGHT_ANTI_AXIS_MOVE;
2624 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2625 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2626 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2627 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2628 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2629 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2630 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_IN_WINDOW);
2631 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2632 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW);
2633 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2634 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2635 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2636 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_LEAVE_WINDOW);
2637 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2638 pointerEvent->pressedButtons_.insert(1);
2639 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2640 windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2641 pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2642 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2643 inputWindowsManager->extraData_.appended = false;
2644 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2645 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2646 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2647 }
2648
2649 /**
2650 * @tc.name: InputWindowsManagerTest_SelectWindowInfo_002
2651 * @tc.desc: Test the funcation SelectWindowInfo
2652 * @tc.type: FUNC
2653 * @tc.require:
2654 */
2655 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectWindowInfo_002, TestSize.Level1)
2656 {
2657 CALL_TEST_DEBUG;
2658 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2659 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2660 ASSERT_NE(inputWindowsManager, nullptr);
2661 int32_t logicalX = 10;
2662 int32_t logicalY = 20;
2663 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2664 EXPECT_NE(pointerEvent, nullptr);
2665 pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_UP;
2666 inputWindowsManager->firstBtnDownWindowInfo_.first = -1;
2667 PointerEvent::PointerItem pointerItem;
2668 pointerItem.targetWindowId_ = 2;
2669 inputWindowsManager->extraData_.appended = false;
2670 inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD;
2671 WindowInfo windowInfo;
2672 windowInfo.pointerHotAreas.push_back({ 0, 0, 30, 40 });
2673 windowInfo.windowInputType = WindowInputType::TRANSMIT_BUTTOM;
2674 pointerEvent->pressedButtons_.insert(1);
2675 pointerEvent->pointerAction_ = PointerEvent::POINTER_ACTION_PULL_DOWN;
2676 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP);
2677 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2678 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN);
2679 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2680 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE);
2681 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2682 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
2683 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2684 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_ENTER_WINDOW);
2685 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2686 inputWindowsManager->firstBtnDownWindowInfo_.first = 1;
2687 pointerEvent->pressedButtons_.insert(2);
2688 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2689 inputWindowsManager->extraData_.appended = false;
2690 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SelectWindowInfo(logicalX, logicalY, pointerEvent));
2691 }
2692
2693 /**
2694 * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint
2695 * @tc.desc: Test the funcation TouchPointToDisplayPoint
2696 * @tc.type: FUNC
2697 * @tc.require:
2698 */
2699 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint, TestSize.Level1)
2700 {
2701 CALL_TEST_DEBUG;
2702 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2703 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2704 ASSERT_NE(inputWindowsManager, nullptr);
2705 int32_t deviceId = 10;
2706 libinput_event_touch touch {};
2707 EventTouch touchInfo;
2708 int32_t physicalDisplayId;
2709 inputWindowsManager->bindInfo_.AddDisplay(2, "abcdefg");
2710 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2711 (deviceId, &touch, touchInfo, physicalDisplayId));
2712 deviceId = 2;
2713 DisplayInfo displayInfo;
2714 displayInfo.width = -1;
2715 displayInfo.height = 3;
2716 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2717 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2718 (deviceId, &touch, touchInfo, physicalDisplayId));
2719 displayInfo.width = 3;
2720 displayInfo.height = -1;
2721 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2722 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2723 (deviceId, &touch, touchInfo, physicalDisplayId));
2724 displayInfo.width = -5;
2725 displayInfo.height = -6;
2726 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2727 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2728 (deviceId, &touch, touchInfo, physicalDisplayId));
2729 displayInfo.width = 3;
2730 displayInfo.height = 2;
2731 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2732 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint
2733 (deviceId, &touch, touchInfo, physicalDisplayId));
2734 }
2735
2736 /**
2737 * @tc.name: InputWindowsManagerTest_FoldScreenRotation
2738 * @tc.desc: Test the function FoldScreenRotation
2739 * @tc.type: FUNC
2740 * @tc.require:
2741 */
2742 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation, TestSize.Level1)
2743 {
2744 CALL_TEST_DEBUG;
2745 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2746 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2747 ASSERT_NE(inputWindowsManager, nullptr);
2748 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2749 ASSERT_NE(pointerEvent, nullptr);
2750 WindowInfoEX winInfoEx;
2751 pointerEvent->bitwise_ = 0x00000000;
2752 pointerEvent->SetPointerId(1);
2753 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2754 inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(2, winInfoEx));
2755 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2756 }
2757
2758 /**
2759 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_001
2760 * @tc.desc: Test the function FoldScreenRotation
2761 * @tc.type: FUNC
2762 * @tc.require:
2763 */
2764 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_001, TestSize.Level1)
2765 {
2766 CALL_TEST_DEBUG;
2767 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
2768 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2769 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2770 ASSERT_NE(inputWindowsManager, nullptr);
2771 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2772 ASSERT_NE(pointerEvent, nullptr);
2773 WindowInfoEX winInfoEx;
2774 DisplayInfo displayInfo;
2775 displayInfo.id = 10;
2776 pointerEvent->bitwise_ = 0x00000000;
2777 pointerEvent->SetPointerId(1);
2778 pointerEvent->SetTargetDisplayId(10);
2779 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2780 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2781 inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2782 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2783 }
2784
2785 /**
2786 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_002
2787 * @tc.desc: Test the function FoldScreenRotation
2788 * @tc.type: FUNC
2789 * @tc.require:
2790 */
2791 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_002, TestSize.Level1)
2792 {
2793 CALL_TEST_DEBUG;
2794 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2795 std::shared_ptr<InputWindowsManager> inputWindowsManager =
2796 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
2797 ASSERT_NE(inputWindowsManager, nullptr);
2798 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2799 ASSERT_NE(pointerEvent, nullptr);
2800 WindowInfoEX winInfoEx;
2801 DisplayInfo displayInfo;
2802 displayInfo.id = 10;
2803 pointerEvent->SetPointerId(1);
2804 pointerEvent->SetTargetDisplayId(10);
2805 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2806 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
2807 inputWindowsManager->touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2808 inputWindowsManager->lastDirection_ = std::make_pair(10, static_cast<Direction>(-1));
2809 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->FoldScreenRotation(pointerEvent));
2810 }
2811
2812 /**
2813 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_003
2814 * @tc.desc: Test the function FoldScreenRotation
2815 * @tc.type: FUNC
2816 * @tc.require:
2817 */
2818 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_003, TestSize.Level1)
2819 {
2820 CALL_TEST_DEBUG;
2821 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2822 InputWindowsManager inputWindowsManager;
2823 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2824 ASSERT_NE(pointerEvent, nullptr);
2825 PointerEvent::PointerItem item;
2826 DisplayInfo displayInfo;
2827 displayInfo.id = 10;
2828 displayInfo.direction = DIRECTION90;
2829 item.SetPointerId(2);
2830 pointerEvent->AddPointerItem(item);
2831 pointerEvent->SetPointerId(1);
2832 pointerEvent->SetTargetDisplayId(10);
2833 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2834 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2835 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2836 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2837 }
2838
2839 /**
2840 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_004
2841 * @tc.desc: Test the function FoldScreenRotation
2842 * @tc.type: FUNC
2843 * @tc.require:
2844 */
2845 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_004, TestSize.Level1)
2846 {
2847 CALL_TEST_DEBUG;
2848 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2849 InputWindowsManager inputWindowsManager;
2850 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2851 ASSERT_NE(pointerEvent, nullptr);
2852 PointerEvent::PointerItem item;
2853 DisplayInfo displayInfo;
2854 displayInfo.id = 10;
2855 displayInfo.direction = DIRECTION90;
2856 item.SetPointerId(1);
2857 item.SetPressed(false);
2858 pointerEvent->AddPointerItem(item);
2859 pointerEvent->SetPointerId(1);
2860 pointerEvent->SetTargetDisplayId(10);
2861 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2862 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2863 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2864 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2865 }
2866
2867 /**
2868 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_005
2869 * @tc.desc: Test the function FoldScreenRotation
2870 * @tc.type: FUNC
2871 * @tc.require:
2872 */
2873 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_005, TestSize.Level1)
2874 {
2875 CALL_TEST_DEBUG;
2876 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2877 InputWindowsManager inputWindowsManager;
2878 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2879 ASSERT_NE(pointerEvent, nullptr);
2880 PointerEvent::PointerItem item;
2881 DisplayInfo displayInfo;
2882 displayInfo.id = 10;
2883 displayInfo.direction = DIRECTION90;
2884 item.SetPointerId(1);
2885 item.SetPressed(true);
2886 pointerEvent->AddPointerItem(item);
2887 pointerEvent->SetPointerId(1);
2888 pointerEvent->SetTargetDisplayId(10);
2889 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
2890 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN);
2891 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2892 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2893 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2894 }
2895
2896 /**
2897 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_006
2898 * @tc.desc: Test the function FoldScreenRotation
2899 * @tc.type: FUNC
2900 * @tc.require:
2901 */
2902 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_006, TestSize.Level1)
2903 {
2904 CALL_TEST_DEBUG;
2905 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2906 InputWindowsManager inputWindowsManager;
2907 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2908 ASSERT_NE(pointerEvent, nullptr);
2909 PointerEvent::PointerItem item;
2910 WindowInfoEX winInfoEx;
2911 DisplayInfo displayInfo;
2912 displayInfo.id = 10;
2913 displayInfo.direction = DIRECTION90;
2914 item.SetPointerId(1);
2915 item.SetPressed(true);
2916 pointerEvent->bitwise_ = 0x00000000;
2917 pointerEvent->AddPointerItem(item);
2918 pointerEvent->SetPointerId(1);
2919 pointerEvent->SetTargetDisplayId(10);
2920 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
2921 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2922 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2923 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2924 inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2925 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2926 }
2927
2928 /**
2929 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_007
2930 * @tc.desc: Test the function FoldScreenRotation
2931 * @tc.type: FUNC
2932 * @tc.require:
2933 */
2934 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_007, TestSize.Level1)
2935 {
2936 CALL_TEST_DEBUG;
2937 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2938 InputWindowsManager inputWindowsManager;
2939 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2940 ASSERT_NE(pointerEvent, nullptr);
2941 PointerEvent::PointerItem item;
2942 WindowInfoEX winInfoEx;
2943 DisplayInfo displayInfo;
2944 displayInfo.id = 10;
2945 displayInfo.direction = DIRECTION90;
2946 item.SetPointerId(1);
2947 item.SetPressed(true);
2948 pointerEvent->bitwise_ = 0x00000080;
2949 pointerEvent->AddPointerItem(item);
2950 pointerEvent->SetPointerId(1);
2951 pointerEvent->SetTargetDisplayId(10);
2952 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2953 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2954 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2955 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2956 inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2957 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2958 }
2959
2960 /**
2961 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_008
2962 * @tc.desc: Test the function FoldScreenRotation
2963 * @tc.type: FUNC
2964 * @tc.require:
2965 */
2966 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_008, TestSize.Level1)
2967 {
2968 CALL_TEST_DEBUG;
2969 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
2970 InputWindowsManager inputWindowsManager;
2971 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
2972 ASSERT_NE(pointerEvent, nullptr);
2973 PointerEvent::PointerItem item;
2974 WindowInfoEX winInfoEx;
2975 DisplayInfo displayInfo;
2976 displayInfo.id = 10;
2977 displayInfo.direction = DIRECTION90;
2978 item.SetPointerId(1);
2979 item.SetPressed(true);
2980 pointerEvent->bitwise_ = 0x00000000;
2981 pointerEvent->AddPointerItem(item);
2982 pointerEvent->SetPointerId(1);
2983 pointerEvent->SetTargetDisplayId(10);
2984 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
2985 pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE);
2986 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION0);
2987 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
2988 inputWindowsManager.touchItemDownInfos_.insert(std::make_pair(1, winInfoEx));
2989 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
2990 }
2991
2992 /**
2993 * @tc.name: InputWindowsManagerTest_FoldScreenRotation_009
2994 * @tc.desc: Test the function FoldScreenRotation
2995 * @tc.type: FUNC
2996 * @tc.require:
2997 */
2998 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_009, TestSize.Level1)
2999 {
3000 CALL_TEST_DEBUG;
3001 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3002 InputWindowsManager inputWindowsManager;
3003 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3004 ASSERT_NE(pointerEvent, nullptr);
3005 PointerEvent::PointerItem item;
3006 DisplayInfo displayInfo;
3007 displayInfo.id = 10;
3008 displayInfo.direction = DIRECTION90;
3009 item.SetPointerId(1);
3010 pointerEvent->AddPointerItem(item);
3011 pointerEvent->SetPointerId(1);
3012 pointerEvent->SetTargetDisplayId(10);
3013 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN);
3014 inputWindowsManager.lastDirection_ = std::make_pair(10, DIRECTION90);
3015 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3016 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.FoldScreenRotation(pointerEvent));
3017 }
3018
3019 /**
3020 * @tc.name: InputWindowsManagerTest_RotateScreen
3021 * @tc.desc: Test the function RotateScreen
3022 * @tc.type: FUNC
3023 * @tc.require:
3024 */
3025 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen, TestSize.Level1)
3026 {
3027 CALL_TEST_DEBUG;
3028 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3029 InputWindowsManager inputWindowsManager;
3030 DisplayInfo info;
3031 PhysicalCoordinate coord;
3032 info.height = 500;
3033 coord.x = 200;
3034 info.direction = DIRECTION0;
3035 inputWindowsManager.cursorPos_.direction = DIRECTION90;
3036 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3037 }
3038
3039 /**
3040 * @tc.name: InputWindowsManagerTest_RotateScreen_001
3041 * @tc.desc: Test the function RotateScreen
3042 * @tc.type: FUNC
3043 * @tc.require:
3044 */
3045 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, TestSize.Level1)
3046 {
3047 CALL_TEST_DEBUG;
3048 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3049 InputWindowsManager inputWindowsManager;
3050 DisplayInfo info;
3051 PhysicalCoordinate coord;
3052 info.width = 500;
3053 coord.y = 200;
3054 info.direction = DIRECTION0;
3055 inputWindowsManager.cursorPos_.direction = DIRECTION270;
3056 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3057 }
3058
3059 /**
3060 * @tc.name: InputWindowsManagerTest_RotateScreen_002
3061 * @tc.desc: Test the function RotateScreen
3062 * @tc.type: FUNC
3063 * @tc.require:
3064 */
3065 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, TestSize.Level1)
3066 {
3067 CALL_TEST_DEBUG;
3068 InputWindowsManager inputWindowsManager;
3069 DisplayInfo info;
3070 PhysicalCoordinate coord;
3071 info.direction = static_cast<Direction>(10);
3072 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3073 }
3074
3075 /**
3076 * @tc.name: InputWindowsManagerTest_RotateScreen_003
3077 * @tc.desc: Verify if (cursorPos_.displayDirection != info.displayDirection && cursorPos_.direction != info.direction)
3078 * @tc.type: FUNC
3079 * @tc.require:
3080 */
3081 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, TestSize.Level1)
3082 {
3083 CALL_TEST_DEBUG;
3084 PhysicalCoordinate coord;
3085 DisplayInfo info;
3086 InputWindowsManager inputWindowsManager;
3087
3088 info.direction = DIRECTION0;
3089 info.displayDirection = DIRECTION0;
3090 inputWindowsManager.cursorPos_.displayDirection = DIRECTION270;
3091 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3092
3093 info.displayDirection = DIRECTION0;
3094 inputWindowsManager.cursorPos_.displayDirection = DIRECTION0;
3095 info.direction = DIRECTION0;
3096 inputWindowsManager.cursorPos_.direction = DIRECTION270;
3097 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3098
3099 info.displayDirection = DIRECTION0;
3100 inputWindowsManager.cursorPos_.displayDirection = DIRECTION0;
3101 info.direction = DIRECTION0;
3102 inputWindowsManager.cursorPos_.direction = DIRECTION0;
3103 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3104 }
3105
3106 /**
3107 * @tc.name: InputWindowsManagerTest_RotateScreen_004
3108 * @tc.desc: Verify if (cursorPos_.direction == Direction::DIRECTION90)
3109 * @tc.type: FUNC
3110 * @tc.require:
3111 */
3112 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_004, TestSize.Level1)
3113 {
3114 CALL_TEST_DEBUG;
3115 PhysicalCoordinate coord;
3116 DisplayInfo info;
3117 InputWindowsManager inputWindowsManager;
3118
3119 info.displayDirection = DIRECTION0;
3120 inputWindowsManager.cursorPos_.displayDirection = DIRECTION0;
3121 info.direction = DIRECTION0;
3122 inputWindowsManager.cursorPos_.direction = DIRECTION0;
3123
3124 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3125 }
3126
3127 /**
3128 * @tc.name: InputWindowsManagerTest_RotateScreen_005
3129 * @tc.desc: Verify if (cursorPos_.direction == Direction::DIRECTION90)
3130 * @tc.type: FUNC
3131 * @tc.require:
3132 */
3133 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_005, TestSize.Level1)
3134 {
3135 CALL_TEST_DEBUG;
3136 PhysicalCoordinate coord;
3137 DisplayInfo info;
3138 InputWindowsManager inputWindowsManager;
3139
3140 info.displayDirection = DIRECTION0;
3141 inputWindowsManager.cursorPos_.displayDirection = DIRECTION0;
3142 info.direction = DIRECTION90;
3143 inputWindowsManager.cursorPos_.direction = DIRECTION90;
3144
3145 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3146 }
3147
3148 /**
3149 * @tc.name: InputWindowsManagerTest_RotateScreen_006
3150 * @tc.desc: Verify else if (cursorPos_.direction == Direction::DIRECTION270)
3151 * @tc.type: FUNC
3152 * @tc.require:
3153 */
3154 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_006, TestSize.Level1)
3155 {
3156 CALL_TEST_DEBUG;
3157 PhysicalCoordinate coord;
3158 DisplayInfo info;
3159 InputWindowsManager inputWindowsManager;
3160
3161 info.displayDirection = DIRECTION0;
3162 inputWindowsManager.cursorPos_.displayDirection = DIRECTION0;
3163 info.direction = DIRECTION270;
3164 inputWindowsManager.cursorPos_.direction = DIRECTION270;
3165
3166 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3167 }
3168
3169 /**
3170 * @tc.name: InputWindowsManagerTest_RotateScreen_007
3171 * @tc.desc: Verify if (direction == DIRECTION90)
3172 * @tc.type: FUNC
3173 * @tc.require:
3174 */
3175 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_007, TestSize.Level1)
3176 {
3177 CALL_TEST_DEBUG;
3178 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3179 PhysicalCoordinate coord;
3180 DisplayInfo info;
3181 InputWindowsManager inputWindowsManager;
3182 info.direction = DIRECTION90;
3183 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3184 }
3185
3186 /**
3187 * @tc.name: InputWindowsManagerTest_RotateScreen_008
3188 * @tc.desc: Verify if (direction == DIRECTION90)
3189 * @tc.type: FUNC
3190 * @tc.require:
3191 */
3192 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_008, TestSize.Level1)
3193 {
3194 CALL_TEST_DEBUG;
3195 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3196 PhysicalCoordinate coord;
3197 DisplayInfo info;
3198 InputWindowsManager inputWindowsManager;
3199 info.direction = DIRECTION90;
3200 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3201 }
3202
3203 /**
3204 * @tc.name: InputWindowsManagerTest_RotateScreen_009
3205 * @tc.desc: Verify if (direction == DIRECTION180)
3206 * @tc.type: FUNC
3207 * @tc.require:
3208 */
3209 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_009, TestSize.Level1)
3210 {
3211 CALL_TEST_DEBUG;
3212 PhysicalCoordinate coord;
3213 DisplayInfo info;
3214 InputWindowsManager inputWindowsManager;
3215 info.direction = DIRECTION180;
3216 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3217 }
3218
3219 /**
3220 * @tc.name: InputWindowsManagerTest_RotateScreen_010
3221 * @tc.desc: Verify if (direction == DIRECTION270)
3222 * @tc.type: FUNC
3223 * @tc.require:
3224 */
3225 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_010, TestSize.Level1)
3226 {
3227 CALL_TEST_DEBUG;
3228 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3229 PhysicalCoordinate coord;
3230 DisplayInfo info;
3231 InputWindowsManager inputWindowsManager;
3232 info.direction = DIRECTION270;
3233 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3234 }
3235
3236 /**
3237 * @tc.name: InputWindowsManagerTest_RotateScreen_011
3238 * @tc.desc: Verify if (direction == DIRECTION270)
3239 * @tc.type: FUNC
3240 * @tc.require:
3241 */
3242 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_011, TestSize.Level1)
3243 {
3244 CALL_TEST_DEBUG;
3245 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3246 PhysicalCoordinate coord;
3247 DisplayInfo info;
3248 InputWindowsManager inputWindowsManager;
3249 info.direction = DIRECTION270;
3250 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord));
3251 }
3252
3253 /**
3254 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_001
3255 * @tc.desc: Verify if (displayDirection == DIRECTION0)
3256 * @tc.type: FUNC
3257 * @tc.require:
3258 */
3259 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_001, TestSize.Level1)
3260 {
3261 CALL_TEST_DEBUG;
3262 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3263 PhysicalCoordinate coord;
3264 DisplayInfo info;
3265 InputWindowsManager inputWindowsManager;
3266
3267 info.direction = DIRECTION0;
3268 info.displayDirection = DIRECTION0;
3269 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3270 }
3271
3272 /**
3273 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_002
3274 * @tc.desc: Verify if (displayDirection == DIRECTION90)
3275 * @tc.type: FUNC
3276 * @tc.require:
3277 */
3278 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_002, TestSize.Level1)
3279 {
3280 CALL_TEST_DEBUG;
3281 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3282 PhysicalCoordinate coord;
3283 DisplayInfo info;
3284 InputWindowsManager inputWindowsManager;
3285
3286 info.direction = DIRECTION90;
3287 info.displayDirection = DIRECTION0;
3288 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3289 }
3290
3291 /**
3292 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_003
3293 * @tc.desc: Verify if (displayDirection == DIRECTION90)
3294 * @tc.type: FUNC
3295 * @tc.require:
3296 */
3297 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_003, TestSize.Level1)
3298 {
3299 CALL_TEST_DEBUG;
3300 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3301 PhysicalCoordinate coord;
3302 DisplayInfo info;
3303 InputWindowsManager inputWindowsManager;
3304
3305 info.direction = DIRECTION90;
3306 info.displayDirection = DIRECTION0;
3307 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3308 }
3309
3310 /**
3311 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_004
3312 * @tc.desc: Verify if (displayDirection == DIRECTION180)
3313 * @tc.type: FUNC
3314 * @tc.require:
3315 */
3316 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_004, TestSize.Level1)
3317 {
3318 CALL_TEST_DEBUG;
3319 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3320 PhysicalCoordinate coord;
3321 DisplayInfo info;
3322 InputWindowsManager inputWindowsManager;
3323
3324 info.direction = DIRECTION180;
3325 info.displayDirection = DIRECTION0;
3326 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3327 }
3328
3329 /**
3330 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_005
3331 * @tc.desc: Verify if (displayDirection == DIRECTION180)
3332 * @tc.type: FUNC
3333 * @tc.require:
3334 */
3335 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_005, TestSize.Level1)
3336 {
3337 CALL_TEST_DEBUG;
3338 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3339 PhysicalCoordinate coord;
3340 DisplayInfo info;
3341 InputWindowsManager inputWindowsManager;
3342
3343 info.direction = DIRECTION180;
3344 info.displayDirection = DIRECTION0;
3345 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3346 }
3347
3348 /**
3349 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_006
3350 * @tc.desc: Verify if (displayDirection == DIRECTION270)
3351 * @tc.type: FUNC
3352 * @tc.require:
3353 */
3354 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_006, TestSize.Level1)
3355 {
3356 CALL_TEST_DEBUG;
3357 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3358 PhysicalCoordinate coord;
3359 DisplayInfo info;
3360 InputWindowsManager inputWindowsManager;
3361
3362 info.direction = DIRECTION270;
3363 info.displayDirection = DIRECTION0;
3364 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3365 }
3366
3367 /**
3368 * @tc.name: InputWindowsManagerTest_RotateDisplayScreen_007
3369 * @tc.desc: Verify if (displayDirection == DIRECTION270)
3370 * @tc.type: FUNC
3371 * @tc.require:
3372 */
3373 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_007, TestSize.Level1)
3374 {
3375 CALL_TEST_DEBUG;
3376 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3377 PhysicalCoordinate coord;
3378 DisplayInfo info;
3379 InputWindowsManager inputWindowsManager;
3380
3381 info.direction = DIRECTION270;
3382 info.displayDirection = DIRECTION0;
3383 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateDisplayScreen(info, coord));
3384 }
3385
3386 /**
3387 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer
3388 * @tc.desc: Test the function IsNeedRefreshLayer
3389 * @tc.type: FUNC
3390 * @tc.require:
3391 */
3392 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer, TestSize.Level1)
3393 {
3394 CALL_TEST_DEBUG;
3395 int32_t displayId = -1;
3396 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3397 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3398 InputWindowsManager inputWindowsManager;
3399 int32_t windowId = 10;
3400 DisplayInfo displayInfo;
3401 WindowInfo winInfo;
3402 displayInfo.id = 100;
3403 displayInfo.x = 200;
3404 displayInfo.y = 200;
3405 winInfo.flags = 0;
3406 winInfo.id = 10;
3407 inputWindowsManager.mouseLocation_.displayId = 80;
3408 inputWindowsManager.mouseLocation_.physicalX = 100;
3409 inputWindowsManager.mouseLocation_.physicalY = 100;
3410 winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3411 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3412 inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
3413 EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3414 }
3415
3416 /**
3417 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_007
3418 * @tc.desc: Test the function IsNeedRefreshLayer
3419 * @tc.type: FUNC
3420 * @tc.require:
3421 */
3422 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_007, TestSize.Level1)
3423 {
3424 CALL_TEST_DEBUG;
3425 int32_t displayId = -1;
3426 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3427 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3428 InputWindowsManager inputWindowsManager;
3429 int32_t windowId = -1;
3430 DisplayInfo displayInfo;
3431 WindowInfo winInfo;
3432 displayInfo.id = 100;
3433 displayInfo.x = 200;
3434 displayInfo.y = 200;
3435 winInfo.flags = 0;
3436 winInfo.id = 10;
3437 inputWindowsManager.mouseLocation_.displayId = 80;
3438 inputWindowsManager.mouseLocation_.physicalX = 100;
3439 inputWindowsManager.mouseLocation_.physicalY = 100;
3440 winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3441 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3442 inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
3443 EXPECT_TRUE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3444 }
3445
3446 /**
3447 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_008
3448 * @tc.desc: Test the function IsNeedRefreshLayer
3449 * @tc.type: FUNC
3450 * @tc.require:
3451 */
3452 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_008, TestSize.Level1)
3453 {
3454 CALL_TEST_DEBUG;
3455 int32_t displayId = -1;
3456 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3457 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3458 InputWindowsManager inputWindowsManager;
3459 int32_t windowId = 50;
3460 DisplayInfo displayInfo;
3461 WindowInfo winInfo;
3462 displayInfo.id = 100;
3463 displayInfo.x = 200;
3464 displayInfo.y = 200;
3465 winInfo.flags = 0;
3466 winInfo.id = 10;
3467 inputWindowsManager.mouseLocation_.displayId = 80;
3468 inputWindowsManager.mouseLocation_.physicalX = 100;
3469 inputWindowsManager.mouseLocation_.physicalY = 100;
3470 winInfo.pointerHotAreas.push_back({ 100, 100, 1000, 1000 });
3471 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3472 inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
3473 EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3474 }
3475
3476 /**
3477 * @tc.name: InputWindowsManagerTest_IsNeedRefreshLayer_009
3478 * @tc.desc: Test the function IsNeedRefreshLayer
3479 * @tc.type: FUNC
3480 * @tc.require:
3481 */
3482 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_009, TestSize.Level1)
3483 {
3484 CALL_TEST_DEBUG;
3485 int32_t displayId = -1;
3486 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3487 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId));
3488 InputWindowsManager inputWindowsManager;
3489 int32_t windowId = 50;
3490 DisplayInfo displayInfo;
3491 WindowInfo winInfo;
3492 displayInfo.id = 100;
3493 displayInfo.x = 200;
3494 displayInfo.y = 200;
3495 winInfo.flags = 0;
3496 inputWindowsManager.mouseLocation_.displayId = 80;
3497 inputWindowsManager.mouseLocation_.physicalX = 100;
3498 inputWindowsManager.mouseLocation_.physicalY = 100;
3499 winInfo.pointerHotAreas.push_back({ 100, 100, INT32_MAX, 1000 });
3500 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3501 inputWindowsManager.displayGroupInfo_.windowsInfo.push_back(winInfo);
3502 EXPECT_FALSE(inputWindowsManager.IsNeedRefreshLayer(windowId));
3503 }
3504
3505 /**
3506 * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation
3507 * @tc.desc: Test the funcation AdjustDisplayRotation
3508 * @tc.type: FUNC
3509 * @tc.require:
3510 */
3511 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation, TestSize.Level1)
3512 {
3513 CALL_TEST_DEBUG;
3514 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3515 std::shared_ptr<InputWindowsManager> inputWindowsManager =
3516 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3517 DisplayInfo displayInfo;
3518 displayInfo.id = 100;
3519 displayInfo.direction = DIRECTION90;
3520 inputWindowsManager->cursorPos_.displayId = 100;
3521 inputWindowsManager->cursorPos_.direction = DIRECTION0;
3522 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
3523 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3524 }
3525
3526 /**
3527 * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_001
3528 * @tc.desc: Test the funcation AdjustDisplayRotation
3529 * @tc.type: FUNC
3530 * @tc.require:
3531 */
3532 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_001, TestSize.Level1)
3533 {
3534 CALL_TEST_DEBUG;
3535 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false));
3536 std::shared_ptr<InputWindowsManager> inputWindowsManager =
3537 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3538 DisplayInfo displayInfo;
3539 displayInfo.id = 100;
3540 displayInfo.direction = DIRECTION90;
3541 inputWindowsManager->cursorPos_.displayId = 100;
3542 inputWindowsManager->cursorPos_.direction = DIRECTION90;
3543 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
3544 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->AdjustDisplayRotation());
3545 }
3546
3547 /**
3548 * @tc.name: InputWindowsManagerTest_AdjustDisplayRotation_002
3549 * @tc.desc: Test the funcation AdjustDisplayRotation
3550 * @tc.type: FUNC
3551 * @tc.require:
3552 */
3553 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_002, TestSize.Level1)
3554 {
3555 CALL_TEST_DEBUG;
3556 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
3557 InputWindowsManager inputWindowsManager;
3558 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.AdjustDisplayRotation());
3559 }
3560
3561 /**
3562 * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_001
3563 * @tc.desc: Test the funcation TouchPointToDisplayPoint
3564 * @tc.type: FUNC
3565 * @tc.require:
3566 */
3567 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_001, TestSize.Level1)
3568 {
3569 CALL_TEST_DEBUG;
3570 std::string uniq = "uniq";
3571 EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3572 InputWindowsManager inputWindowsManager;
3573 DisplayInfo displayInfo;
3574 int32_t deviceId = 100;
3575 libinput_event_touch touch {};
3576 EventTouch touchInfo;
3577 int32_t physicalDisplayId = 200;
3578 displayInfo.id = 100;
3579 displayInfo.uniq = "uniq";
3580 displayInfo.width = -1;
3581 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3582 EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3583 }
3584
3585 /**
3586 * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_002
3587 * @tc.desc: Test the funcation TouchPointToDisplayPoint
3588 * @tc.type: FUNC
3589 * @tc.require:
3590 */
3591 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_002, TestSize.Level1)
3592 {
3593 CALL_TEST_DEBUG;
3594 std::string uniq = "uniq";
3595 EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3596 InputWindowsManager inputWindowsManager;
3597 DisplayInfo displayInfo;
3598 int32_t deviceId = 100;
3599 libinput_event_touch touch {};
3600 EventTouch touchInfo;
3601 int32_t physicalDisplayId = 200;
3602 displayInfo.id = 100;
3603 displayInfo.uniq = "uniq";
3604 displayInfo.width = 100;
3605 displayInfo.height = -1;
3606 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3607 EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3608 }
3609
3610 /**
3611 * @tc.name: InputWindowsManagerTest_TouchPointToDisplayPoint_003
3612 * @tc.desc: Test the funcation TouchPointToDisplayPoint
3613 * @tc.type: FUNC
3614 * @tc.require:
3615 */
3616 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoint_003, TestSize.Level1)
3617 {
3618 CALL_TEST_DEBUG;
3619 std::string uniq = "uniq";
3620 EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq));
3621 InputWindowsManager inputWindowsManager;
3622 DisplayInfo displayInfo;
3623 int32_t deviceId = 100;
3624 libinput_event_touch touch {};
3625 EventTouch touchInfo;
3626 int32_t physicalDisplayId = 200;
3627 displayInfo.id = 100;
3628 displayInfo.uniq = "uniq";
3629 displayInfo.width = 100;
3630 displayInfo.height = 100;
3631 displayInfo.validWidth = displayInfo.width;
3632 displayInfo.validHeight = displayInfo.height;
3633 inputWindowsManager.displayGroupInfo_.displaysInfo.push_back(displayInfo);
3634 EXPECT_FALSE(inputWindowsManager.TouchPointToDisplayPoint(deviceId, &touch, touchInfo, physicalDisplayId));
3635 }
3636
3637 /**
3638 * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo
3639 * @tc.desc: Test the funcation UpdateDisplayInfo
3640 * @tc.type: FUNC
3641 * @tc.require:
3642 */
3643 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo, TestSize.Level1)
3644 {
3645 CALL_TEST_DEBUG;
3646 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(true));
3647 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3648 InputWindowsManager inputWindowsManager;
3649 DisplayGroupInfo displayGroupInfo;
3650 DisplayInfo displayInfo;
3651 WindowInfo winInfo;
3652 winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN;
3653 displayGroupInfo.windowsInfo.push_back(winInfo);
3654 displayGroupInfo.displaysInfo.push_back(displayInfo);
3655 displayGroupInfo.currentUserId = 100;
3656 inputWindowsManager.currentUserId_ = 200;
3657 inputWindowsManager.pointerDrawFlag_ = true;
3658 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfo(displayGroupInfo));
3659 }
3660
3661 /**
3662 * @tc.name: InputWindowsManagerTest_UpdateDisplayInfo_001
3663 * @tc.desc: Test the funcation UpdateDisplayInfo
3664 * @tc.type: FUNC
3665 * @tc.require:
3666 */
3667 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_001, TestSize.Level1)
3668 {
3669 CALL_TEST_DEBUG;
3670 EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(false));
3671 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3672 InputWindowsManager inputWindowsManager;
3673 DisplayGroupInfo displayGroupInfo;
3674 DisplayInfo displayInfo;
3675 WindowInfo winInfo;
3676 winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN;
3677 displayGroupInfo.windowsInfo.push_back(winInfo);
3678 displayGroupInfo.displaysInfo.push_back(displayInfo);
3679 displayGroupInfo.currentUserId = 100;
3680 inputWindowsManager.currentUserId_ = 200;
3681 inputWindowsManager.pointerDrawFlag_ = true;
3682 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdateDisplayInfo(displayGroupInfo));
3683 }
3684
3685 /**
3686 * @tc.name: InputWindowsManagerTest_SetPointerStyle
3687 * @tc.desc: Test the funcation SetPointerStyle
3688 * @tc.type: FUNC
3689 * @tc.require:
3690 */
3691 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPointerStyle, TestSize.Level1)
3692 {
3693 CALL_TEST_DEBUG;
3694 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3695 InputWindowsManager inputWindowsManager;
3696 int32_t pid = 100;
3697 int32_t windowId = 100;
3698 PointerStyle pointerStyle;
3699 bool isUiExtension = false;
3700 EXPECT_NE(inputWindowsManager.SetPointerStyle(pid, windowId, pointerStyle, isUiExtension), RET_OK);
3701 }
3702
3703 /**
3704 * @tc.name: InputWindowsManagerTest_IsInHotArea
3705 * @tc.desc: Test the funcation IsInHotArea
3706 * @tc.type: FUNC
3707 * @tc.require:
3708 */
3709 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea, TestSize.Level1)
3710 {
3711 CALL_TEST_DEBUG;
3712 InputWindowsManager inputWindowsManager;
3713 int32_t x = 10;
3714 int32_t y = 300;
3715 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3716 WindowInfo window;
3717 EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3718 }
3719
3720 /**
3721 * @tc.name: InputWindowsManagerTest_IsInHotArea_001
3722 * @tc.desc: Test the funcation IsInHotArea
3723 * @tc.type: FUNC
3724 * @tc.require:
3725 */
3726 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_001, TestSize.Level1)
3727 {
3728 CALL_TEST_DEBUG;
3729 InputWindowsManager inputWindowsManager;
3730 int32_t x = 300;
3731 int32_t y = 300;
3732 std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
3733 WindowInfo window;
3734 EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3735 }
3736
3737 /**
3738 * @tc.name: InputWindowsManagerTest_IsInHotArea_002
3739 * @tc.desc: Test the funcation IsInHotArea
3740 * @tc.type: FUNC
3741 * @tc.require:
3742 */
3743 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_002, TestSize.Level1)
3744 {
3745 CALL_TEST_DEBUG;
3746 InputWindowsManager inputWindowsManager;
3747 int32_t x = 300;
3748 int32_t y = 10;
3749 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3750 WindowInfo window;
3751 EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3752 }
3753
3754 /**
3755 * @tc.name: InputWindowsManagerTest_IsInHotArea_003
3756 * @tc.desc: Test the funcation IsInHotArea
3757 * @tc.type: FUNC
3758 * @tc.require:
3759 */
3760 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInHotArea_003, TestSize.Level1)
3761 {
3762 CALL_TEST_DEBUG;
3763 InputWindowsManager inputWindowsManager;
3764 int32_t x = 300;
3765 int32_t y = 300;
3766 std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
3767 WindowInfo window;
3768 EXPECT_FALSE(inputWindowsManager.IsInHotArea(x, y, rects, window));
3769 }
3770
3771 /**
3772 * @tc.name: InputWindowsManagerTest_InWhichHotArea
3773 * @tc.desc: Test the funcation InWhichHotArea
3774 * @tc.type: FUNC
3775 * @tc.require:
3776 */
3777 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea, TestSize.Level1)
3778 {
3779 CALL_TEST_DEBUG;
3780 InputWindowsManager inputWindowsManager;
3781 int32_t x = 50;
3782 int32_t y = 300;
3783 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3784 PointerStyle pointerStyle;
3785 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3786 }
3787
3788 /**
3789 * @tc.name: InputWindowsManagerTest_InWhichHotArea_001
3790 * @tc.desc: Test the funcation InWhichHotArea
3791 * @tc.type: FUNC
3792 * @tc.require:
3793 */
3794 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_001, TestSize.Level1)
3795 {
3796 CALL_TEST_DEBUG;
3797 InputWindowsManager inputWindowsManager;
3798 int32_t x = 300;
3799 int32_t y = 300;
3800 std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
3801 PointerStyle pointerStyle;
3802 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3803 }
3804
3805 /**
3806 * @tc.name: InputWindowsManagerTest_InWhichHotArea_002
3807 * @tc.desc: Test the funcation InWhichHotArea
3808 * @tc.type: FUNC
3809 * @tc.require:
3810 */
3811 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_002, TestSize.Level1)
3812 {
3813 CALL_TEST_DEBUG;
3814 InputWindowsManager inputWindowsManager;
3815 int32_t x = 300;
3816 int32_t y = 50;
3817 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3818 PointerStyle pointerStyle;
3819 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3820 }
3821
3822 /**
3823 * @tc.name: InputWindowsManagerTest_InWhichHotArea_003
3824 * @tc.desc: Test the funcation InWhichHotArea
3825 * @tc.type: FUNC
3826 * @tc.require:
3827 */
3828 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_003, TestSize.Level1)
3829 {
3830 CALL_TEST_DEBUG;
3831 InputWindowsManager inputWindowsManager;
3832 int32_t x = 300;
3833 int32_t y = 300;
3834 std::vector<Rect> rects = { { 100, 100, 1000, 100 } };
3835 PointerStyle pointerStyle;
3836 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects, pointerStyle));
3837 }
3838
3839 /**
3840 * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas
3841 * @tc.desc: Test the funcation UpdatePointerChangeAreas
3842 * @tc.type: FUNC
3843 * @tc.require:
3844 */
3845 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas, TestSize.Level1)
3846 {
3847 CALL_TEST_DEBUG;
3848 InputWindowsManager inputWindowsManager;
3849 DisplayGroupInfo displayGroupInfo;
3850 WindowInfo winInfo;
3851 winInfo.id = 100;
3852 winInfo.area;
3853 displayGroupInfo.windowsInfo.push_back(winInfo);
3854 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerChangeAreas(displayGroupInfo));
3855 }
3856
3857 /**
3858 * @tc.name: InputWindowsManagerTest_UpdatePointerChangeAreas_001
3859 * @tc.desc: Test the funcation UpdatePointerChangeAreas
3860 * @tc.type: FUNC
3861 * @tc.require:
3862 */
3863 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_001, TestSize.Level1)
3864 {
3865 CALL_TEST_DEBUG;
3866 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3867 InputWindowsManager inputWindowsManager;
3868 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.UpdatePointerChangeAreas());
3869 }
3870
3871 /**
3872 * @tc.name: InputWindowsManagerTest_GetWidthAndHeight
3873 * @tc.desc: Test the funcation GetWidthAndHeight
3874 * @tc.type: FUNC
3875 * @tc.require:
3876 */
3877 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight, TestSize.Level1)
3878 {
3879 CALL_TEST_DEBUG;
3880 EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true));
3881 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3882 InputWindowsManager inputWindowsManager;
3883 DisplayInfo displayInfo;
3884 int32_t width = 300;
3885 int32_t height = 300;
3886 displayInfo.direction = DIRECTION90;
3887 EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetWidthAndHeight(&displayInfo, width, height));
3888 }
3889
3890 /**
3891 * @tc.name: InputWindowsManagerTest_InWhichHotArea_004
3892 * @tc.desc: Test the funcation InWhichHotArea
3893 * @tc.type: FUNC
3894 * @tc.require:
3895 */
3896 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_004, TestSize.Level1)
3897 {
3898 CALL_TEST_DEBUG;
3899 InputWindowsManager inputWindowsManager;
3900 int32_t x = 50;
3901 int32_t y = 300;
3902 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3903 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
3904 }
3905
3906 /**
3907 * @tc.name: InputWindowsManagerTest_InWhichHotArea_005
3908 * @tc.desc: Test the funcation InWhichHotArea
3909 * @tc.type: FUNC
3910 * @tc.require:
3911 */
3912 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_005, TestSize.Level1)
3913 {
3914 CALL_TEST_DEBUG;
3915 InputWindowsManager inputWindowsManager;
3916 int32_t x = 300;
3917 int32_t y = 300;
3918 std::vector<Rect> rects = { { 100, 100, 100, 1000 } };
3919 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
3920 }
3921
3922 /**
3923 * @tc.name: InputWindowsManagerTest_InWhichHotArea_006
3924 * @tc.desc: Test the funcation InWhichHotArea
3925 * @tc.type: FUNC
3926 * @tc.require:
3927 */
3928 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_006, TestSize.Level1)
3929 {
3930 CALL_TEST_DEBUG;
3931 InputWindowsManager inputWindowsManager;
3932 int32_t x = 300;
3933 int32_t y = 50;
3934 std::vector<Rect> rects = { { 100, 100, 1000, 1000 } };
3935 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
3936 }
3937
3938 /**
3939 * @tc.name: InputWindowsManagerTest_InWhichHotArea_007
3940 * @tc.desc: Test the funcation InWhichHotArea
3941 * @tc.type: FUNC
3942 * @tc.require:
3943 */
3944 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_007, TestSize.Level1)
3945 {
3946 CALL_TEST_DEBUG;
3947 InputWindowsManager inputWindowsManager;
3948 int32_t x = 300;
3949 int32_t y = 300;
3950 std::vector<Rect> rects = { { 100, 100, 1000, 100 } };
3951 EXPECT_FALSE(inputWindowsManager.InWhichHotArea(x, y, rects));
3952 }
3953
3954 /**
3955 * @tc.name: DrawTouchGraphic_004
3956 * @tc.desc: Test the function DrawTouchGraphic
3957 * @tc.type: FUNC
3958 * @tc.require:
3959 */
3960 HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_004, TestSize.Level1)
3961 {
3962 CALL_TEST_DEBUG;
3963 std::shared_ptr<InputWindowsManager> inputWindowsManager =
3964 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3965 ASSERT_NE(inputWindowsManager, nullptr);
3966 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
3967 ASSERT_NE(pointerEvent, nullptr);
3968 int32_t displayId = 10;
3969 pointerEvent->SetTargetDisplayId(displayId);
3970
3971 DisplayInfo displayInfo;
3972 displayInfo.id = 10;
3973 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
3974
3975 inputWindowsManager->knuckleDrawMgr_ = nullptr;
3976 inputWindowsManager->knuckleDynamicDrawingManager_ = nullptr;
3977
3978 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->DrawTouchGraphic(pointerEvent));
3979 }
3980
3981 /**
3982 * @tc.name: SetWindowStateNotifyPid_001
3983 * @tc.desc: Test the function DrawTouchGraphic
3984 * @tc.type: FUNC
3985 * @tc.require:
3986 */
3987 HWTEST_F(InputWindowsManagerTest, SetWindowStateNotifyPid_001, TestSize.Level1)
3988 {
3989 CALL_TEST_DEBUG;
3990 std::shared_ptr<InputWindowsManager> inputWindowsManager =
3991 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
3992 ASSERT_NE(inputWindowsManager, nullptr);
3993
3994 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false));
3995 int32_t pid = 0;
3996 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SetWindowStateNotifyPid(pid));
3997
3998 EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true));
3999 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SetWindowStateNotifyPid(pid));
4000 }
4001
4002 /**
4003 * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_002
4004 * @tc.desc: Test the funcation SendUIExtentionPointerEvent
4005 * @tc.type: FUNC
4006 * @tc.require:
4007 */
4008 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_002, TestSize.Level1)
4009 {
4010 CALL_TEST_DEBUG;
4011 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
4012 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
4013 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
4014 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(false));
4015 std::shared_ptr<InputWindowsManager> inputWindowsManager =
4016 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4017 ASSERT_NE(inputWindowsManager, nullptr);
4018 int32_t logicalX = 100;
4019 int32_t logicalY = 200;
4020
4021 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4022 ASSERT_NE(pointerEvent, nullptr);
4023 pointerEvent->pointerId_ = 1;
4024 PointerEvent::PointerItem item;
4025 item.pointerId_ = 1;
4026 pointerEvent->pointers_.push_back(item);
4027 int32_t displayId = 10;
4028 pointerEvent->SetTargetDisplayId(displayId);
4029
4030 WindowInfo windowInfo;
4031 windowInfo.id = 1;
4032 windowInfo.pid = 11;
4033 windowInfo.transform.push_back(1.1);
4034
4035 DisplayInfo displayInfo;
4036 displayInfo.id = 10;
4037 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
4038
4039 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
4040 (logicalX, logicalY, windowInfo, pointerEvent));
4041 }
4042
4043 /**
4044 * @tc.name: InputWindowsManagerTest_SendUIExtentionPointerEvent_003
4045 * @tc.desc: Test the funcation SendUIExtentionPointerEvent
4046 * @tc.type: FUNC
4047 * @tc.require:
4048 */
4049 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointerEvent_003, TestSize.Level1)
4050 {
4051 CALL_TEST_DEBUG;
4052 EXPECT_CALL(*messageParcelMock_, GetClientFd(_)).WillOnce(Return(1));
4053 SessionPtr session = std::make_shared<UDSSession>(PROGRAM_NAME, MODULE_TYPE, UDS_FD, UDS_UID, UDS_PID);
4054 EXPECT_CALL(*messageParcelMock_, GetSession(_)).WillOnce(Return(session));
4055 EXPECT_CALL(*messageParcelMock_, SendMsg(_)).WillOnce(Return(true));
4056 std::shared_ptr<InputWindowsManager> inputWindowsManager =
4057 std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
4058 ASSERT_NE(inputWindowsManager, nullptr);
4059 int32_t logicalX = 100;
4060 int32_t logicalY = 200;
4061
4062 std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
4063 ASSERT_NE(pointerEvent, nullptr);
4064 pointerEvent->pointerId_ = 1;
4065 PointerEvent::PointerItem item;
4066 item.pointerId_ = 1;
4067 pointerEvent->pointers_.push_back(item);
4068 int32_t displayId = 10;
4069 pointerEvent->SetTargetDisplayId(displayId);
4070
4071 WindowInfo windowInfo;
4072 windowInfo.id = 1;
4073 windowInfo.pid = 11;
4074 windowInfo.transform.push_back(1.1);
4075
4076 DisplayInfo displayInfo;
4077 displayInfo.id = 10;
4078 inputWindowsManager->displayGroupInfo_.displaysInfo.push_back(displayInfo);
4079
4080 EXPECT_NO_FATAL_FAILURE(inputWindowsManager->SendUIExtentionPointerEvent
4081 (logicalX, logicalY, windowInfo, pointerEvent));
4082 }
4083 } // namespace MMI
4084 } // namespace OHOS