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)
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)
754 return num; 754 return num;
755} 755}
756 756
757int
758multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees)
759{
760 Evas *e = evas_object_evas_get(obj);
761 /* clamp num mouse moves to a vaguely sane value */
762 int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES);
763 int last_x = round(cx + radius);
764 int last_y = round(cy);
765 /* start at 0 degrees */
766 evas_event_feed_multi_down(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
767 for (i = 1; i < num; i++)
768 {
769 /* x = cx + r * cos(a), y = cy + r * sin(a) */
770 int ax, ay;
771 /* each iteration is 1 degree */
772 double angle = (i * (degrees / DRAG_OBJECT_AROUND_NUM_MOVES)) * M_PI / 180.0;
773 ax = round(cx + radius * cos(angle));
774 ay = round(cy + radius * sin(angle));
775 if ((ax == last_x) && (ay == last_y)) continue;
776 evas_event_feed_multi_move(e, touch_point, ax, ay, 1, 1, 1, 1, 0, ax, ay, ts++, NULL);
777 last_x = ax, last_y = ay;
778 }
779 evas_event_feed_multi_up(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL);
780 /* only count arc motion: subtract initial move, mouse down, mouse up */
781 return num;
782}
757 783
758int 784int
759pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2) 785pinch_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);
34void multi_press_object(Eo *obj, int ids); 34void multi_press_object(Eo *obj, int ids);
35void multi_click_object_at(Eo *obj, int x, int y, int ids); 35void multi_click_object_at(Eo *obj, int x, int y, int ids);
36void multi_press_object_at(Eo *obj, int x, int y, int ids); 36void multi_press_object_at(Eo *obj, int x, int y, int ids);
37int multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees);
37void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate); 38void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
38int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees); 39int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees);
39int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2); 40int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2);