summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2014-10-02 16:34:10 +0200
committerCedric BAIL <cedric@osg.samsung.com>2014-10-02 16:52:30 +0200
commit308f000b394472d34560446baee51d67a339a426 (patch)
treedfc377ddb7ab831e6786be53f6dfa9f85ba03ed7 /src/tests/evas/evas_test_image.c
parentbcc61b1f1277e9de21d06996df9a84757b65a1ac (diff)
evas: tests tgv file decoding.
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c56
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)
238} 238}
239END_TEST 239END_TEST
240 240
241START_TEST(evas_object_image_loader_data)
242{
243 Evas *e = _setup_evas();
244 Evas_Object *obj, *ref;
245 Eina_Strbuf *str;
246
247 const char *files[] = {
248 "Light-50",
249 "Pic1-10",
250 "Pic1-100",
251 "Pic1-50",
252 "Pic4-10",
253 "Pic4-100",
254 "Pic4-50",
255 "Train-10"
256 };
257 unsigned int i;
258
259 obj = evas_object_image_add(e);
260 ref = evas_object_image_add(e);
261 str = eina_strbuf_new();
262
263 for (i = 0; i < sizeof (files) / sizeof (files[0]); i++)
264 {
265 int w, h, r_w, r_h;
266 const uint32_t *d, *r_d;
267
268 eina_strbuf_append_printf(str, "%s/%s.tgv", TESTS_IMG_DIR, files[i]);
269 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL);
270 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
271 evas_object_image_size_get(obj, &w, &h);
272 d = evas_object_image_data_get(obj, EINA_FALSE);
273
274 eina_strbuf_reset(str);
275
276 eina_strbuf_append_printf(str, "%s/%s.png", TESTS_IMG_DIR, files[i]);
277 evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
278 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
279 evas_object_image_size_get(ref, &r_w, &r_h);
280 r_d = evas_object_image_data_get(ref, EINA_FALSE);
281
282 eina_strbuf_reset(str);
283
284 fail_if(w != r_w || h != r_h);
285 fail_if(memcmp(d, r_d, w * h * 4));
286 }
287
288 evas_object_del(obj);
289 evas_object_del(ref);
290
291 evas_free(e);
292 evas_shutdown();
293}
294END_TEST
295
241void evas_test_image_object(TCase *tc) 296void evas_test_image_object(TCase *tc)
242{ 297{
243 tcase_add_test(tc, evas_object_image_loader); 298 tcase_add_test(tc, evas_object_image_loader);
244 tcase_add_test(tc, evas_object_image_loader_orientation); 299 tcase_add_test(tc, evas_object_image_loader_orientation);
300 tcase_add_test(tc, evas_object_image_loader_data);
245} 301}