summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-05-06 15:34:47 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-05-06 15:35:36 -0700
commit359657f1f1fdaf4daa1af3addd0e8714d76b6099 (patch)
treedeef22e618e70b76849a47f3cfa6dd1d210a3e1e /src/tests/ecore/ecore_test_ecore.c
parentc96383e42c8d8b2de64ebbe14fc9fe02eb09f037 (diff)
ecore: add tests case for Efl.Loop.Fd.
Diffstat (limited to 'src/tests/ecore/ecore_test_ecore.c')
-rw-r--r--src/tests/ecore/ecore_test_ecore.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index 968a7ec553..3c65e52bb8 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -267,6 +267,49 @@ START_TEST(ecore_test_ecore_main_loop_fd_handler)
267} 267}
268END_TEST 268END_TEST
269 269
270static Eina_Bool
271_eo_read_cb(void *data, const Eo_Event *info EINA_UNUSED)
272{
273 Eina_Bool *did = data;
274
275 *did = EINA_TRUE;
276 ecore_main_loop_quit();
277
278 return EO_CALLBACK_CONTINUE;
279}
280
281START_TEST(ecore_test_efl_loop_fd)
282{
283 Eina_Bool did = EINA_FALSE;
284 Eo *fd;
285 int comm[2];
286 int ret;
287
288 ret = ecore_init();
289 fail_if(ret < 1);
290
291 ret = pipe(comm);
292 fail_if(ret != 0);
293
294 fd = eo_add(EFL_LOOP_FD_CLASS, ecore_main_loop_get(),
295 efl_loop_fd_set(eo_self, comm[0]),
296 eo_event_callback_add(eo_self, EFL_LOOP_FD_EVENT_READ, _eo_read_cb, &did));
297 fail_if(fd == NULL);
298
299 ret = write(comm[1], &did, 1);
300 fail_if(ret != 1);
301
302 ecore_main_loop_begin();
303
304 close(comm[0]);
305 close(comm[1]);
306
307 fail_if(did == EINA_FALSE);
308
309 ret = ecore_shutdown();
310}
311END_TEST
312
270START_TEST(ecore_test_ecore_main_loop_fd_handler_activate_modify) 313START_TEST(ecore_test_ecore_main_loop_fd_handler_activate_modify)
271{ 314{
272 Eina_Bool did = EINA_FALSE; 315 Eina_Bool did = EINA_FALSE;
@@ -745,4 +788,5 @@ void ecore_test_ecore(TCase *tc)
745 tcase_add_test(tc, ecore_test_ecore_app); 788 tcase_add_test(tc, ecore_test_ecore_app);
746 tcase_add_test(tc, ecore_test_ecore_main_loop_poller); 789 tcase_add_test(tc, ecore_test_ecore_main_loop_poller);
747 tcase_add_test(tc, ecore_test_ecore_main_loop_poller_add_del); 790 tcase_add_test(tc, ecore_test_ecore_main_loop_poller_add_del);
791 tcase_add_test(tc, ecore_test_efl_loop_fd);
748} 792}