[PATCH libinput 02/12] test: fix middle button defaults test

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 20 20:53:29 UTC 2017


This failed on devices without a middle button, we just didn't have a test
device to trigger this.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/test-pointer.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/test/test-pointer.c b/test/test-pointer.c
index 986ec8b..abc8a11 100644
--- a/test/test-pointer.c
+++ b/test/test-pointer.c
@@ -1742,22 +1742,21 @@ START_TEST(middlebutton_default_enabled)
 	struct libinput_device *device = dev->libinput_device;
 	enum libinput_config_status status;
 	int available;
-	enum libinput_config_middle_emulation_state deflt, state;
+	enum libinput_config_middle_emulation_state state;
+
+	if (!libinput_device_pointer_has_button(dev->libinput_device,
+						BTN_MIDDLE))
+		return;
 
 	available = libinput_device_config_middle_emulation_is_available(device);
 	ck_assert(available);
 
-	if (libinput_device_pointer_has_button(device, BTN_MIDDLE))
-		deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED;
-	else
-		deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED;
-
 	state = libinput_device_config_middle_emulation_get_enabled(device);
-	ck_assert_int_eq(state, deflt);
+	ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
 
 	state = libinput_device_config_middle_emulation_get_default_enabled(
 					    device);
-	ck_assert_int_eq(state, deflt);
+	ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
 
 	status = libinput_device_config_middle_emulation_set_enabled(device,
 					    LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
-- 
2.9.3



More information about the wayland-devel mailing list