summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_job.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2016-05-02 18:14:44 -0700
committerCedric Bail <cedric@osg.samsung.com>2016-05-02 18:17:09 -0700
commit664d6772011b6fcf63ae7457e3ee96d281c17189 (patch)
tree62b63b9e87dc7a17196db5e091c174c28b24ec4a /src/tests/ecore/ecore_test_job.c
parentcfdc09fa934ad63c8b91499b80980f98d27415a1 (diff)
ecore: add test case for Efl.Loop.Job.
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_job.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_job.c b/src/tests/ecore/ecore_test_job.c
new file mode 100644
index 0000000000..1e36be5d46
--- /dev/null
+++ b/src/tests/ecore/ecore_test_job.c
@@ -0,0 +1,67 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include "ecore_suite.h"
7
8static void
9_ecore_promise_quit(void *data, void **value)
10{
11 Eina_Bool *bob = data;
12
13 fail_if(data != *value);
14 *bob = EINA_TRUE;
15 ecore_main_loop_quit();
16}
17
18START_TEST(ecore_test_job_promise)
19{
20 Eina_Bool bob = EINA_FALSE;
21 Eina_Promise *job = NULL;
22
23 ecore_init();
24
25 efl_loop_job(ecore_main_loop_get(), &job, &bob);
26 eina_promise_then(job, &_ecore_promise_quit, NULL, &bob);
27
28 ecore_main_loop_begin();
29
30 fail_if(bob != EINA_TRUE);
31
32 ecore_shutdown();
33}
34END_TEST
35
36static void
37_ecore_quit(void *data)
38{
39 Eina_Bool *bob = data;
40
41 *bob = EINA_TRUE;
42 ecore_main_loop_quit();
43}
44
45START_TEST(ecore_test_job)
46{
47 Eina_Bool bob = EINA_FALSE;
48 Ecore_Job *job;
49
50 ecore_init();
51
52 job = ecore_job_add(&_ecore_quit, &bob);
53 fail_if(!job);
54
55 ecore_main_loop_begin();
56
57 fail_if(bob != EINA_TRUE);
58
59 ecore_shutdown();
60}
61END_TEST
62
63void ecore_test_ecore_job(TCase *tc)
64{
65 tcase_add_test(tc, ecore_test_job);
66 tcase_add_test(tc, ecore_test_job_promise);
67}