summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-12 14:36:31 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-16 14:48:49 +0200
commit62059763c6dfcda808781e20de94358d76bb301e (patch)
tree7b84f312356a0c147a7f65e0c8121a04d7aef2a0
parent564ba9b96c4309db89a9cf9ba32da0b8dfc7257a (diff)
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 <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9321
-rw-r--r--src/tests/elementary/suite_helpers.c49
1 files 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)
391 ecore_main_loop_begin(); 391 ecore_main_loop_begin();
392} 392}
393 393
394void 394enum
395click_object(Eo *obj) 395{
396 NONE = 0,
397 LEFT = 1 << 0,
398 RIGHT = 1 << 1,
399 TOP = 1 << 2,
400 BOTTOM = 1 << 3,
401};
402
403static void
404click_object_internal(Eo *obj, int dir)
396{ 405{
406 int x, y;
397 Evas *e = evas_object_evas_get(obj); 407 Evas *e = evas_object_evas_get(obj);
398 Eina_Rect r = efl_gfx_entity_geometry_get(obj); 408 Eina_Rect r = efl_gfx_entity_geometry_get(obj);
399 evas_event_feed_mouse_move(e, r.x + r.w / 2, r.y + r.h / 2, 0, NULL); 409 if (dir & LEFT)
410 x = r.x + (.1 * r.w);
411 else if (dir & RIGHT)
412 x = r.x + (.9 * r.w);
413 else
414 x = r.x + r.w / 2;
415 if (dir & TOP)
416 y = r.y + (.1 * r.h);
417 else if (dir & BOTTOM)
418 y = r.y + (.9 * r.h);
419 else
420 y = r.y + r.h / 2;
421 evas_event_feed_mouse_move(e, x, y, 0, NULL);
400 evas_event_feed_mouse_down(e, 1, 0, 0, NULL); 422 evas_event_feed_mouse_down(e, 1, 0, 0, NULL);
401 evas_event_feed_mouse_up(e, 1, 0, 0, NULL); 423 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
402} 424}
403 425
404void 426void
427click_object(Eo *obj)
428{
429 click_object_internal(obj, NONE);
430}
431
432void
405click_part(Eo *obj, const char *part) 433click_part(Eo *obj, const char *part)
406{ 434{
407 Efl_Part *part_obj = efl_ref(efl_part(obj, part)); 435 Efl_Part *part_obj = efl_ref(efl_part(obj, part));
408 Eo *content; 436 Eo *content;
437 int dir = 0;
409 438
410 if (efl_canvas_layout_part_type_get(part_obj) == EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW) 439 if (efl_canvas_layout_part_type_get(part_obj) == EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW)
411 content = efl_content_get(part_obj); 440 content = efl_content_get(part_obj);
412 else 441 else
413 content = part_obj; 442 {
414 click_object(content); 443 content = part_obj;
444 if (strstr(part, "left"))
445 dir |= LEFT;
446 else if (strstr(part, "right"))
447 dir |= RIGHT;
448 if (strstr(part, "top"))
449 dir |= TOP;
450 else if (strstr(part, "bottom"))
451 dir |= BOTTOM;
452 }
453 click_object_internal(content, dir);
415 if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE)) 454 if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE))
416 edje_object_message_signal_process(content); 455 edje_object_message_signal_process(content);
417 edje_object_message_signal_process(obj); 456 edje_object_message_signal_process(obj);