summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-10 15:15:19 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-11 17:40:46 +0200
commit162c0e2ba562d953724da370d7b7ffe560350993 (patch)
tree7fb0004ba9d7060f19165430203ac11923950843
parent4a1c13f491c70397deb85a2935882447eebc34a5 (diff)
tests/elm: create abstract function for clicking swallowed part objects
this handles all the part object getting and signal processing and geometry calculating so you can get to clickin those parts faster Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9269
-rw-r--r--src/tests/elementary/efl_ui_test_spin_button.c14
-rw-r--r--src/tests/elementary/suite_helpers.c12
-rw-r--r--src/tests/elementary/suite_helpers.h1
3 files changed, 18 insertions, 9 deletions
diff --git a/src/tests/elementary/efl_ui_test_spin_button.c b/src/tests/elementary/efl_ui_test_spin_button.c
index bded16cb13..78b21a4046 100644
--- a/src/tests/elementary/efl_ui_test_spin_button.c
+++ b/src/tests/elementary/efl_ui_test_spin_button.c
@@ -40,14 +40,10 @@ _set_flag_quit(void *data, const Efl_Event *ev)
40} 40}
41 41
42static void 42static void
43click_spin_part(Efl_Part *obj) 43click_spin_part(Eo *obj, const char *part)
44{ 44{
45 get_me_to_those_events(spin); 45 get_me_to_those_events(spin);
46 efl_ref(obj); 46 click_part(obj, part);
47 click_object(obj);
48 edje_object_message_signal_process(obj);
49 efl_unref(obj);
50 edje_object_message_signal_process(spin);
51} 47}
52 48
53EFL_START_TEST (spin_value_events) 49EFL_START_TEST (spin_value_events)
@@ -131,7 +127,7 @@ EFL_START_TEST (spin_value_inc)
131 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 127 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
132 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 128 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
133 129
134 click_spin_part(efl_content_get(efl_part(spin, "efl.inc_button"))); 130 click_spin_part(spin, "efl.inc_button");
135 131
136 ck_assert_int_eq(changed, EINA_TRUE); 132 ck_assert_int_eq(changed, EINA_TRUE);
137 ck_assert_int_eq(min_reached, EINA_FALSE); 133 ck_assert_int_eq(min_reached, EINA_FALSE);
@@ -156,7 +152,7 @@ EFL_START_TEST (spin_value_inc_max)
156 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 152 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
157 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 153 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
158 154
159 click_spin_part(efl_content_get(efl_part(spin, "efl.inc_button"))); 155 click_spin_part(spin, "efl.inc_button");
160 156
161 ck_assert_int_eq(changed, EINA_TRUE); 157 ck_assert_int_eq(changed, EINA_TRUE);
162 ck_assert_int_eq(min_reached, EINA_FALSE); 158 ck_assert_int_eq(min_reached, EINA_FALSE);
@@ -181,7 +177,7 @@ EFL_START_TEST (spin_value_dec_min)
181 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 177 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
182 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 178 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
183 179
184 click_spin_part(efl_content_get(efl_part(spin, "efl.dec_button"))); 180 click_spin_part(spin, "efl.dec_button");
185 181
186 ck_assert_int_eq(changed, EINA_TRUE); 182 ck_assert_int_eq(changed, EINA_TRUE);
187 ck_assert_int_eq(min_reached, EINA_TRUE); 183 ck_assert_int_eq(min_reached, EINA_TRUE);
diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c
index 080abadd4e..ee2efcb8d4 100644
--- a/src/tests/elementary/suite_helpers.c
+++ b/src/tests/elementary/suite_helpers.c
@@ -400,3 +400,15 @@ click_object(Eo *obj)
400 evas_event_feed_mouse_down(e, 1, 0, 0, NULL); 400 evas_event_feed_mouse_down(e, 1, 0, 0, NULL);
401 evas_event_feed_mouse_up(e, 1, 0, 0, NULL); 401 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
402} 402}
403
404void
405click_part(Eo *obj, const char *part)
406{
407 Efl_Part *part_obj = efl_ref(efl_part(obj, part));
408 Eo *content = efl_content_get(part_obj);
409 click_object(content);
410 if (efl_isa(content, EFL_LAYOUT_SIGNAL_INTERFACE))
411 edje_object_message_signal_process(content);
412 edje_object_message_signal_process(obj);
413 efl_unref(part_obj);
414}
diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h
index 46bd04ef23..9c1bd2a866 100644
--- a/src/tests/elementary/suite_helpers.h
+++ b/src/tests/elementary/suite_helpers.h
@@ -12,4 +12,5 @@ void fail_on_errors_setup(void);
12 12
13void get_me_to_those_events(Eo *obj); 13void get_me_to_those_events(Eo *obj);
14void click_object(Eo *obj); 14void click_object(Eo *obj);
15void click_part(Eo *obj, const char *part);
15#endif 16#endif