summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-01-26 11:02:14 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-01-26 11:02:14 +0100
commit311ea67b65814d73a9231c3376f2a69388e1b973 (patch)
treebeeebcba3e33e7468edc60abf33f4cda879a8568 /src/tests/evas/evas_test_image.c
parentc54c2d94c2ccf783e397c660882436cd45b082ed (diff)
evas: add new test for bug in BMP loader.
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 86023c810c..ed339e6d14 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -392,6 +392,67 @@ START_TEST(evas_object_image_all_loader_data)
392} 392}
393END_TEST 393END_TEST
394 394
395const char *buggy[] = {
396 "BMP301K"
397};
398
399START_TEST(evas_object_image_buggy)
400{
401 Evas *e = _setup_evas();
402 Evas_Object *obj, *ref;
403 Eina_Strbuf *str;
404 unsigned int i, j;
405
406 obj = evas_object_image_add(e);
407 ref = evas_object_image_add(e);
408 str = eina_strbuf_new();
409
410 for (i = 0; i < sizeof (buggy) / sizeof (buggy[0]); i++)
411 {
412 for (j = 0; j < sizeof (exts) / sizeof (exts[0]); j++)
413 {
414 struct stat st;
415 int w, h, r_w, r_h;
416 const uint32_t *d, *r_d;
417
418 eina_strbuf_reset(str);
419
420 if (!strcmp(exts[j], "png")) continue ;
421
422 eina_strbuf_append_printf(str, "%s/%s.%s", TESTS_IMG_DIR,
423 buggy[i], exts[j]);
424
425 if (stat(eina_strbuf_string_get(str), &st) != 0) continue;
426
427 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL);
428 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
429 evas_object_image_size_get(obj, &w, &h);
430 d = evas_object_image_data_get(obj, EINA_FALSE);
431
432 eina_strbuf_reset(str);
433
434 eina_strbuf_append_printf(str, "%s/%s.png", TESTS_IMG_DIR,
435 buggy[i]);
436 evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
437 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
438 evas_object_image_size_get(ref, &r_w, &r_h);
439 r_d = evas_object_image_data_get(ref, EINA_FALSE);
440
441 fail_if(w != r_w || h != r_h);
442 fail_if(memcmp(d, r_d, w * h * 4));
443 }
444 }
445
446 evas_object_del(obj);
447 evas_object_del(ref);
448
449 eina_strbuf_free(str);
450
451 evas_free(e);
452 evas_shutdown();
453}
454END_TEST
455
395void evas_test_image_object(TCase *tc) 456void evas_test_image_object(TCase *tc)
396{ 457{
397 tcase_add_test(tc, evas_object_image_loader); 458 tcase_add_test(tc, evas_object_image_loader);
@@ -401,5 +462,6 @@ void evas_test_image_object(TCase *tc)
401#endif 462#endif
402#if BUILD_LOADER_PNG 463#if BUILD_LOADER_PNG
403 tcase_add_test(tc, evas_object_image_all_loader_data); 464 tcase_add_test(tc, evas_object_image_all_loader_data);
465 tcase_add_test(tc, evas_object_image_buggy);
404#endif 466#endif
405} 467}