eo: let's check that this nested restarted event are working somehow.
This commit is contained in:
parent
1fd049510f
commit
7cb53a3ae2
|
@ -30,6 +30,34 @@ _a_changed_cb(void *data, const Eo_Event *event)
|
|||
return (cb_count != 3);
|
||||
}
|
||||
|
||||
static Eina_Bool inside = EINA_FALSE;
|
||||
static int called = 0;
|
||||
|
||||
static Eina_Bool
|
||||
_restart_1_cb(void *data, const Eo_Event *event)
|
||||
{
|
||||
fprintf(stderr, "restart 1 inside: %i\n", inside);
|
||||
fail_if(!inside);
|
||||
called++;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_restart_2_cb(void *data, const Eo_Event *event)
|
||||
{
|
||||
fprintf(stderr, "restart 2 inside: %i\n", inside);
|
||||
fail_if(inside);
|
||||
|
||||
inside = EINA_TRUE;
|
||||
eo_event_callback_call(event->obj, event->desc, data);
|
||||
inside = EINA_FALSE;
|
||||
|
||||
called++;
|
||||
|
||||
fprintf(stderr, "restart 2 exit inside: %i (%i)\n", inside, called);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -169,6 +197,11 @@ main(int argc, char *argv[])
|
|||
fcount = eo_event_global_freeze_count_get(EO_CLASS);
|
||||
fail_if(fcount != 0);
|
||||
|
||||
eo_event_callback_priority_add(obj, EV_RESTART, EO_CALLBACK_PRIORITY_DEFAULT, _restart_1_cb, NULL);
|
||||
eo_event_callback_priority_add(obj, EV_RESTART, EO_CALLBACK_PRIORITY_BEFORE, _restart_2_cb, NULL);
|
||||
eo_event_callback_call(obj, EV_RESTART, NULL);
|
||||
fail_if(inside);
|
||||
fail_if(called != 2);
|
||||
|
||||
eo_unref(obj);
|
||||
eo_shutdown();
|
||||
|
|
|
@ -13,6 +13,8 @@ typedef struct
|
|||
|
||||
EAPI const Eo_Event_Description _EV_A_CHANGED =
|
||||
EO_EVENT_DESCRIPTION("a,changed");
|
||||
EAPI const Eo_Event_Description _EV_RESTART =
|
||||
EO_EVENT_DESCRIPTION_RESTART("restart");
|
||||
|
||||
#define MY_CLASS SIMPLE_CLASS
|
||||
|
||||
|
@ -79,6 +81,7 @@ static Eo_Op_Description op_descs[] = {
|
|||
|
||||
static const Eo_Event_Description *event_desc[] = {
|
||||
EV_A_CHANGED,
|
||||
EV_RESTART,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -94,4 +97,3 @@ static const Eo_Class_Description class_desc = {
|
|||
};
|
||||
|
||||
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ EAPI void simple_a_set(Eo *obj, int a);
|
|||
extern const Eo_Event_Description _EV_A_CHANGED;
|
||||
#define EV_A_CHANGED (&(_EV_A_CHANGED))
|
||||
|
||||
extern const Eo_Event_Description _EV_RESTART;
|
||||
#define EV_RESTART (&(_EV_RESTART))
|
||||
|
||||
#define SIMPLE_CLASS simple_class_get()
|
||||
const Eo_Class *simple_class_get(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue