summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-26 08:50:53 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-06-26 09:54:55 -0400
commitf085bd8ae7500d7c9b961cea713d0e9da25afb1f (patch)
tree95348037148751ed96220fb78ea5a2a013fac586
parent5b00dc344febd4004f268d8d76a05f7579d08288 (diff)
efl_input_interface: add test to verify focus in/out
Summary: 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. Reviewers: zmike, segfaultxavi Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9166
-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}