summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-10-14 22:08:55 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-10-15 16:20:53 +0900
commitf6fd05ff74df03ace98d9158bf38f8322cffaf53 (patch)
tree0fbf08d5590f26eb0815ca5b4d06d4973f45b32a
parente09a4094bedd0ecc8e7cc4af614dabe1b7b5fb05 (diff)
Evas GL: Add test case for surfaceless contexts
-rw-r--r--src/tests/evas/evas_test_evasgl.c93
1 files changed, 58 insertions, 35 deletions
diff --git a/src/tests/evas/evas_test_evasgl.c b/src/tests/evas/evas_test_evasgl.c
index af840b5da1..6ee7c92f1e 100644
--- a/src/tests/evas/evas_test_evasgl.c
+++ b/src/tests/evas/evas_test_evasgl.c
@@ -77,7 +77,6 @@ _test_evasgl_init(const char *engine, const char *options)
77 /* valid current states */ 77 /* valid current states */
78 fail_if(!evas_gl_make_current(evgl, sfc, ctx)); 78 fail_if(!evas_gl_make_current(evgl, sfc, ctx));
79 fail_if(!evas_gl_make_current(evgl, NULL, NULL)); 79 fail_if(!evas_gl_make_current(evgl, NULL, NULL));
80 fail_if(!evas_gl_make_current(evgl, NULL, ctx));
81 80
82 /* no context but surface: invalid */ 81 /* no context but surface: invalid */
83 fprintf(stderr, "================ IGNORE ERRORS BEGIN ================\n"); 82 fprintf(stderr, "================ IGNORE ERRORS BEGIN ================\n");
@@ -199,52 +198,76 @@ _test_evasgl_context_version(const char *engine, const char *options)
199 END_EVASGL_TEST(); 198 END_EVASGL_TEST();
200} 199}
201 200
202START_TEST(evas_test_evasgl_init_opengl_x11) 201static void
202_test_evasgl_surfaceless_context(const char *engine, const char *options)
203{ 203{
204 _test_evasgl_init("opengl_x11", NULL); 204 if (!_detect_osmesa())
205} 205 return;
206END_TEST
207 206
208START_TEST(evas_test_evasgl_current_get_opengl_x11) 207 START_EVASGL_TEST(engine, options);
209{ 208 Evas_GL_Context *ctx;
210 _test_evasgl_current_get("opengl_x11", NULL); 209 Evas_GL_Surface *sfc;
211} 210 Evas_GL_Config *cfg;
212END_TEST 211 Evas_GL_API *gl;
212 Evas_GL *evgl;
213 const char *eexts;
213 214
214START_TEST(evas_test_evasgl_context_version_opengl_x11) 215 fail_if(!(evgl = evas_gl_new(evas)));
215{ 216 fail_if(!(ctx = evas_gl_context_create(evgl, NULL)));
216 _test_evasgl_context_version("opengl_x11", NULL);
217}
218END_TEST
219 217
220START_TEST(evas_test_evasgl_init_buffer) 218 // FIXME: evas_gl_string_query will fail before the first make_current
221{ 219 fail_if(!(cfg = evas_gl_config_new()));
222 _test_evasgl_init("buffer", NULL); 220 fail_if(!(sfc = evas_gl_surface_create(evgl, cfg, 1, 1)));
223} 221 fail_if(!evas_gl_make_current(evgl, sfc, ctx));
224END_TEST 222 // FIXME
225 223
226START_TEST(evas_test_evasgl_current_get_buffer) 224 eexts = evas_gl_string_query(evgl, EVAS_GL_EXTENSIONS);
227{ 225 if (eexts && strstr(eexts, "EGL_KHR_surfaceless_context"))
228 _test_evasgl_current_get("buffer", NULL); 226 {
229} 227 fail_if(!evas_gl_make_current(evgl, NULL, ctx));
230END_TEST 228 fail_if(!(gl = evas_gl_context_api_get(evgl, ctx)));
229 fail_if(!gl->glGetString(GL_VERSION));
230 }
231 else printf("Surfaceless context not supported. Skipped.\n");
231 232
232START_TEST(evas_test_evasgl_context_version_buffer) 233 fail_if(!evas_gl_make_current(evgl, NULL, NULL));
233{ 234 evas_gl_context_destroy(evgl, ctx);
234 _test_evasgl_context_version("buffer", NULL); 235 evas_gl_free(evgl);
236
237 END_EVASGL_TEST();
235} 238}
236END_TEST 239
240#define TEST_ADD(name) \
241 START_TEST(evas ## name ## _opengl_x11) \
242 { name("opengl_x11", NULL); } \
243 END_TEST \
244 START_TEST(evas ## name ## _buffer) \
245 { name("buffer", NULL); } \
246 END_TEST
247
248TEST_ADD(_test_evasgl_init)
249TEST_ADD(_test_evasgl_current_get)
250TEST_ADD(_test_evasgl_context_version)
251TEST_ADD(_test_evasgl_surfaceless_context)
237 252
238void evas_test_evasgl(TCase *tc) 253void evas_test_evasgl(TCase *tc)
239{ 254{
255#undef TEST_ADD
256#define TEST_ADD(name) tcase_add_test(tc, evas ## name ## _opengl_x11);
257
240 if (getenv("DISPLAY")) 258 if (getenv("DISPLAY"))
241 { 259 {
242 tcase_add_test(tc, evas_test_evasgl_init_opengl_x11); 260 TEST_ADD(_test_evasgl_init);
243 tcase_add_test(tc, evas_test_evasgl_current_get_opengl_x11); 261 TEST_ADD(_test_evasgl_current_get);
244 tcase_add_test(tc, evas_test_evasgl_context_version_opengl_x11); 262 TEST_ADD(_test_evasgl_context_version);
263 TEST_ADD(_test_evasgl_surfaceless_context);
245 } 264 }
246 265
247 tcase_add_test(tc, evas_test_evasgl_init_buffer); 266#undef TEST_ADD
248 tcase_add_test(tc, evas_test_evasgl_current_get_buffer); 267#define TEST_ADD(name) tcase_add_test(tc, evas ## name ## _buffer);
249 tcase_add_test(tc, evas_test_evasgl_context_version_buffer); 268
269 TEST_ADD(_test_evasgl_init);
270 TEST_ADD(_test_evasgl_current_get);
271 TEST_ADD(_test_evasgl_context_version);
272 TEST_ADD(_test_evasgl_surfaceless_context);
250} 273}