forked from enlightenment/efl
tests: use loop test to split jpeg tests from evas_object_image_all_loader_data
Summary: jpeg loader tests take 4+ seconds due to manual value comparisons, so ensure that they run separately ref T6856 Reviewers: stefan_schmidt Subscribers: cedric Maniphest Tasks: T6856 Differential Revision: https://phab.enlightenment.org/D5911
This commit is contained in:
parent
c943c4a2ff
commit
22cb35c9a4
|
@ -17,6 +17,7 @@ static const Efl_Test_Case etc[] = {
|
|||
{ "Render Engines", evas_test_render_engines },
|
||||
{ "Filters", evas_test_filters },
|
||||
{ "Images", evas_test_image_object },
|
||||
{ "Images", evas_test_image_object2 },
|
||||
{ "Meshes", evas_test_mesh },
|
||||
{ "Masking", evas_test_mask },
|
||||
{ "Evas GL", evas_test_evasgl },
|
||||
|
|
|
@ -11,6 +11,7 @@ void evas_test_callbacks(TCase *tc);
|
|||
void evas_test_render_engines(TCase *tc);
|
||||
void evas_test_filters(TCase *tc);
|
||||
void evas_test_image_object(TCase *tc);
|
||||
void evas_test_image_object2(TCase *tc);
|
||||
void evas_test_mesh(TCase *tc);
|
||||
void evas_test_mask(TCase *tc);
|
||||
void evas_test_evasgl(TCase *tc);
|
||||
|
|
|
@ -38,10 +38,6 @@ static const char *exts[] = {
|
|||
#ifdef BUILD_LOADER_WEBP
|
||||
,"webp"
|
||||
#endif
|
||||
#ifdef BUILD_LOADER_JPEG
|
||||
,"jpeg"
|
||||
,"jpg"
|
||||
#endif
|
||||
#ifdef BUILD_LOADER_TGV
|
||||
,"tgv"
|
||||
#endif
|
||||
|
@ -49,6 +45,13 @@ static const char *exts[] = {
|
|||
,"jp2"
|
||||
,"j2k"
|
||||
#endif
|
||||
/* ADD NEW FORMATS HERE
|
||||
* JPEG MUST BE LAST
|
||||
*/
|
||||
#ifdef BUILD_LOADER_JPEG
|
||||
,"jpeg"
|
||||
,"jpg"
|
||||
#endif
|
||||
};
|
||||
|
||||
EFL_START_TEST(evas_object_image_loader)
|
||||
|
@ -396,60 +399,55 @@ EFL_START_TEST(evas_object_image_all_loader_data)
|
|||
Evas *e = _setup_evas();
|
||||
Evas_Object *obj, *ref;
|
||||
Eina_Strbuf *str;
|
||||
unsigned int i;
|
||||
struct stat st;
|
||||
int w, h, s, r_w, r_h, r_s;
|
||||
const uint32_t *d, *r_d;
|
||||
Evas_Colorspace c, r_c;
|
||||
|
||||
obj = evas_object_image_add(e);
|
||||
ref = evas_object_image_add(e);
|
||||
str = eina_strbuf_new();
|
||||
|
||||
for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++)
|
||||
eina_strbuf_reset(str);
|
||||
|
||||
eina_strbuf_append_printf(str, "%s/Pic4-%s.png", TESTS_IMG_DIR, exts[_i]);
|
||||
|
||||
if (stat(eina_strbuf_string_get(str), &st) != 0) goto end;
|
||||
|
||||
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);
|
||||
s = evas_object_image_stride_get(obj);
|
||||
c = evas_object_image_colorspace_get(obj);
|
||||
d = evas_object_image_data_get(obj, EINA_FALSE);
|
||||
|
||||
eina_strbuf_reset(str);
|
||||
|
||||
eina_strbuf_append_printf(str, "%s/Pic4.%s", TESTS_IMG_DIR, exts[_i]);
|
||||
evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
|
||||
fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
|
||||
evas_object_image_size_get(ref, &r_w, &r_h);
|
||||
r_s = evas_object_image_stride_get(ref);
|
||||
r_c = evas_object_image_colorspace_get(ref);
|
||||
r_d = evas_object_image_data_get(ref, EINA_FALSE);
|
||||
|
||||
fail_if(w != r_w || h != r_h);
|
||||
fail_if(s != r_s);
|
||||
fail_if(c != r_c);
|
||||
fail_if(w*4 != s);
|
||||
if (strcmp(exts[_i], "jpeg") == 0 || strcmp(exts[_i], "jpg") == 0)
|
||||
{
|
||||
struct stat st;
|
||||
int w, h, s, r_w, r_h, r_s;
|
||||
const uint32_t *d, *r_d;
|
||||
Evas_Colorspace c, r_c;
|
||||
|
||||
eina_strbuf_reset(str);
|
||||
|
||||
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);
|
||||
s = evas_object_image_stride_get(obj);
|
||||
c = evas_object_image_colorspace_get(obj);
|
||||
d = evas_object_image_data_get(obj, EINA_FALSE);
|
||||
|
||||
eina_strbuf_reset(str);
|
||||
|
||||
eina_strbuf_append_printf(str, "%s/Pic4.%s", TESTS_IMG_DIR, exts[i]);
|
||||
evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
|
||||
fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
|
||||
evas_object_image_size_get(ref, &r_w, &r_h);
|
||||
r_s = evas_object_image_stride_get(ref);
|
||||
r_c = evas_object_image_colorspace_get(ref);
|
||||
r_d = evas_object_image_data_get(ref, EINA_FALSE);
|
||||
|
||||
fail_if(w != r_w || h != r_h);
|
||||
fail_if(s != r_s);
|
||||
fail_if(c != r_c);
|
||||
fail_if(w*4 != s);
|
||||
if (strcmp(exts[i], "jpeg") == 0 || strcmp(exts[i], "jpg") == 0)
|
||||
//jpeg norm allows a variation of 1 bit per component
|
||||
for (int j = 0; j < s * h; j++)
|
||||
{
|
||||
//jpeg norm allows a variation of 1 bit per component
|
||||
for (int j = 0; j < s * h; j++)
|
||||
{
|
||||
fail_if(abs(((char*)d)[j] - ((char*)r_d)[j]) > 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fail_if(memcmp(d, r_d, w * h * 4));
|
||||
fail_if(abs(((char*)d)[j] - ((char*)r_d)[j]) > 1);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fail_if(memcmp(d, r_d, w * h * 4));
|
||||
}
|
||||
end:
|
||||
evas_object_del(obj);
|
||||
evas_object_del(ref);
|
||||
|
||||
|
@ -883,9 +881,25 @@ void evas_test_image_object(TCase *tc)
|
|||
# if BUILD_LOADER_JP2K
|
||||
tcase_add_test(tc, evas_object_image_jp2k_loader_data);
|
||||
# endif
|
||||
tcase_add_test(tc, evas_object_image_all_loader_data);
|
||||
#ifdef BUILD_LOADER_JPEG
|
||||
/* jpeg takes forever from manual value comparisons */
|
||||
tcase_add_loop_test(tc, evas_object_image_all_loader_data, 0, EINA_C_ARRAY_LENGTH(exts) - 2);
|
||||
#else
|
||||
tcase_add_loop_test(tc, evas_object_image_all_loader_data, 0, EINA_C_ARRAY_LENGTH(exts));
|
||||
#endif
|
||||
tcase_add_test(tc, evas_object_image_buggy);
|
||||
tcase_add_test(tc, evas_object_image_map_unmap);
|
||||
#endif
|
||||
tcase_add_test(tc, evas_object_image_partially_load_orientation);
|
||||
}
|
||||
|
||||
|
||||
void evas_test_image_object2(TCase *tc)
|
||||
{
|
||||
#if BUILD_LOADER_PNG
|
||||
#ifdef BUILD_LOADER_JPEG
|
||||
/* jpeg takes forever from manual value comparisons */
|
||||
tcase_add_loop_test(tc, evas_object_image_all_loader_data, EINA_C_ARRAY_LENGTH(exts) - 2, EINA_C_ARRAY_LENGTH(exts));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue