summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-03-24 18:22:15 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-03-29 08:26:05 +0100
commitf66b3edc4d191856427e8553cb9e49f81f44f6b1 (patch)
tree67135b15ebb439c29e2483436560214567b13580 /src/tests
parent02c2918fe6aa35c05fb8fc039d05a01c3c692eff (diff)
efl_ui_widget: add tests for parent and disalbed property
this just adds more coverage over the behaviour of efl_ui_widget properties. Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com> Differential Revision: https://phab.enlightenment.org/D8458
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_test_widget.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c
index c597388a51..bf75b0e012 100644
--- a/src/tests/elementary/efl_ui_test_widget.c
+++ b/src/tests/elementary/efl_ui_test_widget.c
@@ -225,6 +225,66 @@ EFL_START_TEST(efl_ui_test_widget_sub_object_theme_sync)
225} 225}
226EFL_END_TEST 226EFL_END_TEST
227 227
228EFL_START_TEST(efl_ui_test_widget_parent_relation)
229{
230 Efl_Ui_Win *win, *w1, *w2, *w3;
231
232 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
233 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
234 efl_text_set(efl_added, "Hello World"));
235 //first check the initial state
236 w1 = efl_add(efl_ui_widget_realized_class_get(), win);
237 ck_assert_ptr_eq(efl_ui_widget_parent_get(w1), win);
238 w2 = efl_add(efl_ui_widget_realized_class_get(), w1);
239 ck_assert_ptr_eq(efl_ui_widget_parent_get(w2), w1);
240 w3 = efl_add(efl_ui_widget_realized_class_get(), w1);
241 ck_assert_ptr_eq(efl_ui_widget_parent_get(w3), w1);
242
243 //check if widget_parent is working correctly
244 efl_ui_widget_sub_object_add(w2, w3);
245 ck_assert_ptr_eq(efl_ui_widget_parent_get(w3), w2);
246
247 efl_del(win);
248}
249EFL_END_TEST
250
251
252EFL_START_TEST(efl_ui_test_widget_disabled_parent)
253{
254 Efl_Ui_Win *win, *w1, *w2, *t;
255
256 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
257 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
258 efl_text_set(efl_added, "Hello World"));
259 //first check the initial state
260 w1 = efl_add(efl_ui_widget_realized_class_get(), win);
261 efl_ui_widget_disabled_set(w1, EINA_TRUE);
262 w2 = efl_add(efl_ui_widget_realized_class_get(), win);
263 efl_ui_widget_disabled_set(w2, EINA_FALSE);
264 ck_assert_int_eq(efl_ui_widget_disabled_get(w1), EINA_TRUE);
265 ck_assert_int_eq(efl_ui_widget_disabled_get(w2), EINA_FALSE);
266
267 //check if disalbed gets correctly setted on reparent
268 t = efl_add(efl_ui_widget_realized_class_get(), win);
269 efl_ui_widget_sub_object_add(w2, t);
270 ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_FALSE);
271 efl_ui_widget_sub_object_add(w1, t);
272 ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_TRUE);
273 efl_del(t);
274
275 t = efl_add(efl_ui_widget_realized_class_get(), w2);
276 ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_FALSE);
277 efl_del(t);
278
279 t = efl_add(efl_ui_widget_realized_class_get(), w1);
280 ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_TRUE);
281 efl_del(t);
282
283
284 efl_del(win);
285}
286EFL_END_TEST
287
228static int tree_abort; 288static int tree_abort;
229static int tree_abort_level; 289static int tree_abort_level;
230 290
@@ -254,4 +314,6 @@ void efl_ui_test_widget(TCase *tc)
254 tcase_add_test(tc, efl_ui_test_widget_sub_iterator); 314 tcase_add_test(tc, efl_ui_test_widget_sub_iterator);
255 tcase_add_test(tc, efl_ui_test_widget_sub_object_add_del); 315 tcase_add_test(tc, efl_ui_test_widget_sub_object_add_del);
256 tcase_add_test(tc, efl_ui_test_widget_sub_object_theme_sync); 316 tcase_add_test(tc, efl_ui_test_widget_sub_object_theme_sync);
317 tcase_add_test(tc, efl_ui_test_widget_parent_relation);
318 tcase_add_test(tc, efl_ui_test_widget_disabled_parent);
257} 319}