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
This commit is contained in:
Marcel Hollerbach 2020-03-23 17:35:12 +01:00
parent 59ee633dc0
commit 61fe913995
1 changed files with 59 additions and 11 deletions

View File

@ -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);
}