forked from enlightenment/efl
evas: tests only for extension compiled in.
This commit is contained in:
parent
2a9272333f
commit
5c8a8a51ce
|
@ -2,6 +2,8 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -11,6 +13,41 @@
|
||||||
|
|
||||||
#define TESTS_IMG_DIR TESTS_SRC_DIR"/images"
|
#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
|
#if 0
|
||||||
static const char *
|
static const char *
|
||||||
_test_image_get(const char *name)
|
_test_image_get(const char *name)
|
||||||
|
@ -35,8 +72,20 @@ START_TEST(evas_object_image_loader)
|
||||||
it = eina_file_direct_ls(TESTS_IMG_DIR);
|
it = eina_file_direct_ls(TESTS_IMG_DIR);
|
||||||
EINA_ITERATOR_FOREACH(it, file)
|
EINA_ITERATOR_FOREACH(it, file)
|
||||||
{
|
{
|
||||||
|
Eina_Bool found = EINA_FALSE;
|
||||||
|
unsigned int i;
|
||||||
int w, h;
|
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);
|
evas_object_image_file_set(o, file->path, NULL);
|
||||||
fail_if(evas_object_image_load_error_get(o) != EVAS_LOAD_ERROR_NONE);
|
fail_if(evas_object_image_load_error_get(o) != EVAS_LOAD_ERROR_NONE);
|
||||||
evas_object_image_size_get(o, &w, &h);
|
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 *e = _setup_evas();
|
||||||
Evas_Object *obj, *ref;
|
Evas_Object *obj, *ref;
|
||||||
Eina_Strbuf *str;
|
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;
|
unsigned int i;
|
||||||
|
|
||||||
obj = evas_object_image_add(e);
|
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++)
|
for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++)
|
||||||
{
|
{
|
||||||
|
struct stat st;
|
||||||
int w, h, r_w, r_h;
|
int w, h, r_w, r_h;
|
||||||
const uint32_t *d, *r_d;
|
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]);
|
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);
|
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);
|
fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
|
||||||
evas_object_image_size_get(obj, &w, &h);
|
evas_object_image_size_get(obj, &w, &h);
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 297 KiB |
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
Loading…
Reference in New Issue