summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-03-25 10:07:56 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2020-04-17 11:53:47 +0200
commite2365a0ed326e9c82301eb8036207f1632a6214e (patch)
treebb2e750adab8b9e82249e5b347c8c504477c446b
parent989570b133df8e509a4c35cf89b0f11a6dd67ddb (diff)
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
-rw-r--r--src/tests/elementary/efl_ui_test_image.c27
-rw-r--r--src/tests/elementary/elm_test_image.c26
2 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_image.c b/src/tests/elementary/efl_ui_test_image.c
index 244f1047e4..bd7d125323 100644
--- a/src/tests/elementary/efl_ui_test_image.c
+++ b/src/tests/elementary/efl_ui_test_image.c
@@ -30,7 +30,34 @@ EFL_START_TEST(efl_ui_image_test_icon)
30} 30}
31EFL_END_TEST 31EFL_END_TEST
32 32
33extern Eo *elm_image_object_get(Eo*);
34EFL_START_TEST(efl_ui_image_test_scale_method)
35{
36 Eo *win, *image;
37 Eina_Size2D sz;
38
39 win = win_add(NULL, "image", EFL_UI_WIN_TYPE_BASIC);
40 efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100));
41
42 image = efl_add(EFL_UI_IMAGE_CLASS, win,
43 efl_file_set(efl_added, ELM_IMAGE_DATA_DIR"/images/logo.png"),
44 efl_gfx_arrangement_content_align_set(efl_added, 0.5, 0.0),
45 efl_gfx_image_scale_method_set(efl_added, EFL_GFX_IMAGE_SCALE_METHOD_FIT_WIDTH)
46 );
47 efl_gfx_entity_size_set(image, EINA_SIZE2D(100, 100));
48 get_me_to_those_events(win);
49 sz = efl_gfx_entity_size_get(image);
50 ck_assert_int_eq(sz.w, 100);
51 ck_assert_int_eq(sz.h, 100);
52 /* legacy operation on eo object: very illegal */
53 sz = efl_gfx_entity_size_get(elm_image_object_get(image));
54 ck_assert_int_eq(sz.w, 100);
55 ck_assert_int_eq(sz.h, 100);
56}
57EFL_END_TEST
58
33void efl_ui_test_image(TCase *tc) 59void efl_ui_test_image(TCase *tc)
34{ 60{
35 tcase_add_test(tc, efl_ui_image_test_icon); 61 tcase_add_test(tc, efl_ui_image_test_icon);
62 tcase_add_test(tc, efl_ui_image_test_scale_method);
36} 63}
diff --git a/src/tests/elementary/elm_test_image.c b/src/tests/elementary/elm_test_image.c
index 108ee9f373..888069f2b7 100644
--- a/src/tests/elementary/elm_test_image.c
+++ b/src/tests/elementary/elm_test_image.c
@@ -277,6 +277,31 @@ EFL_START_TEST(elm_image_test_memfile_set)
277} 277}
278EFL_END_TEST 278EFL_END_TEST
279 279
280EFL_START_TEST(elm_image_test_scale_method)
281{
282 Evas_Object *win, *image;
283 int w, h;
284
285 win = win_add(NULL, "image", ELM_WIN_BASIC);
286 evas_object_resize(win, 100, 100);
287
288 image = elm_image_add(win);
289 ck_assert(elm_image_file_set(image, ELM_IMAGE_DATA_DIR"/images/logo.png", NULL));
290 evas_object_size_hint_align_set(image, 0.5, 0.0);
291 efl_gfx_image_scale_method_set(image, EFL_GFX_IMAGE_SCALE_METHOD_FIT_WIDTH);
292 evas_object_resize(image, 100, 100);
293 evas_object_show(image);
294 evas_object_show(win);
295 get_me_to_those_events(win);
296 evas_object_geometry_get(image, NULL, NULL, &w, &h);
297 ck_assert_int_eq(w, 100);
298 ck_assert_int_eq(h, 100);
299 evas_object_geometry_get(elm_image_object_get(image), NULL, NULL, &w, &h);
300 ck_assert_int_eq(w, 100);
301 ck_assert_int_eq(h, 100);
302}
303EFL_END_TEST
304
280#ifdef BUILD_LOADER_GIF 305#ifdef BUILD_LOADER_GIF
281static void 306static void
282_test_render(void *data, Evas *e EINA_UNUSED, void *event_info) 307_test_render(void *data, Evas *e EINA_UNUSED, void *event_info)
@@ -332,6 +357,7 @@ void elm_test_image(TCase *tc)
332 tcase_add_test(tc, elm_image_evas_object_color_set); 357 tcase_add_test(tc, elm_image_evas_object_color_set);
333 tcase_add_test(tc, elm_image_evas_image_get); 358 tcase_add_test(tc, elm_image_evas_image_get);
334 tcase_add_test(tc, elm_image_test_memfile_set); 359 tcase_add_test(tc, elm_image_test_memfile_set);
360 tcase_add_test(tc, elm_image_test_scale_method);
335#ifdef BUILD_LOADER_GIF 361#ifdef BUILD_LOADER_GIF
336 tcase_add_test(tc, elm_image_test_gif); 362 tcase_add_test(tc, elm_image_test_gif);
337#endif 363#endif