1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 #include "input_manager.h"
18 #include "input_manager_command.h"
19 
20 namespace OHOS {
21 namespace MMI {
22 namespace {
23 using namespace testing::ext;
24 constexpr int32_t KNUCKLE_SIZE = 9;
25 } // namespace
26 class InjectEventTest : public testing::Test {
27 public:
SetUpTestCase(void)28     static void SetUpTestCase(void) {}
TearDownTestCase(void)29     static void TearDownTestCase(void) {}
30 };
31 
32 /**
33  * @tc.name:InjectEvent_InjectMouse_001
34  * @tc.desc: test inject mouse move interface
35  * @tc.type: FUNC
36  * @tc.require:AR000GJN3F
37  */
38 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_001, TestSize.Level1)
39 {
40     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
41     char command1[] = {"uinput"};
42     char command2[] = {"-M"};
43     char command3[] = {"-m"};
44     char command4[] = {"100"};
45     char command5[] = {"200"};
46     char *argv[] = {command1, command2, command3, command4, command5};
47     int32_t result = inputManagerCommand->ParseCommand(5, argv);
48     EXPECT_EQ(OHOS::ERR_OK, result);
49 }
50 
51 /**
52  * @tc.name:InjectEvent_InjectMouse_002
53  * @tc.desc: test inject mouse down interface
54  * @tc.type: FUNC
55  * @tc.require:SR000GGQBJ
56  */
57 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_002, TestSize.Level1)
58 {
59     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
60     char command1[] = {"uinput"};
61     char command2[] = {"-M"};
62     char command3[] = {"-d"};
63     char command4[] = {"0"};
64     char *argv[] = {command1, command2, command3, command4};
65     int32_t result = inputManagerCommand->ParseCommand(4, argv);
66     EXPECT_EQ(OHOS::ERR_OK, result);
67 }
68 
69 /**
70  * @tc.name:InjectEvent_InjectMouse_003
71  * @tc.desc: test inject mouse up interface
72  * @tc.type: FUNC
73  * @tc.require:SR000GGQBJ
74  */
75 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_003, TestSize.Level1)
76 {
77     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
78     char command1[] = {"uinput"};
79     char command2[] = {"-M"};
80     char command3[] = {"-u"};
81     char command4[] = {"0"};
82     char *argv[] = {command1, command2, command3, command4};
83     int32_t result = inputManagerCommand->ParseCommand(4, argv);
84     EXPECT_EQ(OHOS::ERR_OK, result);
85 }
86 
87 /**
88  * @tc.name:InjectEvent_InjectMouse_004
89  * @tc.desc: test inject mouse click interface
90  * @tc.type: FUNC
91  * @tc.require:SR000GGQBJ
92  */
93 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_004, TestSize.Level1)
94 {
95     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
96     char command1[] = {"uinput"};
97     char command2[] = {"-M"};
98     char command3[] = {"-c"};
99     char command4[] = {"0"};
100     char *argv[] = {command1, command2, command3, command4};
101     int32_t result = inputManagerCommand->ParseCommand(4, argv);
102     EXPECT_EQ(OHOS::ERR_OK, result);
103 }
104 
105 /**
106  * @tc.name:InjectEvent_InjectMouse_005
107  * @tc.desc: test inject mouse double click interface
108  * @tc.type: FUNC
109  * @tc.require:SR000GGQBJ
110  */
111 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_005, TestSize.Level1)
112 {
113     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
114     char command1[] = {"uinput"};
115     char command2[] = {"-M"};
116     char command3[] = {"-b"};
117     char command4[] = {"200"};
118     char command5[] = {"1250"};
119     char command6[] = {"0"};
120     char command7[] = {"100"};
121     char command8[] = {"300"};
122     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8};
123     int32_t result = inputManagerCommand->ParseCommand(8, argv);
124     EXPECT_EQ(OHOS::ERR_OK, result);
125 }
126 
127 /**
128  * @tc.name:InjectEvent_InjectMouse_006
129  * @tc.desc: test inject mouse scroll interface
130  * @tc.type: FUNC
131  * @tc.require:SR000GGQBJ
132  */
133 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_006, TestSize.Level1)
134 {
135     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
136     char command1[] = {"uinput"};
137     char command2[] = {"-M"};
138     char command3[] = {"-s"};
139     char command4[] = {"50"};
140     char *argv[] = {command1, command2, command3, command4};
141     int32_t result = inputManagerCommand->ParseCommand(4, argv);
142     EXPECT_EQ(OHOS::ERR_OK, result);
143 }
144 
145 /**
146  * @tc.name:InjectEvent_InjectMouse_007
147  * @tc.desc: test inject mouse smooth movement interface
148  * @tc.type: FUNC
149  * @tc.require:SR000GGQBJ
150  */
151 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_007, TestSize.Level1)
152 {
153     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
154     char command1[] = {"uinput"};
155     char command2[] = {"-M"};
156     char command3[] = {"-m"};
157     char command4[] = {"200"};
158     char command5[] = {"200"};
159     char command6[] = {"200"};
160     char command7[] = {"700"};
161     char command8[] = {"3000"};
162     char command9[] = {"--trace"};
163 
164     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8, command9};
165     int32_t result = inputManagerCommand->ParseCommand(9, argv);
166     EXPECT_EQ(OHOS::ERR_OK, result);
167 }
168 
169 /**
170  * @tc.name:InjectEvent_InjectMouse_008
171  * @tc.desc: test inject mouse soomth drag interface
172  * @tc.type: FUNC
173  * @tc.require:SR000GGQBJ
174  */
175 HWTEST_F(InjectEventTest, InjectEvent_InjectMouse_008, TestSize.Level1)
176 {
177     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
178     char command1[] = {"uinput"};
179     char command2[] = {"-M"};
180     char command3[] = {"-g"};
181     char command4[] = {"100"};
182     char command5[] = {"200"};
183     char command6[] = {"100"};
184     char command7[] = {"700"};
185     char command8[] = {"3000"};
186 
187     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8};
188     int32_t result = inputManagerCommand->ParseCommand(8, argv);
189     EXPECT_EQ(OHOS::ERR_OK, result);
190 }
191 
192 /**
193  * @tc.name:InjectEvent_InjectKey_001
194  * @tc.desc: test inject key down interface
195  * @tc.type: FUNC
196  * @tc.require:SR000GGQBJ
197  */
198 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_001, TestSize.Level1)
199 {
200     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
201     char command1[] = {"uinput"};
202     char command2[] = {"-K"};
203     char command3[] = {"-d"};
204     char command4[] = {"16"};
205     char *argv[] = {command1, command2, command3, command4};
206     int32_t result = inputManagerCommand->ParseCommand(4, argv);
207     EXPECT_EQ(OHOS::ERR_OK, result);
208 }
209 
210 /**
211  * @tc.name:InjectEvent_InjectKey_002
212  * @tc.desc: test inject key up interface
213  * @tc.type: FUNC
214  * @tc.require:SR000GGQBJ
215  */
216 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_002, TestSize.Level1)
217 {
218     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
219     char command1[] = {"uinput"};
220     char command2[] = {"-K"};
221     char command3[] = {"-d"};
222     char command4[] = {"16"};
223     char command5[] = {"-i"};
224     char command6[] = {"1000"};
225     char command7[] = {"-u"};
226     char command8[] = {"16"};
227     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8};
228     int32_t result = inputManagerCommand->ParseCommand(8, argv);
229     EXPECT_EQ(OHOS::ERR_OK, result);
230 }
231 
232 /**
233  * @tc.name:InjectEvent_InjectKey_003
234  * @tc.desc: test inject press and hold the key interface
235  * @tc.type: FUNC
236  * @tc.require:SR000GGQBJ
237  */
238 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_003, TestSize.Level1)
239 {
240     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
241     char command1[] = {"uinput"};
242     char command2[] = {"-K"};
243     char command3[] = {"-l"};
244     char command4[] = {"17"};
245     char *argv[] = {command1, command2, command3, command4};
246     int32_t result = inputManagerCommand->ParseCommand(4, argv);
247     EXPECT_EQ(OHOS::ERR_OK, result);
248 }
249 
250 /**
251  * @tc.name:InjectEvent_InjectKey_009
252  * @tc.desc: test inject keyevent of text.
253  * @tc.type: FUNC
254  * @tc.require:
255  */
256 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_009, TestSize.Level1)
257 {
258     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
259     char command1[] = {"uinput"};
260     char command2[] = {"-K"};
261     char command3[] = {"-t"};
262     char command4[] = {"abc ABC 123 ,-+*/.=~[{}]"};
263     char *argv[] = {command1, command2, command3, command4};
264     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
265     EXPECT_EQ(OHOS::ERR_OK, result);
266 }
267 
268 /**
269  * @tc.name:InjectEvent_InjectKey_010
270  * @tc.desc: test inject keyevent of illegal character text.
271  * @tc.type: FUNC
272  * @tc.require:
273  */
274 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_010, TestSize.Level1)
275 {
276     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
277     char command1[] = {"uinput"};
278     char command2[] = {"-K"};
279     char command3[] = {"-t"};
280     char command4[] = {"abc一二三"};
281     char *argv[] = {command1, command2, command3, command4};
282     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
283     EXPECT_NE(OHOS::ERR_OK, result);
284 }
285 
286 /**
287  * @tc.name:InjectEvent_InjectKey_011
288  * @tc.desc: test inject keyevent of text.
289  * @tc.type: FUNC
290  * @tc.require:
291  */
292 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_011, TestSize.Level1)
293 {
294     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
295     char command1[] = {"uinput"};
296     char command2[] = {"-K"};
297     char command3[] = {"--text"};
298     char command4[] = {"abc ABC 123 ,-+*/.=~[{}]"};
299     char *argv[] = {command1, command2, command3, command4};
300     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
301     EXPECT_EQ(OHOS::ERR_OK, result);
302 }
303 
304 /**
305  * @tc.name:InjectEvent_InjectKey_012
306  * @tc.desc: test inject keyevent of illegal character text.
307  * @tc.type: FUNC
308  * @tc.require:
309  */
310 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_012, TestSize.Level1)
311 {
312     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
313     char command1[] = {"uinput"};
314     char command2[] = {"-K"};
315     char command3[] = {"--text"};
316     char command4[] = {"abc一二三"};
317     char *argv[] = {command1, command2, command3, command4};
318     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
319     EXPECT_NE(OHOS::ERR_OK, result);
320 }
321 
322 /**
323  * @tc.name:InjectEvent_InjectKey_013
324  * @tc.desc: test inject keyevent of text.
325  * @tc.type: FUNC
326  * @tc.require:
327  */
328 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_013, TestSize.Level1)
329 {
330     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
331     char command1[] = {"uinput"};
332     char command2[] = {"--keyboard"};
333     char command3[] = {"-t"};
334     char command4[] = {"abc ABC 123 ,-+*/.=~[{}]"};
335     char *argv[] = {command1, command2, command3, command4};
336     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
337     EXPECT_EQ(OHOS::ERR_OK, result);
338 }
339 
340 /**
341  * @tc.name:InjectEvent_InjectKey_014
342  * @tc.desc: test inject keyevent of text.
343  * @tc.type: FUNC
344  * @tc.require:
345  */
346 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_014, TestSize.Level1)
347 {
348     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
349     char command1[] = {"uinput"};
350     char command2[] = {"--keyboard"};
351     char command3[] = {"--text"};
352     char command4[] = {"abc ABC 123 ,-+*/.=~[{}]"};
353     char *argv[] = {command1, command2, command3, command4};
354     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
355     EXPECT_EQ(OHOS::ERR_OK, result);
356 }
357 
358 /**
359  * @tc.name:InjectEvent_InjectKey_015
360  * @tc.desc: test inject keyevent of text.
361  * @tc.type: FUNC
362  * @tc.require:
363  */
364 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_015, TestSize.Level1)
365 {
366     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
367     char command1[] = {"uinput"};
368     char command2[] = {"-K"};
369     char command3[] = {"-t"};
370     char command4[2002] = { 0 };
371 
372     for (int i = 0; i < 2001; ++i) {
373         command4[i] = 'a';
374     }
375     command4[2001] = '\n';
376     char *argv[] = {command1, command2, command3, command4};
377     int32_t result = inputManagerCommand->ParseCommand(4, argv);
378     EXPECT_EQ(OHOS::ERR_OK, result);
379 }
380 
381 /**
382  * @tc.name:InjectEvent_InjectKey_016
383  * @tc.desc: test inject keyevent of text. Combined commands is not supported.
384  * @tc.type: FUNC
385  * @tc.require:
386  */
387 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_016, TestSize.Level1)
388 {
389     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
390     char command1[] = {"uinput"};
391     char command2[] = {"-K"};
392     char command3[] = {"-d"};
393     char command4[] = {"2017"};
394     char command5[] = {"-t"};
395     char command6[] = {"abc"};
396     char *argv[] = {command1, command2, command3, command4, command5, command6};
397     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
398     EXPECT_NE(OHOS::ERR_OK, result);
399 }
400 
401 /**
402  * @tc.name:InjectEvent_InjectKey_017
403  * @tc.desc: test inject keyevent of text. Combined commands is not supported.
404  * @tc.type: FUNC
405  * @tc.require:
406  */
407 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_017, TestSize.Level1)
408 {
409     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
410     char command1[] = {"uinput"};
411     char command2[] = {"-K"};
412     char command3[] = {"-t"};
413     char command4[] = {"abc"};
414     char command5[] = {"-d"};
415     char command6[] = {"2017"};
416     char *argv[] = {command1, command2, command3, command4, command5, command6};
417     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
418     EXPECT_NE(OHOS::ERR_OK, result);
419 }
420 
421 /**
422  * @tc.name:InjectEvent_InjectKey_018
423  * @tc.desc: test inject keyevent of text. Combined commands is not supported.
424  * @tc.type: FUNC
425  * @tc.require:
426  */
427 HWTEST_F(InjectEventTest, InjectEvent_InjectKey_018, TestSize.Level1)
428 {
429     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
430     char command1[] = {"uinput"};
431     char command2[] = {"-K"};
432     char command3[] = {"-t"};
433     char command4[] = {"abc"};
434     char command5[] = {"-t"};
435     char command6[] = {"def"};
436     char *argv[] = {command1, command2, command3, command4, command5, command6};
437     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
438     EXPECT_NE(OHOS::ERR_OK, result);
439 }
440 
441 /**
442  * @tc.name:InjectEvent_InjectTouch_001
443  * @tc.desc: test inject touch screen smooth movement interface
444  * @tc.type: FUNC
445  * @tc.require:SR000GGQBJ
446  */
447 HWTEST_F(InjectEventTest, InjectEvent_InjectTouch_001, TestSize.Level1)
448 {
449     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
450     char command1[] = {"uinput"};
451     char command2[] = {"-T"};
452     char command3[] = {"-m"};
453     char command4[] = {"100"};
454     char command5[] = {"200"};
455     char command6[] = {"100"};
456     char command7[] = {"600"};
457     char command8[] = {"1000"};
458     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8};
459     int32_t result = inputManagerCommand->ParseCommand(8, argv);
460     EXPECT_EQ(OHOS::ERR_OK, result);
461 }
462 
463 /**
464  * @tc.name:InjectEvent_InjectTouch_002
465  * @tc.desc: test inject touch down interface
466  * @tc.type: FUNC
467  * @tc.require:SR000GGQBJ
468  */
469 HWTEST_F(InjectEventTest, InjectEvent_InjectTouch_002, TestSize.Level1)
470 {
471     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
472     char command1[] = {"uinput"};
473     char command2[] = {"-T"};
474     char command3[] = {"-d"};
475     char command4[] = {"100"};
476     char command5[] = {"200"};
477     char *argv[] = {command1, command2, command3, command4, command5};
478     int32_t result = inputManagerCommand->ParseCommand(5, argv);
479     EXPECT_EQ(OHOS::ERR_OK, result);
480 }
481 
482 /**
483  * @tc.name:InjectEvent_InjectTouch_003
484  * @tc.desc: test inject touch up interface
485  * @tc.type: FUNC
486  * @tc.require:SR000GGQBJ
487  */
488 HWTEST_F(InjectEventTest, InjectEvent_InjectTouch_003, TestSize.Level1)
489 {
490     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
491     char command1[] = {"uinput"};
492     char command2[] = {"-T"};
493     char command3[] = {"-u"};
494     char command4[] = {"100"};
495     char command5[] = {"200"};
496     char *argv[] = {command1, command2, command3, command4, command5};
497     int32_t result = inputManagerCommand->ParseCommand(5, argv);
498     EXPECT_EQ(OHOS::ERR_OK, result);
499 }
500 
501 /**
502  * @tc.name:InjectEvent_InjectTouch_004
503  * @tc.desc: test inject touch click interface
504  * @tc.type: FUNC
505  * @tc.require:SR000GGQBJ
506  */
507 HWTEST_F(InjectEventTest, InjectEvent_InjectTouch_004, TestSize.Level1)
508 {
509     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
510     char command1[] = {"uinput"};
511     char command2[] = {"-T"};
512     char command3[] = {"-c"};
513     char command4[] = {"200"};
514     char command5[] = {"1250"};
515     char command6[] = {"200"};
516     char *argv[] = {command1, command2, command3, command4, command5, command6};
517     int32_t result = inputManagerCommand->ParseCommand(5, argv);
518     EXPECT_EQ(OHOS::ERR_OK, result);
519 }
520 
521 /**
522  * @tc.name:InjectEvent_InjectTouch_005
523  * @tc.desc: test inject touch drag interface
524  * @tc.type: FUNC
525  * @tc.require:SR000GGQBJ
526  */
527 HWTEST_F(InjectEventTest, InjectEvent_InjectTouch_005, TestSize.Level1)
528 {
529     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
530     char command1[] = {"uinput"};
531     char command2[] = {"-T"};
532     char command3[] = {"-g"};
533     char command4[] = {"100"};
534     char command5[] = {"200"};
535     char command6[] = {"100"};
536     char command7[] = {"600"};
537     char command8[] = {"700"};
538     char command9[] = {"3000"};
539     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8, command9};
540     int32_t result = inputManagerCommand->ParseCommand(9, argv);
541     EXPECT_EQ(OHOS::ERR_OK, result);
542 }
543 
544 /**
545  * @tc.name:InjectEvent_InjectKnuckle_001
546  * @tc.desc: test inject single knuckle double click interface
547  * @tc.type: FUNC
548  * @tc.require:
549  */
550 HWTEST_F(InjectEventTest, InjectEvent_InjectKnuckle_001, TestSize.Level1)
551 {
552     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
553     char command1[] = {"uinput"};
554     char command2[] = {"-T"};
555     char command3[] = {"-k"};
556     char command4[] = {"-s"};
557     char command5[] = {"100"};
558     char command6[] = {"200"};
559     char command7[] = {"130"};
560     char command8[] = {"230"};
561     char command9[] = {"200"};
562     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8, command9};
563     int32_t result = inputManagerCommand->ParseCommand(KNUCKLE_SIZE, argv);
564     EXPECT_EQ(OHOS::ERR_OK, result);
565 }
566 
567 /**
568  * @tc.name:InjectEvent_InjectKnuckle_002
569  * @tc.desc: test inject double knuckle double click interface
570  * @tc.type: FUNC
571  * @tc.require:
572  */
573 HWTEST_F(InjectEventTest, InjectEvent_InjectKnuckle_002, TestSize.Level1)
574 {
575     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
576     char command1[] = {"uinput"};
577     char command2[] = {"-T"};
578     char command3[] = {"-k"};
579     char command4[] = {"-d"};
580     char command5[] = {"200"};
581     char command6[] = {"300"};
582     char command7[] = {"230"};
583     char command8[] = {"330"};
584     char command9[] = {"200"};
585     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8, command9};
586     int32_t result = inputManagerCommand->ParseCommand(KNUCKLE_SIZE, argv);
587     EXPECT_EQ(OHOS::ERR_OK, result);
588 }
589 
590 /**
591  * @tc.name:InjectEvent_InjectTouchPad_001
592  * @tc.desc: test inject touchpad two finger pinch, scale is 2.05
593  * @tc.type: FUNC
594  * @tc.require:
595  */
596 HWTEST_F(InjectEventTest, InjectEvent_InjectTouchPad_001, TestSize.Level1)
597 {
598     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
599     char command1[] = {"uinput"};
600     char command2[] = {"-P"};
601     char command3[] = {"-p"};
602     char command4[] = {"2"};
603     char command5[] = {"205"};
604     char *argv[] = {command1, command2, command3, command4, command5};
605     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
606     EXPECT_NE(OHOS::ERR_OK, result);
607 }
608 
609 /**
610  * @tc.name:InjectEvent_InjectStylus_001
611  * @tc.desc: test inject stylus smooth movement interface
612  * @tc.type: FUNC
613  * @tc.require:
614  */
615 HWTEST_F(InjectEventTest, InjectEvent_InjectStylus_001, TestSize.Level1)
616 {
617     auto inputManagerCommand = std::make_unique<InputManagerCommand>();
618     char command1[] = {"uinput"};
619     char command2[] = {"-S"};
620     char command3[] = {"-m"};
621     char command4[] = {"100"};
622     char command5[] = {"200"};
623     char command6[] = {"100"};
624     char command7[] = {"600"};
625     char command8[] = {"1000"};
626     char *argv[] = {command1, command2, command3, command4, command5, command6, command7, command8};
627     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
628     EXPECT_EQ(OHOS::ERR_OK, result);
629 }
630 
631 /**
632  * @tc.name:InjectEvent_InjectTouchPad_013
633  * @tc.desc: test touchpad rotate interface
634  * @tc.type: FUNC
635  * @tc.require:
636  */
637 HWTEST_F(InjectEventTest, InjectEvent_InjectTouchPad_013, TestSize.Level1)
638 {
639     std::unique_ptr<InputManagerCommand> inputManagerCommand = std::make_unique<InputManagerCommand>();
640     char command1[] = {"uinput"};
641     char command2[] = {"-P"};
642     char command3[] = {"-r"};
643     char command4[] = {"90"};
644     char *argv[] = {command1, command2, command3, command4};
645     int32_t result = inputManagerCommand->ParseCommand(sizeof(argv) / sizeof(argv[0]), argv);
646     EXPECT_EQ(OHOS::ERR_OK, result);
647 }
648 } // namespace MMI
649 } // namespace OHOS