summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-25 09:17:21 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-25 10:07:15 +0200
commitad6e44951eda223302cea7f94ff55e8344b4d7e3 (patch)
tree6067c8ac4cf2b349fa803acabe79a0598d628c8e
parentd422c10f5a0f124146d1bdce7ca733c15b0ea147 (diff)
efl_input_interface: add tests for mouse wheel emitting
this tests if z and direction is correctly emitted
-rw-r--r--src/tests/elementary/efl_ui_test_win.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c
index 2f362467cd..cfc57a7834 100644
--- a/src/tests/elementary/efl_ui_test_win.c
+++ b/src/tests/elementary/efl_ui_test_win.c
@@ -334,6 +334,38 @@ EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_in_out)
334} 334}
335EFL_END_TEST 335EFL_END_TEST
336 336
337static void
338_check_pointer_wheel_cb(void *data, const Efl_Event *ev)
339{
340 Eina_Bool *called = data;
341 ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP);
342 ck_assert_int_eq(efl_input_pointer_wheel_delta_get(ev->info), 2);
343 ck_assert_int_eq(efl_input_pointer_wheel_horizontal_get(ev->info), 1);
344 ck_assert_int_eq(efl_input_pointer_double_click_get(ev->info), 0);
345 ck_assert_int_eq(efl_input_pointer_triple_click_get(ev->info), 0);
346 ck_assert_int_eq(efl_input_pointer_button_flags_get(ev->info), 0);
347 ck_assert_int_eq(efl_input_pointer_touch_id_get(ev->info), 0);
348 position_eq(efl_input_pointer_position_get(ev->info), EINA_POSITION2D(20, 20));
349 ck_assert_int_eq(efl_input_pointer_button_get(ev->info), 0);
350 ck_assert_int_eq(efl_input_pointer_action_get(ev->info), EFL_POINTER_ACTION_WHEEL );
351 *called = EINA_TRUE;
352}
353
354EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_wheel)
355{
356 Efl_Ui_Win *win;
357 Eina_Bool pointer_wheel = EINA_FALSE;
358 Efl_Canvas_Object *rect;
359
360 create_environment(&win, &rect);
361
362 efl_event_callback_add(rect, EFL_EVENT_POINTER_WHEEL, _check_pointer_wheel_cb, &pointer_wheel);
363
364 evas_event_feed_mouse_move(evas_object_evas_get(win), 20, 20, TIMESTAMP, NULL);
365 evas_event_feed_mouse_wheel(evas_object_evas_get(win), 1, 2, TIMESTAMP, NULL);
366 ck_assert_int_eq(pointer_wheel, EINA_TRUE);
367}
368EFL_END_TEST
337void 369void
338efl_ui_test_win(TCase *tc) 370efl_ui_test_win(TCase *tc)
339{ 371{
@@ -346,4 +378,5 @@ efl_ui_test_win(TCase *tc)
346 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_down); 378 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_down);
347 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_up); 379 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); 380 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_in_out);
381 tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_wheel);
349} 382}