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)
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)
94} 94}
95EFL_END_TEST 95EFL_END_TEST
96 96
97static void
98create_environment(Eo **win, Eo **rect)
99{
100 *win = efl_new(EFL_UI_WIN_CLASS);
101 *rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(*win));
102 efl_canvas_object_seat_focus_add(*rect, NULL);
103}
104
105EFL_START_TEST(efl_ui_win_test_efl_input_interface_focus)
106{
107 Efl_Ui_Win *win;
108 Efl_Canvas_Object *rect, *focus_in = NULL, *focus_out = NULL;
109 create_environment(&win, &rect);
110 efl_canvas_object_seat_focus_del(rect, NULL);
111
112 efl_event_callback_add(rect, EFL_EVENT_FOCUS_IN , _check_focus_event, &focus_in);
113 efl_event_callback_add(rect, EFL_EVENT_FOCUS_OUT, _check_focus_event, &focus_out);
114
115 efl_canvas_object_seat_focus_add(rect, NULL);
116 ck_assert_ptr_eq(focus_out, NULL);
117 ck_assert_ptr_eq(focus_in, rect);
118 focus_out = NULL;
119 focus_in = NULL;
120
121 efl_canvas_object_seat_focus_del(rect, NULL);
122 ck_assert_ptr_eq(focus_out, rect);
123 ck_assert_ptr_eq(focus_in, NULL);
124 focus_out = NULL;
125 focus_in = NULL;
126}
127EFL_END_TEST
128
97void 129void
98efl_ui_test_win(TCase *tc) 130efl_ui_test_win(TCase *tc)
99{ 131{
100 tcase_add_test(tc, efl_ui_win_test_scene_focus); 132 tcase_add_test(tc, efl_ui_win_test_scene_focus);
101 tcase_add_test(tc, efl_ui_win_test_object_focus); 133 tcase_add_test(tc, efl_ui_win_test_object_focus);
134 tcase_add_test(tc, efl_ui_win_test_object_focus);
135 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_focus);
102} 136}