test: add tests for touch calibration
[platform/upstream/libinput.git] / test / path.c
1
2 /*
3  * Copyright © 2013 Red Hat, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of the copyright holders not be used in
10  * advertising or publicity pertaining to distribution of the software
11  * without specific, written prior permission.  The copyright holders make
12  * no representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied warranty.
14  *
15  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
16  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  */
23
24 #include <config.h>
25
26 #include <check.h>
27 #include <errno.h>
28 #include <fcntl.h>
29 #include <libinput.h>
30 #include <libudev.h>
31 #include <unistd.h>
32
33 #include "litest.h"
34
35 static int open_func_count = 0;
36 static int close_func_count = 0;
37
38 static int open_restricted(const char *path, int flags, void *data)
39 {
40         int fd;
41         open_func_count++;
42         fd = open(path, flags);
43         return fd < 0 ? -errno : fd;
44 }
45 static void close_restricted(int fd, void *data)
46 {
47         close_func_count++;
48         close(fd);
49 }
50
51 const struct libinput_interface simple_interface = {
52         .open_restricted = open_restricted,
53         .close_restricted = close_restricted,
54 };
55
56 START_TEST(path_create_NULL)
57 {
58         struct libinput *li;
59
60         open_func_count = 0;
61         close_func_count = 0;
62
63         li = libinput_path_create_context(NULL, NULL);
64         ck_assert(li == NULL);
65         li = libinput_path_create_context(&simple_interface, NULL);
66         ck_assert(li != NULL);
67         libinput_unref(li);
68
69         ck_assert_int_eq(open_func_count, 0);
70         ck_assert_int_eq(close_func_count, 0);
71
72         open_func_count = 0;
73         close_func_count = 0;
74 }
75 END_TEST
76
77 START_TEST(path_create_invalid)
78 {
79         struct libinput *li;
80         struct libinput_device *device;
81         const char *path = "/tmp";
82
83         open_func_count = 0;
84         close_func_count = 0;
85
86         li = libinput_path_create_context(&simple_interface, NULL);
87         ck_assert(li != NULL);
88         device = libinput_path_add_device(li, path);
89         ck_assert(device == NULL);
90
91         ck_assert_int_eq(open_func_count, 0);
92         ck_assert_int_eq(close_func_count, 0);
93
94         libinput_unref(li);
95         ck_assert_int_eq(close_func_count, 0);
96
97         open_func_count = 0;
98         close_func_count = 0;
99 }
100 END_TEST
101
102 START_TEST(path_create_destroy)
103 {
104         struct libinput *li;
105         struct libinput_device *device;
106         struct libevdev_uinput *uinput;
107         int rc;
108         void *userdata = &rc;
109
110         uinput = litest_create_uinput_device("test device", NULL,
111                                              EV_KEY, BTN_LEFT,
112                                              EV_KEY, BTN_RIGHT,
113                                              EV_REL, REL_X,
114                                              EV_REL, REL_Y,
115                                              -1);
116
117         li = libinput_path_create_context(&simple_interface, userdata);
118         ck_assert(li != NULL);
119         ck_assert(libinput_get_user_data(li) == userdata);
120
121         device = libinput_path_add_device(li,
122                                           libevdev_uinput_get_devnode(uinput));
123         ck_assert(device != NULL);
124
125         ck_assert_int_eq(open_func_count, 1);
126
127         libevdev_uinput_destroy(uinput);
128         libinput_unref(li);
129         ck_assert_int_eq(close_func_count, 1);
130
131         open_func_count = 0;
132         close_func_count = 0;
133 }
134 END_TEST
135
136 START_TEST(path_added_seat)
137 {
138         struct litest_device *dev = litest_current_device();
139         struct libinput *li = dev->libinput;
140         struct libinput_event *event;
141         struct libinput_device *device;
142         struct libinput_seat *seat;
143         const char *seat_name;
144         enum libinput_event_type type;
145
146         libinput_dispatch(li);
147
148         event = libinput_get_event(li);
149         ck_assert(event != NULL);
150
151         type = libinput_event_get_type(event);
152         ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
153
154         device = libinput_event_get_device(event);
155         seat = libinput_device_get_seat(device);
156         ck_assert(seat != NULL);
157
158         seat_name = libinput_seat_get_logical_name(seat);
159         ck_assert_str_eq(seat_name, "default");
160
161         libinput_event_destroy(event);
162 }
163 END_TEST
164
165 START_TEST(path_added_device)
166 {
167         struct litest_device *dev = litest_current_device();
168         struct libinput *li = dev->libinput;
169         struct libinput_event *event;
170         struct libinput_device *device;
171
172         libinput_dispatch(li);
173
174         while ((event = libinput_get_event(li))) {
175                 enum libinput_event_type type;
176                 type = libinput_event_get_type(event);
177
178                 if (type == LIBINPUT_EVENT_DEVICE_ADDED) {
179                         break;
180                 }
181
182                 libinput_event_destroy(event);
183         }
184
185         ck_assert(event != NULL);
186
187         device = libinput_event_get_device(event);
188         ck_assert(device != NULL);
189
190         libinput_event_destroy(event);
191 }
192 END_TEST
193
194 START_TEST(path_add_device)
195 {
196         struct litest_device *dev = litest_current_device();
197         struct libinput *li = dev->libinput;
198         struct libinput_event *event;
199         struct libinput_device *device;
200         const char *sysname1 = NULL, *sysname2 = NULL;
201
202         libinput_dispatch(li);
203
204         while ((event = libinput_get_event(li))) {
205                 enum libinput_event_type type;
206                 type = libinput_event_get_type(event);
207
208                 if (type == LIBINPUT_EVENT_DEVICE_ADDED) {
209                         ck_assert(sysname1 == NULL);
210                         device = libinput_event_get_device(event);
211                         ck_assert(device != NULL);
212                         sysname1 = libinput_device_get_sysname(device);
213                 }
214
215                 libinput_event_destroy(event);
216         }
217
218         device = libinput_path_add_device(li,
219                                           libevdev_uinput_get_devnode(dev->uinput));
220         ck_assert(device != NULL);
221
222         libinput_dispatch(li);
223
224         while ((event = libinput_get_event(li))) {
225                 enum libinput_event_type type;
226                 type = libinput_event_get_type(event);
227
228                 if (type == LIBINPUT_EVENT_DEVICE_ADDED) {
229                         ck_assert(sysname2 == NULL);
230                         device = libinput_event_get_device(event);
231                         ck_assert(device != NULL);
232                         sysname2 = libinput_device_get_sysname(device);
233                 }
234
235                 libinput_event_destroy(event);
236         }
237
238         ck_assert_str_eq(sysname1, sysname2);
239
240         libinput_event_destroy(event);
241 }
242 END_TEST
243
244 START_TEST(path_add_invalid_path)
245 {
246         struct libinput *li;
247         struct libinput_event *event;
248         struct libinput_device *device;
249
250         li = litest_create_context();
251
252         device = libinput_path_add_device(li, "/tmp/");
253         ck_assert(device == NULL);
254
255         libinput_dispatch(li);
256
257         while ((event = libinput_get_event(li)))
258                 ck_abort();
259
260         libinput_unref(li);
261 }
262 END_TEST
263
264 START_TEST(path_device_sysname)
265 {
266         struct litest_device *dev = litest_current_device();
267         struct libinput_event *ev;
268         struct libinput_device *device;
269         const char *sysname;
270
271         libinput_dispatch(dev->libinput);
272
273         while ((ev = libinput_get_event(dev->libinput))) {
274                 if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED)
275                         continue;
276
277                 device = libinput_event_get_device(ev);
278                 sysname = libinput_device_get_sysname(device);
279                 ck_assert(sysname != NULL && strlen(sysname) > 1);
280                 ck_assert(strchr(sysname, '/') == NULL);
281                 ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
282
283                 libinput_event_destroy(ev);
284         }
285 }
286 END_TEST
287
288 START_TEST(path_remove_device)
289 {
290         struct litest_device *dev = litest_current_device();
291         struct libinput *li = dev->libinput;
292         struct libinput_event *event;
293         struct libinput_device *device;
294         int remove_event = 0;
295
296         device = libinput_path_add_device(li,
297                                           libevdev_uinput_get_devnode(dev->uinput));
298         ck_assert(device != NULL);
299         litest_drain_events(li);
300
301         libinput_path_remove_device(device);
302         libinput_dispatch(li);
303
304         while ((event = libinput_get_event(li))) {
305                 enum libinput_event_type type;
306                 type = libinput_event_get_type(event);
307
308                 if (type == LIBINPUT_EVENT_DEVICE_REMOVED)
309                         remove_event++;
310
311                 libinput_event_destroy(event);
312         }
313
314         ck_assert_int_eq(remove_event, 1);
315 }
316 END_TEST
317
318 START_TEST(path_double_remove_device)
319 {
320         struct litest_device *dev = litest_current_device();
321         struct libinput *li = dev->libinput;
322         struct libinput_event *event;
323         struct libinput_device *device;
324         int remove_event = 0;
325
326         device = libinput_path_add_device(li,
327                                           libevdev_uinput_get_devnode(dev->uinput));
328         ck_assert(device != NULL);
329         litest_drain_events(li);
330
331         libinput_path_remove_device(device);
332         libinput_path_remove_device(device);
333         libinput_dispatch(li);
334
335         while ((event = libinput_get_event(li))) {
336                 enum libinput_event_type type;
337                 type = libinput_event_get_type(event);
338
339                 if (type == LIBINPUT_EVENT_DEVICE_REMOVED)
340                         remove_event++;
341
342                 libinput_event_destroy(event);
343         }
344
345         ck_assert_int_eq(remove_event, 1);
346 }
347 END_TEST
348
349 START_TEST(path_suspend)
350 {
351         struct libinput *li;
352         struct libinput_device *device;
353         struct libevdev_uinput *uinput;
354         int rc;
355         void *userdata = &rc;
356
357         uinput = litest_create_uinput_device("test device", NULL,
358                                              EV_KEY, BTN_LEFT,
359                                              EV_KEY, BTN_RIGHT,
360                                              EV_REL, REL_X,
361                                              EV_REL, REL_Y,
362                                              -1);
363
364         li = libinput_path_create_context(&simple_interface, userdata);
365         ck_assert(li != NULL);
366
367         device = libinput_path_add_device(li,
368                                           libevdev_uinput_get_devnode(uinput));
369         ck_assert(device != NULL);
370
371         libinput_suspend(li);
372         libinput_resume(li);
373
374         libevdev_uinput_destroy(uinput);
375         libinput_unref(li);
376
377         open_func_count = 0;
378         close_func_count = 0;
379 }
380 END_TEST
381
382 START_TEST(path_double_suspend)
383 {
384         struct libinput *li;
385         struct libinput_device *device;
386         struct libevdev_uinput *uinput;
387         int rc;
388         void *userdata = &rc;
389
390         uinput = litest_create_uinput_device("test device", NULL,
391                                              EV_KEY, BTN_LEFT,
392                                              EV_KEY, BTN_RIGHT,
393                                              EV_REL, REL_X,
394                                              EV_REL, REL_Y,
395                                              -1);
396
397         li = libinput_path_create_context(&simple_interface, userdata);
398         ck_assert(li != NULL);
399
400         device = libinput_path_add_device(li,
401                                           libevdev_uinput_get_devnode(uinput));
402         ck_assert(device != NULL);
403
404         libinput_suspend(li);
405         libinput_suspend(li);
406         libinput_resume(li);
407
408         libevdev_uinput_destroy(uinput);
409         libinput_unref(li);
410
411         open_func_count = 0;
412         close_func_count = 0;
413 }
414 END_TEST
415
416 START_TEST(path_double_resume)
417 {
418         struct libinput *li;
419         struct libinput_device *device;
420         struct libevdev_uinput *uinput;
421         int rc;
422         void *userdata = &rc;
423
424         uinput = litest_create_uinput_device("test device", NULL,
425                                              EV_KEY, BTN_LEFT,
426                                              EV_KEY, BTN_RIGHT,
427                                              EV_REL, REL_X,
428                                              EV_REL, REL_Y,
429                                              -1);
430
431         li = libinput_path_create_context(&simple_interface, userdata);
432         ck_assert(li != NULL);
433
434         device = libinput_path_add_device(li,
435                                           libevdev_uinput_get_devnode(uinput));
436         ck_assert(device != NULL);
437
438         libinput_suspend(li);
439         libinput_resume(li);
440         libinput_resume(li);
441
442         libevdev_uinput_destroy(uinput);
443         libinput_unref(li);
444
445         open_func_count = 0;
446         close_func_count = 0;
447 }
448 END_TEST
449
450 START_TEST(path_add_device_suspend_resume)
451 {
452         struct libinput *li;
453         struct libinput_device *device;
454         struct libinput_event *event;
455         struct libevdev_uinput *uinput1, *uinput2;
456         int rc;
457         int nevents;
458         void *userdata = &rc;
459
460         uinput1 = litest_create_uinput_device("test device", NULL,
461                                               EV_KEY, BTN_LEFT,
462                                               EV_KEY, BTN_RIGHT,
463                                               EV_REL, REL_X,
464                                               EV_REL, REL_Y,
465                                               -1);
466         uinput2 = litest_create_uinput_device("test device 2", NULL,
467                                               EV_KEY, BTN_LEFT,
468                                               EV_KEY, BTN_RIGHT,
469                                               EV_REL, REL_X,
470                                               EV_REL, REL_Y,
471                                               -1);
472
473         li = libinput_path_create_context(&simple_interface, userdata);
474         ck_assert(li != NULL);
475
476         device = libinput_path_add_device(li,
477                                           libevdev_uinput_get_devnode(uinput1));
478         ck_assert(device != NULL);
479         device = libinput_path_add_device(li,
480                                           libevdev_uinput_get_devnode(uinput2));
481
482         libinput_dispatch(li);
483
484         nevents = 0;
485         while ((event = libinput_get_event(li))) {
486                 enum libinput_event_type type;
487                 type = libinput_event_get_type(event);
488                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
489                 libinput_event_destroy(event);
490                 nevents++;
491         }
492
493         ck_assert_int_eq(nevents, 2);
494
495         libinput_suspend(li);
496         libinput_dispatch(li);
497
498         nevents = 0;
499         while ((event = libinput_get_event(li))) {
500                 enum libinput_event_type type;
501                 type = libinput_event_get_type(event);
502                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
503                 libinput_event_destroy(event);
504                 nevents++;
505         }
506
507         ck_assert_int_eq(nevents, 2);
508
509         libinput_resume(li);
510         libinput_dispatch(li);
511
512         nevents = 0;
513         while ((event = libinput_get_event(li))) {
514                 enum libinput_event_type type;
515                 type = libinput_event_get_type(event);
516                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
517                 libinput_event_destroy(event);
518                 nevents++;
519         }
520
521         ck_assert_int_eq(nevents, 2);
522
523         libevdev_uinput_destroy(uinput1);
524         libevdev_uinput_destroy(uinput2);
525         libinput_unref(li);
526
527         open_func_count = 0;
528         close_func_count = 0;
529 }
530 END_TEST
531
532 START_TEST(path_add_device_suspend_resume_fail)
533 {
534         struct libinput *li;
535         struct libinput_device *device;
536         struct libinput_event *event;
537         struct libevdev_uinput *uinput1, *uinput2;
538         int rc;
539         int nevents;
540         void *userdata = &rc;
541
542         uinput1 = litest_create_uinput_device("test device", NULL,
543                                               EV_KEY, BTN_LEFT,
544                                               EV_KEY, BTN_RIGHT,
545                                               EV_REL, REL_X,
546                                               EV_REL, REL_Y,
547                                               -1);
548         uinput2 = litest_create_uinput_device("test device 2", NULL,
549                                               EV_KEY, BTN_LEFT,
550                                               EV_KEY, BTN_RIGHT,
551                                               EV_REL, REL_X,
552                                               EV_REL, REL_Y,
553                                               -1);
554
555         li = libinput_path_create_context(&simple_interface, userdata);
556         ck_assert(li != NULL);
557
558         device = libinput_path_add_device(li,
559                                           libevdev_uinput_get_devnode(uinput1));
560         ck_assert(device != NULL);
561         device = libinput_path_add_device(li,
562                                           libevdev_uinput_get_devnode(uinput2));
563         ck_assert(device != NULL);
564
565         libinput_dispatch(li);
566
567         nevents = 0;
568         while ((event = libinput_get_event(li))) {
569                 enum libinput_event_type type;
570                 type = libinput_event_get_type(event);
571                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
572                 libinput_event_destroy(event);
573                 nevents++;
574         }
575
576         ck_assert_int_eq(nevents, 2);
577
578         libinput_suspend(li);
579         libinput_dispatch(li);
580
581         nevents = 0;
582         while ((event = libinput_get_event(li))) {
583                 enum libinput_event_type type;
584                 type = libinput_event_get_type(event);
585                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
586                 libinput_event_destroy(event);
587                 nevents++;
588         }
589
590         ck_assert_int_eq(nevents, 2);
591
592         /* now drop one of the devices */
593         libevdev_uinput_destroy(uinput1);
594         rc = libinput_resume(li);
595         ck_assert_int_eq(rc, -1);
596
597         libinput_dispatch(li);
598
599         nevents = 0;
600         while ((event = libinput_get_event(li))) {
601                 enum libinput_event_type type;
602                 type = libinput_event_get_type(event);
603                 /* We expect one device being added, second one fails,
604                  * causing a removed event for the first one */
605                 if (type != LIBINPUT_EVENT_DEVICE_ADDED &&
606                     type != LIBINPUT_EVENT_DEVICE_REMOVED)
607                         ck_abort();
608                 libinput_event_destroy(event);
609                 nevents++;
610         }
611
612         ck_assert_int_eq(nevents, 2);
613
614         libevdev_uinput_destroy(uinput2);
615         libinput_unref(li);
616
617         open_func_count = 0;
618         close_func_count = 0;
619 }
620 END_TEST
621
622 START_TEST(path_add_device_suspend_resume_remove_device)
623 {
624         struct libinput *li;
625         struct libinput_device *device;
626         struct libinput_event *event;
627         struct libevdev_uinput *uinput1, *uinput2;
628         int rc;
629         int nevents;
630         void *userdata = &rc;
631
632         uinput1 = litest_create_uinput_device("test device", NULL,
633                                               EV_KEY, BTN_LEFT,
634                                               EV_KEY, BTN_RIGHT,
635                                               EV_REL, REL_X,
636                                               EV_REL, REL_Y,
637                                               -1);
638         uinput2 = litest_create_uinput_device("test device 2", NULL,
639                                               EV_KEY, BTN_LEFT,
640                                               EV_KEY, BTN_RIGHT,
641                                               EV_REL, REL_X,
642                                               EV_REL, REL_Y,
643                                               -1);
644
645         li = libinput_path_create_context(&simple_interface, userdata);
646         ck_assert(li != NULL);
647
648         device = libinput_path_add_device(li,
649                                           libevdev_uinput_get_devnode(uinput1));
650         ck_assert(device != NULL);
651         device = libinput_path_add_device(li,
652                                           libevdev_uinput_get_devnode(uinput2));
653
654         libinput_device_ref(device);
655         libinput_dispatch(li);
656
657         nevents = 0;
658         while ((event = libinput_get_event(li))) {
659                 enum libinput_event_type type;
660                 type = libinput_event_get_type(event);
661                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
662                 libinput_event_destroy(event);
663                 nevents++;
664         }
665
666         ck_assert_int_eq(nevents, 2);
667
668         libinput_suspend(li);
669         libinput_dispatch(li);
670
671         nevents = 0;
672         while ((event = libinput_get_event(li))) {
673                 enum libinput_event_type type;
674                 type = libinput_event_get_type(event);
675                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
676                 libinput_event_destroy(event);
677                 nevents++;
678         }
679
680         ck_assert_int_eq(nevents, 2);
681
682         /* now drop and remove one of the devices */
683         libevdev_uinput_destroy(uinput2);
684         libinput_path_remove_device(device);
685         libinput_device_unref(device);
686
687         rc = libinput_resume(li);
688         ck_assert_int_eq(rc, 0);
689
690         libinput_dispatch(li);
691
692         nevents = 0;
693         while ((event = libinput_get_event(li))) {
694                 enum libinput_event_type type;
695                 type = libinput_event_get_type(event);
696                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
697                 libinput_event_destroy(event);
698                 nevents++;
699         }
700
701         ck_assert_int_eq(nevents, 1);
702
703         libevdev_uinput_destroy(uinput1);
704         libinput_unref(li);
705
706         open_func_count = 0;
707         close_func_count = 0;
708 }
709 END_TEST
710
711 START_TEST(path_seat_recycle)
712 {
713         struct libinput *li;
714         struct libevdev_uinput *uinput;
715         int rc;
716         void *userdata = &rc;
717         struct libinput_event *ev;
718         struct libinput_device *device;
719         struct libinput_seat *saved_seat = NULL;
720         struct libinput_seat *seat;
721         int data = 0;
722         int found = 0;
723         void *user_data;
724
725         uinput = litest_create_uinput_device("test device", NULL,
726                                              EV_KEY, BTN_LEFT,
727                                              EV_KEY, BTN_RIGHT,
728                                              EV_REL, REL_X,
729                                              EV_REL, REL_Y,
730                                              -1);
731
732         li = libinput_path_create_context(&simple_interface, userdata);
733         ck_assert(li != NULL);
734
735         device = libinput_path_add_device(li,
736                                           libevdev_uinput_get_devnode(uinput));
737         ck_assert(device != NULL);
738
739         libinput_dispatch(li);
740         while ((ev = libinput_get_event(li))) {
741                 switch (libinput_event_get_type(ev)) {
742                 case LIBINPUT_EVENT_DEVICE_ADDED:
743                         if (saved_seat)
744                                 break;
745
746                         device = libinput_event_get_device(ev);
747                         ck_assert(device != NULL);
748                         saved_seat = libinput_device_get_seat(device);
749                         libinput_seat_set_user_data(saved_seat, &data);
750                         libinput_seat_ref(saved_seat);
751                         break;
752                 default:
753                         break;
754                 }
755
756                 libinput_event_destroy(ev);
757         }
758
759         ck_assert(saved_seat != NULL);
760
761         libinput_suspend(li);
762
763         litest_drain_events(li);
764
765         libinput_resume(li);
766
767         libinput_dispatch(li);
768         while ((ev = libinput_get_event(li))) {
769                 switch (libinput_event_get_type(ev)) {
770                 case LIBINPUT_EVENT_DEVICE_ADDED:
771                         device = libinput_event_get_device(ev);
772                         ck_assert(device != NULL);
773
774                         seat = libinput_device_get_seat(device);
775                         user_data = libinput_seat_get_user_data(seat);
776                         if (user_data == &data) {
777                                 found = 1;
778                                 ck_assert(seat == saved_seat);
779                         }
780                         break;
781                 default:
782                         break;
783                 }
784
785                 libinput_event_destroy(ev);
786         }
787
788         ck_assert(found == 1);
789
790         libinput_unref(li);
791
792         libevdev_uinput_destroy(uinput);
793 }
794 END_TEST
795
796 int
797 main(int argc, char **argv)
798 {
799         litest_add_no_device("path:create", path_create_NULL);
800         litest_add_no_device("path:create", path_create_invalid);
801         litest_add_no_device("path:create", path_create_destroy);
802         litest_add_no_device("path:suspend", path_suspend);
803         litest_add_no_device("path:suspend", path_double_suspend);
804         litest_add_no_device("path:suspend", path_double_resume);
805         litest_add_no_device("path:suspend", path_add_device_suspend_resume);
806         litest_add_no_device("path:suspend", path_add_device_suspend_resume_fail);
807         litest_add_no_device("path:suspend", path_add_device_suspend_resume_remove_device);
808         litest_add_for_device("path:seat events", path_added_seat, LITEST_SYNAPTICS_CLICKPAD);
809         litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY);
810         litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY);
811         litest_add_for_device("path:device events", path_add_device, LITEST_SYNAPTICS_CLICKPAD);
812         litest_add_no_device("path:device events", path_add_invalid_path);
813         litest_add_for_device("path:device events", path_remove_device, LITEST_SYNAPTICS_CLICKPAD);
814         litest_add_for_device("path:device events", path_double_remove_device, LITEST_SYNAPTICS_CLICKPAD);
815         litest_add_no_device("path:seat", path_seat_recycle);
816
817         return litest_run(argc, argv);
818 }