summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-01-16 14:29:23 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-01-16 14:31:57 +0100
commitf176c1589ccfc518858978a7f08735db7911b130 (patch)
tree1f3c6b692a856122d7325c8c1fbb0ebc977e2c20
parent8a4d75e8798bc2fdda4899b2722fe0f5b5cf30cb (diff)
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.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 @@
5#include <Ecore.h> 5#include <Ecore.h>
6#include "elm_suite.h" 6#include "elm_suite.h"
7 7
8typedef struct _Callback_Data 8static Eina_Bool
9timer_expired_cb(void *user_data)
9{ 10{
10 Ecore_Timer *timer; 11 Eina_Bool *did_timeout = user_data;
11 Eina_Bool did_timeout; 12
12} Callback_Data; 13 *did_timeout = EINA_TRUE;
14 ecore_main_loop_quit();
15
16 return EINA_TRUE;
17}
13 18
14static Eina_Bool 19static Eina_Bool
15timer_expired_cb(void *user_data) 20idler_done_cb(void *user_data)
16{ 21{
17 Callback_Data *data = user_data; 22 Eina_Bool *done = user_data;
18 data->did_timeout = EINA_TRUE; 23
19 data->timer = NULL; 24 if (*done) ecore_main_loop_quit();
20 25
21 return ECORE_CALLBACK_CANCEL; 26 return EINA_TRUE;
22} 27}
23 28
24Eina_Bool 29Eina_Bool
25elm_test_helper_wait_flag(double in, Eina_Bool *done) 30elm_test_helper_wait_flag(double in, Eina_Bool *done)
26{ 31{
27 Callback_Data data; 32 Eina_Bool did_timeout = EINA_FALSE;
33 Ecore_Timer *tm;
34 Ecore_Idle_Enterer *idle;
28 35
29 data.did_timeout = EINA_FALSE; 36 tm = ecore_timer_add(in, timer_expired_cb, &did_timeout);
30 data.timer = ecore_timer_add(in, timer_expired_cb, &data); 37 idle = ecore_idle_enterer_add(idler_done_cb, done);
31 38
32 while (*done == EINA_FALSE && data.did_timeout == EINA_FALSE) 39 ecore_main_loop_begin();
33 ecore_main_loop_iterate();
34 40
35 if (data.timer) 41 ecore_idle_enterer_del(idle);
36 ecore_timer_del(data.timer); 42 ecore_timer_del(tm);
37 43
38 return !data.did_timeout; 44 return !did_timeout;
39} 45}