summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-11-13 09:51:13 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-11-13 09:51:13 +0000
commit6b47edd99865dcfed6d45d8ccfc418e1b42b160e (patch)
tree752e666b53ad82038a7d86f71a939c5cca4d49be
parent8f9255e2c16efed25a26ad39eaa37b07cf670c38 (diff)
evas test - fix evas suite image data compare
the test was wrong and waiting to fail. it worked by luck before, but it was comparing a deleted image's data vs a new one that replaced it. this fixes that. makes the test suite now reliable. asan pointed this out. @fix
-rw-r--r--src/tests/evas/evas_test_image.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 4ec5aa919e..c2530632a3 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -679,7 +679,7 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
679 const uint32_t *d, *n_d; 679 const uint32_t *d, *n_d;
680 const uint32_t *d2, *n_d2; 680 const uint32_t *d2, *n_d2;
681 const char *img_path, *img_path2; 681 const char *img_path, *img_path2;
682 Evas_Object *img, *img2; 682 Evas_Object *img, *img2, *img3, *img4;
683 Eina_Rect region; 683 Eina_Rect region;
684 684
685 Evas *e = _setup_evas(); 685 Evas *e = _setup_evas();
@@ -708,39 +708,39 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
708 evas_object_move(img2, 250, 250); 708 evas_object_move(img2, 250, 250);
709 evas_object_show(img2); 709 evas_object_show(img2);
710 710
711 evas_object_image_size_get(img, &w2, &h2); 711 evas_object_image_size_get(img2, &w2, &h2);
712 d2 = evas_object_image_data_get(img, EINA_FALSE); 712 d2 = evas_object_image_data_get(img2, EINA_FALSE);
713 713
714 for (i = 0; i < 100; i++) 714 for (i = 0; i < 100; i++)
715 { 715 {
716 evas_object_del(img); 716 img3 = evas_object_image_add(e);
717 evas_object_del(img2); 717 evas_object_image_memfile_set(img3, content, size, "png", NULL);
718 evas_object_image_fill_set(img3, 0, 0, 250, 250);
719 evas_object_resize(img3, 250, 250);
720 evas_object_move(img3, 0, 0);
721 evas_object_show(img3);
718 722
719 img = evas_object_image_add(e); 723 evas_object_image_size_get(img3, &n_w, &n_h);
720 evas_object_image_memfile_set(img, content, size, "png", NULL); 724 n_d = evas_object_image_data_get(img3, EINA_FALSE);
721 evas_object_image_fill_set(img, 0, 0, 250, 250);
722 evas_object_resize(img, 250, 250);
723 evas_object_move(img, 0, 0);
724 evas_object_show(img);
725
726 evas_object_image_size_get(img, &n_w, &n_h);
727 n_d = evas_object_image_data_get(img, EINA_FALSE);
728 725
729 fail_if(w != n_w || h != n_h); 726 fail_if(w != n_w || h != n_h);
730 fail_if(memcmp(d, n_d, w * h * 4)); 727 fail_if(memcmp(d, n_d, w * h * 4));
731 728
732 img2 = evas_object_image_add(e); 729 img4 = evas_object_image_add(e);
733 evas_object_image_memfile_set(img2, content2, size2, "png", NULL); 730 evas_object_image_memfile_set(img4, content2, size2, "png", NULL);
734 evas_object_image_fill_set(img2, 0, 0, 250, 250); 731 evas_object_image_fill_set(img4, 0, 0, 250, 250);
735 evas_object_resize(img2, 250, 250); 732 evas_object_resize(img4, 250, 250);
736 evas_object_move(img2, 250, 250); 733 evas_object_move(img4, 250, 250);
737 evas_object_show(img2); 734 evas_object_show(img4);
738 735
739 evas_object_image_size_get(img, &n_w2, &n_h2); 736 evas_object_image_size_get(img4, &n_w2, &n_h2);
740 n_d2 = evas_object_image_data_get(img, EINA_FALSE); 737 n_d2 = evas_object_image_data_get(img4, EINA_FALSE);
741 738
742 fail_if(w2 != n_w2 || h2 != n_h2); 739 fail_if(w2 != n_w2 || h2 != n_h2);
743 fail_if(memcmp(d2, n_d2, w2 * h2 * 4)); 740 fail_if(memcmp(d2, n_d2, w2 * h2 * 4));
741
742 evas_object_del(img3);
743 evas_object_del(img4);
744 } 744 }
745 745
746 region = efl_gfx_image_content_region_get(img); 746 region = efl_gfx_image_content_region_get(img);
@@ -762,6 +762,9 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
762 ck_assert_int_eq(region.y, 8); 762 ck_assert_int_eq(region.y, 8);
763 ck_assert_int_eq(region.w, 120); 763 ck_assert_int_eq(region.w, 120);
764 ck_assert_int_eq(region.h, 77); 764 ck_assert_int_eq(region.h, 77);
765
766 evas_object_del(img);
767 evas_object_del(img2);
765} 768}
766EFL_END_TEST 769EFL_END_TEST
767 770