forked from enlightenment/efl
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
This commit is contained in:
parent
b0455490e7
commit
132d3dfb92
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue