From 635d998f67d6216b9cde1c60094bb07672256626 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 9 Jan 2020 10:04:06 -0500 Subject: [PATCH] tests/elm: add util functions for pressing mouse button without releasing Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11083 --- src/tests/elementary/suite_helpers.c | 59 +++++++++++++++++++++++++--- src/tests/elementary/suite_helpers.h | 6 +++ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 165777c929..0f9d80bfbf 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -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) { diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h index b3ccab556b..b48c06c924 100644 --- a/src/tests/elementary/suite_helpers.h +++ b/src/tests/elementary/suite_helpers.h @@ -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);