summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-20 13:24:52 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-03 10:54:36 +0100
commitdb5fcd13db38115506ef1adcc4f795c14ee0d338 (patch)
tree83c36eb27ab8ac00f9e1352c3bd560047fa5a894
parent7f6dfbac809b250e2c9f25728b6fe77e2aca61fb (diff)
downloadefl-db5fcd13db38115506ef1adcc4f795c14ee0d338.tar.gz
tests/elm: add util function for doing a multi-press drag around
same as existing function, but takes a finger id Differential Revision: https://phab.enlightenment.org/D11389
-rw-r--r--src/tests/elementary/suite_helpers.c26
-rw-r--r--src/tests/elementary/suite_helpers.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c
index ea8164a642..e31e302c9f 100644
--- a/src/tests/elementary/suite_helpers.c
+++ b/src/tests/elementary/suite_helpers.c
@@ -754,6 +754,32 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees)
return num;
}
+int
+multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees)
+{
+ Evas *e = evas_object_evas_get(obj);
+ /* clamp num mouse moves to a vaguely sane value */
+ int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES);
+ int last_x = round(cx + radius);
+ int last_y = round(cy);
+ /* start at 0 degrees */
+ evas_event_feed_multi_down(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
+ for (i = 1; i < num; i++)
+ {
+ /* x = cx + r * cos(a), y = cy + r * sin(a) */
+ int ax, ay;
+ /* each iteration is 1 degree */
+ double angle = (i * (degrees / DRAG_OBJECT_AROUND_NUM_MOVES)) * M_PI / 180.0;
+ ax = round(cx + radius * cos(angle));
+ ay = round(cy + radius * sin(angle));
+ if ((ax == last_x) && (ay == last_y)) continue;
+ evas_event_feed_multi_move(e, touch_point, ax, ay, 1, 1, 1, 1, 0, ax, ay, ts++, NULL);
+ last_x = ax, last_y = ay;
+ }
+ evas_event_feed_multi_up(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
+ /* 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)
diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h
index 1a028e5683..2a8e1d23e0 100644
--- a/src/tests/elementary/suite_helpers.h
+++ b/src/tests/elementary/suite_helpers.h
@@ -34,6 +34,7 @@ void multi_click_object(Eo *obj, int ids);
void multi_press_object(Eo *obj, int ids);
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);
+int multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees);
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);