summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-04-22 13:14:48 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2020-04-28 13:29:34 +0200
commitc622bd2e2353518dda6edf2742213fae6ba17d6b (patch)
treeab5494399a131ec9acee9171720d2c9892161b1a /src/tests
parent02ad4d18ba86c9160a6e75829a6ec16a9d79ef7c (diff)
tests/elm: add a list sizing test
basic test to ensure that list sizing is homogeneous and works as it "should", even though list sizing internals are a black hole of lost time and dreams Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11748
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/elm_test_list.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_list.c b/src/tests/elementary/elm_test_list.c
index 063384b235..ab5b5ed20c 100644
--- a/src/tests/elementary/elm_test_list.c
+++ b/src/tests/elementary/elm_test_list.c
@@ -291,6 +291,51 @@ EFL_START_TEST(elm_list_test_callbacks)
291} 291}
292EFL_END_TEST 292EFL_END_TEST
293 293
294static Eo *
295create_content_with_size(Eo *parent, int mw, int mh)
296{
297 Evas *e = evas_object_evas_get(parent);
298 Eo *rect = evas_object_rectangle_add(e);
299
300 evas_object_size_hint_min_set(rect, mw, mh);
301 evas_object_show(rect);
302
303 return rect;
304}
305
306EFL_START_TEST(elm_list_test_sizing)
307{
308 Evas_Object *win, *list;
309 unsigned int i;
310 int count[NUM_ITEMS] = {0};
311 Elm_Object_Item *it;
312
313 win = win_add(NULL, "list", ELM_WIN_BASIC);
314 evas_object_resize(win, 100, 100);
315
316 list = elm_list_add(win);
317 evas_object_resize(list, 100, 100);
318 for (i = 0; i < NUM_ITEMS; i++)
319 elm_list_item_append(list, "item", create_content_with_size(list, i * 5, i * 5), NULL, (void*)event_callback_single_call_int_data, &(count[i]));
320
321 elm_list_go(list);
322 evas_object_show(list);
323 evas_object_show(win);
324 get_me_to_those_events(win);
325
326 for (i = 0, it = elm_list_first_item_get(list); i < NUM_ITEMS; i++, it = elm_list_item_next(it))
327 {
328 Eo *rect = elm_object_item_content_get(it);
329 ck_assert(rect);
330 /* list is always homogeneous, so these should all have the size of the largest min size */
331 assert_object_size_eq(rect, (NUM_ITEMS - 1) * 5, (NUM_ITEMS - 1) * 5);
332 }
333
334 /* weird SIGILL in shutdown if the list isn't deleted here */
335 evas_object_del(list);
336}
337EFL_END_TEST
338
294void elm_test_list(TCase *tc) 339void elm_test_list(TCase *tc)
295{ 340{
296 tcase_add_test(tc, elm_list_legacy_type_check); 341 tcase_add_test(tc, elm_list_legacy_type_check);
@@ -306,4 +351,5 @@ void elm_test_list(TCase *tc)
306#endif 351#endif
307 tcase_add_test(tc, elm_atspi_children_parent); 352 tcase_add_test(tc, elm_atspi_children_parent);
308 tcase_add_test(tc, elm_list_test_callbacks); 353 tcase_add_test(tc, elm_list_test_callbacks);
354 tcase_add_test(tc, elm_list_test_sizing);
309} 355}