summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-25 09:42:41 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-25 09:54:19 -0400
commitbcf27e35a276dd588211d4cec1d1a7c5fd7eedc0 (patch)
tree62639fadae378c32b506436b7faa2d162dc39764
parent3638b632c84421cdd37a9e2447be56aa4647728a (diff)
tests/layout: add legacy layout test to verify behavior with legacy size hints
Summary: this verifies that user-set legacy size hints will be applied accurately during calc, and that the size of a layout can accurately decrease when its contents min sizes decrease ref 95b5731461c53df2691ef43db61f321de5b366d3 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10453
-rw-r--r--src/tests/elementary/elm_test_layout.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_layout.c b/src/tests/elementary/elm_test_layout.c
index 5184086538..7ddffc9345 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -70,9 +70,54 @@ EFL_START_TEST(elm_layout_test_swallows)
70} 70}
71EFL_END_TEST 71EFL_END_TEST
72 72
73EFL_START_TEST(elm_layout_test_sizing)
74{
75 Evas_Object *win, *ly, *rect;
76 int w, h;
77
78 win = win_add(NULL, "layout", ELM_WIN_BASIC);
79 evas_object_show(win);
80
81 rect = evas_object_rectangle_add(evas_object_evas_get(win));
82
83 ly = elm_button_add(win);
84 elm_object_text_set(ly, "test");
85 elm_object_content_set(ly, rect);
86 evas_object_show(ly);
87
88 /* verify that the button calc is the size of the text */
89 evas_object_smart_need_recalculate_set(ly, 1);
90 evas_object_smart_calculate(ly);
91 evas_object_size_hint_min_get(ly, &w, &h);
92 ck_assert_int_lt(w, 100);
93 ck_assert_int_gt(w, 0);
94 ck_assert_int_lt(h, 100);
95 ck_assert_int_gt(h, 0);
96
97 /* verify that the button calc is the size of the text + minsize of rect */
98 evas_object_size_hint_min_set(rect, 100, 100);
99 evas_object_smart_need_recalculate_set(ly, 1);
100 evas_object_smart_calculate(ly);
101 evas_object_size_hint_min_get(ly, &w, &h);
102 ck_assert_int_ge(w, 100);
103 ck_assert_int_ge(h, 100);
104
105 /* verify that the button calc is once again the size of the text */
106 evas_object_size_hint_min_set(rect, 0, 0);
107 evas_object_smart_need_recalculate_set(ly, 1);
108 evas_object_smart_calculate(ly);
109 evas_object_size_hint_min_get(ly, &w, &h);
110 ck_assert_int_lt(w, 100);
111 ck_assert_int_gt(w, 0);
112 ck_assert_int_lt(h, 100);
113 ck_assert_int_gt(h, 0);
114}
115EFL_END_TEST
116
73void elm_test_layout(TCase *tc) 117void elm_test_layout(TCase *tc)
74{ 118{
75 tcase_add_test(tc, elm_layout_test_legacy_type_check); 119 tcase_add_test(tc, elm_layout_test_legacy_type_check);
76 tcase_add_test(tc, elm_atspi_role_get); 120 tcase_add_test(tc, elm_atspi_role_get);
77 tcase_add_test(tc, elm_layout_test_swallows); 121 tcase_add_test(tc, elm_layout_test_swallows);
122 tcase_add_test(tc, elm_layout_test_sizing);
78} 123}