mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
test: create a new device during the disable test to change fds
In the current test, disable followed by enable would result in the same fd number for the new device, not exposing a bug fixed by "evdev: Ensure the libevdev object receives the new fd on resume" Create a keyboard device after suspending the first device, then re-enable the device. This changes the fd to a different number, so we pick up on internal bugs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
47e10da12a
commit
58abea3946
1 changed files with 21 additions and 0 deletions
|
|
@ -121,6 +121,8 @@ START_TEST(device_disable)
|
|||
struct libinput *li = dev->libinput;
|
||||
struct libinput_device *device;
|
||||
enum libinput_config_status status;
|
||||
struct libinput_event *event;
|
||||
struct litest_device *tmp;
|
||||
|
||||
device = dev->libinput_device;
|
||||
|
||||
|
|
@ -138,11 +140,30 @@ START_TEST(device_disable)
|
|||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
/* create a new device so the resumed fd isn't the same as the
|
||||
suspended one */
|
||||
tmp = litest_add_device(li, LITEST_KEYBOARD);
|
||||
ck_assert_notnull(tmp);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* no event from resuming */
|
||||
status = libinput_device_config_send_events_set_mode(device,
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
|
||||
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
/* event from renabled device */
|
||||
litest_event(dev, EV_REL, REL_X, 10);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
|
||||
libinput_dispatch(li);
|
||||
event = libinput_get_event(li);
|
||||
ck_assert_notnull(event);
|
||||
ck_assert_int_eq(libinput_event_get_type(event),
|
||||
LIBINPUT_EVENT_POINTER_MOTION);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
litest_delete_device(tmp);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue