[PATCH libinput 03/15] test: replace a while loop with a litest helper

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 17 21:45:04 PST 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/tablet.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/test/tablet.c b/test/tablet.c
index 1e5947a..746f643 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -799,15 +799,10 @@ START_TEST(tool_ref)
 	litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
 	litest_event(dev, EV_SYN, SYN_REPORT, 0);
 
-	libinput_dispatch(li);
-	while ((event = libinput_get_event(li))) {
-		if (libinput_event_get_type(event) ==
-		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
-			break;
-		}
-		libinput_event_destroy(event);
-	}
-
+	litest_wait_for_event_of_type(li,
+				      LIBINPUT_EVENT_TABLET_PROXIMITY,
+				      -1);
+	event = libinput_get_event(li);
 	tablet_event = libinput_event_get_tablet_event(event);
 	tool = libinput_event_tablet_get_tool(tablet_event);
 
-- 
2.1.0



More information about the wayland-devel mailing list