[PATCH libinput 02/26] test: replace a while loop with a litest helper

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 23 22:21:05 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 f003bd9..dc5402f 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -855,15 +855,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