diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2020-01-22 13:56:07 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2020-01-23 15:26:01 -0500 |
commit | 2aa110a191d15ba47c9f63f73dcad222117c4d5b (patch) | |
tree | c71b9aceae28b6f99ea99a92b9115fb32148d8f1 | |
parent | 981c3fbad099185eed122ca3c3b218e5c7da89c1 (diff) | |
download | efl-2aa110a191d15ba47c9f63f73dcad222117c4d5b.tar.gz |
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
-rw-r--r-- | src/tests/elementary/suite_helpers.c | 26 | ||||
-rw-r--r-- | src/tests/elementary/suite_helpers.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 647c5b2aee..ab4bf4ebf6 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 2dce6c4439..1a028e5683 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); |