From e28b1c6078b9efd7c6c44937430a81c4ed7a3a70 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 22 Jan 2020 13:56:07 -0500 Subject: [PATCH] tests/elm: add util function for doing pinch motions simple function which takes start points and vectors for 2 touches Differential Revision: https://phab.enlightenment.org/D11166 --- src/tests/elementary/suite_helpers.c | 26 ++++++++++++++++++++++++++ src/tests/elementary/suite_helpers.h | 1 + 2 files changed, 27 insertions(+) diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 647c5b2..ab4bf4e 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -752,3 +752,29 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees) /* only count arc motion: subtract initial move, mouse down, mouse up */ return num; } + + +int +pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2) +{ + Evas *e = evas_object_evas_get(obj); + int i, idx, idy, idx2, idy2; + evas_event_feed_multi_down(e, 0, x, y, 1, 1, 1, 1, 0, x, y, 0, ts, NULL); + evas_event_feed_multi_down(e, 1, x2, y2, 1, 1, 1, 1, 0, x2, y2, 0, ts++, NULL); + for (i = 1; i < abs(dx); i++) + { + idx = (i * dx / abs(dx)); + idy = (i * dy / abs(dx)); + idx2 = (i * dx2 / abs(dx)); + idy2 = (i * dy2 / abs(dx)); + /* move first point along positive vector */ + evas_event_feed_multi_move(e, 0, x + idx, y + idy, 1, 1, 1, 1, 0, x + idx, y + idy, ts, NULL); + /* move second point along negative vector */ + evas_event_feed_multi_move(e, 1, x2 + idx2, y2 + idy2, 1, 1, 1, 1, 0, x2 + idx2, y2 + idy2, ts++, NULL); + /* also trigger smart calc if we're iterating just in case that's important */ + evas_smart_objects_calculate(e); + } + evas_event_feed_multi_up(e, 0, x + idx, y + idy, 1, 1, 1, 1, 0, x + idx, y + idy, 0, ts, NULL); + evas_event_feed_multi_up(e, 1, x2 + idx2, y2 + idy2, 1, 1, 1, 1, 0, x2 + idx2, y2 + idy2, 0, ts++, NULL); + return i - 2; +} diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h index 2dce6c4..1a028e5 100644 --- a/src/tests/elementary/suite_helpers.h +++ b/src/tests/elementary/suite_helpers.h @@ -36,6 +36,7 @@ void multi_click_object_at(Eo *obj, int x, int y, int ids); void multi_press_object_at(Eo *obj, int x, int y, int ids); 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); +int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2); void wheel_object(Eo *obj, Eina_Bool horiz, Eina_Bool down); void wheel_part(Eo *obj, const char *part, Eina_Bool horiz, Eina_Bool down); void wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down); -- 2.7.4