From 5c8a8a51ce6e9f0505de298783d8ba496943cf6a Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Wed, 22 Oct 2014 14:14:26 +0200 Subject: evas: tests only for extension compiled in. --- src/tests/evas/evas_test_image.c | 82 ++++++++++++++++++++++++------------ src/tests/evas/images/Pic4-jpeg.png | Bin 0 -> 303802 bytes src/tests/evas/images/Pic4-tgv.png | Bin 0 -> 104160 bytes src/tests/evas/images/Pic4.jpeg | Bin 0 -> 55595 bytes src/tests/evas/images/Pic4.tgv | Bin 0 -> 33917 bytes 5 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 src/tests/evas/images/Pic4-jpeg.png create mode 100644 src/tests/evas/images/Pic4-tgv.png create mode 100644 src/tests/evas/images/Pic4.jpeg create mode 100644 src/tests/evas/images/Pic4.tgv 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 @@ # include "config.h" #endif +#include +#include #include #include @@ -11,6 +13,41 @@ #define TESTS_IMG_DIR TESTS_SRC_DIR"/images" +static const char *exts[] = { + "png" +#ifdef BUILD_LOADER_TGA + ,"tga" +#endif +#ifdef BUILD_LOADER_WBMP + ,"wbmp" +#endif + // FIXME: Seems like XPM support is currently broken +#if 0 +#ifdef BUILD_LOADER_XPM + ,"xpm" +#endif +#endif +#ifdef BUILD_LOADER_BMP + ,"bmp" +#endif +#ifdef BUILD_LOADER_GIF + ,"gif" +#endif +#ifdef BUILD_LOADER_PSD + ,"psd" +#endif +#ifdef BUILD_LOADER_WEBP + ,"webp" +#endif +#ifdef BUILD_LOADER_JPEG + ,"jpeg" + ,"jpg" +#endif +#ifdef BUILD_LOADER_TGV + ,"tgv" +#endif +}; + #if 0 static const char * _test_image_get(const char *name) @@ -35,8 +72,20 @@ START_TEST(evas_object_image_loader) it = eina_file_direct_ls(TESTS_IMG_DIR); EINA_ITERATOR_FOREACH(it, file) { + Eina_Bool found = EINA_FALSE; + unsigned int i; int w, h; + for (i = 0; i < (sizeof (exts) / sizeof (exts[0])); i++) + if (!strcasecmp(file->path + file->path_length - strlen(exts[i]), + exts[i])) + { + found = EINA_TRUE; + break; + } + + if (!found) continue; + evas_object_image_file_set(o, file->path, NULL); fail_if(evas_object_image_load_error_get(o) != EVAS_LOAD_ERROR_NONE); evas_object_image_size_get(o, &w, &h); @@ -298,34 +347,6 @@ START_TEST(evas_object_image_all_loader_data) Evas *e = _setup_evas(); Evas_Object *obj, *ref; Eina_Strbuf *str; - - const char *exts[] = { - "png" -#ifdef BUILD_LOADER_TGA - ,"tga" -#endif -#ifdef BUILD_LOADER_WBMP - ,"wbmp" -#endif - // FIXME: Seems like XPM support is currently broken -#if 0 -#ifdef BUILD_LOADER_XPM - ,"xpm" -#endif -#endif -#ifdef BUILD_LOADER_BMP - ,"bmp" -#endif -#ifdef BUILD_LOADER_GIF - ,"gif" -#endif -#ifdef BUILD_LOADER_PSD - ,"psd" -#endif -#ifdef BUILD_LOADER_WEBP - ,"webp" -#endif - }; unsigned int i; obj = evas_object_image_add(e); @@ -334,11 +355,16 @@ START_TEST(evas_object_image_all_loader_data) for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++) { + struct stat st; int w, h, r_w, r_h; const uint32_t *d, *r_d; + fprintf(stderr, "testing '%s'\n", exts[i]); eina_strbuf_append_printf(str, "%s/Pic4-%s.png", TESTS_IMG_DIR, exts[i]); + + if (stat(eina_strbuf_string_get(str), &st) != 0) continue; + evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL); fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE); evas_object_image_size_get(obj, &w, &h); diff --git a/src/tests/evas/images/Pic4-jpeg.png b/src/tests/evas/images/Pic4-jpeg.png new file mode 100644 index 0000000000..51120585d0 Binary files /dev/null and b/src/tests/evas/images/Pic4-jpeg.png differ diff --git a/src/tests/evas/images/Pic4-tgv.png b/src/tests/evas/images/Pic4-tgv.png new file mode 100644 index 0000000000..957ca0ef1b Binary files /dev/null and b/src/tests/evas/images/Pic4-tgv.png differ diff --git a/src/tests/evas/images/Pic4.jpeg b/src/tests/evas/images/Pic4.jpeg new file mode 100644 index 0000000000..ca077ed7a0 Binary files /dev/null and b/src/tests/evas/images/Pic4.jpeg differ diff --git a/src/tests/evas/images/Pic4.tgv b/src/tests/evas/images/Pic4.tgv new file mode 100644 index 0000000000..4adf4434c9 Binary files /dev/null and b/src/tests/evas/images/Pic4.tgv differ -- cgit v1.2.1