summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_test_layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elementary/elm_test_layout.c')
-rw-r--r--src/tests/elementary/elm_test_layout.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_layout.c b/src/tests/elementary/elm_test_layout.c
index 5184086..d08b9cb 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -70,9 +70,71 @@ 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
117EFL_START_TEST(elm_layout_test_theme_changed_callback)
118{
119 Evas_Object *win, *ly;
120 int called = 0;
121
122 win = win_add(NULL, "layout", ELM_WIN_BASIC);
123 evas_object_show(win);
124
125 ly = elm_button_add(win);
126 evas_object_smart_callback_add(ly, "theme,changed", event_callback_single_call_int_data, &called);
127 evas_object_show(ly);
128 elm_object_style_set(ly, "anchor");
129 ck_assert_int_eq(called, 1);
130}
131EFL_END_TEST
132
73void elm_test_layout(TCase *tc) 133void elm_test_layout(TCase *tc)
74{ 134{
75 tcase_add_test(tc, elm_layout_test_legacy_type_check); 135 tcase_add_test(tc, elm_layout_test_legacy_type_check);
76 tcase_add_test(tc, elm_atspi_role_get); 136 tcase_add_test(tc, elm_atspi_role_get);
77 tcase_add_test(tc, elm_layout_test_swallows); 137 tcase_add_test(tc, elm_layout_test_swallows);
138 tcase_add_test(tc, elm_layout_test_sizing);
139 tcase_add_test(tc, elm_layout_test_theme_changed_callback);
78} 140}