From 4e7db651cec791c88bb6fe7dbf6ff5b6e45c9f6b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 13 Jan 2017 15:57:45 +1000 Subject: [PATCH] test: add a test to force a destroy for the path backend The test suite (and tests) we have now all clean up nicely before calling the final libinput_unref(). Add one where there's at least one device still connected. Signed-off-by: Peter Hutterer --- test/test-path.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test-path.c b/test/test-path.c index b9434338..4f49d2b0 100644 --- a/test/test-path.c +++ b/test/test-path.c @@ -192,6 +192,24 @@ START_TEST(path_create_destroy) } END_TEST +START_TEST(path_force_destroy) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li; + struct libinput_device *device; + + li = libinput_path_create_context(&simple_interface, NULL); + ck_assert_notnull(li); + libinput_ref(li); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(dev->uinput)); + ck_assert_notnull(device); + + while (libinput_unref(li) != NULL) + ; +} +END_TEST + START_TEST(path_set_user_data) { struct libinput *li; @@ -936,6 +954,7 @@ litest_setup_tests_path(void) litest_add_no_device("path:create", path_create_invalid_file); litest_add_no_device("path:create", path_create_invalid_kerneldev); litest_add_no_device("path:create", path_create_destroy); + litest_add("path:create", path_force_destroy, LITEST_ANY, LITEST_ANY); litest_add_no_device("path:create", path_set_user_data); litest_add_no_device("path:suspend", path_suspend); litest_add_no_device("path:suspend", path_double_suspend);