summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-01-31 12:23:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-02-02 23:46:14 +0000
commit8705aba2eaf39ac1a31ccbcb6409e85a45c23be2 (patch)
treee0b7e4df7a4aa373d7500d7028cbb06778017191
parent736de2f9a72d877f13bb0ba6fbba1edd108cb3e6 (diff)
test: add helper functions for checking proximity events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--test/litest.c21
-rw-r--r--test/litest.h4
2 files changed, 19 insertions, 6 deletions
diff --git a/test/litest.c b/test/litest.c
index 9f441704..65a57e46 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -3505,21 +3505,30 @@ litest_assert_tablet_button_event(struct libinput *li, unsigned int button,
libinput_event_destroy(event);
}
-void litest_assert_tablet_proximity_event(struct libinput *li,
- enum libinput_tablet_tool_proximity_state state)
+
+struct libinput_event_tablet_tool *
+litest_is_proximity_event(struct libinput_event *event,
+ enum libinput_tablet_tool_proximity_state state)
{
- struct libinput_event *event;
struct libinput_event_tablet_tool *tev;
enum libinput_event_type type = LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY;
- litest_wait_for_event(li);
- event = libinput_get_event(li);
-
litest_assert_notnull(event);
litest_assert_event_type(event, type);
tev = libinput_event_get_tablet_tool_event(event);
litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tev),
state);
+ return tev;
+}
+
+void litest_assert_tablet_proximity_event(struct libinput *li,
+ enum libinput_tablet_tool_proximity_state state)
+{
+ struct libinput_event *event;
+
+ litest_wait_for_event(li);
+ event = libinput_get_event(li);
+ litest_is_proximity_event(event, state);
libinput_event_destroy(event);
}
diff --git a/test/litest.h b/test/litest.h
index 67cec9bc..ab2633bc 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -762,6 +762,10 @@ litest_is_switch_event(struct libinput_event *event,
enum libinput_switch sw,
enum libinput_switch_state state);
+struct libinput_event_tablet_tool *
+litest_is_proximity_event(struct libinput_event *event,
+ enum libinput_tablet_tool_proximity_state state);
+
void
litest_assert_key_event(struct libinput *li, unsigned int key,
enum libinput_key_state state);