From 61fe913995f907373b726428a79cebd99c8cd265 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 23 Mar 2020 17:35:12 +0100 Subject: efl_ui_test_widget: add test for subtree disabling / tree unfocusabling this is valdating the previous commit. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11557 --- src/tests/elementary/efl_ui_test_widget.c | 70 ++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index cbef4fa385..39d6be4137 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -333,11 +333,14 @@ EFL_START_TEST(efl_ui_test_widget_win_provider_find) EFL_END_TEST #define CHECK_UNFOCUSABLE_STATE(x) \ - ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.box), x); \ - ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.win), x); \ - ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.ic), x); \ - ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn1), x); \ - ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn2), x) + CHECK_UNFOCUSABLE_STATE_VEC(x, x, x, x, x) + +#define CHECK_UNFOCUSABLE_STATE_VEC(x1, x2, x3, x4, x5) \ + ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.win), x1); \ + ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.ic), x2); \ + ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.box), x3); \ + ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn1), x4); \ + ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn2), x5) EFL_START_TEST(efl_ui_test_widget_tree_unfocusable) @@ -364,13 +367,35 @@ EFL_START_TEST(efl_ui_test_widget_tree_unfocusable) } EFL_END_TEST -#define CHECK_DISABLED_STATE(x) \ - ck_assert_int_eq(efl_ui_widget_disabled_get(s.box), x); \ - ck_assert_int_eq(efl_ui_widget_disabled_get(s.win), x); \ - ck_assert_int_eq(efl_ui_widget_disabled_get(s.ic), x); \ - ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn1), x); \ - ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn2), x) +EFL_START_TEST(efl_ui_test_widget_tree_unfocusable_nested_calls) +{ + State s; + + _small_ui(&s); + CHECK_UNFOCUSABLE_STATE(0); + + elm_widget_tree_unfocusable_set(s.win, EINA_TRUE); + CHECK_UNFOCUSABLE_STATE(1); + + elm_widget_tree_unfocusable_set(s.box, EINA_TRUE); + CHECK_UNFOCUSABLE_STATE(1); + + elm_widget_tree_unfocusable_set(s.win, EINA_FALSE); + CHECK_UNFOCUSABLE_STATE_VEC(0, 0, 1, 1, 1); + + elm_widget_tree_unfocusable_set(s.box, EINA_FALSE); + CHECK_UNFOCUSABLE_STATE(0); +} +EFL_END_TEST + +#define CHECK_DISABLED_STATE(x) CHECK_DISABLED_STATE_VEC(x,x,x,x,x) +#define CHECK_DISABLED_STATE_VEC(x1,x2,x3,x4,x5) \ + ck_assert_int_eq(efl_ui_widget_disabled_get(s.win), x1); \ + ck_assert_int_eq(efl_ui_widget_disabled_get(s.ic), x2); \ + ck_assert_int_eq(efl_ui_widget_disabled_get(s.box), x3); \ + ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn1), x4); \ + ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn2), x5) EFL_START_TEST(efl_ui_test_widget_disabled_repeat_call) { @@ -396,6 +421,27 @@ EFL_START_TEST(efl_ui_test_widget_disabled_repeat_call) } EFL_END_TEST +EFL_START_TEST(efl_ui_test_widget_disabled_nested_calls) +{ + State s; + + _small_ui(&s); + CHECK_DISABLED_STATE(0); + + efl_ui_widget_disabled_set(s.win, EINA_TRUE); + CHECK_DISABLED_STATE(1); + + efl_ui_widget_disabled_set(s.box, EINA_TRUE); + CHECK_DISABLED_STATE(1); + + efl_ui_widget_disabled_set(s.win, EINA_FALSE); + CHECK_DISABLED_STATE_VEC(0, 0, 1, 1, 1); + + efl_ui_widget_disabled_set(s.box, EINA_FALSE); + CHECK_DISABLED_STATE(0); +} +EFL_END_TEST + void efl_ui_test_widget(TCase *tc) { tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); @@ -411,5 +457,7 @@ void efl_ui_test_widget(TCase *tc) tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour); tcase_add_test(tc, efl_ui_test_widget_win_provider_find); tcase_add_test(tc, efl_ui_test_widget_tree_unfocusable); + tcase_add_test(tc, efl_ui_test_widget_tree_unfocusable_nested_calls); tcase_add_test(tc, efl_ui_test_widget_disabled_repeat_call); + tcase_add_test(tc, efl_ui_test_widget_disabled_nested_calls); } -- cgit v1.2.1