[PATCH weston] tests: add buffer release test for implicit attach
Pekka Paalanen
ppaalanen at gmail.com
Mon Feb 11 07:02:00 PST 2013
The protocol specification says:
- when a wl_buffer is attached, it becomes pending
- when a pending wl_buffer is committed, it becomes current and stays as
pending
Therefore, a wl_buffer becomes busy without an explicit attach, if it
was already pending from a previous attach.
Excercise this path in the test, too, although the release count can
legally be 0, 1, or 2.
Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
tests/event-test.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/event-test.c b/tests/event-test.c
index 980dfaa..3a706b3 100644
--- a/tests/event-test.c
+++ b/tests/event-test.c
@@ -354,7 +354,7 @@ buffer_release_handler(void *data, struct wl_buffer *buffer)
{
int *released = data;
- *released = 1;
+ *released += 1;
}
static struct wl_buffer_listener buffer_listener = {
@@ -408,11 +408,19 @@ TEST(buffer_release)
assert(buf2_released == 1);
/* buf3 may or may not be released */
+ /* commit buf3 again, without explicitly attaching it */
+ frame_callback_set(surface, &frame);
+ wl_surface_commit(surface);
+ frame_callback_wait(client, &frame);
+ assert(buf1_released == 0);
+ assert(buf2_released == 1);
+ /* buf3_released may be 0, 1, or 2. */
+
wl_surface_attach(surface, client->surface->wl_buffer, 0, 0);
frame_callback_set(surface, &frame);
wl_surface_commit(surface);
frame_callback_wait(client, &frame);
assert(buf1_released == 0);
assert(buf2_released == 1);
- assert(buf3_released == 1);
+ assert(buf3_released >= 1);
}
--
1.7.12.4
More information about the wayland-devel
mailing list