summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2014-10-21 16:46:12 +0200
committerCedric BAIL <cedric@osg.samsung.com>2014-10-21 23:42:03 +0200
commitf7e07b4914635fa75aae6c53fb9b8b1fe1eaad05 (patch)
tree80652c008da6ff22258a945e0cffbb21bf2406c9 /src/tests/evas/evas_test_image.c
parent8606eed0f5ddb645457f28613dd224e6e0ca4b37 (diff)
evas: tests more file format loader.
NOTE: It seems that the xpm one is broken. If somebody could give it a better look and check if it work for him or not, before opening a bug in phab.
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c82
1 files changed, 80 insertions, 2 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 849682c8ba..b8ae289b77 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -238,7 +238,7 @@ START_TEST(evas_object_image_loader_orientation)
238} 238}
239END_TEST 239END_TEST
240 240
241START_TEST(evas_object_image_loader_data) 241START_TEST(evas_object_image_tgv_loader_data)
242{ 242{
243 Evas *e = _setup_evas(); 243 Evas *e = _setup_evas();
244 Evas_Object *obj, *ref; 244 Evas_Object *obj, *ref;
@@ -293,9 +293,87 @@ START_TEST(evas_object_image_loader_data)
293} 293}
294END_TEST 294END_TEST
295 295
296START_TEST(evas_object_image_all_loader_data)
297{
298 Evas *e = _setup_evas();
299 Evas_Object *obj, *ref;
300 Eina_Strbuf *str;
301
302 const char *exts[] = {
303 "png"
304#ifdef BUILD_LOADER_TGA
305 ,"tga"
306#endif
307#ifdef BUILD_LOADER_WBMP
308 ,"wbmp"
309#endif
310 // FIXME: Seems like XPM support is currently broken
311#if 0
312#ifdef BUILD_LOADER_XPM
313 ,"xpm"
314#endif
315#endif
316#ifdef BUILD_LOADER_BMP
317 ,"bmp"
318#endif
319#ifdef BUILD_LOADER_GIF
320 ,"gif"
321#endif
322#ifdef BUILD_LOADER_PSD
323 ,"psd"
324#endif
325#ifdef BUILD_LOADER_WEBP
326 ,"webp"
327#endif
328 };
329 unsigned int i;
330
331 obj = evas_object_image_add(e);
332 ref = evas_object_image_add(e);
333 str = eina_strbuf_new();
334
335 for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++)
336 {
337 int w, h, r_w, r_h;
338 const uint32_t *d, *r_d;
339
340
341 eina_strbuf_append_printf(str, "%s/Pic4-%s.png", TESTS_IMG_DIR, exts[i]);
342 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL);
343 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
344 evas_object_image_size_get(obj, &w, &h);
345 d = evas_object_image_data_get(obj, EINA_FALSE);
346
347 eina_strbuf_reset(str);
348
349 eina_strbuf_append_printf(str, "%s/Pic4.%s", TESTS_IMG_DIR, exts[i]);
350 evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
351 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
352 evas_object_image_size_get(ref, &r_w, &r_h);
353 r_d = evas_object_image_data_get(ref, EINA_FALSE);
354
355 eina_strbuf_reset(str);
356
357 fail_if(w != r_w || h != r_h);
358 fail_if(memcmp(d, r_d, w * h * 4));
359 }
360
361 evas_object_del(obj);
362 evas_object_del(ref);
363
364 evas_free(e);
365 evas_shutdown();
366}
367END_TEST
368
296void evas_test_image_object(TCase *tc) 369void evas_test_image_object(TCase *tc)
297{ 370{
298 tcase_add_test(tc, evas_object_image_loader); 371 tcase_add_test(tc, evas_object_image_loader);
299 tcase_add_test(tc, evas_object_image_loader_orientation); 372 tcase_add_test(tc, evas_object_image_loader_orientation);
300 tcase_add_test(tc, evas_object_image_loader_data); 373#if BUILD_LOADER_TGV && BUILD_LOADER_PNG
374 tcase_add_test(tc, evas_object_image_tgv_loader_data);
375#endif
376#if BUILD_LOADER_PNG
377 tcase_add_test(tc, evas_object_image_all_loader_data);
378#endif
301} 379}