tests/elm: add util functions for pressing mouse button without releasing

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11083
This commit is contained in:
Mike Blumenkrantz 2020-01-09 10:04:06 -05:00 committed by Marcel Hollerbach
parent c05d8cfe75
commit 635d998f67
2 changed files with 59 additions and 6 deletions

View File

@ -466,29 +466,42 @@ attempt_to_find_the_right_point_for_mouse_positioning(Eo *obj, int dir)
}
static void
click_object_internal(Eo *obj, int dir, int flags)
click_object_internal(Eo *obj, int dir, int flags, Eina_Bool up)
{
Evas *e = evas_object_evas_get(obj);
Eina_Position2D pos = attempt_to_find_the_right_point_for_mouse_positioning(obj, dir);
evas_event_feed_mouse_move(e, pos.x, pos.y, ts++, NULL);
evas_event_feed_mouse_down(e, 1, flags, ts++, NULL);
evas_event_feed_mouse_up(e, 1, 0, ts++, NULL);
if (up)
evas_event_feed_mouse_up(e, 1, 0, ts++, NULL);
}
void
click_object(Eo *obj)
{
click_object_internal(obj, NONE, 0);
click_object_internal(obj, NONE, 0, EINA_TRUE);
}
void
press_object(Eo *obj)
{
click_object_internal(obj, NONE, 0, EINA_FALSE);
}
void
click_object_flags(Eo *obj, int flags)
{
click_object_internal(obj, NONE, flags);
click_object_internal(obj, NONE, flags, EINA_TRUE);
}
void
click_part_flags(Eo *obj, const char *part, int flags)
press_object_flags(Eo *obj, int flags)
{
click_object_internal(obj, NONE, flags, EINA_FALSE);
}
static void
click_part_flags_internal(Eo *obj, const char *part, int flags, Eina_Bool up)
{
Efl_Part *part_obj = efl_ref(efl_part(obj, part));
Eo *content;
@ -508,19 +521,37 @@ click_part_flags(Eo *obj, const char *part, int flags)
else if (strstr(part, "bottom"))
dir |= BOTTOM;
}
click_object_internal(content, dir, flags);
click_object_internal(content, dir, flags, up);
if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE))
edje_object_message_signal_process(content);
edje_object_message_signal_process(obj);
efl_unref(part_obj);
}
void
click_part_flags(Eo *obj, const char *part, int flags)
{
click_part_flags_internal(obj, part, flags, EINA_TRUE);
}
void
press_part_flags(Eo *obj, const char *part, int flags)
{
click_part_flags_internal(obj, part, flags, EINA_FALSE);
}
void
click_part(Eo *obj, const char *part)
{
click_part_flags(obj, part, 0);
}
void
press_part(Eo *obj, const char *part)
{
press_part_flags(obj, part, 0);
}
static void
wheel_object_internal(Eo *obj, int dir, Eina_Bool horiz, Eina_Bool down)
{
@ -594,6 +625,14 @@ click_object_at(Eo *obj, int x, int y)
evas_event_feed_mouse_up(e, 1, 0, ts++, NULL);
}
void
press_object_at(Eo *obj, int x, int y)
{
Evas *e = evas_object_evas_get(obj);
evas_event_feed_mouse_move(e, x, y, ts++, NULL);
evas_event_feed_mouse_down(e, 1, 0, ts++, NULL);
}
void
click_object_at_flags(Eo *obj, int x, int y, int flags)
{
@ -603,6 +642,14 @@ click_object_at_flags(Eo *obj, int x, int y, int flags)
evas_event_feed_mouse_up(e, 1, 0, ts++, NULL);
}
void
press_object_at_flags(Eo *obj, int x, int y, int flags)
{
Evas *e = evas_object_evas_get(obj);
evas_event_feed_mouse_move(e, x, y, ts++, NULL);
evas_event_feed_mouse_down(e, 1, flags, ts++, NULL);
}
void
wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down)
{

View File

@ -24,6 +24,12 @@ void click_part(Eo *obj, const char *part);
void click_part_flags(Eo *obj, const char *part, int flags);
void click_object_at(Eo *obj, int x, int y);
void click_object_at_flags(Eo *obj, int x, int y, int flags);
void press_object(Eo *obj);
void press_object_flags(Eo *obj, int flags);
void press_part(Eo *obj, const char *part);
void press_part_flags(Eo *obj, const char *part, int flags);
void press_object_at(Eo *obj, int x, int y);
void press_object_at_flags(Eo *obj, int x, int y, int flags);
void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees);
void wheel_object(Eo *obj, Eina_Bool horiz, Eina_Bool down);