summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-25 09:12:40 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-25 10:07:15 +0200
commitd422c10f5a0f124146d1bdce7ca733c15b0ea147 (patch)
tree16eea88fbc70047080d6028dbf13e9dafdcdcbdb
parent946fde3acf6350e4534d388fdb337eaa9abbb1b8 (diff)
efl_input_interface: test pointer in and out events on a object
this verifies that EFL_EVENT_POINTER_IN EFL_EVENT_POINTER_OUT are emitted correctly with the correct event content.
-rw-r--r--src/tests/elementary/efl_ui_test_win.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c
index fb4728222f..2f362467cd 100644
--- a/src/tests/elementary/efl_ui_test_win.c
+++ b/src/tests/elementary/efl_ui_test_win.c
@@ -274,6 +274,66 @@ EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_up)
274} 274}
275EFL_END_TEST 275EFL_END_TEST
276 276
277static void
278_check_pointer_in_cb(void *data, const Efl_Event *ev)
279{
280 Eina_Bool *called = data;
281 ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP);
282 ck_assert_int_eq(efl_input_pointer_wheel_delta_get(ev->info), 0);
283 ck_assert_int_eq(efl_input_pointer_wheel_horizontal_get(ev->info), 0);
284 ck_assert_int_eq(efl_input_pointer_double_click_get(ev->info), 0);
285 ck_assert_int_eq(efl_input_pointer_triple_click_get(ev->info), 0);
286 ck_assert_int_eq(efl_input_pointer_button_flags_get(ev->info), 0);
287 ck_assert_int_eq(efl_input_pointer_touch_id_get(ev->info), 0);
288 position_eq(efl_input_pointer_position_get(ev->info), EINA_POSITION2D(20, 20));
289 ck_assert_int_eq(efl_input_pointer_button_get(ev->info), 0);
290 ck_assert_int_eq(efl_input_pointer_action_get(ev->info), EFL_POINTER_ACTION_IN );
291 *called = EINA_TRUE;
292}
293
294static void
295_check_pointer_out_cb(void *data, const Efl_Event *ev)
296{
297 Eina_Bool *called = data;
298 ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP);
299 ck_assert_int_eq(efl_input_pointer_wheel_delta_get(ev->info), 0);
300 ck_assert_int_eq(efl_input_pointer_wheel_horizontal_get(ev->info), 0);
301 ck_assert_int_eq(efl_input_pointer_double_click_get(ev->info), 0);
302 ck_assert_int_eq(efl_input_pointer_triple_click_get(ev->info), 0);
303 ck_assert_int_eq(efl_input_pointer_button_flags_get(ev->info), 0);
304 ck_assert_int_eq(efl_input_pointer_touch_id_get(ev->info), 0);
305 position_eq(efl_input_pointer_position_get(ev->info), EINA_POSITION2D(5, 5));
306 ck_assert_int_eq(efl_input_pointer_button_get(ev->info), 0);
307 ck_assert_int_eq(efl_input_pointer_action_get(ev->info), EFL_POINTER_ACTION_OUT );
308 *called = EINA_TRUE;
309}
310
311EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_in_out)
312{
313 Efl_Ui_Win *win;
314 Eina_Bool pointer_in = EINA_FALSE, pointer_out = EINA_FALSE;
315 Efl_Canvas_Object *rect;
316
317 create_environment(&win, &rect);
318 evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP - 1, NULL);
319 evas_object_geometry_set(rect, 10, 10, 20, 20);
320
321 evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP - 1, NULL);
322 efl_event_callback_add(rect, EFL_EVENT_POINTER_IN, _check_pointer_in_cb, &pointer_in);
323 efl_event_callback_add(rect, EFL_EVENT_POINTER_OUT, _check_pointer_out_cb, &pointer_out);
324
325 evas_event_feed_mouse_move(evas_object_evas_get(win), 20, 20, TIMESTAMP, NULL);
326 ck_assert_int_eq(pointer_in, EINA_TRUE);
327 ck_assert_int_eq(pointer_out, EINA_FALSE);
328 pointer_in = EINA_FALSE;
329 pointer_out = EINA_FALSE;
330
331 evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP, NULL);
332 ck_assert_int_eq(pointer_in, EINA_FALSE);
333 ck_assert_int_eq(pointer_out, EINA_TRUE);
334}
335EFL_END_TEST
336
277void 337void
278efl_ui_test_win(TCase *tc) 338efl_ui_test_win(TCase *tc)
279{ 339{
@@ -285,4 +345,5 @@ efl_ui_test_win(TCase *tc)
285 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_move); 345 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_move);
286 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_down); 346 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_down);
287 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_up); 347 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_up);
348 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_in_out);
288} 349}