summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-04-12 17:44:48 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-04-13 11:07:34 +0200
commite5001b2cf3f751c5dd0b94d79c8662bbd99922d3 (patch)
treedfc29fbb4a7c9d6a201943c9c43a924757bda66f
parent35e7b3641116b0fd910c23c33625e5e0b2146895 (diff)
downloadefl-e5001b2cf3f751c5dd0b94d79c8662bbd99922d3.tar.gz
elm_suite: add test for request_move
-rw-r--r--src/tests/elementary/elm_test_focus.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_focus.c b/src/tests/elementary/elm_test_focus.c
index 4da5daf9df..90b613a553 100644
--- a/src/tests/elementary/elm_test_focus.c
+++ b/src/tests/elementary/elm_test_focus.c
@@ -890,6 +890,58 @@ EFL_START_TEST(test_pop_history_element)
}
EFL_END_TEST
+static void
+_focus_request_tree_check(Efl_Ui_Focus_Manager *m, Eina_Bool accept_logicals, Efl_Ui_Focus_Object *objs[])
+{
+ int i = 0;
+ for (i = 1; objs[i]; ++i)
+ {
+ ck_assert_ptr_eq(efl_ui_focus_manager_request_move(m, EFL_UI_FOCUS_DIRECTION_NEXT, objs[i], accept_logicals), objs[i + 1]);
+ }
+ i--;
+ for (; i > 0; --i)
+ {
+ ck_assert_ptr_eq(efl_ui_focus_manager_request_move(m, EFL_UI_FOCUS_DIRECTION_PREVIOUS, objs[i], accept_logicals), objs[i - 1]);
+ }
+}
+
+EFL_START_TEST(test_request_move)
+{
+ Efl_Ui_Focus_Manager *m;
+ Efl_Ui_Focus_Object *root, *c1, *c2, *c3, *c4, *c5, *c6;
+
+ m = elm_focus_test_manager_new(&root);
+ c1 = elm_focus_test_object_new("child1", 0, 0, 20, 20);
+ c2 = elm_focus_test_object_new("child2", 0, 0, 20, 20);
+ c3 = elm_focus_test_object_new("child3", 0, 0, 20, 20);
+ c4 = elm_focus_test_object_new("child4", 0, 0, 20, 20);
+ c5 = elm_focus_test_object_new("child5", 0, 0, 20, 20);
+ c6 = elm_focus_test_object_new("child6", 0, 0, 20, 20);
+
+ efl_ui_focus_manager_calc_register(m, c1, root, NULL);
+ efl_ui_focus_manager_calc_register_logical(m, c2, root, NULL);
+ efl_ui_focus_manager_calc_register(m, c3, c2, NULL);
+ efl_ui_focus_manager_calc_register(m, c4, c2, NULL);
+ efl_ui_focus_manager_calc_register(m, c5, c2, NULL);
+ efl_ui_focus_manager_calc_register(m, c6, root, NULL);
+
+ // c3 c4 c5
+ // \ | /
+ // \ | /
+ // c1 c2 c6
+ // \ | /
+ // rooot
+
+ Efl_Ui_Focus_Object *objs_logical[] = {NULL, root, c1, c2, c3, c4, c5, c6, NULL};
+ _focus_request_tree_check(m, EINA_TRUE, objs_logical);
+
+ Efl_Ui_Focus_Object *objs_regular[] = {NULL, c1, c3, c4, c5, c6, NULL};
+ _focus_request_tree_check(m, EINA_FALSE, objs_regular);
+
+}
+EFL_END_TEST
+
+
void elm_test_focus(TCase *tc)
{
tcase_add_test(tc, focus_register_twice);
@@ -918,4 +970,5 @@ void elm_test_focus(TCase *tc)
tcase_add_test(tc, test_unregister_last_focused);
tcase_add_test(tc, test_unregister_last_focused_no_child);
tcase_add_test(tc, test_pop_history_element);
+ tcase_add_test(tc, test_request_move);
}