[PATCH libinput 04/26] test: add litest_assert_tablet_button_event()

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 23 22:21:07 PST 2015


Does what it says on the box. or at least in the manual inside the box.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest.c | 21 +++++++++++++++++++++
 test/litest.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/test/litest.c b/test/litest.c
index 05ed2b2..6d4bfdb 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1405,6 +1405,27 @@ litest_assert_button_event(struct libinput *li, unsigned int button,
 }
 
 void
+litest_assert_tablet_button_event(struct libinput *li, unsigned int button,
+				  enum libinput_button_state state)
+{
+	struct libinput_event *event;
+	struct libinput_event_tablet *tev;
+
+	litest_wait_for_event(li);
+	event = libinput_get_event(li);
+
+	ck_assert(event != NULL);
+	ck_assert_int_eq(libinput_event_get_type(event),
+			 LIBINPUT_EVENT_TABLET_BUTTON);
+	tev = libinput_event_get_tablet_event(event);
+	ck_assert_int_eq(libinput_event_tablet_get_button(tev),
+			 button);
+	ck_assert_int_eq(libinput_event_tablet_get_button_state(tev),
+			 state);
+	libinput_event_destroy(event);
+}
+
+void
 litest_assert_scroll(struct libinput *li,
 		     enum libinput_pointer_axis axis,
 		     int minimum_movement)
diff --git a/test/litest.h b/test/litest.h
index dd1ad9a..b0a68f7 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -186,6 +186,9 @@ void litest_assert_scroll(struct libinput *li,
 			  int minimum_movement);
 void litest_assert_only_typed_events(struct libinput *li,
 				     enum libinput_event_type type);
+void litest_assert_tablet_button_event(struct libinput *li,
+				       unsigned int button,
+				       enum libinput_button_state state);
 
 struct libevdev_uinput * litest_create_uinput_device(const char *name,
 						     struct input_id *id,
-- 
2.1.0



More information about the wayland-devel mailing list