bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=62059763c6dfcda808781e20de94358d76bb301e
commit 62059763c6dfcda808781e20de94358d76bb301e Author: Mike Blumenkrantz <zm...@samsung.com> Date: Fri Jul 12 14:36:31 2019 -0400 tests/elm: improve click_part() further to guess part locations non-swallow parts exist "somewhere" on a given layout, and it may be the case that they are not actually positioned and just take up the whole layout space. for these parts, if they have a direction in their name, we can try to vaguely guess where the part might be in order to (ideally) click it Reviewed-by: Marcel Hollerbach <m...@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9321 --- src/tests/elementary/suite_helpers.c | 49 ++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 2e3f658fa2..727db9be98 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -391,27 +391,66 @@ get_me_to_those_events(Eo *obj) ecore_main_loop_begin(); } -void -click_object(Eo *obj) +enum +{ + NONE = 0, + LEFT = 1 << 0, + RIGHT = 1 << 1, + TOP = 1 << 2, + BOTTOM = 1 << 3, +}; + +static void +click_object_internal(Eo *obj, int dir) { + int x, y; Evas *e = evas_object_evas_get(obj); Eina_Rect r = efl_gfx_entity_geometry_get(obj); - evas_event_feed_mouse_move(e, r.x + r.w / 2, r.y + r.h / 2, 0, NULL); + if (dir & LEFT) + x = r.x + (.1 * r.w); + else if (dir & RIGHT) + x = r.x + (.9 * r.w); + else + x = r.x + r.w / 2; + if (dir & TOP) + y = r.y + (.1 * r.h); + else if (dir & BOTTOM) + y = r.y + (.9 * r.h); + else + y = r.y + r.h / 2; + evas_event_feed_mouse_move(e, x, y, 0, NULL); evas_event_feed_mouse_down(e, 1, 0, 0, NULL); evas_event_feed_mouse_up(e, 1, 0, 0, NULL); } +void +click_object(Eo *obj) +{ + click_object_internal(obj, NONE); +} + void click_part(Eo *obj, const char *part) { Efl_Part *part_obj = efl_ref(efl_part(obj, part)); Eo *content; + int dir = 0; if (efl_canvas_layout_part_type_get(part_obj) == EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW) content = efl_content_get(part_obj); else - content = part_obj; - click_object(content); + { + content = part_obj; + if (strstr(part, "left")) + dir |= LEFT; + else if (strstr(part, "right")) + dir |= RIGHT; + if (strstr(part, "top")) + dir |= TOP; + else if (strstr(part, "bottom")) + dir |= BOTTOM; + } + click_object_internal(content, dir); if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE)) edje_object_message_signal_process(content); edje_object_message_signal_process(obj); --