cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=664d6772011b6fcf63ae7457e3ee96d281c17189

commit 664d6772011b6fcf63ae7457e3ee96d281c17189
Author: Cedric Bail <ced...@osg.samsung.com>
Date:   Mon May 2 18:14:44 2016 -0700

    ecore: add test case for Efl.Loop.Job.
---
 src/Makefile_Ecore.am            |  1 +
 src/tests/ecore/ecore_suite.c    |  1 +
 src/tests/ecore/ecore_suite.h    |  1 +
 src/tests/ecore/ecore_test_job.c | 67 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)

diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 58df14b..e890c75 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -195,6 +195,7 @@ tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \
 tests/ecore/ecore_test_ecore_input.c \
 tests/ecore/ecore_test_ecore_file.c \
 tests/ecore/ecore_test_promise.c \
+tests/ecore/ecore_test_job.c \
 tests/ecore/ecore_suite.h
 
 tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 04ad191..b45ab02 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -27,6 +27,7 @@ static const Efl_Test_Case etc[] = {
   { "Ecore_Input", ecore_test_ecore_input },
   { "Ecore_File", ecore_test_ecore_file },
   { "Ecore_Promise", ecore_test_ecore_promise },
+  { "Ecore_Job", ecore_test_ecore_job },
   { NULL, NULL }
 };
 
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index 558e610..ed7a3ac 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -16,5 +16,6 @@ void ecore_test_ecore_fb(TCase *tc);
 void ecore_test_ecore_input(TCase *tc);
 void ecore_test_ecore_file(TCase *tc);
 void ecore_test_ecore_promise(TCase *tc);
+void ecore_test_ecore_job(TCase *tc);
 
 #endif /* _ECORE_SUITE_H */
diff --git a/src/tests/ecore/ecore_test_job.c b/src/tests/ecore/ecore_test_job.c
new file mode 100644
index 0000000..1e36be5
--- /dev/null
+++ b/src/tests/ecore/ecore_test_job.c
@@ -0,0 +1,67 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Ecore.h>
+#include "ecore_suite.h"
+
+static void
+_ecore_promise_quit(void *data, void **value)
+{
+   Eina_Bool *bob = data;
+
+   fail_if(data != *value);
+   *bob = EINA_TRUE;
+   ecore_main_loop_quit();
+}
+
+START_TEST(ecore_test_job_promise)
+{
+   Eina_Bool bob = EINA_FALSE;
+   Eina_Promise *job = NULL;
+
+   ecore_init();
+
+   efl_loop_job(ecore_main_loop_get(), &job, &bob);
+   eina_promise_then(job, &_ecore_promise_quit, NULL, &bob);
+
+   ecore_main_loop_begin();
+
+   fail_if(bob != EINA_TRUE);
+
+   ecore_shutdown();
+}
+END_TEST
+
+static void
+_ecore_quit(void *data)
+{
+   Eina_Bool *bob = data;
+
+   *bob = EINA_TRUE;
+   ecore_main_loop_quit();
+}
+
+START_TEST(ecore_test_job)
+{
+   Eina_Bool bob = EINA_FALSE;
+   Ecore_Job *job;
+
+   ecore_init();
+
+   job = ecore_job_add(&_ecore_quit, &bob);
+   fail_if(!job);
+
+   ecore_main_loop_begin();
+
+   fail_if(bob != EINA_TRUE);
+
+   ecore_shutdown();
+}
+END_TEST
+
+void ecore_test_ecore_job(TCase *tc)
+{
+   tcase_add_test(tc, ecore_test_job);
+   tcase_add_test(tc, ecore_test_job_promise);
+}

-- 


Reply via email to