forked from enlightenment/efl
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.
This commit is contained in:
parent
801b65a4af
commit
f15d380f00
|
@ -5,35 +5,41 @@
|
|||
#include <Ecore.h>
|
||||
#include "elm_suite.h"
|
||||
|
||||
typedef struct _Callback_Data
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
Eina_Bool did_timeout;
|
||||
} Callback_Data;
|
||||
|
||||
static Eina_Bool
|
||||
timer_expired_cb(void *user_data)
|
||||
{
|
||||
Callback_Data *data = user_data;
|
||||
data->did_timeout = EINA_TRUE;
|
||||
data->timer = NULL;
|
||||
Eina_Bool *did_timeout = user_data;
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
*did_timeout = EINA_TRUE;
|
||||
ecore_main_loop_quit();
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
idler_done_cb(void *user_data)
|
||||
{
|
||||
Eina_Bool *done = user_data;
|
||||
|
||||
if (*done) ecore_main_loop_quit();
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue