diff options
author | Emil Velikov <emil.velikov@collabora.com> | 2016-11-14 17:08:18 +0000 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2016-11-21 16:07:29 +0000 |
commit | a69b870e1dc6056170baa30919938a7118401890 (patch) | |
tree | fcfef11d54fc7cd36f4c9d31664031109f2f1855 /tests | |
parent | 02639554e7f943172cdb523f5895c4ed16510abf (diff) |
tests/buffer-count-test: teardown after the test
Might be a bit of an overkill, but still. One should cleanup after
themselves.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/buffer-count-test.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/buffer-count-test.c b/tests/buffer-count-test.c index e7d8ca7d..0df97740 100644 --- a/tests/buffer-count-test.c +++ b/tests/buffer-count-test.c @@ -39,6 +39,7 @@ struct test_data { struct client *client; + struct wl_egl_window *native_window; EGLDisplay egl_dpy; EGLContext egl_ctx; @@ -49,7 +50,6 @@ struct test_data { static int init_egl(struct test_data *test_data) { - struct wl_egl_window *native_window; struct surface *surface = test_data->client->surface; const char *str, *mesa; @@ -94,14 +94,15 @@ init_egl(struct test_data *test_data) if (!test_data->egl_ctx) fail("eglCreateContext"); - native_window = + test_data->native_window = wl_egl_window_create(surface->wl_surface, surface->width, surface->height); test_data->egl_surface = weston_platform_create_egl_surface(test_data->egl_dpy, test_data->egl_conf, - native_window, NULL); + test_data->native_window, + NULL); ret = eglMakeCurrent(test_data->egl_dpy, test_data->egl_surface, test_data->egl_surface, test_data->egl_ctx); @@ -122,6 +123,17 @@ init_egl(struct test_data *test_data) return 0; } +static void +fini_egl(struct test_data *test_data) +{ + eglMakeCurrent(test_data->egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + weston_platform_destroy_egl_surface(test_data->egl_dpy, + test_data->egl_surface); + wl_egl_window_destroy(test_data->native_window); + eglTerminate(test_data->egl_dpy); +} + TEST(test_buffer_count) { struct test_data test_data; @@ -155,4 +167,6 @@ TEST(test_buffer_count) /* The implementation should only end up creating two buffers * and cycling between them */ assert(buffer_count == 2); + + fini_egl(&test_data); } |