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 <cstdio>
17 #include <gtest/gtest.h>
18 
19 #include "general_mouse.h"
20 #include "mouse_transform_processor.h"
21 #include "window_info.h"
22 #include "mouse_device_state.h"
23 #include "virtual_mouse.h"
24 #include "input_device_manager.h"
25 #include "input_windows_manager.h"
26 #include "i_input_windows_manager.h"
27 #include "libinput_wrapper.h"
28 
29 namespace OHOS {
30 namespace MMI {
31 namespace {
32 using namespace testing::ext;
33 constexpr int32_t BTN_RIGHT_MENUE_CODE = 0x118;
34 constexpr int32_t HARD_PC_PRO_DEVICE_WIDTH = 2880;
35 constexpr int32_t HARD_PC_PRO_DEVICE_HEIGHT = 1920;
36 }
37 class MouseTransformProcessorTest : public testing::Test {
38 public:
39     static void SetUpTestCase(void);
40     static void TearDownTestCase(void);
41     static void SetupMouse();
42     static void CloseMouse();
43     void SetUp();
44     void TearDown();
45 
46 private:
47     static GeneralMouse vMouse_;
48     static LibinputWrapper libinput_;
49 
50     MouseTransformProcessor g_processor_ { 0 };
51     int32_t prePointerSpeed_ { 5 };
52     int32_t prePrimaryButton_ { 0 };
53     int32_t preScrollRows_ { 3 };
54     int32_t preTouchpadPointerSpeed_ { 9 };
55     int32_t preRightClickType_ { 1 };
56     bool preScrollSwitch_ { true };
57     bool preScrollDirection_ { true };
58     bool preTapSwitch_ { true };
59 };
60 
61 GeneralMouse MouseTransformProcessorTest::vMouse_;
62 LibinputWrapper MouseTransformProcessorTest::libinput_;
63 
SetUpTestCase(void)64 void MouseTransformProcessorTest::SetUpTestCase(void)
65 {
66     ASSERT_TRUE(libinput_.Init());
67     SetupMouse();
68 }
69 
TearDownTestCase(void)70 void MouseTransformProcessorTest::TearDownTestCase(void)
71 {
72     CloseMouse();
73 }
74 
SetupMouse()75 void MouseTransformProcessorTest::SetupMouse()
76 {
77     ASSERT_TRUE(vMouse_.SetUp());
78     std::cout << "device node name: " << vMouse_.GetDevPath() << std::endl;
79     ASSERT_TRUE(libinput_.AddPath(vMouse_.GetDevPath()));
80 
81     libinput_event *event = libinput_.Dispatch();
82     ASSERT_TRUE(event != nullptr);
83     ASSERT_EQ(libinput_event_get_type(event), LIBINPUT_EVENT_DEVICE_ADDED);
84     struct libinput_device *device = libinput_event_get_device(event);
85     ASSERT_TRUE(device != nullptr);
86     INPUT_DEV_MGR->OnInputDeviceAdded(device);
87 }
88 
CloseMouse()89 void MouseTransformProcessorTest::CloseMouse()
90 {
91     libinput_.RemovePath(vMouse_.GetDevPath());
92     vMouse_.Close();
93 }
94 
SetUp()95 void MouseTransformProcessorTest::SetUp()
96 {
97     prePointerSpeed_ = g_processor_.GetPointerSpeed();
98     prePrimaryButton_ = g_processor_.GetMousePrimaryButton();
99     preScrollRows_ = g_processor_.GetMouseScrollRows();
100     g_processor_.GetTouchpadPointerSpeed(preTouchpadPointerSpeed_);
101     g_processor_.GetTouchpadRightClickType(preRightClickType_);
102     g_processor_.GetTouchpadScrollSwitch(preScrollSwitch_);
103     g_processor_.GetTouchpadScrollDirection(preScrollDirection_);
104     g_processor_.GetTouchpadTapSwitch(preTapSwitch_);
105 }
106 
TearDown()107 void MouseTransformProcessorTest::TearDown()
108 {
109     g_processor_.SetPointerSpeed(prePointerSpeed_);
110     g_processor_.SetMousePrimaryButton(prePrimaryButton_);
111     g_processor_.SetMouseScrollRows(preScrollRows_);
112     g_processor_.SetTouchpadPointerSpeed(preTouchpadPointerSpeed_);
113     g_processor_.SetTouchpadRightClickType(preRightClickType_);
114     g_processor_.SetTouchpadScrollSwitch(preScrollSwitch_);
115     g_processor_.SetTouchpadScrollDirection(preScrollDirection_);
116     g_processor_.SetTouchpadTapSwitch(preTapSwitch_);
117 }
118 
119 /**
120  * @tc.name: MouseTransformProcessorTest_DeletePressedButton_001
121  * @tc.desc: Test DeletePressedButton
122  * @tc.type: FUNC
123  * @tc.require:
124  */
125 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_DeletePressedButton_001, TestSize.Level1)
126 {
127     int32_t deviceId = 0;
128     MouseTransformProcessor processor(deviceId);
129     int32_t originButton = 1;
130     ASSERT_NO_FATAL_FAILURE(processor.DeletePressedButton(originButton));
131 }
132 
133 /**
134  * @tc.name: MouseTransformProcessorTest_DeletePressedButton_002
135  * @tc.desc: Test DeletePressedButton
136  * @tc.type: FUNC
137  * @tc.require:
138  */
139 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_DeletePressedButton_002, TestSize.Level1)
140 {
141     int32_t deviceId = 0;
142     MouseTransformProcessor processor(deviceId);
143     int32_t originButton = 1;
144     int32_t mappedButton = 2;
145     processor.buttonMapping_[originButton] = mappedButton;
146     ASSERT_NO_FATAL_FAILURE(processor.DeletePressedButton(originButton));
147 }
148 
149 /**
150  * @tc.name: MouseTransformProcessorTest_HandleAxisAccelateTouchPad_001
151  * @tc.desc: Test HandleAxisAccelateTouchPad
152  * @tc.type: FUNC
153  * @tc.require:
154  */
155 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisAccelateTouchPad_001, TestSize.Level1)
156 {
157     int32_t deviceId = 0;
158     MouseTransformProcessor processor(deviceId);
159     double axisValue = 2.0;
160     auto inputWindowsManager = std::static_pointer_cast<InputWindowsManager>(WIN_MGR);
161     ASSERT_NE(inputWindowsManager, nullptr);
162     inputWindowsManager->captureModeInfo_.isCaptureMode = true;
163     EXPECT_NO_FATAL_FAILURE(processor.HandleAxisAccelateTouchPad(axisValue));
164     inputWindowsManager->captureModeInfo_.isCaptureMode = false;
165     EXPECT_NO_FATAL_FAILURE(processor.HandleAxisAccelateTouchPad(axisValue));
166     axisValue = -5.0;
167     EXPECT_NO_FATAL_FAILURE(processor.HandleAxisAccelateTouchPad(axisValue));
168 }
169 
170 /**
171  * @tc.name: MouseTransformProcessorTest_CheckDeviceType_01
172  * @tc.desc: Test CheckDeviceType
173  * @tc.type: FUNC
174  * @tc.require:
175  */
176 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CheckDeviceType_01, TestSize.Level1)
177 {
178     int32_t deviceId = 0;
179     MouseTransformProcessor processor(deviceId);
180     int32_t width = HARD_PC_PRO_DEVICE_WIDTH;
181     int32_t height = HARD_PC_PRO_DEVICE_HEIGHT;
182     ASSERT_NO_FATAL_FAILURE(processor.CheckDeviceType(width, height));
183 }
184 
185 /**
186  * @tc.name: MouseTransformProcessorTest_Dump_002
187  * @tc.desc: Test Dump
188  * @tc.type: FUNC
189  * @tc.require:
190  */
191 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_Dump_002, TestSize.Level1)
192 {
193     std::vector<std::string> args;
194     std::vector<std::string> idNames;
195     int32_t deviceId = 0;
196     MouseTransformProcessor processor(deviceId);
197     int32_t fd = 0;
198     processor.Dump(fd, args);
199     ASSERT_EQ(args, idNames);
200 }
201 
202 /**
203  * @tc.name: MouseTransformProcessorTest_NormalizeMoveMouse_003
204  * @tc.desc: Test NormalizeMoveMouse
205  * @tc.type: FUNC
206  * @tc.require:
207  */
208 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_NormalizeMoveMouse_003, TestSize.Level1)
209 {
210     bool isNormalize = true;
211     int32_t deviceId = 0;
212     MouseTransformProcessor processor(deviceId);
213     int32_t offsetX = 0;
214     int32_t offsetY = 0;
215     ASSERT_EQ(processor.NormalizeMoveMouse(offsetX, offsetY), isNormalize);
216 }
217 
218 /**
219  * @tc.name: MouseTransformProcessorTest_GetDisplayId_004
220  * @tc.desc: Test GetDisplayId
221  * @tc.type: FUNC
222  * @tc.require:
223  */
224 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetDisplayId_004, TestSize.Level1)
225 {
226     int32_t idNames = -1;
227     int32_t deviceId = 0;
228     MouseTransformProcessor processor(deviceId);
229     ASSERT_EQ(processor.GetDisplayId(), idNames);
230 }
231 
232 /**
233  * @tc.name: MouseTransformProcessorTest_SetPointerSpeed_005
234  * @tc.desc: Test SetPointerSpeed
235  * @tc.type: FUNC
236  * @tc.require:
237  */
238 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetPointerSpeed_005, TestSize.Level1)
239 {
240     int32_t idNames = 0;
241     int32_t deviceId = 0;
242     MouseTransformProcessor processor(deviceId);
243     int32_t speed = 5;
244     ASSERT_EQ(processor.SetPointerSpeed(speed), idNames);
245 }
246 
247 /**
248  * @tc.name: MouseTransformProcessorTest_SetPointerSpeed_006
249  * @tc.desc: Test GetPointerSpeed
250  * @tc.type: FUNC
251  * @tc.require:
252  */
253 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetPointerSpeed_006, TestSize.Level1)
254 {
255     int32_t idNames = 5;
256     int32_t deviceId = 0;
257     MouseTransformProcessor processor(deviceId);
258     int32_t speed = 5;
259     processor.SetPointerSpeed(speed);
260     ASSERT_EQ(processor.GetPointerSpeed(), idNames);
261 }
262 
263 /**
264  * @tc.name: MouseTransformProcessorTest_SetPointerLocation_008
265  * @tc.desc: Test SetPointerLocation
266  * @tc.type: FUNC
267  * @tc.require:
268  */
269 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetPointerLocation_008, TestSize.Level1)
270 {
271     int32_t idNames = -1;
272     int32_t deviceId = 0;
273     MouseTransformProcessor processor(deviceId);
274     int32_t x = 0;
275     int32_t y = 0;
276     ASSERT_EQ(processor.SetPointerLocation(x, y), idNames);
277 }
278 
279 /**
280  * @tc.name: MouseTransformProcessorTest_SetPointerSpeed_009
281  * @tc.desc: Test GetPointerSpeed
282  * @tc.type: FUNC
283  * @tc.require:
284  */
285 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetPointerSpeed_009, TestSize.Level1)
286 {
287     int32_t idNames = 1;
288     int32_t deviceId = 0;
289     MouseTransformProcessor processor(deviceId);
290     int32_t speed = 0;
291     processor.SetPointerSpeed(speed);
292     ASSERT_EQ(processor.GetPointerSpeed(), idNames);
293 }
294 
295 /**
296  * @tc.name: MouseTransformProcessorTest_SetMousePrimaryButton_010
297  * @tc.desc: Test SetMousePrimaryButton
298  * @tc.type: FUNC
299  * @tc.require:
300  */
301 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetMousePrimaryButton_010, TestSize.Level1)
302 {
303     int32_t deviceId = 1;
304     MouseTransformProcessor processor(deviceId);
305     int32_t primaryButton = 1;
306     ASSERT_TRUE(processor.SetMousePrimaryButton(primaryButton) == RET_OK);
307 }
308 
309 /**
310  * @tc.name: MouseTransformProcessorTest_GetMousePrimaryButton_011
311  * @tc.desc: Test GetMousePrimaryButton
312  * @tc.type: FUNC
313  * @tc.require:
314  */
315 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetMousePrimaryButton_011, TestSize.Level1)
316 {
317     int32_t deviceId = 0;
318     MouseTransformProcessor processor(deviceId);
319     int32_t primaryButton = 1;
320     processor.SetMousePrimaryButton(primaryButton);
321     int32_t primaryButtonRes = 1;
322     ASSERT_TRUE(processor.GetMousePrimaryButton() == primaryButtonRes);
323 }
324 
325 /**
326  * @tc.name: MouseTransformProcessorTest_SetMouseScrollRows_012
327  * @tc.desc: Test SetMouseScrollRows
328  * @tc.type: FUNC
329  * @tc.require:
330  */
331 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetMouseScrollRows_012, TestSize.Level1)
332 {
333     int32_t deviceId = 1;
334     MouseTransformProcessor processor(deviceId);
335     int32_t rows = 1;
336     ASSERT_TRUE(processor.SetMouseScrollRows(rows) == RET_OK);
337 }
338 
339 /**
340  * @tc.name: MouseTransformProcessorTest_GetMouseScrollRows_013
341  * @tc.desc: Test GetMouseScrollRows
342  * @tc.type: FUNC
343  * @tc.require:
344  */
345 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetMouseScrollRows_013, TestSize.Level1)
346 {
347     int32_t deviceId = 0;
348     MouseTransformProcessor processor(deviceId);
349     int32_t rows = 1;
350     processor.SetMouseScrollRows(rows);
351     int32_t newRows = 1;
352     ASSERT_TRUE(processor.GetMouseScrollRows() == newRows);
353 }
354 /**
355  * @tc.name: MouseTransformProcessorTest_SetTouchpadScrollSwitch_014
356  * @tc.desc: Test SetTouchpadScrollSwitch
357  * @tc.type: FUNC
358  * @tc.require:
359  */
360 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadScrollSwitch_014, TestSize.Level1)
361 {
362     int32_t deviceId = 6;
363     MouseTransformProcessor processor(deviceId);
364     bool flag = false;
365     ASSERT_TRUE(processor.SetTouchpadScrollSwitch(flag) == RET_OK);
366 }
367 
368 /**
369  * @tc.name: MouseTransformProcessorTest_GetTouchpadScrollSwitch_015
370  * @tc.desc: Test GetTouchpadScrollSwitch
371  * @tc.type: FUNC
372  * @tc.require:
373  */
374 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadScrollSwitch_015, TestSize.Level1)
375 {
376     int32_t deviceId = 6;
377     MouseTransformProcessor processor(deviceId);
378     bool flag = true;
379     processor.SetTouchpadScrollSwitch(flag);
380     bool newFlag = true;
381     processor.GetTouchpadScrollSwitch(flag);
382     ASSERT_TRUE(flag == newFlag);
383 }
384 
385 /**
386  * @tc.name: MouseTransformProcessorTest_SetTouchpadScrollSwitch_014
387  * @tc.desc: Test SetTouchpadScrollDirection
388  * @tc.type: FUNC
389  * @tc.require:
390  */
391 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadScrollDirection_016, TestSize.Level1)
392 {
393     int32_t deviceId = 6;
394     MouseTransformProcessor processor(deviceId);
395     bool state = false;
396     ASSERT_TRUE(processor.SetTouchpadScrollDirection(state) == RET_OK);
397 }
398 
399 /**
400  * @tc.name: MouseTransformProcessorTest_GetTouchpadScrollDirection_017
401  * @tc.desc: Test GetTouchpadScrollDirection
402  * @tc.type: FUNC
403  * @tc.require:
404  */
405 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadScrollDirection_017, TestSize.Level1)
406 {
407     int32_t deviceId = 6;
408     MouseTransformProcessor processor(deviceId);
409     bool state = true;
410     processor.SetTouchpadScrollDirection(state);
411     bool newState = true;
412     processor.GetTouchpadScrollDirection(state);
413     ASSERT_TRUE(state == newState);
414 }
415 
416 /**
417  * @tc.name: MouseTransformProcessorTest_SetTouchpadTapSwitch_018
418  * @tc.desc: Test SetTouchpadTapSwitch
419  * @tc.type: FUNC
420  * @tc.require:
421  */
422 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadTapSwitch_018, TestSize.Level1)
423 {
424     int32_t deviceId = 6;
425     MouseTransformProcessor processor(deviceId);
426     bool flag = false;
427     ASSERT_TRUE(processor.SetTouchpadTapSwitch(flag) == RET_OK);
428 }
429 
430 /**
431  * @tc.name: MouseTransformProcessorTest_GetTouchpadTapSwitch_019
432  * @tc.desc: Test GetTouchpadTapSwitch
433  * @tc.type: FUNC
434  * @tc.require:
435  */
436 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadTapSwitch_019, TestSize.Level1)
437 {
438     int32_t deviceId = 6;
439     MouseTransformProcessor processor(deviceId);
440     bool flag = false;
441     processor.SetTouchpadTapSwitch(flag);
442     bool newFlag = false;
443     processor.GetTouchpadTapSwitch(flag);
444     ASSERT_TRUE(flag == newFlag);
445 }
446 
447 /**
448  * @tc.name: MouseTransformProcessorTest_SetTouchpadPointerSpeed_020
449  * @tc.desc: Test SetTouchpadPointerSpeed
450  * @tc.type: FUNC
451  * @tc.require:
452  */
453 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadPointerSpeed_020, TestSize.Level1)
454 {
455     int32_t deviceId = 6;
456     MouseTransformProcessor processor(deviceId);
457     int32_t speed = 2;
458     ASSERT_TRUE(processor.SetTouchpadPointerSpeed(speed) == RET_OK);
459 }
460 
461 /**
462  * @tc.name: MouseTransformProcessorTest_GetTouchpadPointerSpeed_021
463  * @tc.desc: Test GetTouchpadPointerSpeed
464  * @tc.type: FUNC
465  * @tc.require:
466  */
467 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadPointerSpeed_021, TestSize.Level1)
468 {
469     int32_t deviceId = 6;
470     MouseTransformProcessor processor(deviceId);
471     int32_t speed = 2;
472     processor.SetTouchpadPointerSpeed(speed);
473     int32_t newSpeed = 3;
474     processor.GetTouchpadPointerSpeed(newSpeed);
475     ASSERT_TRUE(speed == newSpeed);
476 }
477 
478 /**
479  * @tc.name: MouseTransformProcessorTest_SetTouchpadPointerSpeed_022
480  * @tc.desc: Test SetTouchpadPointerSpeed
481  * @tc.type: FUNC
482  * @tc.require:
483  */
484 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadPointerSpeed_022, TestSize.Level1)
485 {
486     int32_t deviceId = 6;
487     MouseTransformProcessor processor(deviceId);
488     int32_t speed = 8;
489     ASSERT_TRUE(processor.SetTouchpadPointerSpeed(speed) == RET_OK);
490 }
491 
492 /**
493  * @tc.name: MouseTransformProcessorTest_GetTouchpadPointerSpeed_023
494  * @tc.desc: Test GetTouchpadPointerSpeed
495  * @tc.type: FUNC
496  * @tc.require:
497  */
498 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadPointerSpeed_023, TestSize.Level1)
499 {
500     int32_t deviceId = 6;
501     MouseTransformProcessor processor(deviceId);
502     int32_t speed = 8;
503     processor.SetTouchpadPointerSpeed(speed);
504     int32_t newSpeed = 7;
505     processor.GetTouchpadPointerSpeed(newSpeed);
506     ASSERT_TRUE(speed == newSpeed);
507 }
508 
509 /**
510  * @tc.name: MouseTransformProcessorTest_SetTouchpadRightClickType_024
511  * @tc.desc: Test SetTouchpadRightClickType
512  * @tc.type: FUNC
513  * @tc.require:
514  */
515 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetTouchpadRightClickType_024, TestSize.Level1)
516 {
517     int32_t deviceId = 6;
518     MouseTransformProcessor processor(deviceId);
519     int32_t type = 2;
520     ASSERT_TRUE(processor.SetTouchpadRightClickType(type) == RET_OK);
521 }
522 
523 /**
524  * @tc.name: MouseTransformProcessorTest_GetTouchpadRightClickType_025
525  * @tc.desc: Test GetTouchpadRightClickType
526  * @tc.type: FUNC
527  * @tc.require:
528  */
529 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadRightClickType_025, TestSize.Level1)
530 {
531     int32_t deviceId = 6;
532     MouseTransformProcessor processor(deviceId);
533     int32_t type = 1;
534     processor.SetTouchpadRightClickType(type);
535     int32_t newType = 3;
536     processor.GetTouchpadRightClickType(newType);
537     ASSERT_TRUE(type == newType);
538 }
539 
540 /**
541  * @tc.name: MouseTransformProcessorTest_GetPointerEvent_001
542  * @tc.desc: Get pointer event verify
543  * @tc.type: FUNC
544  * @tc.require:
545  */
546 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetPointerEvent_001, TestSize.Level1)
547 {
548     int32_t deviceId = 0;
549     MouseTransformProcessor processor(deviceId);
550     auto ret = processor.GetPointerEvent();
551     ASSERT_NE(ret, nullptr);
552 }
553 
554 /**
555  * @tc.name: MouseTransformProcessorTest_HandleMotionInner_001
556  * @tc.desc: Handle motion inner verify
557  * @tc.type: FUNC
558  * @tc.require:
559  */
560 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleMotionInner_001, TestSize.Level1)
561 {
562     int32_t deviceId = 0;
563     MouseTransformProcessor processor(deviceId);
564     struct libinput_event_pointer* data = nullptr;
565     struct libinput_event* event = nullptr;
566     auto ret = processor.HandleMotionInner(data, event);
567     ASSERT_NE(ret, RET_OK);
568 }
569 
570 /**
571  * @tc.name: MouseTransformProcessorTest_CalculateOffset_001
572  * @tc.desc: Calculate offset verify
573  * @tc.type: FUNC
574  * @tc.require:
575  */
576 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffset_001, TestSize.Level1)
577 {
578     int32_t deviceId = 0;
579     MouseTransformProcessor processor(deviceId);
580     Direction direction = DIRECTION90;
581     Offset offset;
582     ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(direction, offset));
583 }
584 
585 /**
586  * @tc.name: MouseTransformProcessorTest_CalculateOffset_002
587  * @tc.desc: Calculate offset verify
588  * @tc.type: FUNC
589  * @tc.require:
590  */
591 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffset_002, TestSize.Level1)
592 {
593     int32_t deviceId = 0;
594     MouseTransformProcessor processor(deviceId);
595     Direction direction = DIRECTION180;
596     Offset offset;
597     ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(direction, offset));
598 }
599 
600 /**
601  * @tc.name: MouseTransformProcessorTest_CalculateOffset_003
602  * @tc.desc: Calculate offset verify
603  * @tc.type: FUNC
604  * @tc.require:
605  */
606 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffset_003, TestSize.Level1)
607 {
608     int32_t deviceId = 0;
609     MouseTransformProcessor processor(deviceId);
610     Direction direction = DIRECTION270;
611     Offset offset;
612     ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(direction, offset));
613 }
614 
615 /**
616  * @tc.name: MouseTransformProcessorTest_HandleButtonInner_001
617  * @tc.desc: Handle button inner verify
618  * @tc.type: FUNC
619  * @tc.require:
620  */
621 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonInner_001, TestSize.Level1)
622 {
623     int32_t deviceId = 0;
624     MouseTransformProcessor processor(deviceId);
625     struct libinput_event_pointer* data = nullptr;
626     struct libinput_event* event = nullptr;
627     auto ret = processor.HandleButtonInner(data, event);
628     ASSERT_NE(ret, RET_OK);
629 }
630 
631 /**
632  * @tc.name: MouseTransformProcessorTest_HandleButtonValueInner_001
633  * @tc.desc: Handle button value inner verify
634  * @tc.type: FUNC
635  * @tc.require:
636  */
637 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonValueInner_001, TestSize.Level1)
638 {
639     int32_t deviceId = 0;
640     MouseTransformProcessor processor(deviceId);
641     struct libinput_event_pointer* data = nullptr;
642     uint32_t button = -1;
643     int32_t type = 0;
644     auto ret = processor.HandleButtonValueInner(data, button, type);
645     ASSERT_NE(ret, RET_ERR);
646 }
647 
648 /**
649  * @tc.name: MouseTransformProcessorTest_HandleButtonValueInner_002
650  * @tc.desc: Handle button value inner verify
651  * @tc.type: FUNC
652  * @tc.require:
653  */
654 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonValueInner_002, TestSize.Level1)
655 {
656     int32_t deviceId = 0;
657     MouseTransformProcessor processor(deviceId);
658     struct libinput_event_pointer* data = nullptr;
659     uint32_t button = 272;
660     int32_t type = 1;
661     auto ret = processor.HandleButtonValueInner(data, button, type);
662     ASSERT_NE(ret, RET_OK);
663 }
664 
665 /**
666  * @tc.name: MouseTransformProcessorTest_HandleTouchPadAxisState_001
667  * @tc.desc: Handle touch pad axis state verify
668  * @tc.type: FUNC
669  * @tc.require:
670  */
671 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchPadAxisState_001, TestSize.Level1)
672 {
673     int32_t deviceId = 0;
674     MouseTransformProcessor processor(deviceId);
675     libinput_pointer_axis_source source = LIBINPUT_POINTER_AXIS_SOURCE_FINGER;
676     int32_t direction = 0;
677     bool tpScrollSwitch = false;
678     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchPadAxisState(source, direction, tpScrollSwitch));
679 }
680 
681 /**
682  * @tc.name: MouseTransformProcessorTest_HandleAxisInner_001
683  * @tc.desc: Handle axis inner verify
684  * @tc.type: FUNC
685  * @tc.require:
686  */
687 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisInner_001, TestSize.Level1)
688 {
689     int32_t deviceId = 0;
690     MouseTransformProcessor processor(deviceId);
691     struct libinput_event_pointer* data = nullptr;
692     auto ret = processor.HandleAxisInner(data);
693     ASSERT_NE(ret, RET_OK);
694 }
695 
696 /**
697  * @tc.name: MouseTransformProcessorTest_HandleAxisBeginEndInner_001
698  * @tc.desc: Handle axis begin end inner verify
699  * @tc.type: FUNC
700  * @tc.require:
701  */
702 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisBeginEndInner_001, TestSize.Level1)
703 {
704     int32_t deviceId = 0;
705     MouseTransformProcessor processor(deviceId);
706     struct libinput_event* event = nullptr;
707     auto ret = processor.HandleAxisBeginEndInner(event);
708     ASSERT_NE(ret, RET_OK);
709 }
710 
711 /**
712  * @tc.name: MouseTransformProcessorTest_HandleAxisPostInner_001
713  * @tc.desc: Handle axis post inner verify
714  * @tc.type: FUNC
715  * @tc.require:
716  */
717 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisPostInner_001, TestSize.Level1)
718 {
719     int32_t deviceId = 0;
720     MouseTransformProcessor processor(deviceId);
721     PointerEvent::PointerItem pointerItem;
722     ASSERT_NO_FATAL_FAILURE(processor.HandleAxisPostInner(pointerItem));
723 }
724 
725 /**
726  * @tc.name: MouseTransformProcessorTest_HandlePostInner_001
727  * @tc.desc: Handle post inner verify
728  * @tc.type: FUNC
729  * @tc.require:
730  */
731 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandlePostInner_001, TestSize.Level1)
732 {
733     int32_t deviceId = 0;
734     MouseTransformProcessor processor(deviceId);
735     struct libinput_event_pointer* data = nullptr;
736     PointerEvent::PointerItem pointerItem;
737     ASSERT_NO_FATAL_FAILURE(processor.HandlePostInner(data, pointerItem));
738 }
739 
740 /**
741  * @tc.name: MouseTransformProcessorTest_Normalize_001
742  * @tc.desc: Normalize verify
743  * @tc.type: FUNC
744  * @tc.require:
745  */
746 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_Normalize_001, TestSize.Level1)
747 {
748     int32_t deviceId = 0;
749     MouseTransformProcessor processor(deviceId);
750     struct libinput_event* event = nullptr;
751     auto ret = processor.Normalize(event);
752     ASSERT_NE(ret, RET_OK);
753 }
754 
755 /**
756  * @tc.name: MouseTransformProcessorTest_NormalizeRotateEvent_001
757  * @tc.desc: Normalize rotate event verify
758  * @tc.type: FUNC
759  * @tc.require:
760  */
761 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_NormalizeRotateEvent_001, TestSize.Level1)
762 {
763     int32_t deviceId = 0;
764     MouseTransformProcessor processor(deviceId);
765     struct libinput_event* event = nullptr;
766     int32_t type = 1;
767     double angle = 90.0;
768     auto ret = processor.NormalizeRotateEvent(event, type, angle);
769     ASSERT_NE(ret, RET_OK);
770 }
771 
772 /**
773  * @tc.name: MouseTransformProcessorTest_HandleMotionMoveMouse_001
774  * @tc.desc: Handle motion move mouse verify
775  * @tc.type: FUNC
776  * @tc.require:
777  */
778 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleMotionMoveMouse_001, TestSize.Level1)
779 {
780     int32_t deviceId = 0;
781     MouseTransformProcessor processor(deviceId);
782     int32_t offsetX = 10;
783     int32_t offsetY = 20;
784     ASSERT_NO_FATAL_FAILURE(processor.HandleMotionMoveMouse(offsetX, offsetY));
785 }
786 
787 /**
788  * @tc.name: MouseTransformProcessorTest_HandleMotionMoveMouse_002
789  * @tc.desc: Handle motion move mouse verify
790  * @tc.type: FUNC
791  * @tc.require:
792  */
793 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleMotionMoveMouse_002, TestSize.Level1)
794 {
795     int32_t deviceId = 0;
796     MouseTransformProcessor processor(deviceId);
797     int32_t offsetX = -1000;
798     int32_t offsetY = 500;
799     ASSERT_NO_FATAL_FAILURE(processor.HandleMotionMoveMouse(offsetX, offsetY));
800 }
801 
802 /**
803  * @tc.name: MouseTransformProcessorTest_OnDisplayLost_001
804  * @tc.desc: On display lost verify
805  * @tc.type: FUNC
806  * @tc.require:
807  */
808 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_OnDisplayLost_001, TestSize.Level1)
809 {
810     int32_t deviceId = 0;
811     MouseTransformProcessor processor(deviceId);
812     int32_t displayId = -1;
813     ASSERT_NO_FATAL_FAILURE(processor.OnDisplayLost(displayId));
814 }
815 
816 /**
817  * @tc.name: MouseTransformProcessorTest_OnDisplayLost_002
818  * @tc.desc: On display lost verify
819  * @tc.type: FUNC
820  * @tc.require:
821  */
822 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_OnDisplayLost_002, TestSize.Level1)
823 {
824     int32_t deviceId = 0;
825     MouseTransformProcessor processor(deviceId);
826     int32_t displayId = 1;
827     ASSERT_NO_FATAL_FAILURE(processor.OnDisplayLost(displayId));
828 }
829 
830 /**
831  * @tc.name: MouseTransformProcessorTest_HandlePostMoveMouse_001
832  * @tc.desc: Handle post move mouse verify
833  * @tc.type: FUNC
834  * @tc.require:
835  */
836 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandlePostMoveMouse_001, TestSize.Level1)
837 {
838     int32_t deviceId = 0;
839     MouseTransformProcessor processor(deviceId);
840     PointerEvent::PointerItem pointerItem;
841     ASSERT_NO_FATAL_FAILURE(processor.HandlePostMoveMouse(pointerItem));
842 }
843 
844 /**
845  * @tc.name: MouseTransformProcessorTest_DumpInner_001
846  * @tc.desc: Dump inner verify
847  * @tc.type: FUNC
848  * @tc.require:
849  */
850 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_DumpInner_001, TestSize.Level1)
851 {
852     int32_t deviceId = 0;
853     MouseTransformProcessor processor(deviceId);
854     ASSERT_NO_FATAL_FAILURE(processor.DumpInner());
855 }
856 
857 /**
858  * @tc.name: MouseTransformProcessorTest_GetTouchpadSpeed_001
859  * @tc.desc: Get touchpad speed verify
860  * @tc.type: FUNC
861  * @tc.require:
862  */
863 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_GetTouchpadSpeed_001, TestSize.Level1)
864 {
865     int32_t deviceId = 0;
866     MouseTransformProcessor processor(deviceId);
867     auto ret = processor.GetTouchpadSpeed();
868     ASSERT_NE(ret, RET_OK);
869 }
870 
871 /**
872  * @tc.name: MouseTransformProcessorTest_HandleTouchpadRightButton_001
873  * @tc.desc: Handle touchpad right button verify
874  * @tc.type: FUNC
875  * @tc.require:
876  */
877 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadRightButton_001, TestSize.Level1)
878 {
879     int32_t deviceId = 0;
880     MouseTransformProcessor processor(deviceId);
881     struct libinput_event_pointer* data = nullptr;
882     int32_t eventType = 1;
883     uint32_t button = 0x118;
884     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, eventType, button));
885 }
886 
887 /**
888  * @tc.name: MouseTransformProcessorTest_HandleTouchpadRightButton_002
889  * @tc.desc: Handle touchpad right button verify
890  * @tc.type: FUNC
891  * @tc.require:
892  */
893 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadRightButton_002, TestSize.Level1)
894 {
895     int32_t deviceId = 0;
896     MouseTransformProcessor processor(deviceId);
897     struct libinput_event_pointer* data = nullptr;
898     int32_t eventType = LIBINPUT_EVENT_POINTER_TAP;
899     uint32_t button = MouseDeviceState::LIBINPUT_RIGHT_BUTTON_CODE;
900     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, eventType, button));
901 }
902 
903 /**
904  * @tc.name: MouseTransformProcessorTest_Normalize_01
905  * @tc.desc: Test the branch that handles mouse movement events
906  * @tc.type: FUNC
907  * @tc.require:
908  */
909 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_Normalize_01, TestSize.Level1)
910 {
911     CALL_TEST_DEBUG;
912     vMouse_.SendEvent(EV_REL, REL_X, 5);
913     vMouse_.SendEvent(EV_REL, REL_Y, -10);
914     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
915     libinput_event *event = libinput_.Dispatch();
916     ASSERT_TRUE(event != nullptr);
917     struct libinput_device *dev = libinput_event_get_device(event);
918     ASSERT_TRUE(dev != nullptr);
919     std::cout << "pointer device: " << libinput_device_get_name(dev) << std::endl;
920     int32_t deviceId = 0;
921     MouseTransformProcessor processor(deviceId);
922     EXPECT_EQ(processor.Normalize(event), RET_ERR);
923 }
924 
925 /**
926  * @tc.name: MouseTransformProcessorTest_Normalize_02
927  * @tc.desc: Tests the branch that handles the left mouse button event
928  * @tc.type: FUNC
929  * @tc.require:
930  */
931 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_Normalize_02, TestSize.Level1)
932 {
933     CALL_TEST_DEBUG;
934     vMouse_.SendEvent(EV_KEY, BTN_LEFT, 1);
935     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
936     libinput_event *event = libinput_.Dispatch();
937     ASSERT_TRUE(event != nullptr);
938     struct libinput_device *dev = libinput_event_get_device(event);
939     ASSERT_TRUE(dev != nullptr);
940     std::cout << "pointer device: " << libinput_device_get_name(dev) << std::endl;
941     int32_t deviceId = 0;
942     MouseTransformProcessor processor(deviceId);
943     EXPECT_EQ(processor.Normalize(event), RET_ERR);
944 }
945 
946 /**
947  * @tc.name: MouseTransformProcessorTest_NormalizeRotateEvent_01
948  * @tc.desc: Test normal conditions
949  * @tc.type: FUNC
950  * @tc.require:
951  */
952 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_NormalizeRotateEvent_01, TestSize.Level1)
953 {
954     CALL_TEST_DEBUG;
955     vMouse_.SendEvent(EV_REL, REL_X, 5);
956     vMouse_.SendEvent(EV_REL, REL_Y, -10);
957     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
958     libinput_event *event = libinput_.Dispatch();
959     ASSERT_TRUE(event != nullptr);
960     struct libinput_device *dev = libinput_event_get_device(event);
961     ASSERT_TRUE(dev != nullptr);
962     std::cout << "pointer device: " << libinput_device_get_name(dev) << std::endl;
963     int32_t deviceId = 0;
964     MouseTransformProcessor processor(deviceId);
965     int32_t type = 1;
966     double angle = 90.0;
967     int32_t result = processor.NormalizeRotateEvent(event, type, angle);
968     EXPECT_EQ(result, RET_OK);
969 }
970 
971 /**
972  * @tc.name: MouseTransformProcessorTest_NormalizeRotateEvent_02
973  * @tc.desc: Tests HandlePostInner return false
974  * @tc.type: FUNC
975  * @tc.require:
976  */
977 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_NormalizeRotateEvent_02, TestSize.Level1)
978 {
979     CALL_TEST_DEBUG;
980     vMouse_.SendEvent(EV_REL, REL_X, 5);
981     vMouse_.SendEvent(EV_REL, REL_Y, -10);
982     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
983     libinput_event *event = libinput_.Dispatch();
984     ASSERT_TRUE(event != nullptr);
985     struct libinput_device *dev = libinput_event_get_device(event);
986     ASSERT_TRUE(dev != nullptr);
987     std::cout << "pointer device: " << libinput_device_get_name(dev) << std::endl;
988     int32_t deviceId = 0;
989     MouseTransformProcessor processor(deviceId);
990     int32_t type = 0;
991     double angle = 0.0;
992     std::shared_ptr<PointerEvent::PointerItem> pointerItem = nullptr;
993     int32_t result = processor.NormalizeRotateEvent(event, type, angle);
994     EXPECT_EQ(result, RET_OK);
995 }
996 
997 /**
998  * @tc.name: MouseTransformProcessorTest_HandleTouchpadRightButton_003
999  * @tc.desc: Handle touchpad right button verify
1000  * @tc.type: FUNC
1001  * @tc.require:
1002  */
1003 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadRightButton_003, TestSize.Level1)
1004 {
1005     int32_t deviceId = 0;
1006     MouseTransformProcessor processor(deviceId);
1007     struct libinput_event_pointer* data = nullptr;
1008     int32_t eventType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1009     uint32_t button = MouseDeviceState::LIBINPUT_LEFT_BUTTON_CODE;
1010     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, eventType, button));
1011 }
1012 
1013 /**
1014  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_001
1015  * @tc.desc: Handle touchpad left button verify
1016  * @tc.type: FUNC
1017  * @tc.require:
1018  */
1019 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_001, TestSize.Level1)
1020 {
1021     int32_t deviceId = 0;
1022     MouseTransformProcessor processor(deviceId);
1023     struct libinput_event_pointer* data = nullptr;
1024     int32_t eventType = 1;
1025     uint32_t button = 0x118;
1026     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, eventType, button));
1027 }
1028 
1029 /**
1030  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_002
1031  * @tc.desc: Handle touchpad left button verify
1032  * @tc.type: FUNC
1033  * @tc.require:
1034  */
1035 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_002, TestSize.Level1)
1036 {
1037     int32_t deviceId = 0;
1038     MouseTransformProcessor processor(deviceId);
1039     struct libinput_event_pointer* data = nullptr;
1040     int32_t eventType = 1;
1041     uint32_t button = MouseDeviceState::LIBINPUT_RIGHT_BUTTON_CODE;
1042     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, eventType, button));
1043 }
1044 
1045 /**
1046  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_003
1047  * @tc.desc: Handle touchpad left button verify
1048  * @tc.type: FUNC
1049  * @tc.require:
1050  */
1051 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_003, TestSize.Level1)
1052 {
1053     int32_t deviceId = 0;
1054     MouseTransformProcessor processor(deviceId);
1055     struct libinput_event_pointer* data = nullptr;
1056     int32_t eventType = LIBINPUT_EVENT_POINTER_TAP;
1057     uint32_t button = MouseDeviceState::LIBINPUT_RIGHT_BUTTON_CODE;
1058     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, eventType, button));
1059 }
1060 
1061 /**
1062  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_004
1063  * @tc.desc: Handle touchpad left button verify
1064  * @tc.type: FUNC
1065  * @tc.require:
1066  */
1067 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_004, TestSize.Level1)
1068 {
1069     int32_t deviceId = 0;
1070     MouseTransformProcessor processor(deviceId);
1071     struct libinput_event_pointer* data = nullptr;
1072     int32_t eventType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1073     uint32_t button = MouseDeviceState::LIBINPUT_LEFT_BUTTON_CODE;
1074     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, eventType, button));
1075 }
1076 
1077 /**
1078  * @tc.name: MouseTransformProcessorTest_TransTouchpadRightButton_01
1079  * @tc.desc: Trans touchpad right button verify
1080  * @tc.type: FUNC
1081  * @tc.require:
1082  */
1083 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_TransTouchpadRightButton_01, TestSize.Level1)
1084 {
1085     int32_t deviceId = 0;
1086     MouseTransformProcessor processor(deviceId);
1087     struct libinput_event_pointer* data = nullptr;
1088     int32_t eventType = LIBINPUT_EVENT_POINTER_TAP;
1089     uint32_t button = MouseDeviceState::LIBINPUT_RIGHT_BUTTON_CODE;
1090     processor.TransTouchpadRightButton(data, eventType, button);
1091     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, eventType, button));
1092 }
1093 
1094 /**
1095  * @tc.name: MouseTransformProcessorTest_TransTouchpadRightButton_02
1096  * @tc.desc: Trans touchpad right button verify
1097  * @tc.type: FUNC
1098  * @tc.require:
1099  */
1100 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_TransTouchpadRightButton_02, TestSize.Level1)
1101 {
1102     int32_t deviceId = 0;
1103     MouseTransformProcessor processor(deviceId);
1104     struct libinput_event_pointer* data = nullptr;
1105     int32_t eventType = LIBINPUT_EVENT_POINTER_TAP;
1106     uint32_t button = MouseDeviceState::LIBINPUT_LEFT_BUTTON_CODE;
1107     processor.TransTouchpadRightButton(data, eventType, button);
1108     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, eventType, button));
1109 }
1110 
1111 /**
1112  * @tc.name: MouseTransformProcessorTest_CheckAndPackageAxisEvent_001
1113  * @tc.desc: Test isAxisBegin is false
1114  * @tc.type: FUNC
1115  * @tc.require:
1116  */
1117 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CheckAndPackageAxisEvent_001, TestSize.Level1)
1118 {
1119     CALL_TEST_DEBUG;
1120     int32_t deviceId = 0;
1121     MouseTransformProcessor processor(deviceId);
1122     processor.isAxisBegin_ = false;
1123     bool result = processor.CheckAndPackageAxisEvent();
1124     EXPECT_FALSE(result);
1125 }
1126 
1127 /**
1128  * @tc.name: MouseTransformProcessorTest_CheckAndPackageAxisEvent_002
1129  * @tc.desc: Test isAxisBegin is true
1130  * @tc.type: FUNC
1131  * @tc.require:
1132  */
1133 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CheckAndPackageAxisEvent_002, TestSize.Level1)
1134 {
1135     CALL_TEST_DEBUG;
1136     int32_t deviceId = 0;
1137     MouseTransformProcessor processor(deviceId);
1138     processor.isAxisBegin_ = true;
1139     bool result = processor.CheckAndPackageAxisEvent();
1140     EXPECT_TRUE(result);
1141 }
1142 
1143 /**
1144  * @tc.name: MouseTransformProcessorTest_HandleButtonValueInner_003
1145  * @tc.desc: The corresponding key type cannot be found in the test overlay buttonId
1146  * @tc.type: FUNC
1147  * @tc.require:
1148  */
1149 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonValueInner_003, TestSize.Level1)
1150 {
1151     CALL_TEST_DEBUG;
1152     vMouse_.SendEvent(EV_REL, REL_X, 5);
1153     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1154     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1155     libinput_event *event = libinput_.Dispatch();
1156     ASSERT_TRUE(event != nullptr);
1157     auto data = libinput_event_get_pointer_event(event);
1158     ASSERT_TRUE(data != nullptr);
1159     int32_t deviceId = 0;
1160     MouseTransformProcessor processor(deviceId);
1161     uint32_t button = 0;
1162     int32_t type = 2;
1163     int32_t ret = processor.HandleButtonValueInner(data, button, type);
1164     EXPECT_EQ(ret, RET_ERR);
1165 }
1166 
1167 /**
1168  * @tc.name: MouseTransformProcessorTest_HandleButtonValueInner_004
1169  * @tc.desc: Test overwrite buttonId to find corresponding key type
1170  * @tc.type: FUNC
1171  * @tc.require:
1172  */
1173 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonValueInner_004, TestSize.Level1)
1174 {
1175     CALL_TEST_DEBUG;
1176     vMouse_.SendEvent(EV_REL, REL_X, 5);
1177     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1178     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1179     libinput_event *event = libinput_.Dispatch();
1180     ASSERT_TRUE(event != nullptr);
1181     auto data = libinput_event_get_pointer_event(event);
1182     ASSERT_TRUE(data != nullptr);
1183     int32_t deviceId = 0;
1184     MouseTransformProcessor processor(deviceId);
1185     uint32_t button = MouseDeviceState::LIBINPUT_LEFT_BUTTON_CODE;
1186     int32_t type = 2;
1187     int32_t ret = processor.HandleButtonValueInner(data, button, type);
1188     EXPECT_EQ(ret, RET_OK);
1189 }
1190 
1191 /**
1192  * @tc.name: MouseTransformProcessorTest_HandleButtonValueInner_005
1193  * @tc.desc: Test the case that the buttonId covers different key types
1194  * @tc.type: FUNC
1195  * @tc.require:
1196  */
1197 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonValueInner_005, TestSize.Level1)
1198 {
1199     CALL_TEST_DEBUG;
1200     vMouse_.SendEvent(EV_REL, REL_X, 5);
1201     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1202     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1203     libinput_event *event = libinput_.Dispatch();
1204     ASSERT_TRUE(event != nullptr);
1205     auto data = libinput_event_get_pointer_event(event);
1206     ASSERT_TRUE(data != nullptr);
1207     int32_t deviceId = 0;
1208     MouseTransformProcessor processor(deviceId);
1209     uint32_t button = MouseDeviceState::LIBINPUT_RIGHT_BUTTON_CODE;
1210     int32_t type = 2;
1211     int32_t ret = processor.HandleButtonValueInner(data, button, type);
1212     EXPECT_EQ(ret, RET_OK);
1213     button = MouseDeviceState::LIBINPUT_MIDDLE_BUTTON_CODE;
1214     ret = processor.HandleButtonValueInner(data, button, type);
1215     EXPECT_EQ(ret, RET_OK);
1216 }
1217 
1218 /**
1219  * @tc.name: MouseTransformProcessorTest_HandleMotionInner_002
1220  * @tc.desc: Test HandleMotionInner
1221  * @tc.type: FUNC
1222  * @tc.require:
1223  */
1224 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleMotionInner_002, TestSize.Level1)
1225 {
1226     CALL_TEST_DEBUG;
1227     vMouse_.SendEvent(EV_REL, REL_X, 5);
1228     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1229     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1230     libinput_event *event = libinput_.Dispatch();
1231     ASSERT_TRUE(event != nullptr);
1232     auto data = libinput_event_get_pointer_event(event);
1233     ASSERT_TRUE(data != nullptr);
1234     int32_t deviceId = 0;
1235     MouseTransformProcessor processor(deviceId);
1236     int32_t ret = processor.HandleMotionInner(data, event);
1237     EXPECT_EQ(ret, RET_ERR);
1238 }
1239 
1240 /**
1241  * @tc.name: MouseTransformProcessorTest_HandleMotionInner_003
1242  * @tc.desc: Test HandleMotionInner
1243  * @tc.type: FUNC
1244  * @tc.require:
1245  */
1246 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleMotionInner_003, TestSize.Level1)
1247 {
1248     CALL_TEST_DEBUG;
1249     vMouse_.SendEvent(EV_REL, REL_X, 5);
1250     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1251     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1252     libinput_event *event = libinput_.Dispatch();
1253     ASSERT_TRUE(event != nullptr);
1254     auto data = libinput_event_get_pointer_event(event);
1255     ASSERT_TRUE(data != nullptr);
1256     int32_t deviceId = 0;
1257     MouseTransformProcessor processor(deviceId);
1258     CursorPosition cursorPos;
1259     cursorPos.displayId = -1;
1260     int32_t type = LIBINPUT_EVENT_POINTER_MOTION_TOUCHPAD;
1261     int32_t ret = processor.HandleMotionInner(data, event);
1262     EXPECT_EQ(ret, RET_ERR);
1263     type = LIBINPUT_EVENT_POINTER_BUTTON;
1264     ret = processor.HandleMotionInner(data, event);
1265     EXPECT_EQ(ret, RET_ERR);
1266 }
1267 
1268 /**
1269  * @tc.name: MouseTransformProcessorTest_HandleButtonInner_002
1270  * @tc.desc: Test HandleButtonInner
1271  * @tc.type: FUNC
1272  * @tc.require:
1273  */
1274 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleButtonInner_002, TestSize.Level1)
1275 {
1276     CALL_TEST_DEBUG;
1277     vMouse_.SendEvent(EV_REL, REL_X, 5);
1278     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1279     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1280     libinput_event *event = libinput_.Dispatch();
1281     ASSERT_TRUE(event != nullptr);
1282     auto data = libinput_event_get_pointer_event(event);
1283     ASSERT_TRUE(data != nullptr);
1284     int32_t deviceId = 0;
1285     MouseTransformProcessor processor(deviceId);
1286     int32_t ret = processor.HandleButtonInner(data, event);
1287     EXPECT_EQ(ret, RET_ERR);
1288 }
1289 
1290 /**
1291  * @tc.name: MouseTransformProcessorTest_HandleTouchPadAxisState_01
1292  * @tc.desc: Test HandleTouchPadAxisState
1293  * @tc.type: FUNC
1294  * @tc.require:
1295  */
1296 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchPadAxisState_01, TestSize.Level1)
1297 {
1298     int32_t deviceId = 0;
1299     MouseTransformProcessor processor(deviceId);
1300     libinput_pointer_axis_source source = LIBINPUT_POINTER_AXIS_SOURCE_FINGER;
1301     int32_t direction = 1;
1302     bool tpScrollSwitch = true;
1303     processor.HandleTouchPadAxisState(source, direction, tpScrollSwitch);
1304 }
1305 
1306 /**
1307  * @tc.name: MouseTransformProcessorTest_HandleTouchpadRightButton_01
1308  * @tc.desc: Test HandleTouchpadRightButton
1309  * @tc.type: FUNC
1310  * @tc.require:
1311  */
1312 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadRightButton_01, TestSize.Level1)
1313 {
1314     int32_t deviceId = 0;
1315     MouseTransformProcessor processor(deviceId);
1316     struct libinput_event_pointer *data = nullptr;
1317     int32_t evenType = LIBINPUT_EVENT_POINTER_TAP;
1318     uint32_t button = BTN_RIGHT_MENUE_CODE;
1319     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, evenType, button));
1320 }
1321 
1322 /**
1323  * @tc.name: MouseTransformProcessorTest_HandleTouchpadRightButton_02
1324  * @tc.desc: Test HandleTouchpadRightButton
1325  * @tc.type: FUNC
1326  * @tc.require:
1327  */
1328 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadRightButton_02, TestSize.Level1)
1329 {
1330     int32_t deviceId = 0;
1331     MouseTransformProcessor processor(deviceId);
1332     struct libinput_event_pointer *data = nullptr;
1333     int32_t evenType = LIBINPUT_EVENT_POINTER_TAP;
1334     uint32_t button = MouseDeviceState::LIBINPUT_BUTTON_CODE::LIBINPUT_RIGHT_BUTTON_CODE;
1335     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadRightButton(data, evenType, button));
1336 }
1337 
1338 /**
1339  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_01
1340  * @tc.desc: Test HandleTouchpadLeftButton
1341  * @tc.type: FUNC
1342  * @tc.require:
1343  */
1344 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_01, TestSize.Level1)
1345 {
1346     int32_t deviceId = 0;
1347     MouseTransformProcessor processor(deviceId);
1348     struct libinput_event_pointer *data = nullptr;
1349     int32_t evenType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1350     uint32_t button = BTN_RIGHT_MENUE_CODE;
1351     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, evenType, button));
1352 }
1353 
1354 /**
1355  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_02
1356  * @tc.desc: Test HandleTouchpadLeftButton
1357  * @tc.type: FUNC
1358  * @tc.require:
1359  */
1360 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_02, TestSize.Level1)
1361 {
1362     int32_t deviceId = 0;
1363     MouseTransformProcessor processor(deviceId);
1364     struct libinput_event_pointer *data = nullptr;
1365     int32_t evenType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1366     uint32_t button = MouseDeviceState::LIBINPUT_BUTTON_CODE::LIBINPUT_RIGHT_BUTTON_CODE;
1367     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, evenType, button));
1368 }
1369 
1370 /**
1371  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_03
1372  * @tc.desc: Test HandleTouchpadLeftButton
1373  * @tc.type: FUNC
1374  * @tc.require:
1375  */
1376 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_03, TestSize.Level1)
1377 {
1378     int32_t deviceId = 0;
1379     MouseTransformProcessor processor(deviceId);
1380     struct libinput_event_pointer *data = nullptr;
1381     int32_t evenType = LIBINPUT_EVENT_POINTER_TAP;
1382     uint32_t button = MouseDeviceState::LIBINPUT_BUTTON_CODE::LIBINPUT_RIGHT_BUTTON_CODE;
1383     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, evenType, button));
1384 }
1385 
1386 /**
1387  * @tc.name: MouseTransformProcessorTest_HandleTouchpadLeftButton_04
1388  * @tc.desc: Test HandleTouchpadLeftButton
1389  * @tc.type: FUNC
1390  * @tc.require:
1391  */
1392 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleTouchpadLeftButton_04, TestSize.Level1)
1393 {
1394     int32_t deviceId = 0;
1395     MouseTransformProcessor processor(deviceId);
1396     struct libinput_event_pointer *data = nullptr;
1397     int32_t evenType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1398     uint32_t button = MouseDeviceState::LIBINPUT_BUTTON_CODE::LIBINPUT_LEFT_BUTTON_CODE;
1399     ASSERT_NO_FATAL_FAILURE(processor.HandleTouchpadLeftButton(data, evenType, button));
1400 }
1401 
1402 /**
1403  * @tc.name: MouseTransformProcessorTest_TransTouchpadRightButton_04
1404  * @tc.desc: Test TransTouchpadRightButton
1405  * @tc.type: FUNC
1406  * @tc.require:
1407  */
1408 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_TransTouchpadRightButton_04, TestSize.Level1)
1409 {
1410     int32_t deviceId = 0;
1411     MouseTransformProcessor processor(deviceId);
1412     struct libinput_event_pointer *data = nullptr;
1413     int32_t evenType = LIBINPUT_EVENT_KEYBOARD_KEY;
1414     uint32_t button = BTN_RIGHT_MENUE_CODE;
1415     processor.TransTouchpadRightButton(data, evenType, button);
1416 }
1417 
1418 /**
1419  * @tc.name: MouseTransformProcessorTest_TransTouchpadRightButton_05
1420  * @tc.desc: Test TransTouchpadRightButton
1421  * @tc.type: FUNC
1422  * @tc.require:
1423  */
1424 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_TransTouchpadRightButton_05, TestSize.Level1)
1425 {
1426     int32_t deviceId = 0;
1427     MouseTransformProcessor processor(deviceId);
1428     struct libinput_event_pointer *data = nullptr;
1429     int32_t evenType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1430     uint32_t button = BTN_RIGHT_MENUE_CODE;
1431     processor.TransTouchpadRightButton(data, evenType, button);
1432 }
1433 
1434 /**
1435  * @tc.name: MouseTransformProcessorTest_TransTouchpadRightButton_06
1436  * @tc.desc: Test TransTouchpadRightButton
1437  * @tc.type: FUNC
1438  * @tc.require:
1439  */
1440 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_TransTouchpadRightButton_06, TestSize.Level1)
1441 {
1442     int32_t deviceId = 0;
1443     MouseTransformProcessor processor(deviceId);
1444     processor.SetTouchpadRightClickType(2);
1445     struct libinput_event_pointer *data = nullptr;
1446     int32_t evenType = LIBINPUT_EVENT_POINTER_BUTTON_TOUCHPAD;
1447     uint32_t button = BTN_RIGHT_MENUE_CODE;
1448     processor.TransTouchpadRightButton(data, evenType, button);
1449 }
1450 
1451 /**
1452  * @tc.name: MouseTransformProcessorTest_HandleAxisBeginEndInner_01
1453  * @tc.desc: Test HandleAxisBeginEndInner
1454  * @tc.type: FUNC
1455  * @tc.require:
1456  */
1457 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisBeginEndInner_01, TestSize.Level1)
1458 {
1459     CALL_TEST_DEBUG;
1460     int32_t deviceId = 1;
1461     bool isAxisBegin;
1462     bool isPressed;
1463     MouseTransformProcessor processor(deviceId);
1464 
1465     vMouse_.SendEvent(EV_REL, REL_X, 5);
1466     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1467     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1468     libinput_event *event = libinput_.Dispatch();
1469     ASSERT_TRUE(event != nullptr);
1470     struct libinput_device *dev = libinput_event_get_device(event);
1471     ASSERT_TRUE(dev != nullptr);
1472 
1473     isAxisBegin = false;
1474     isPressed = true;
1475     int32_t ret = processor.HandleAxisBeginEndInner(event);
1476     EXPECT_EQ(ret, RET_ERR);
1477 }
1478 
1479 /**
1480  * @tc.name: MouseTransformProcessorTest_HandleAxisBeginEndInner_02
1481  * @tc.desc: Test HandleAxisBeginEndInner
1482  * @tc.type: FUNC
1483  * @tc.require:
1484  */
1485 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisBeginEndInner_02, TestSize.Level1)
1486 {
1487     CALL_TEST_DEBUG;
1488     bool isAxisBegin;
1489     bool isPressed;
1490     int32_t deviceId = 1;
1491     MouseTransformProcessor processor(deviceId);
1492     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1493     ASSERT_TRUE(pointerEvent != nullptr);
1494 
1495     vMouse_.SendEvent(EV_REL, REL_X, 5);
1496     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1497     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1498     libinput_event *event = libinput_.Dispatch();
1499     ASSERT_TRUE(event != nullptr);
1500     struct libinput_device *dev = libinput_event_get_device(event);
1501     ASSERT_TRUE(dev != nullptr);
1502 
1503     isAxisBegin = true;
1504     isPressed = true;
1505     int32_t ret = processor.HandleAxisBeginEndInner(event);
1506     pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END);
1507     EXPECT_EQ(ret, RET_ERR);
1508 }
1509 
1510 /**
1511  * @tc.name: MouseTransformProcessorTest_HandleAxisBeginEndInner_03
1512  * @tc.desc: Test HandleAxisBeginEndInner
1513  * @tc.type: FUNC
1514  * @tc.require:
1515  */
1516 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisBeginEndInner_03, TestSize.Level1)
1517 {
1518     CALL_TEST_DEBUG;
1519     int32_t buttonId;
1520     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1521     ASSERT_TRUE(pointerEvent != nullptr);
1522     int32_t deviceId = 1;
1523     MouseTransformProcessor processor(deviceId);
1524 
1525     vMouse_.SendEvent(EV_REL, REL_X, 5);
1526     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1527     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1528     libinput_event *event = libinput_.Dispatch();
1529     ASSERT_TRUE(event != nullptr);
1530     struct libinput_device *dev = libinput_event_get_device(event);
1531     ASSERT_TRUE(dev != nullptr);
1532 
1533     buttonId = PointerEvent::BUTTON_NONE;
1534     int32_t ret = processor.HandleAxisBeginEndInner(event);
1535     EXPECT_EQ(ret, RET_ERR);
1536 }
1537 
1538 /**
1539  * @tc.name: MouseTransformProcessorTest_SetPointerSpeed_001
1540  * @tc.desc: Test the funcation SetPointerSpeed
1541  * @tc.type: FUNC
1542  * @tc.require:
1543  */
1544 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_SetPointerSpeed_001, TestSize.Level1)
1545 {
1546     CALL_TEST_DEBUG;
1547     int32_t deviceId = 1;
1548     MouseTransformProcessor processor(deviceId);
1549     int32_t speed = -1;
1550     ASSERT_EQ(processor.SetPointerSpeed(speed), 0);
1551     speed = 15;
1552     ASSERT_EQ(processor.SetPointerSpeed(speed), 0);
1553     speed = 5;
1554     EXPECT_NO_FATAL_FAILURE(processor.SetPointerSpeed(speed));
1555 }
1556 
1557 /**
1558  * @tc.name: MouseTransformProcessorTest_HandleAxisBeginEndInner_002
1559  * @tc.desc: Test the funcation HandleAxisBeginEndInner
1560  * @tc.type: FUNC
1561  * @tc.require:
1562  */
1563 HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_HandleAxisBeginEndInner_002, TestSize.Level1)
1564 {
1565     CALL_TEST_DEBUG;
1566     std::shared_ptr<PointerEvent> pointerEvent = PointerEvent::Create();
1567     ASSERT_TRUE(pointerEvent != nullptr);
1568     int32_t deviceId = 1;
1569     MouseTransformProcessor processor(deviceId);
1570     vMouse_.SendEvent(EV_REL, REL_X, 5);
1571     vMouse_.SendEvent(EV_REL, REL_Y, -10);
1572     vMouse_.SendEvent(EV_SYN, SYN_REPORT, 0);
1573     libinput_event *event = libinput_.Dispatch();
1574     ASSERT_TRUE(event != nullptr);
1575     struct libinput_device *dev = libinput_event_get_device(event);
1576     ASSERT_TRUE(dev != nullptr);
1577     processor.buttonId_ = PointerEvent::BUTTON_NONE;
1578     processor.isAxisBegin_ = false;
1579     processor.isPressed_ = true;
1580     int32_t ret = processor.HandleAxisBeginEndInner(event);
1581     EXPECT_EQ(ret, RET_ERR);
1582     processor.isAxisBegin_ = true;
1583     ret = processor.HandleAxisBeginEndInner(event);
1584     EXPECT_EQ(ret, RET_OK);
1585     processor.isPressed_ = false;
1586     ret = processor.HandleAxisBeginEndInner(event);
1587     EXPECT_EQ(ret, RET_ERR);
1588 }
1589 }
1590 }
1591