From 5010abc7d17533e9856ab20ae14cd0e9c2fce38b Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Sun, 24 Mar 2019 18:22:15 +0100 Subject: [PATCH] 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 Differential Revision: https://phab.enlightenment.org/D8458 --- src/tests/elementary/efl_ui_test_widget.c | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index c597388..bf75b0e 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) } EFL_END_TEST +EFL_START_TEST(efl_ui_test_widget_parent_relation) +{ + Efl_Ui_Win *win, *w1, *w2, *w3; + + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_text_set(efl_added, "Hello World")); + //first check the initial state + w1 = efl_add(efl_ui_widget_realized_class_get(), win); + ck_assert_ptr_eq(efl_ui_widget_parent_get(w1), win); + w2 = efl_add(efl_ui_widget_realized_class_get(), w1); + ck_assert_ptr_eq(efl_ui_widget_parent_get(w2), w1); + w3 = efl_add(efl_ui_widget_realized_class_get(), w1); + ck_assert_ptr_eq(efl_ui_widget_parent_get(w3), w1); + + //check if widget_parent is working correctly + efl_ui_widget_sub_object_add(w2, w3); + ck_assert_ptr_eq(efl_ui_widget_parent_get(w3), w2); + + efl_del(win); +} +EFL_END_TEST + + +EFL_START_TEST(efl_ui_test_widget_disabled_parent) +{ + Efl_Ui_Win *win, *w1, *w2, *t; + + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_text_set(efl_added, "Hello World")); + //first check the initial state + w1 = efl_add(efl_ui_widget_realized_class_get(), win); + efl_ui_widget_disabled_set(w1, EINA_TRUE); + w2 = efl_add(efl_ui_widget_realized_class_get(), win); + efl_ui_widget_disabled_set(w2, EINA_FALSE); + ck_assert_int_eq(efl_ui_widget_disabled_get(w1), EINA_TRUE); + ck_assert_int_eq(efl_ui_widget_disabled_get(w2), EINA_FALSE); + + //check if disalbed gets correctly setted on reparent + t = efl_add(efl_ui_widget_realized_class_get(), win); + efl_ui_widget_sub_object_add(w2, t); + ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_FALSE); + efl_ui_widget_sub_object_add(w1, t); + ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_TRUE); + efl_del(t); + + t = efl_add(efl_ui_widget_realized_class_get(), w2); + ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_FALSE); + efl_del(t); + + t = efl_add(efl_ui_widget_realized_class_get(), w1); + ck_assert_int_eq(efl_ui_widget_disabled_get(t), EINA_TRUE); + efl_del(t); + + + efl_del(win); +} +EFL_END_TEST + static int tree_abort; static int tree_abort_level; @@ -254,4 +314,6 @@ void efl_ui_test_widget(TCase *tc) tcase_add_test(tc, efl_ui_test_widget_sub_iterator); tcase_add_test(tc, efl_ui_test_widget_sub_object_add_del); tcase_add_test(tc, efl_ui_test_widget_sub_object_theme_sync); + tcase_add_test(tc, efl_ui_test_widget_parent_relation); + tcase_add_test(tc, efl_ui_test_widget_disabled_parent); } -- 2.7.4