style fix: Remove duplicate empty lines
[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 litest_device *dev = litest_current_device();
247         struct libinput *li = dev->libinput;
248         struct libinput_event *event;
249         struct libinput_device *device;
250
251         litest_drain_events(li);
252
253         device = libinput_path_add_device(li, "/tmp/");
254         ck_assert(device == NULL);
255
256         libinput_dispatch(li);
257
258         while ((event = libinput_get_event(li)))
259                 ck_abort();
260 }
261 END_TEST
262
263 START_TEST(path_device_sysname)
264 {
265         struct litest_device *dev = litest_current_device();
266         struct libinput_event *ev;
267         struct libinput_device *device;
268         const char *sysname;
269
270         libinput_dispatch(dev->libinput);
271
272         while ((ev = libinput_get_event(dev->libinput))) {
273                 if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED)
274                         continue;
275
276                 device = libinput_event_get_device(ev);
277                 sysname = libinput_device_get_sysname(device);
278                 ck_assert(sysname != NULL && strlen(sysname) > 1);
279                 ck_assert(strchr(sysname, '/') == NULL);
280                 ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
281
282                 libinput_event_destroy(ev);
283         }
284 }
285 END_TEST
286
287 START_TEST(path_remove_device)
288 {
289         struct litest_device *dev = litest_current_device();
290         struct libinput *li = dev->libinput;
291         struct libinput_event *event;
292         struct libinput_device *device;
293         int remove_event = 0;
294
295         device = libinput_path_add_device(li,
296                                           libevdev_uinput_get_devnode(dev->uinput));
297         ck_assert(device != NULL);
298         litest_drain_events(li);
299
300         libinput_path_remove_device(device);
301         libinput_dispatch(li);
302
303         while ((event = libinput_get_event(li))) {
304                 enum libinput_event_type type;
305                 type = libinput_event_get_type(event);
306
307                 if (type == LIBINPUT_EVENT_DEVICE_REMOVED)
308                         remove_event++;
309
310                 libinput_event_destroy(event);
311         }
312
313         ck_assert_int_eq(remove_event, 1);
314 }
315 END_TEST
316
317 START_TEST(path_double_remove_device)
318 {
319         struct litest_device *dev = litest_current_device();
320         struct libinput *li = dev->libinput;
321         struct libinput_event *event;
322         struct libinput_device *device;
323         int remove_event = 0;
324
325         device = libinput_path_add_device(li,
326                                           libevdev_uinput_get_devnode(dev->uinput));
327         ck_assert(device != NULL);
328         litest_drain_events(li);
329
330         libinput_path_remove_device(device);
331         libinput_path_remove_device(device);
332         libinput_dispatch(li);
333
334         while ((event = libinput_get_event(li))) {
335                 enum libinput_event_type type;
336                 type = libinput_event_get_type(event);
337
338                 if (type == LIBINPUT_EVENT_DEVICE_REMOVED)
339                         remove_event++;
340
341                 libinput_event_destroy(event);
342         }
343
344         ck_assert_int_eq(remove_event, 1);
345 }
346 END_TEST
347
348 START_TEST(path_suspend)
349 {
350         struct libinput *li;
351         struct libinput_device *device;
352         struct libevdev_uinput *uinput;
353         int rc;
354         void *userdata = &rc;
355
356         uinput = litest_create_uinput_device("test device", NULL,
357                                              EV_KEY, BTN_LEFT,
358                                              EV_KEY, BTN_RIGHT,
359                                              EV_REL, REL_X,
360                                              EV_REL, REL_Y,
361                                              -1);
362
363         li = libinput_path_create_context(&simple_interface, userdata);
364         ck_assert(li != NULL);
365
366         device = libinput_path_add_device(li,
367                                           libevdev_uinput_get_devnode(uinput));
368         ck_assert(device != NULL);
369
370         libinput_suspend(li);
371         libinput_resume(li);
372
373         libevdev_uinput_destroy(uinput);
374         libinput_unref(li);
375
376         open_func_count = 0;
377         close_func_count = 0;
378 }
379 END_TEST
380
381 START_TEST(path_double_suspend)
382 {
383         struct libinput *li;
384         struct libinput_device *device;
385         struct libevdev_uinput *uinput;
386         int rc;
387         void *userdata = &rc;
388
389         uinput = litest_create_uinput_device("test device", NULL,
390                                              EV_KEY, BTN_LEFT,
391                                              EV_KEY, BTN_RIGHT,
392                                              EV_REL, REL_X,
393                                              EV_REL, REL_Y,
394                                              -1);
395
396         li = libinput_path_create_context(&simple_interface, userdata);
397         ck_assert(li != NULL);
398
399         device = libinput_path_add_device(li,
400                                           libevdev_uinput_get_devnode(uinput));
401         ck_assert(device != NULL);
402
403         libinput_suspend(li);
404         libinput_suspend(li);
405         libinput_resume(li);
406
407         libevdev_uinput_destroy(uinput);
408         libinput_unref(li);
409
410         open_func_count = 0;
411         close_func_count = 0;
412 }
413 END_TEST
414
415 START_TEST(path_double_resume)
416 {
417         struct libinput *li;
418         struct libinput_device *device;
419         struct libevdev_uinput *uinput;
420         int rc;
421         void *userdata = &rc;
422
423         uinput = litest_create_uinput_device("test device", NULL,
424                                              EV_KEY, BTN_LEFT,
425                                              EV_KEY, BTN_RIGHT,
426                                              EV_REL, REL_X,
427                                              EV_REL, REL_Y,
428                                              -1);
429
430         li = libinput_path_create_context(&simple_interface, userdata);
431         ck_assert(li != NULL);
432
433         device = libinput_path_add_device(li,
434                                           libevdev_uinput_get_devnode(uinput));
435         ck_assert(device != NULL);
436
437         libinput_suspend(li);
438         libinput_resume(li);
439         libinput_resume(li);
440
441         libevdev_uinput_destroy(uinput);
442         libinput_unref(li);
443
444         open_func_count = 0;
445         close_func_count = 0;
446 }
447 END_TEST
448
449 START_TEST(path_add_device_suspend_resume)
450 {
451         struct libinput *li;
452         struct libinput_device *device;
453         struct libinput_event *event;
454         struct libevdev_uinput *uinput1, *uinput2;
455         int rc;
456         int nevents;
457         void *userdata = &rc;
458
459         uinput1 = litest_create_uinput_device("test device", NULL,
460                                               EV_KEY, BTN_LEFT,
461                                               EV_KEY, BTN_RIGHT,
462                                               EV_REL, REL_X,
463                                               EV_REL, REL_Y,
464                                               -1);
465         uinput2 = litest_create_uinput_device("test device 2", NULL,
466                                               EV_KEY, BTN_LEFT,
467                                               EV_KEY, BTN_RIGHT,
468                                               EV_REL, REL_X,
469                                               EV_REL, REL_Y,
470                                               -1);
471
472         li = libinput_path_create_context(&simple_interface, userdata);
473         ck_assert(li != NULL);
474
475         device = libinput_path_add_device(li,
476                                           libevdev_uinput_get_devnode(uinput1));
477         ck_assert(device != NULL);
478         device = libinput_path_add_device(li,
479                                           libevdev_uinput_get_devnode(uinput2));
480
481         libinput_dispatch(li);
482
483         nevents = 0;
484         while ((event = libinput_get_event(li))) {
485                 enum libinput_event_type type;
486                 type = libinput_event_get_type(event);
487                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
488                 libinput_event_destroy(event);
489                 nevents++;
490         }
491
492         ck_assert_int_eq(nevents, 2);
493
494         libinput_suspend(li);
495         libinput_dispatch(li);
496
497         nevents = 0;
498         while ((event = libinput_get_event(li))) {
499                 enum libinput_event_type type;
500                 type = libinput_event_get_type(event);
501                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
502                 libinput_event_destroy(event);
503                 nevents++;
504         }
505
506         ck_assert_int_eq(nevents, 2);
507
508         libinput_resume(li);
509         libinput_dispatch(li);
510
511         nevents = 0;
512         while ((event = libinput_get_event(li))) {
513                 enum libinput_event_type type;
514                 type = libinput_event_get_type(event);
515                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
516                 libinput_event_destroy(event);
517                 nevents++;
518         }
519
520         ck_assert_int_eq(nevents, 2);
521
522         libevdev_uinput_destroy(uinput1);
523         libevdev_uinput_destroy(uinput2);
524         libinput_unref(li);
525
526         open_func_count = 0;
527         close_func_count = 0;
528 }
529 END_TEST
530
531 START_TEST(path_add_device_suspend_resume_fail)
532 {
533         struct libinput *li;
534         struct libinput_device *device;
535         struct libinput_event *event;
536         struct libevdev_uinput *uinput1, *uinput2;
537         int rc;
538         int nevents;
539         void *userdata = &rc;
540
541         uinput1 = litest_create_uinput_device("test device", NULL,
542                                               EV_KEY, BTN_LEFT,
543                                               EV_KEY, BTN_RIGHT,
544                                               EV_REL, REL_X,
545                                               EV_REL, REL_Y,
546                                               -1);
547         uinput2 = litest_create_uinput_device("test device 2", NULL,
548                                               EV_KEY, BTN_LEFT,
549                                               EV_KEY, BTN_RIGHT,
550                                               EV_REL, REL_X,
551                                               EV_REL, REL_Y,
552                                               -1);
553
554         li = libinput_path_create_context(&simple_interface, userdata);
555         ck_assert(li != NULL);
556
557         device = libinput_path_add_device(li,
558                                           libevdev_uinput_get_devnode(uinput1));
559         ck_assert(device != NULL);
560         device = libinput_path_add_device(li,
561                                           libevdev_uinput_get_devnode(uinput2));
562         ck_assert(device != NULL);
563
564         libinput_dispatch(li);
565
566         nevents = 0;
567         while ((event = libinput_get_event(li))) {
568                 enum libinput_event_type type;
569                 type = libinput_event_get_type(event);
570                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
571                 libinput_event_destroy(event);
572                 nevents++;
573         }
574
575         ck_assert_int_eq(nevents, 2);
576
577         libinput_suspend(li);
578         libinput_dispatch(li);
579
580         nevents = 0;
581         while ((event = libinput_get_event(li))) {
582                 enum libinput_event_type type;
583                 type = libinput_event_get_type(event);
584                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
585                 libinput_event_destroy(event);
586                 nevents++;
587         }
588
589         ck_assert_int_eq(nevents, 2);
590
591         /* now drop one of the devices */
592         libevdev_uinput_destroy(uinput1);
593         rc = libinput_resume(li);
594         ck_assert_int_eq(rc, -1);
595
596         libinput_dispatch(li);
597
598         nevents = 0;
599         while ((event = libinput_get_event(li))) {
600                 enum libinput_event_type type;
601                 type = libinput_event_get_type(event);
602                 /* We expect one device being added, second one fails,
603                  * causing a removed event for the first one */
604                 if (type != LIBINPUT_EVENT_DEVICE_ADDED &&
605                     type != LIBINPUT_EVENT_DEVICE_REMOVED)
606                         ck_abort();
607                 libinput_event_destroy(event);
608                 nevents++;
609         }
610
611         ck_assert_int_eq(nevents, 2);
612
613         libevdev_uinput_destroy(uinput2);
614         libinput_unref(li);
615
616         open_func_count = 0;
617         close_func_count = 0;
618 }
619 END_TEST
620
621 START_TEST(path_add_device_suspend_resume_remove_device)
622 {
623         struct libinput *li;
624         struct libinput_device *device;
625         struct libinput_event *event;
626         struct libevdev_uinput *uinput1, *uinput2;
627         int rc;
628         int nevents;
629         void *userdata = &rc;
630
631         uinput1 = litest_create_uinput_device("test device", NULL,
632                                               EV_KEY, BTN_LEFT,
633                                               EV_KEY, BTN_RIGHT,
634                                               EV_REL, REL_X,
635                                               EV_REL, REL_Y,
636                                               -1);
637         uinput2 = litest_create_uinput_device("test device 2", NULL,
638                                               EV_KEY, BTN_LEFT,
639                                               EV_KEY, BTN_RIGHT,
640                                               EV_REL, REL_X,
641                                               EV_REL, REL_Y,
642                                               -1);
643
644         li = libinput_path_create_context(&simple_interface, userdata);
645         ck_assert(li != NULL);
646
647         device = libinput_path_add_device(li,
648                                           libevdev_uinput_get_devnode(uinput1));
649         ck_assert(device != NULL);
650         device = libinput_path_add_device(li,
651                                           libevdev_uinput_get_devnode(uinput2));
652
653         libinput_device_ref(device);
654         libinput_dispatch(li);
655
656         nevents = 0;
657         while ((event = libinput_get_event(li))) {
658                 enum libinput_event_type type;
659                 type = libinput_event_get_type(event);
660                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
661                 libinput_event_destroy(event);
662                 nevents++;
663         }
664
665         ck_assert_int_eq(nevents, 2);
666
667         libinput_suspend(li);
668         libinput_dispatch(li);
669
670         nevents = 0;
671         while ((event = libinput_get_event(li))) {
672                 enum libinput_event_type type;
673                 type = libinput_event_get_type(event);
674                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED);
675                 libinput_event_destroy(event);
676                 nevents++;
677         }
678
679         ck_assert_int_eq(nevents, 2);
680
681         /* now drop and remove one of the devices */
682         libevdev_uinput_destroy(uinput2);
683         libinput_path_remove_device(device);
684         libinput_device_unref(device);
685
686         rc = libinput_resume(li);
687         ck_assert_int_eq(rc, 0);
688
689         libinput_dispatch(li);
690
691         nevents = 0;
692         while ((event = libinput_get_event(li))) {
693                 enum libinput_event_type type;
694                 type = libinput_event_get_type(event);
695                 ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
696                 libinput_event_destroy(event);
697                 nevents++;
698         }
699
700         ck_assert_int_eq(nevents, 1);
701
702         libevdev_uinput_destroy(uinput1);
703         libinput_unref(li);
704
705         open_func_count = 0;
706         close_func_count = 0;
707 }
708 END_TEST
709
710 START_TEST(path_seat_recycle)
711 {
712         struct libinput *li;
713         struct libevdev_uinput *uinput;
714         int rc;
715         void *userdata = &rc;
716         struct libinput_event *ev;
717         struct libinput_device *device;
718         struct libinput_seat *saved_seat = NULL;
719         struct libinput_seat *seat;
720         int data = 0;
721         int found = 0;
722         void *user_data;
723
724         uinput = litest_create_uinput_device("test device", NULL,
725                                              EV_KEY, BTN_LEFT,
726                                              EV_KEY, BTN_RIGHT,
727                                              EV_REL, REL_X,
728                                              EV_REL, REL_Y,
729                                              -1);
730
731         li = libinput_path_create_context(&simple_interface, userdata);
732         ck_assert(li != NULL);
733
734         device = libinput_path_add_device(li,
735                                           libevdev_uinput_get_devnode(uinput));
736         ck_assert(device != NULL);
737
738         libinput_dispatch(li);
739         while ((ev = libinput_get_event(li))) {
740                 switch (libinput_event_get_type(ev)) {
741                 case LIBINPUT_EVENT_DEVICE_ADDED:
742                         if (saved_seat)
743                                 break;
744
745                         device = libinput_event_get_device(ev);
746                         ck_assert(device != NULL);
747                         saved_seat = libinput_device_get_seat(device);
748                         libinput_seat_set_user_data(saved_seat, &data);
749                         libinput_seat_ref(saved_seat);
750                         break;
751                 default:
752                         break;
753                 }
754
755                 libinput_event_destroy(ev);
756         }
757
758         ck_assert(saved_seat != NULL);
759
760         libinput_suspend(li);
761
762         litest_drain_events(li);
763
764         libinput_resume(li);
765
766         libinput_dispatch(li);
767         while ((ev = libinput_get_event(li))) {
768                 switch (libinput_event_get_type(ev)) {
769                 case LIBINPUT_EVENT_DEVICE_ADDED:
770                         device = libinput_event_get_device(ev);
771                         ck_assert(device != NULL);
772
773                         seat = libinput_device_get_seat(device);
774                         user_data = libinput_seat_get_user_data(seat);
775                         if (user_data == &data) {
776                                 found = 1;
777                                 ck_assert(seat == saved_seat);
778                         }
779                         break;
780                 default:
781                         break;
782                 }
783
784                 libinput_event_destroy(ev);
785         }
786
787         ck_assert(found == 1);
788
789         libinput_unref(li);
790
791         libevdev_uinput_destroy(uinput);
792 }
793 END_TEST
794
795 int main (int argc, char **argv) {
796
797         litest_add("path:create", path_create_NULL, LITEST_ANY, LITEST_ANY);
798         litest_add("path:create", path_create_invalid, LITEST_ANY, LITEST_ANY);
799         litest_add("path:create", path_create_destroy, LITEST_ANY, LITEST_ANY);
800         litest_add("path:suspend", path_suspend, LITEST_ANY, LITEST_ANY);
801         litest_add("path:suspend", path_double_suspend, LITEST_ANY, LITEST_ANY);
802         litest_add("path:suspend", path_double_resume, LITEST_ANY, LITEST_ANY);
803         litest_add("path:suspend", path_add_device_suspend_resume, LITEST_ANY, LITEST_ANY);
804         litest_add("path:suspend", path_add_device_suspend_resume_fail, LITEST_ANY, LITEST_ANY);
805         litest_add("path:suspend", path_add_device_suspend_resume_remove_device, LITEST_ANY, LITEST_ANY);
806         litest_add("path:seat events", path_added_seat, LITEST_ANY, LITEST_ANY);
807         litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY);
808         litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY);
809         litest_add("path:device events", path_add_device, LITEST_ANY, LITEST_ANY);
810         litest_add("path:device events", path_add_invalid_path, LITEST_ANY, LITEST_ANY);
811         litest_add("path:device events", path_remove_device, LITEST_ANY, LITEST_ANY);
812         litest_add("path:device events", path_double_remove_device, LITEST_ANY, LITEST_ANY);
813         litest_add("path:seat", path_seat_recycle,
814                    LITEST_DISABLE_DEVICE, LITEST_DISABLE_DEVICE);
815
816         return litest_run(argc, argv);
817 }