summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-10 15:06:08 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-11 17:40:45 +0200
commit4a1c13f491c70397deb85a2935882447eebc34a5 (patch)
treefae87d1ffc4732ad034576282af95622ad6b20bd
parent1c8f6132af0e75f02d851af67aa67dc427715f20 (diff)
tests/elm: break out click helper function for reuse
also fixes lifetime issue with spin parts Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9268
-rw-r--r--src/tests/elementary/efl_ui_test_spin_button.c19
-rw-r--r--src/tests/elementary/suite_helpers.c10
-rw-r--r--src/tests/elementary/suite_helpers.h1
3 files changed, 19 insertions, 11 deletions
diff --git a/src/tests/elementary/efl_ui_test_spin_button.c b/src/tests/elementary/efl_ui_test_spin_button.c
index c495c881a8..bded16cb13 100644
--- a/src/tests/elementary/efl_ui_test_spin_button.c
+++ b/src/tests/elementary/efl_ui_test_spin_button.c
@@ -40,17 +40,14 @@ _set_flag_quit(void *data, const Efl_Event *ev)
40} 40}
41 41
42static void 42static void
43click_object(Efl_Part *obj) 43click_spin_part(Efl_Part *obj)
44{ 44{
45 get_me_to_those_events(spin); 45 get_me_to_those_events(spin);
46 46 efl_ref(obj);
47 Evas *e = evas_object_evas_get(spin); 47 click_object(obj);
48 //this deletes the part
49 Eina_Rect r = efl_gfx_entity_geometry_get(obj);
50 evas_event_feed_mouse_move(e, r.x+r.w/2, r.y+r.h/2, 1234, NULL);
51 evas_event_feed_mouse_down(e, 1, 0, 1235, NULL);
52 evas_event_feed_mouse_up(e, 1, 0, 1236, NULL);
53 edje_object_message_signal_process(obj); 48 edje_object_message_signal_process(obj);
49 efl_unref(obj);
50 edje_object_message_signal_process(spin);
54} 51}
55 52
56EFL_START_TEST (spin_value_events) 53EFL_START_TEST (spin_value_events)
@@ -134,7 +131,7 @@ EFL_START_TEST (spin_value_inc)
134 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 131 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
135 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 132 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
136 133
137 click_object(efl_content_get(efl_part(spin, "efl.inc_button"))); 134 click_spin_part(efl_content_get(efl_part(spin, "efl.inc_button")));
138 135
139 ck_assert_int_eq(changed, EINA_TRUE); 136 ck_assert_int_eq(changed, EINA_TRUE);
140 ck_assert_int_eq(min_reached, EINA_FALSE); 137 ck_assert_int_eq(min_reached, EINA_FALSE);
@@ -159,7 +156,7 @@ EFL_START_TEST (spin_value_inc_max)
159 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 156 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
160 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 157 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
161 158
162 click_object(efl_content_get(efl_part(spin, "efl.inc_button"))); 159 click_spin_part(efl_content_get(efl_part(spin, "efl.inc_button")));
163 160
164 ck_assert_int_eq(changed, EINA_TRUE); 161 ck_assert_int_eq(changed, EINA_TRUE);
165 ck_assert_int_eq(min_reached, EINA_FALSE); 162 ck_assert_int_eq(min_reached, EINA_FALSE);
@@ -184,7 +181,7 @@ EFL_START_TEST (spin_value_dec_min)
184 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached); 181 efl_event_callback_add(spin, EFL_UI_SPIN_EVENT_MAX_REACHED, _set_flag, &max_reached);
185 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed); 182 efl_event_callback_add(spin, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, _set_flag_quit, &delay_changed);
186 183
187 click_object(efl_content_get(efl_part(spin, "efl.dec_button"))); 184 click_spin_part(efl_content_get(efl_part(spin, "efl.dec_button")));
188 185
189 ck_assert_int_eq(changed, EINA_TRUE); 186 ck_assert_int_eq(changed, EINA_TRUE);
190 ck_assert_int_eq(min_reached, EINA_TRUE); 187 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 9d73c5d26b..080abadd4e 100644
--- a/src/tests/elementary/suite_helpers.c
+++ b/src/tests/elementary/suite_helpers.c
@@ -390,3 +390,13 @@ get_me_to_those_events(Eo *obj)
390 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, events_norendered, NULL); 390 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, events_norendered, NULL);
391 ecore_main_loop_begin(); 391 ecore_main_loop_begin();
392} 392}
393
394void
395click_object(Eo *obj)
396{
397 Evas *e = evas_object_evas_get(obj);
398 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);
400 evas_event_feed_mouse_down(e, 1, 0, 0, NULL);
401 evas_event_feed_mouse_up(e, 1, 0, 0, NULL);
402}
diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h
index 12536d3884..46bd04ef23 100644
--- a/src/tests/elementary/suite_helpers.h
+++ b/src/tests/elementary/suite_helpers.h
@@ -11,4 +11,5 @@ void fail_on_errors_teardown(void);
11void fail_on_errors_setup(void); 11void 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);
14#endif 15#endif