summaryrefslogtreecommitdiff
path: root/src/tests/elm_test_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/elm_test_helper.c')
-rw-r--r--src/tests/elm_test_helper.c40
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;
}