diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-03-23 17:35:12 +0100 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-03-23 20:02:53 +0100 |
commit | 61fe913995f907373b726428a79cebd99c8cd265 (patch) | |
tree | 548ec8118478b94dbd32fcadd049f28e5ed9f69b | |
parent | 59ee633dc0cadb17a426ca588be16992c126ee6f (diff) | |
download | efl-61fe913995f907373b726428a79cebd99c8cd265.tar.gz |
efl_ui_test_widget: add test for subtree disabling / tree unfocusabling
this is valdating the previous commit.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11557
-rw-r--r-- | src/tests/elementary/efl_ui_test_widget.c | 70 |
1 files 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); } |