summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-02-20 09:26:05 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-02-20 12:17:26 +1000
commit53e263fce7c83ca7636a656ecfb1d455564f2c86 (patch)
tree4a5123577203550d9b05c0cedec73873a3312e64 /test
parent72c5821a3b57e9e6fa713bdfb82939c8299e543d (diff)
test: fix the pointer scroll-defaults test
The button-scroll by default behavior is only true on devices with a middle button. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/test-pointer.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/test-pointer.c b/test/test-pointer.c
index d4d2607..27978a9 100644
--- a/test/test-pointer.c
+++ b/test/test-pointer.c
@@ -1136,19 +1136,28 @@ START_TEST(pointer_scroll_nowheel_defaults)
{
struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device;
- enum libinput_config_scroll_method method;
+ enum libinput_config_scroll_method method, expected;
uint32_t button;
+ /* button scrolling is only enabled if there is a
+ middle button present */
+ if (libinput_device_pointer_has_button(device, BTN_MIDDLE))
+ expected = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
+ else
+ expected = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
+
method = libinput_device_config_scroll_get_method(device);
- ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
+ ck_assert_int_eq(method, expected);
method = libinput_device_config_scroll_get_default_method(device);
- ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
+ ck_assert_int_eq(method, expected);
- button = libinput_device_config_scroll_get_button(device);
- ck_assert_int_eq(button, BTN_MIDDLE);
- button = libinput_device_config_scroll_get_default_button(device);
- ck_assert_int_eq(button, BTN_MIDDLE);
+ if (method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
+ button = libinput_device_config_scroll_get_button(device);
+ ck_assert_int_eq(button, BTN_MIDDLE);
+ button = libinput_device_config_scroll_get_default_button(device);
+ ck_assert_int_eq(button, BTN_MIDDLE);
+ }
}
END_TEST