summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-16 13:01:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-16 13:10:34 +0900
commit2d995fdedc6ac67bb9b7fabb38a7b4e1b3e663c9 (patch)
tree5bd04d6016fa3edf1715380be79affb994f5f5b4
parentda1e53820bf1786e2ada9be5e9f9ae7bb0704020 (diff)
tests: Use EO_CALLBACKS_ARRAY_DEFINE in all tests
This should make them work on Windows, too.
-rw-r--r--src/tests/emotion/emotion_test_main-eo.c9
-rw-r--r--src/tests/eo/suite/eo_test_general.c37
2 files changed, 23 insertions, 23 deletions
diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c
index f5b6702..c5adbe1 100644
--- a/src/tests/emotion/emotion_test_main-eo.c
+++ b/src/tests/emotion/emotion_test_main-eo.c
@@ -597,7 +597,7 @@ video_obj_signal_frame_move_cb(void *data EINA_UNUSED, Evas_Object *o, const cha
597 } 597 }
598} 598}
599 599
600static const Eo_Callback_Array_Item emotion_object_test_callbacks[] = { 600EO_CALLBACKS_ARRAY_DEFINE(emotion_object_test_callbacks,
601 { EMOTION_OBJECT_EVENT_FRAME_DECODE, video_obj_frame_decode_cb }, 601 { EMOTION_OBJECT_EVENT_FRAME_DECODE, video_obj_frame_decode_cb },
602 { EMOTION_OBJECT_EVENT_FRAME_RESIZE, video_obj_frame_resize_cb }, 602 { EMOTION_OBJECT_EVENT_FRAME_RESIZE, video_obj_frame_resize_cb },
603 { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, video_obj_length_change_cb }, 603 { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, video_obj_length_change_cb },
@@ -608,9 +608,8 @@ static const Eo_Callback_Array_Item emotion_object_test_callbacks[] = {
608 { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, video_obj_progress_cb }, 608 { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, video_obj_progress_cb },
609 { EMOTION_OBJECT_EVENT_REF_CHANGE, video_obj_ref_cb }, 609 { EMOTION_OBJECT_EVENT_REF_CHANGE, video_obj_ref_cb },
610 { EMOTION_OBJECT_EVENT_BUTTON_NUM_CHANGE, video_obj_button_num_cb }, 610 { EMOTION_OBJECT_EVENT_BUTTON_NUM_CHANGE, video_obj_button_num_cb },
611 { EMOTION_OBJECT_EVENT_BUTTON_CHANGE, video_obj_button_cb }, 611 { EMOTION_OBJECT_EVENT_BUTTON_CHANGE, video_obj_button_cb }
612 { NULL, NULL } 612);
613};
614 613
615static void 614static void
616init_video_object(const char *module_filename, const char *filename) 615init_video_object(const char *module_filename, const char *filename)
@@ -653,7 +652,7 @@ init_video_object(const char *module_filename, const char *filename)
653 edje_obj_size_min_calc(oe, &w, &h); 652 edje_obj_size_min_calc(oe, &w, &h);
654 efl_gfx_size_set(oe, w, h); 653 efl_gfx_size_set(oe, w, h);
655 654
656 eo_event_callback_array_add(o, emotion_object_test_callbacks, oe); 655 eo_event_callback_array_add(o, emotion_object_test_callbacks(), oe);
657 656
658 edje_obj_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o); 657 edje_obj_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o);
659 edje_obj_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o); 658 edje_obj_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o);
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index ddbe098..d92ce5c 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -151,42 +151,43 @@ Eina_Bool
151_eo_signals_cb_added_deled(void *data, const Eo_Event *event) 151_eo_signals_cb_added_deled(void *data, const Eo_Event *event)
152{ 152{
153 const Eo_Callback_Array_Item *callback_array = event->info; 153 const Eo_Callback_Array_Item *callback_array = event->info;
154 const Eo_Callback_Array_Item *(*callback_data)(void) = data;
154 155
155 fail_if((callback_array != data) && 156 fail_if((callback_data() != callback_array) &&
156 (callback_array->func != _eo_signals_cb_added_deled)); 157 (callback_array->func != _eo_signals_cb_added_deled));
157 158
158 return EO_CALLBACK_CONTINUE; 159 return EO_CALLBACK_CONTINUE;
159} 160}
160 161
162EO_CALLBACKS_ARRAY_DEFINE(_eo_signals_callbacks,
163{ EV_A_CHANGED, _eo_signals_a_changed_cb },
164{ EV_A_CHANGED, _eo_signals_a_changed_cb2 },
165{ EV_A_CHANGED, _eo_signals_a_changed_never },
166{ EO_EVENT_DEL, _eo_signals_eo_del_cb });
167
161START_TEST(eo_signals) 168START_TEST(eo_signals)
162{ 169{
163 eo_init(); 170 eo_init();
164 static const Eo_Callback_Array_Item callbacks[] = { 171
165 { EV_A_CHANGED, _eo_signals_a_changed_cb },
166 { EV_A_CHANGED, _eo_signals_a_changed_cb2 },
167 { EV_A_CHANGED, _eo_signals_a_changed_never },
168 { EO_EVENT_DEL, _eo_signals_eo_del_cb },
169 { NULL, NULL }
170 };
171 Eo *obj = eo_add(SIMPLE_CLASS, NULL); 172 Eo *obj = eo_add(SIMPLE_CLASS, NULL);
172 Eina_Bool r; 173 Eina_Bool r;
173 174
174 eo_event_callback_add(obj, EO_EVENT_CALLBACK_ADD, _eo_signals_cb_added_deled, callbacks); 175 eo_event_callback_add(obj, EO_EVENT_CALLBACK_ADD, _eo_signals_cb_added_deled, &_eo_signals_callbacks);
175 r = eo_event_callback_add(obj, EO_EVENT_CALLBACK_DEL, _eo_signals_cb_added_deled, callbacks); 176 r = eo_event_callback_add(obj, EO_EVENT_CALLBACK_DEL, _eo_signals_cb_added_deled, &_eo_signals_callbacks);
176 fail_if(!r); 177 fail_if(!r);
177 eo_event_callback_array_priority_add(obj, callbacks, -100, (void *) 1); 178 eo_event_callback_array_priority_add(obj, _eo_signals_callbacks(), -100, (void *) 1);
178 eo_event_callback_array_add(obj, callbacks, (void *) 3); 179 eo_event_callback_array_add(obj, _eo_signals_callbacks(), (void *) 3);
179 r = eo_event_callback_array_priority_add(obj, callbacks, -50, (void *) 2); 180 r = eo_event_callback_array_priority_add(obj, _eo_signals_callbacks(), -50, (void *) 2);
180 fail_if(!r); 181 fail_if(!r);
181 simple_a_set(obj, 1); 182 simple_a_set(obj, 1);
182 ck_assert_int_eq(_eo_signals_cb_flag, 0x3); 183 ck_assert_int_eq(_eo_signals_cb_flag, 0x3);
183 184
184 eo_event_callback_array_del(obj, callbacks, (void *) 1); 185 eo_event_callback_array_del(obj, _eo_signals_callbacks(), (void *) 1);
185 eo_event_callback_array_del(obj, callbacks, (void *) 2); 186 eo_event_callback_array_del(obj, _eo_signals_callbacks(), (void *) 2);
186 r = eo_event_callback_array_del(obj, callbacks, (void *) 3); 187 r = eo_event_callback_array_del(obj, _eo_signals_callbacks(), (void *) 3);
187 fail_if(!r); 188 fail_if(!r);
188 /* Try to delete something that doesn't exist. */ 189 /* Try to delete something that doesn't exist. */
189 r = eo_event_callback_array_del(obj, callbacks, (void *) 4); 190 r = eo_event_callback_array_del(obj, _eo_signals_callbacks(), (void *) 4);
190 fail_if(r); 191 fail_if(r);
191 _eo_signals_cb_flag = 0; 192 _eo_signals_cb_flag = 0;
192 simple_a_set(obj, 1); 193 simple_a_set(obj, 1);