diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-06-26 08:51:11 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-06-26 09:54:55 -0400 |
commit | 132d3dfb92dea3fcd2fde947b9b41a614be7b24f (patch) | |
tree | 9c62560ac3a244cbbd893907b9120edfcebf78f4 /src/tests/elementary/efl_ui_test_win.c | |
parent | b0455490e7a03def1fe2a0245250635f8de96a52 (diff) | |
download | efl-132d3dfb92dea3fcd2fde947b9b41a614be7b24f.tar.gz |
efl_input_interface: test pointer in and out events on a object
Summary:
this verifies that EFL_EVENT_POINTER_IN EFL_EVENT_POINTER_OUT are
emitted correctly with the correct event content.
Depends on D9168
Reviewers: zmike, segfaultxavi
Reviewed By: zmike
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9169
Diffstat (limited to 'src/tests/elementary/efl_ui_test_win.c')
-rw-r--r-- | src/tests/elementary/efl_ui_test_win.c | 61 |
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) } EFL_END_TEST +static void +_check_pointer_in_cb(void *data, const Efl_Event *ev) +{ + Eina_Bool *called = data; + ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP); + ck_assert_int_eq(efl_input_pointer_wheel_delta_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_wheel_horizontal_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_double_click_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_triple_click_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_button_flags_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_touch_id_get(ev->info), 0); + position_eq(efl_input_pointer_position_get(ev->info), EINA_POSITION2D(20, 20)); + ck_assert_int_eq(efl_input_pointer_button_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_action_get(ev->info), EFL_POINTER_ACTION_IN ); + *called = EINA_TRUE; +} + +static void +_check_pointer_out_cb(void *data, const Efl_Event *ev) +{ + Eina_Bool *called = data; + ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP); + ck_assert_int_eq(efl_input_pointer_wheel_delta_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_wheel_horizontal_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_double_click_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_triple_click_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_button_flags_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_touch_id_get(ev->info), 0); + position_eq(efl_input_pointer_position_get(ev->info), EINA_POSITION2D(5, 5)); + ck_assert_int_eq(efl_input_pointer_button_get(ev->info), 0); + ck_assert_int_eq(efl_input_pointer_action_get(ev->info), EFL_POINTER_ACTION_OUT ); + *called = EINA_TRUE; +} + +EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_in_out) +{ + Efl_Ui_Win *win; + Eina_Bool pointer_in = EINA_FALSE, pointer_out = EINA_FALSE; + Efl_Canvas_Object *rect; + + create_environment(&win, &rect); + evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP - 1, NULL); + evas_object_geometry_set(rect, 10, 10, 20, 20); + + evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP - 1, NULL); + efl_event_callback_add(rect, EFL_EVENT_POINTER_IN, _check_pointer_in_cb, &pointer_in); + efl_event_callback_add(rect, EFL_EVENT_POINTER_OUT, _check_pointer_out_cb, &pointer_out); + + evas_event_feed_mouse_move(evas_object_evas_get(win), 20, 20, TIMESTAMP, NULL); + ck_assert_int_eq(pointer_in, EINA_TRUE); + ck_assert_int_eq(pointer_out, EINA_FALSE); + pointer_in = EINA_FALSE; + pointer_out = EINA_FALSE; + + evas_event_feed_mouse_move(evas_object_evas_get(win), 5, 5, TIMESTAMP, NULL); + ck_assert_int_eq(pointer_in, EINA_FALSE); + ck_assert_int_eq(pointer_out, EINA_TRUE); +} +EFL_END_TEST + void efl_ui_test_win(TCase *tc) { @@ -285,4 +345,5 @@ efl_ui_test_win(TCase *tc) tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_move); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_down); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_up); + tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_in_out); } |