tests: add frame_callback_wait_nofail

With expect_protocol_error, we need a possibility to wait for a frame
without aborting the test when wl_display_dispatch returns -1;
This patch adds function frame_callback_wait_nofail that only
returns 1 or 0 (instead of aborting on error).

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Marek Chalupa 10 years ago committed by Pekka Paalanen
parent 4d06d46ace
commit 1740aa8c85
  1. 9
      tests/weston-test-client-helper.c
  2. 6
      tests/weston-test-client-helper.h

@ -80,12 +80,15 @@ frame_callback_set(struct wl_surface *surface, int *done)
return callback;
}
void
frame_callback_wait(struct client *client, int *done)
int
frame_callback_wait_nofail(struct client *client, int *done)
{
while (!*done) {
assert(wl_display_dispatch(client->wl_display) >= 0);
if (wl_display_dispatch(client->wl_display) < 0)
return 0;
}
return 1;
}
void

@ -120,8 +120,10 @@ move_client(struct client *client, int x, int y);
struct wl_callback *
frame_callback_set(struct wl_surface *surface, int *done);
void
frame_callback_wait(struct client *client, int *done);
int
frame_callback_wait_nofail(struct client *client, int *done);
#define frame_callback_wait(c, d) assert(frame_callback_wait_nofail((c), (d)))
int
get_n_egl_buffers(struct client *client);

Loading…
Cancel
Save