stefan pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=699e5a2bed8e86a966e5872527af9b04d4f5acfe
commit 699e5a2bed8e86a966e5872527af9b04d4f5acfe Author: Stefan Schmidt <[email protected]> Date: Wed Oct 29 14:39:47 2014 +0100 tests/elocation: Enhance tests to wait for callback arrival. These message are passes async over dbus so we better wait until we see the reply if we want to have a test case that is somewhat useful. --- src/tests/elocation/elocation_suite.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/elocation/elocation_suite.c b/src/tests/elocation/elocation_suite.c index 603f2b9..01e375b 100644 --- a/src/tests/elocation/elocation_suite.c +++ b/src/tests/elocation/elocation_suite.c @@ -60,15 +60,36 @@ START_TEST(elocation_test_position_object) END_TEST /* Basic testing for the various functions of the GeoCode API */ +static int cb_count = 0; + +static Eina_Bool +event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event) +{ + fail_if(event == NULL); + + /* We expect 3 callbacks right now */ + if (++cb_count == 3) + ecore_main_loop_quit(); + + return ECORE_CALLBACK_DONE; +} + START_TEST(elocation_test_api_geocode) { Eina_Bool ret; Elocation_Position *position = NULL; Elocation_Address *address = NULL; + Ecore_Event_Handler *handler; ret = elocation_init(); fail_if(ret != EINA_TRUE); + handler = ecore_event_handler_add(ELOCATION_EVENT_GEOCODE, event_cb, NULL); + fail_if(handler == NULL); + + handler = ecore_event_handler_add(ELOCATION_EVENT_REVERSEGEOCODE, event_cb, NULL); + fail_if(handler == NULL); + position = elocation_position_new(); fail_if(position == NULL); @@ -89,6 +110,8 @@ START_TEST(elocation_test_api_geocode) ret = elocation_address_to_position(address, position); fail_if(ret != EINA_TRUE); + ecore_main_loop_begin(); + elocation_position_free(position); elocation_address_free(address); --
