forked from enlightenment/efl
tests/elm: add utility function to trigger a mouse drag
a drag may require a lot of internal calculating to successfully trigger the intended test behavior, so this has a flag which allows it to perform loop iterations and canvas calcs in order to be more universal, along with a global #define for determining exactly how many mouse moves were triggered Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10512
This commit is contained in:
parent
a00307d266
commit
25ab4dbc11
|
@ -564,3 +564,27 @@ wheel_object_at(Eo *obj, int x, int y, Eina_Bool horiz, Eina_Bool down)
|
|||
evas_event_feed_mouse_move(e, x, y, 0, NULL);
|
||||
evas_event_feed_mouse_wheel(e, horiz, down, 0, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate)
|
||||
{
|
||||
Evas *e = evas_object_evas_get(obj);
|
||||
int i;
|
||||
evas_event_feed_mouse_move(e, x, y, 0, NULL);
|
||||
evas_event_feed_mouse_down(e, 1, 0, 0, NULL);
|
||||
if (iterate)
|
||||
{
|
||||
/* iterate twice to trigger timers */
|
||||
ecore_main_loop_iterate();
|
||||
ecore_main_loop_iterate();
|
||||
}
|
||||
/* create DRAG_OBJECT_NUM_MOVES move events distinct from up/down */
|
||||
for (i = 0; i < DRAG_OBJECT_NUM_MOVES; i++)
|
||||
{
|
||||
evas_event_feed_mouse_move(e, x + (i * dx / DRAG_OBJECT_NUM_MOVES), y + (i * dy / DRAG_OBJECT_NUM_MOVES), 0, NULL);
|
||||
/* also trigger smart calc if we're iterating just in case that's important */
|
||||
evas_smart_objects_calculate(e);
|
||||
}
|
||||
evas_event_feed_mouse_move(e, x + dx, y + dy, 0, NULL);
|
||||
evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <Evas.h>
|
||||
|
||||
#define DRAG_OBJECT_NUM_MOVES 4
|
||||
|
||||
int suite_setup(Eina_Bool legacy);
|
||||
void _elm2_suite_init(void);
|
||||
void _elm_suite_shutdown(void);
|
||||
|
@ -17,6 +19,7 @@ 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 drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate);
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue