summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2014-10-22 14:14:26 +0200
committerCedric BAIL <cedric@osg.samsung.com>2014-10-22 14:15:32 +0200
commit5c8a8a51ce6e9f0505de298783d8ba496943cf6a (patch)
tree3ba4283a85c123abcdd5cf49ca16a59b72d96b70 /src/tests/evas/evas_test_image.c
parent2a9272333f730ac3d5b437b65dcd804a169c2ed3 (diff)
evas: tests only for extension compiled in.
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c82
1 files changed, 54 insertions, 28 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index b8ae289b77..157041c3f7 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -2,6 +2,8 @@
2# include "config.h" 2# include "config.h"
3#endif 3#endif
4 4
5#include <sys/types.h>
6#include <sys/stat.h>
5#include <unistd.h> 7#include <unistd.h>
6#include <stdio.h> 8#include <stdio.h>
7 9
@@ -11,6 +13,41 @@
11 13
12#define TESTS_IMG_DIR TESTS_SRC_DIR"/images" 14#define TESTS_IMG_DIR TESTS_SRC_DIR"/images"
13 15
16static const char *exts[] = {
17 "png"
18#ifdef BUILD_LOADER_TGA
19 ,"tga"
20#endif
21#ifdef BUILD_LOADER_WBMP
22 ,"wbmp"
23#endif
24 // FIXME: Seems like XPM support is currently broken
25#if 0
26#ifdef BUILD_LOADER_XPM
27 ,"xpm"
28#endif
29#endif
30#ifdef BUILD_LOADER_BMP
31 ,"bmp"
32#endif
33#ifdef BUILD_LOADER_GIF
34 ,"gif"
35#endif
36#ifdef BUILD_LOADER_PSD
37 ,"psd"
38#endif
39#ifdef BUILD_LOADER_WEBP
40 ,"webp"
41#endif
42#ifdef BUILD_LOADER_JPEG
43 ,"jpeg"
44 ,"jpg"
45#endif
46#ifdef BUILD_LOADER_TGV
47 ,"tgv"
48#endif
49};
50
14#if 0 51#if 0
15static const char * 52static const char *
16_test_image_get(const char *name) 53_test_image_get(const char *name)
@@ -35,8 +72,20 @@ START_TEST(evas_object_image_loader)
35 it = eina_file_direct_ls(TESTS_IMG_DIR); 72 it = eina_file_direct_ls(TESTS_IMG_DIR);
36 EINA_ITERATOR_FOREACH(it, file) 73 EINA_ITERATOR_FOREACH(it, file)
37 { 74 {
75 Eina_Bool found = EINA_FALSE;
76 unsigned int i;
38 int w, h; 77 int w, h;
39 78
79 for (i = 0; i < (sizeof (exts) / sizeof (exts[0])); i++)
80 if (!strcasecmp(file->path + file->path_length - strlen(exts[i]),
81 exts[i]))
82 {
83 found = EINA_TRUE;
84 break;
85 }
86
87 if (!found) continue;
88
40 evas_object_image_file_set(o, file->path, NULL); 89 evas_object_image_file_set(o, file->path, NULL);
41 fail_if(evas_object_image_load_error_get(o) != EVAS_LOAD_ERROR_NONE); 90 fail_if(evas_object_image_load_error_get(o) != EVAS_LOAD_ERROR_NONE);
42 evas_object_image_size_get(o, &w, &h); 91 evas_object_image_size_get(o, &w, &h);
@@ -298,34 +347,6 @@ START_TEST(evas_object_image_all_loader_data)
298 Evas *e = _setup_evas(); 347 Evas *e = _setup_evas();
299 Evas_Object *obj, *ref; 348 Evas_Object *obj, *ref;
300 Eina_Strbuf *str; 349 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; 350 unsigned int i;
330 351
331 obj = evas_object_image_add(e); 352 obj = evas_object_image_add(e);
@@ -334,11 +355,16 @@ START_TEST(evas_object_image_all_loader_data)
334 355
335 for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++) 356 for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++)
336 { 357 {
358 struct stat st;
337 int w, h, r_w, r_h; 359 int w, h, r_w, r_h;
338 const uint32_t *d, *r_d; 360 const uint32_t *d, *r_d;
339 361
362 fprintf(stderr, "testing '%s'\n", exts[i]);
340 363
341 eina_strbuf_append_printf(str, "%s/Pic4-%s.png", TESTS_IMG_DIR, exts[i]); 364 eina_strbuf_append_printf(str, "%s/Pic4-%s.png", TESTS_IMG_DIR, exts[i]);
365
366 if (stat(eina_strbuf_string_get(str), &st) != 0) continue;
367
342 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL); 368 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); 369 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
344 evas_object_image_size_get(obj, &w, &h); 370 evas_object_image_size_get(obj, &w, &h);