diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-01-08 17:39:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-01-15 12:03:25 +1000 |
commit | 541b1c489178823d1b90032d992257b84345200a (patch) | |
tree | 3339b169e2ff6f64929432b424f200992069ed1c /test/udev.c | |
parent | 69d89ddcc2bd4e4f1a166960d70994ee818eda45 (diff) | |
download | libinput-541b1c489178823d1b90032d992257b84345200a.tar.gz |
test: udev suspend tests
Diffstat (limited to 'test/udev.c')
-rw-r--r-- | test/udev.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/udev.c b/test/udev.c index 06471014..2791884b 100644 --- a/test/udev.c +++ b/test/udev.c @@ -261,6 +261,68 @@ START_TEST(udev_removed_seat) } END_TEST +START_TEST(udev_double_suspend) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_create_from_udev(&simple_interface, NULL, udev, "seat0"); + ck_assert(li != NULL); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* expect at least one event */ + ck_assert_int_ge(libinput_dispatch(li), 0); + event = libinput_get_event(li); + ck_assert(event != NULL); + + libinput_suspend(li); + libinput_suspend(li); + libinput_resume(li); + + libinput_event_destroy(event); + libinput_destroy(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_double_resume) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_create_from_udev(&simple_interface, NULL, udev, "seat0"); + ck_assert(li != NULL); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* expect at least one event */ + ck_assert_int_ge(libinput_dispatch(li), 0); + event = libinput_get_event(li); + ck_assert(event != NULL); + + libinput_suspend(li); + libinput_resume(li); + libinput_resume(li); + + libinput_event_destroy(event); + libinput_destroy(li); + udev_unref(udev); +} +END_TEST + int main (int argc, char **argv) { litest_add_no_device("udev:create", udev_create_NULL); @@ -270,5 +332,8 @@ int main (int argc, char **argv) { litest_add_no_device("udev:seat events", udev_added_seat_default); litest_add_no_device("udev:seat events", udev_removed_seat); + litest_add("udev:suspend", udev_double_suspend, LITEST_ANY, LITEST_ANY); + litest_add("udev:suspend", udev_double_resume, LITEST_ANY, LITEST_ANY); + return litest_run(argc, argv); } |