7 const char *called = NULL;
9 static const char *idler_str = "idler";
10 static const char *idle_enterer_str = "idler_enterer";
11 static const char *idle_exiter_str = "idler_exiter";
12 static const char *timer1_str = "timer 1";
13 static const char *timer2_str = "timer 2";
14 static const char *pipe_read_str = "pipe read";
19 Eina_Bool timer_one(void *data __UNUSED__)
21 fprintf(stderr, "timer 1\n");
22 assert(called == pipe_read_str);
24 ecore_pipe_write(the_pipe, "b", 1);
29 ecore_main_loop_quit();
36 Eina_Bool timer_two(void *data __UNUSED__)
38 fprintf(stderr, "timer 2\n");
39 assert(called == timer1_str);
45 Eina_Bool idle_enterer_one(void *data __UNUSED__)
47 fprintf(stderr, "idle enterer!\n");
51 assert(called == timer2_str);
54 assert(called == timer1_str);
57 assert(called == NULL);
59 called = idle_enterer_str;
63 Eina_Bool idler_one(void *data __UNUSED__)
65 fprintf(stderr, "idler!\n");
66 assert(called == idle_enterer_str);
69 ecore_timer_add(0.0, timer_two, NULL);
73 Eina_Bool idle_exiter_one(void *data __UNUSED__)
75 fprintf(stderr, "idle exiter!\n");
76 assert(called == idler_str);
77 called = idle_exiter_str;
81 void pipe_read(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__)
83 fprintf(stderr, "pipe read\n");
84 assert(called == idle_exiter_str);
85 called = pipe_read_str;
88 int main(int argc __UNUSED__, char **argv __UNUSED__)
90 assert(1 == ecore_init());
92 the_pipe = ecore_pipe_add(&pipe_read, NULL);
93 assert(the_pipe != NULL);
94 assert(EINA_TRUE == ecore_pipe_write(the_pipe, "a", 1));
96 assert(NULL != ecore_timer_add(0.0, timer_one, NULL));
98 assert(NULL != ecore_idle_enterer_add(&idle_enterer_one, NULL));
99 assert(NULL != ecore_idler_add(&idler_one, NULL));
100 assert(NULL != ecore_idle_exiter_add(&idle_exiter_one, NULL));
102 ecore_main_loop_begin();
104 /* glib main loop exits on an idle enterer */
105 assert(called == idle_enterer_str);
107 assert(0 == ecore_shutdown());