forked from enlightenment/efl
tests/elm: add image tests to verify internal object size is clamped to object size
ensure that this doesn't break again ref 11587 Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11599
This commit is contained in:
parent
989570b133
commit
e2365a0ed3
|
@ -30,7 +30,34 @@ EFL_START_TEST(efl_ui_image_test_icon)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
extern Eo *elm_image_object_get(Eo*);
|
||||||
|
EFL_START_TEST(efl_ui_image_test_scale_method)
|
||||||
|
{
|
||||||
|
Eo *win, *image;
|
||||||
|
Eina_Size2D sz;
|
||||||
|
|
||||||
|
win = win_add(NULL, "image", EFL_UI_WIN_TYPE_BASIC);
|
||||||
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100));
|
||||||
|
|
||||||
|
image = efl_add(EFL_UI_IMAGE_CLASS, win,
|
||||||
|
efl_file_set(efl_added, ELM_IMAGE_DATA_DIR"/images/logo.png"),
|
||||||
|
efl_gfx_arrangement_content_align_set(efl_added, 0.5, 0.0),
|
||||||
|
efl_gfx_image_scale_method_set(efl_added, EFL_GFX_IMAGE_SCALE_METHOD_FIT_WIDTH)
|
||||||
|
);
|
||||||
|
efl_gfx_entity_size_set(image, EINA_SIZE2D(100, 100));
|
||||||
|
get_me_to_those_events(win);
|
||||||
|
sz = efl_gfx_entity_size_get(image);
|
||||||
|
ck_assert_int_eq(sz.w, 100);
|
||||||
|
ck_assert_int_eq(sz.h, 100);
|
||||||
|
/* legacy operation on eo object: very illegal */
|
||||||
|
sz = efl_gfx_entity_size_get(elm_image_object_get(image));
|
||||||
|
ck_assert_int_eq(sz.w, 100);
|
||||||
|
ck_assert_int_eq(sz.h, 100);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void efl_ui_test_image(TCase *tc)
|
void efl_ui_test_image(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, efl_ui_image_test_icon);
|
tcase_add_test(tc, efl_ui_image_test_icon);
|
||||||
|
tcase_add_test(tc, efl_ui_image_test_scale_method);
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,31 @@ EFL_START_TEST(elm_image_test_memfile_set)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST(elm_image_test_scale_method)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *image;
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
win = win_add(NULL, "image", ELM_WIN_BASIC);
|
||||||
|
evas_object_resize(win, 100, 100);
|
||||||
|
|
||||||
|
image = elm_image_add(win);
|
||||||
|
ck_assert(elm_image_file_set(image, ELM_IMAGE_DATA_DIR"/images/logo.png", NULL));
|
||||||
|
evas_object_size_hint_align_set(image, 0.5, 0.0);
|
||||||
|
efl_gfx_image_scale_method_set(image, EFL_GFX_IMAGE_SCALE_METHOD_FIT_WIDTH);
|
||||||
|
evas_object_resize(image, 100, 100);
|
||||||
|
evas_object_show(image);
|
||||||
|
evas_object_show(win);
|
||||||
|
get_me_to_those_events(win);
|
||||||
|
evas_object_geometry_get(image, NULL, NULL, &w, &h);
|
||||||
|
ck_assert_int_eq(w, 100);
|
||||||
|
ck_assert_int_eq(h, 100);
|
||||||
|
evas_object_geometry_get(elm_image_object_get(image), NULL, NULL, &w, &h);
|
||||||
|
ck_assert_int_eq(w, 100);
|
||||||
|
ck_assert_int_eq(h, 100);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
#ifdef BUILD_LOADER_GIF
|
#ifdef BUILD_LOADER_GIF
|
||||||
static void
|
static void
|
||||||
_test_render(void *data, Evas *e EINA_UNUSED, void *event_info)
|
_test_render(void *data, Evas *e EINA_UNUSED, void *event_info)
|
||||||
|
@ -332,6 +357,7 @@ void elm_test_image(TCase *tc)
|
||||||
tcase_add_test(tc, elm_image_evas_object_color_set);
|
tcase_add_test(tc, elm_image_evas_object_color_set);
|
||||||
tcase_add_test(tc, elm_image_evas_image_get);
|
tcase_add_test(tc, elm_image_evas_image_get);
|
||||||
tcase_add_test(tc, elm_image_test_memfile_set);
|
tcase_add_test(tc, elm_image_test_memfile_set);
|
||||||
|
tcase_add_test(tc, elm_image_test_scale_method);
|
||||||
#ifdef BUILD_LOADER_GIF
|
#ifdef BUILD_LOADER_GIF
|
||||||
tcase_add_test(tc, elm_image_test_gif);
|
tcase_add_test(tc, elm_image_test_gif);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue