diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2015-01-16 14:29:23 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-01-16 14:31:57 +0100 |
commit | f176c1589ccfc518858978a7f08735db7911b130 (patch) | |
tree | 1f3c6b692a856122d7325c8c1fbb0ebc977e2c20 | |
parent | 8a4d75e8798bc2fdda4899b2722fe0f5b5cf30cb (diff) | |
download | elementary-f176c1589ccfc518858978a7f08735db7911b130.tar.gz |
tests: actually run the main loop properly to be able to enter in idle state.
Note that the iterate function will never trigger the idler that are registered
in Ecore. That's by definition. I changed the code to actually use the full
main loop and trigger the change detection on idle enterer. That should be enough
for Elementary as all idler should logically affect the visual aspect of something
at some point and exit idle.
Thanks marcel-hollerbach@t-online.de for helping me debug this issue.
-rw-r--r-- | src/tests/elm_test_helper.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/tests/elm_test_helper.c b/src/tests/elm_test_helper.c index 6e11ef381..81ab0d1d2 100644 --- a/src/tests/elm_test_helper.c +++ b/src/tests/elm_test_helper.c @@ -5,35 +5,41 @@ #include <Ecore.h> #include "elm_suite.h" -typedef struct _Callback_Data +static Eina_Bool +timer_expired_cb(void *user_data) { - Ecore_Timer *timer; - Eina_Bool did_timeout; -} Callback_Data; + Eina_Bool *did_timeout = user_data; + + *did_timeout = EINA_TRUE; + ecore_main_loop_quit(); + + return EINA_TRUE; +} static Eina_Bool -timer_expired_cb(void *user_data) +idler_done_cb(void *user_data) { - Callback_Data *data = user_data; - data->did_timeout = EINA_TRUE; - data->timer = NULL; + Eina_Bool *done = user_data; + + if (*done) ecore_main_loop_quit(); - return ECORE_CALLBACK_CANCEL; + return EINA_TRUE; } Eina_Bool elm_test_helper_wait_flag(double in, Eina_Bool *done) { - Callback_Data data; + Eina_Bool did_timeout = EINA_FALSE; + Ecore_Timer *tm; + Ecore_Idle_Enterer *idle; - data.did_timeout = EINA_FALSE; - data.timer = ecore_timer_add(in, timer_expired_cb, &data); + tm = ecore_timer_add(in, timer_expired_cb, &did_timeout); + idle = ecore_idle_enterer_add(idler_done_cb, done); - while (*done == EINA_FALSE && data.did_timeout == EINA_FALSE) - ecore_main_loop_iterate(); + ecore_main_loop_begin(); - if (data.timer) - ecore_timer_del(data.timer); + ecore_idle_enterer_del(idle); + ecore_timer_del(tm); - return !data.did_timeout; + return !did_timeout; } |