diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2014-10-02 16:34:10 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2014-10-02 16:52:30 +0200 |
commit | 308f000b394472d34560446baee51d67a339a426 (patch) | |
tree | dfc377ddb7ab831e6786be53f6dfa9f85ba03ed7 /src/tests/evas/evas_test_image.c | |
parent | bcc61b1f1277e9de21d06996df9a84757b65a1ac (diff) | |
download | efl-308f000b394472d34560446baee51d67a339a426.tar.gz |
evas: tests tgv file decoding.
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r-- | src/tests/evas/evas_test_image.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c index c0dc6f408a..849682c8ba 100644 --- a/src/tests/evas/evas_test_image.c +++ b/src/tests/evas/evas_test_image.c @@ -238,8 +238,64 @@ START_TEST(evas_object_image_loader_orientation) } END_TEST +START_TEST(evas_object_image_loader_data) +{ + Evas *e = _setup_evas(); + Evas_Object *obj, *ref; + Eina_Strbuf *str; + + const char *files[] = { + "Light-50", + "Pic1-10", + "Pic1-100", + "Pic1-50", + "Pic4-10", + "Pic4-100", + "Pic4-50", + "Train-10" + }; + unsigned int i; + + obj = evas_object_image_add(e); + ref = evas_object_image_add(e); + str = eina_strbuf_new(); + + for (i = 0; i < sizeof (files) / sizeof (files[0]); i++) + { + int w, h, r_w, r_h; + const uint32_t *d, *r_d; + + eina_strbuf_append_printf(str, "%s/%s.tgv", TESTS_IMG_DIR, files[i]); + 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); + d = evas_object_image_data_get(obj, EINA_FALSE); + + eina_strbuf_reset(str); + + eina_strbuf_append_printf(str, "%s/%s.png", TESTS_IMG_DIR, files[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_d = evas_object_image_data_get(ref, EINA_FALSE); + + eina_strbuf_reset(str); + + fail_if(w != r_w || h != r_h); + fail_if(memcmp(d, r_d, w * h * 4)); + } + + evas_object_del(obj); + evas_object_del(ref); + + evas_free(e); + evas_shutdown(); +} +END_TEST + void evas_test_image_object(TCase *tc) { tcase_add_test(tc, evas_object_image_loader); tcase_add_test(tc, evas_object_image_loader_orientation); + tcase_add_test(tc, evas_object_image_loader_data); } |