summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-04-09 13:37:02 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-10 11:28:01 +0200
commit88a6a3c76908d10d83c0f24e04ef2614fa4e94c2 (patch)
tree568edabb91db903900d97b9881fb7ce107220bc5
parent3b22dbc5af3a4759b375a8cc7fa9a414914302b5 (diff)
tests: split ecore idler tests into separate file
Summary: ref T6850 Depends on D5899 Reviewers: stefan_schmidt Subscribers: cedric Maniphest Tasks: T6850 Differential Revision: https://phab.enlightenment.org/D5900
-rw-r--r--src/Makefile_Ecore.am1
-rw-r--r--src/tests/ecore/ecore_suite.c1
-rw-r--r--src/tests/ecore/ecore_suite.h1
-rw-r--r--src/tests/ecore/ecore_test_ecore.c77
-rw-r--r--src/tests/ecore/ecore_test_idle.c103
5 files changed, 106 insertions, 77 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index b000957..2fb2231 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -276,6 +276,7 @@ tests_ecore_ecore_suite_SOURCES = \
276tests/ecore/ecore_suite.c \ 276tests/ecore/ecore_suite.c \
277tests/ecore/ecore_test_ecore.c \ 277tests/ecore/ecore_test_ecore.c \
278tests/ecore/ecore_test_ecore_imf.c \ 278tests/ecore/ecore_test_ecore_imf.c \
279tests/ecore/ecore_test_idle.c \
279tests/ecore/ecore_test_timer.c \ 280tests/ecore/ecore_test_timer.c \
280tests/ecore/ecore_test_ecore_evas.c \ 281tests/ecore/ecore_test_ecore_evas.c \
281tests/ecore/ecore_test_animator.c \ 282tests/ecore/ecore_test_animator.c \
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 5f6a004..a418a7c 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -8,6 +8,7 @@
8 8
9static const Efl_Test_Case etc[] = { 9static const Efl_Test_Case etc[] = {
10 { "Ecore", ecore_test_ecore }, 10 { "Ecore", ecore_test_ecore },
11 { "idle", ecore_test_ecore_idle },
11#if HAVE_ECORE_X 12#if HAVE_ECORE_X
12 { "Ecore_X", ecore_test_ecore_x }, 13 { "Ecore_X", ecore_test_ecore_x },
13#endif 14#endif
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index 0463614..3416e39 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -4,6 +4,7 @@
4#include <check.h> 4#include <check.h>
5#include "../efl_check.h" 5#include "../efl_check.h"
6void ecore_test_ecore(TCase *tc); 6void ecore_test_ecore(TCase *tc);
7void ecore_test_ecore_idle(TCase *tc);
7void ecore_test_ecore_x(TCase *tc); 8void ecore_test_ecore_x(TCase *tc);
8void ecore_test_ecore_imf(TCase *tc); 9void ecore_test_ecore_imf(TCase *tc);
9void ecore_test_ecore_audio(TCase *tc); 10void ecore_test_ecore_audio(TCase *tc);
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index 7297b66..0314eeb 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -25,12 +25,6 @@ _quit_cb(void *data)
25 return EINA_FALSE; 25 return EINA_FALSE;
26} 26}
27 27
28static Eina_Bool
29_dummy_cb(void *data)
30{
31 return !!data;
32}
33
34EFL_START_TEST(ecore_test_ecore_init) 28EFL_START_TEST(ecore_test_ecore_init)
35{ 29{
36} 30}
@@ -50,73 +44,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop)
50} 44}
51EFL_END_TEST 45EFL_END_TEST
52 46
53EFL_START_TEST(ecore_test_ecore_main_loop_idler)
54{
55 Eina_Bool did = EINA_FALSE;
56 Ecore_Idler *idler;
57
58 idler = ecore_idler_add(_quit_cb, &did);
59 fail_if(idler == NULL);
60
61 ecore_main_loop_begin();
62
63 fail_if(did == EINA_FALSE);
64}
65EFL_END_TEST
66
67EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
68{
69 Eina_Bool did = EINA_FALSE;
70 Ecore_Idle_Enterer *idle_enterer;
71
72
73 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
74 fail_if(idle_enterer == NULL);
75
76 ecore_main_loop_begin();
77
78 fail_if(did == EINA_FALSE);
79
80}
81EFL_END_TEST
82
83EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
84{
85 Eina_Bool did = EINA_FALSE;
86 Ecore_Idle_Enterer *idle_enterer;
87
88
89 idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did);
90 fail_if(idle_enterer == NULL);
91
92 ecore_main_loop_begin();
93
94 fail_if(did == EINA_FALSE);
95
96}
97EFL_END_TEST
98
99EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
100{
101 Eina_Bool did = EINA_FALSE;
102 Ecore_Timer *timer;
103 Ecore_Idle_Exiter *idle_exiter;
104
105
106 /* make system exit idle */
107 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
108 fail_if(timer == NULL);
109
110 idle_exiter = ecore_idle_exiter_add(_quit_cb, &did);
111 fail_if(idle_exiter == NULL);
112
113 ecore_main_loop_begin();
114
115 fail_if(did == EINA_FALSE);
116
117}
118EFL_END_TEST
119
120 47
121// Disabled tests: inner main loops are not supposed to work! 48// Disabled tests: inner main loops are not supposed to work!
122#if 0 49#if 0
@@ -685,10 +612,6 @@ void ecore_test_ecore(TCase *tc)
685{ 612{
686 tcase_add_test(tc, ecore_test_ecore_init); 613 tcase_add_test(tc, ecore_test_ecore_init);
687 tcase_add_test(tc, ecore_test_ecore_main_loop); 614 tcase_add_test(tc, ecore_test_ecore_main_loop);
688 tcase_add_test(tc, ecore_test_ecore_main_loop_idler);
689 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
690 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
691 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
692 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler); 615 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
693 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags); 616 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
694 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify); 617 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);
diff --git a/src/tests/ecore/ecore_test_idle.c b/src/tests/ecore/ecore_test_idle.c
new file mode 100644
index 0000000..512d001
--- /dev/null
+++ b/src/tests/ecore/ecore_test_idle.c
@@ -0,0 +1,103 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7
8#include <Eina.h>
9#include <Ecore.h>
10
11#include "ecore_suite.h"
12
13
14static Eina_Bool
15_quit_cb(void *data)
16{
17 Eina_Bool *val = data;
18 if (val) *val = EINA_TRUE;
19 ecore_main_loop_quit();
20 return EINA_FALSE;
21}
22
23static Eina_Bool
24_dummy_cb(void *data)
25{
26 return !!data;
27}
28
29EFL_START_TEST(ecore_test_ecore_main_loop_idler)
30{
31 Eina_Bool did = EINA_FALSE;
32 Ecore_Idler *idler;
33
34 idler = ecore_idler_add(_quit_cb, &did);
35 fail_if(idler == NULL);
36
37 ecore_main_loop_begin();
38
39 fail_if(did == EINA_FALSE);
40}
41EFL_END_TEST
42
43EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
44{
45 Eina_Bool did = EINA_FALSE;
46 Ecore_Idle_Enterer *idle_enterer;
47
48
49 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
50 fail_if(idle_enterer == NULL);
51
52 ecore_main_loop_begin();
53
54 fail_if(did == EINA_FALSE);
55
56}
57EFL_END_TEST
58
59EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
60{
61 Eina_Bool did = EINA_FALSE;
62 Ecore_Idle_Enterer *idle_enterer;
63
64
65 idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did);
66 fail_if(idle_enterer == NULL);
67
68 ecore_main_loop_begin();
69
70 fail_if(did == EINA_FALSE);
71
72}
73EFL_END_TEST
74
75EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
76{
77 Eina_Bool did = EINA_FALSE;
78 Ecore_Timer *timer;
79 Ecore_Idle_Exiter *idle_exiter;
80
81
82 /* make system exit idle */
83 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
84 fail_if(timer == NULL);
85
86 idle_exiter = ecore_idle_exiter_add(_quit_cb, &did);
87 fail_if(idle_exiter == NULL);
88
89 ecore_main_loop_begin();
90
91 fail_if(did == EINA_FALSE);
92
93}
94EFL_END_TEST
95
96
97void ecore_test_ecore_idle(TCase *tc)
98{
99 tcase_add_test(tc, ecore_test_ecore_main_loop_idler);
100 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
101 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
102 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
103}