summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-24 15:42:18 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-25 10:01:15 +0200
commit9b1d01fed101c558c9aebd3090266ed3a01ac85c (patch)
tree1dea1a9f7c681f8c7b8aef5c33fbf2b2a4d2051f
parent0a0f3d5bfe167d1cb31127f066e1e4af3ef0a563 (diff)
downloadefl-9b1d01fed101c558c9aebd3090266ed3a01ac85c.tar.gz
efl_input_interface: add test to verify focus in/out
this verifies that EFL_EVENT_FOCUS_IN / EFL_EVENT_FOCUS_OUT are emitted and passed with the correct event types, and fields on the event object.
-rw-r--r--src/tests/elementary/efl_ui_test_win.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c
index 1482f14867..a0cc374969 100644
--- a/src/tests/elementary/efl_ui_test_win.c
+++ b/src/tests/elementary/efl_ui_test_win.c
@@ -94,9 +94,43 @@ EFL_START_TEST(efl_ui_win_test_object_focus)
}
EFL_END_TEST
+static void
+create_environment(Eo **win, Eo **rect)
+{
+ *win = efl_new(EFL_UI_WIN_CLASS);
+ *rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(*win));
+ efl_canvas_object_seat_focus_add(*rect, NULL);
+}
+
+EFL_START_TEST(efl_ui_win_test_efl_input_interface_focus)
+{
+ Efl_Ui_Win *win;
+ Efl_Canvas_Object *rect, *focus_in = NULL, *focus_out = NULL;
+ create_environment(&win, &rect);
+ efl_canvas_object_seat_focus_del(rect, NULL);
+
+ efl_event_callback_add(rect, EFL_EVENT_FOCUS_IN , _check_focus_event, &focus_in);
+ efl_event_callback_add(rect, EFL_EVENT_FOCUS_OUT, _check_focus_event, &focus_out);
+
+ efl_canvas_object_seat_focus_add(rect, NULL);
+ ck_assert_ptr_eq(focus_out, NULL);
+ ck_assert_ptr_eq(focus_in, rect);
+ focus_out = NULL;
+ focus_in = NULL;
+
+ efl_canvas_object_seat_focus_del(rect, NULL);
+ ck_assert_ptr_eq(focus_out, rect);
+ ck_assert_ptr_eq(focus_in, NULL);
+ focus_out = NULL;
+ focus_in = NULL;
+}
+EFL_END_TEST
+
void
efl_ui_test_win(TCase *tc)
{
tcase_add_test(tc, efl_ui_win_test_scene_focus);
tcase_add_test(tc, efl_ui_win_test_object_focus);
+ tcase_add_test(tc, efl_ui_win_test_object_focus);
+ tcase_add_test(tc, efl_ui_win_test_efl_input_interface_focus);
}