tests: use two roundtrips for global events

first is for getting and binding to globals and the other one is for
getting wl_shm.formats that are emitted after binding
to wl_shm

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index fa11bc1..cf9e742 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -579,8 +579,10 @@
 	client->wl_registry = wl_display_get_registry(client->wl_display);
 	wl_registry_add_listener(client->wl_registry, &registry_listener, client);
 
-	/* trigger global listener */
-	wl_display_dispatch(client->wl_display);
+	/* trigger global listener. Need to dispatch two times, because wl_shm
+	 * will emit new events after binding and we need them to arrive
+	 * before continuing */
+	wl_display_roundtrip(client->wl_display);
 	wl_display_roundtrip(client->wl_display);
 
 	/* must have WL_SHM_FORMAT_ARGB32 */