From 42b68397f9e21e35a9a4ae36ad9144dbe8a87293 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 17 Feb 2017 10:38:09 +1000 Subject: [PATCH] test: check the libinput device for BTN_MIDDLE, not the libevdev device We don't have the same libevdev context that libinput has so if libinput disables/enables event codes we don't see that and may get unexpected behavior in the test. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/test-pointer.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/test-pointer.c b/test/test-pointer.c index 6485258e..986ec8b7 100644 --- a/test/test-pointer.c +++ b/test/test-pointer.c @@ -371,13 +371,15 @@ START_TEST(pointer_button) test_button_event(dev, BTN_LEFT, 1); test_button_event(dev, BTN_LEFT, 0); - if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_RIGHT)) { + if (libinput_device_pointer_has_button(dev->libinput_device, + BTN_RIGHT)) { test_button_event(dev, BTN_RIGHT, 1); test_button_event(dev, BTN_RIGHT, 0); } /* Skip middle button test on trackpoints (used for scrolling) */ - if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) { + if (libinput_device_pointer_has_button(dev->libinput_device, + BTN_MIDDLE)) { test_button_event(dev, BTN_MIDDLE, 1); test_button_event(dev, BTN_MIDDLE, 0); } @@ -904,9 +906,7 @@ START_TEST(pointer_left_handed) BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); - if (libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_MIDDLE)) { + if (libinput_device_pointer_has_button(d, BTN_MIDDLE)) { litest_button_click(dev, BTN_MIDDLE, 1); litest_button_click(dev, BTN_MIDDLE, 0); litest_assert_button_event(li, @@ -1614,7 +1614,8 @@ START_TEST(middlebutton_middleclick) disable_button_scrolling(device); - if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) + if (!libinput_device_pointer_has_button(device->libinput_device, + BTN_MIDDLE)) return; status = libinput_device_config_middle_emulation_set_enabled( @@ -1678,7 +1679,8 @@ START_TEST(middlebutton_middleclick_during) disable_button_scrolling(device); - if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) + if (!libinput_device_pointer_has_button(device->libinput_device, + BTN_MIDDLE)) return; status = libinput_device_config_middle_emulation_set_enabled( @@ -1745,7 +1747,7 @@ START_TEST(middlebutton_default_enabled) available = libinput_device_config_middle_emulation_is_available(device); ck_assert(available); - if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) + if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED; else deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED; @@ -1815,7 +1817,7 @@ START_TEST(middlebutton_default_touchpad) available = libinput_device_config_middle_emulation_is_available(device); ck_assert(!available); - if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) + if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) return; state = libinput_device_config_middle_emulation_get_enabled(