summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorpierre lamot <pierre.lamot@openwide.fr>2015-01-20 15:39:08 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 16:38:06 +0100
commit17e73dca0560013ce00277c8cf399461b26442b9 (patch)
tree24788c55c03728844e748129cba995dd3b612c36 /src/tests/evas/evas_test_image.c
parent66c0f3261dab904fce533b0f7d30b1b374abd658 (diff)
downloadefl-17e73dca0560013ce00277c8cf399461b26442b9.tar.gz
evas: jpeg decoders alows a difference of 1 bit per component.
The required precision of decompressed images allows a difference of 1 bit for each pixel compoment [1] . Such difference has been noticed on OSX when using libjpeg9 from macports. evas_suite images tests has been modified to compare jpeg images with this tolerance. Other image formats are still compare with exact precision [1] http://en.wikipedia.org/wiki/JPEG#Required_precision Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index ed339e6d14..cb3ff690e6 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -356,8 +356,9 @@ 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;
+ 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);
@@ -368,6 +369,8 @@ START_TEST(evas_object_image_all_loader_data)
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);
@@ -376,10 +379,26 @@ START_TEST(evas_object_image_all_loader_data)
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(memcmp(d, r_d, w * h * 4));
+ 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++)
+ {
+ fail_if(abs(((char*)d)[j] - ((char*)r_d)[j]) > 1);
+ }
+ }
+ else
+ {
+ fail_if(memcmp(d, r_d, w * h * 4));
+ }
}
evas_object_del(obj);