forked from enlightenment/efl
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
This commit is contained in:
parent
8f9255e2c1
commit
6b47edd998
|
@ -679,7 +679,7 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
|
||||||
const uint32_t *d, *n_d;
|
const uint32_t *d, *n_d;
|
||||||
const uint32_t *d2, *n_d2;
|
const uint32_t *d2, *n_d2;
|
||||||
const char *img_path, *img_path2;
|
const char *img_path, *img_path2;
|
||||||
Evas_Object *img, *img2;
|
Evas_Object *img, *img2, *img3, *img4;
|
||||||
Eina_Rect region;
|
Eina_Rect region;
|
||||||
|
|
||||||
Evas *e = _setup_evas();
|
Evas *e = _setup_evas();
|
||||||
|
@ -708,39 +708,39 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
|
||||||
evas_object_move(img2, 250, 250);
|
evas_object_move(img2, 250, 250);
|
||||||
evas_object_show(img2);
|
evas_object_show(img2);
|
||||||
|
|
||||||
evas_object_image_size_get(img, &w2, &h2);
|
evas_object_image_size_get(img2, &w2, &h2);
|
||||||
d2 = evas_object_image_data_get(img, EINA_FALSE);
|
d2 = evas_object_image_data_get(img2, EINA_FALSE);
|
||||||
|
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
evas_object_del(img);
|
img3 = evas_object_image_add(e);
|
||||||
evas_object_del(img2);
|
evas_object_image_memfile_set(img3, content, size, "png", NULL);
|
||||||
|
evas_object_image_fill_set(img3, 0, 0, 250, 250);
|
||||||
|
evas_object_resize(img3, 250, 250);
|
||||||
|
evas_object_move(img3, 0, 0);
|
||||||
|
evas_object_show(img3);
|
||||||
|
|
||||||
img = evas_object_image_add(e);
|
evas_object_image_size_get(img3, &n_w, &n_h);
|
||||||
evas_object_image_memfile_set(img, content, size, "png", NULL);
|
n_d = evas_object_image_data_get(img3, EINA_FALSE);
|
||||||
evas_object_image_fill_set(img, 0, 0, 250, 250);
|
|
||||||
evas_object_resize(img, 250, 250);
|
|
||||||
evas_object_move(img, 0, 0);
|
|
||||||
evas_object_show(img);
|
|
||||||
|
|
||||||
evas_object_image_size_get(img, &n_w, &n_h);
|
|
||||||
n_d = evas_object_image_data_get(img, EINA_FALSE);
|
|
||||||
|
|
||||||
fail_if(w != n_w || h != n_h);
|
fail_if(w != n_w || h != n_h);
|
||||||
fail_if(memcmp(d, n_d, w * h * 4));
|
fail_if(memcmp(d, n_d, w * h * 4));
|
||||||
|
|
||||||
img2 = evas_object_image_add(e);
|
img4 = evas_object_image_add(e);
|
||||||
evas_object_image_memfile_set(img2, content2, size2, "png", NULL);
|
evas_object_image_memfile_set(img4, content2, size2, "png", NULL);
|
||||||
evas_object_image_fill_set(img2, 0, 0, 250, 250);
|
evas_object_image_fill_set(img4, 0, 0, 250, 250);
|
||||||
evas_object_resize(img2, 250, 250);
|
evas_object_resize(img4, 250, 250);
|
||||||
evas_object_move(img2, 250, 250);
|
evas_object_move(img4, 250, 250);
|
||||||
evas_object_show(img2);
|
evas_object_show(img4);
|
||||||
|
|
||||||
evas_object_image_size_get(img, &n_w2, &n_h2);
|
evas_object_image_size_get(img4, &n_w2, &n_h2);
|
||||||
n_d2 = evas_object_image_data_get(img, EINA_FALSE);
|
n_d2 = evas_object_image_data_get(img4, EINA_FALSE);
|
||||||
|
|
||||||
fail_if(w2 != n_w2 || h2 != n_h2);
|
fail_if(w2 != n_w2 || h2 != n_h2);
|
||||||
fail_if(memcmp(d2, n_d2, w2 * h2 * 4));
|
fail_if(memcmp(d2, n_d2, w2 * h2 * 4));
|
||||||
|
|
||||||
|
evas_object_del(img3);
|
||||||
|
evas_object_del(img4);
|
||||||
}
|
}
|
||||||
|
|
||||||
region = efl_gfx_image_content_region_get(img);
|
region = efl_gfx_image_content_region_get(img);
|
||||||
|
@ -762,6 +762,9 @@ EFL_START_TEST(evas_object_image_cached_data_comparision)
|
||||||
ck_assert_int_eq(region.y, 8);
|
ck_assert_int_eq(region.y, 8);
|
||||||
ck_assert_int_eq(region.w, 120);
|
ck_assert_int_eq(region.w, 120);
|
||||||
ck_assert_int_eq(region.h, 77);
|
ck_assert_int_eq(region.h, 77);
|
||||||
|
|
||||||
|
evas_object_del(img);
|
||||||
|
evas_object_del(img2);
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue