summaryrefslogtreecommitdiff
path: root/src/tests
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 /src/tests
parent3b22dbc5af3a4759b375a8cc7fa9a414914302b5 (diff)
downloadefl-88a6a3c76908d10d83c0f24e04ef2614fa4e94c2.tar.gz
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
Diffstat (limited to 'src/tests')
-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
4 files changed, 105 insertions, 77 deletions
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 5f6a0040eb..a418a7cce7 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -8,6 +8,7 @@
static const Efl_Test_Case etc[] = {
{ "Ecore", ecore_test_ecore },
+ { "idle", ecore_test_ecore_idle },
#if HAVE_ECORE_X
{ "Ecore_X", ecore_test_ecore_x },
#endif
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index 04636146a7..3416e395c2 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -4,6 +4,7 @@
#include <check.h>
#include "../efl_check.h"
void ecore_test_ecore(TCase *tc);
+void ecore_test_ecore_idle(TCase *tc);
void ecore_test_ecore_x(TCase *tc);
void ecore_test_ecore_imf(TCase *tc);
void 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 7297b665a2..0314eebc6e 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)
return EINA_FALSE;
}
-static Eina_Bool
-_dummy_cb(void *data)
-{
- return !!data;
-}
-
EFL_START_TEST(ecore_test_ecore_init)
{
}
@@ -50,73 +44,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop)
}
EFL_END_TEST
-EFL_START_TEST(ecore_test_ecore_main_loop_idler)
-{
- Eina_Bool did = EINA_FALSE;
- Ecore_Idler *idler;
-
- idler = ecore_idler_add(_quit_cb, &did);
- fail_if(idler == NULL);
-
- ecore_main_loop_begin();
-
- fail_if(did == EINA_FALSE);
-}
-EFL_END_TEST
-
-EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
-{
- Eina_Bool did = EINA_FALSE;
- Ecore_Idle_Enterer *idle_enterer;
-
-
- idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
- fail_if(idle_enterer == NULL);
-
- ecore_main_loop_begin();
-
- fail_if(did == EINA_FALSE);
-
-}
-EFL_END_TEST
-
-EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
-{
- Eina_Bool did = EINA_FALSE;
- Ecore_Idle_Enterer *idle_enterer;
-
-
- idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did);
- fail_if(idle_enterer == NULL);
-
- ecore_main_loop_begin();
-
- fail_if(did == EINA_FALSE);
-
-}
-EFL_END_TEST
-
-EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
-{
- Eina_Bool did = EINA_FALSE;
- Ecore_Timer *timer;
- Ecore_Idle_Exiter *idle_exiter;
-
-
- /* make system exit idle */
- timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
- fail_if(timer == NULL);
-
- idle_exiter = ecore_idle_exiter_add(_quit_cb, &did);
- fail_if(idle_exiter == NULL);
-
- ecore_main_loop_begin();
-
- fail_if(did == EINA_FALSE);
-
-}
-EFL_END_TEST
-
// Disabled tests: inner main loops are not supposed to work!
#if 0
@@ -685,10 +612,6 @@ void ecore_test_ecore(TCase *tc)
{
tcase_add_test(tc, ecore_test_ecore_init);
tcase_add_test(tc, ecore_test_ecore_main_loop);
- tcase_add_test(tc, ecore_test_ecore_main_loop_idler);
- tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
- tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
- tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
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 0000000000..512d00124f
--- /dev/null
+++ b/src/tests/ecore/ecore_test_idle.c
@@ -0,0 +1,103 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <Eina.h>
+#include <Ecore.h>
+
+#include "ecore_suite.h"
+
+
+static Eina_Bool
+_quit_cb(void *data)
+{
+ Eina_Bool *val = data;
+ if (val) *val = EINA_TRUE;
+ ecore_main_loop_quit();
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_dummy_cb(void *data)
+{
+ return !!data;
+}
+
+EFL_START_TEST(ecore_test_ecore_main_loop_idler)
+{
+ Eina_Bool did = EINA_FALSE;
+ Ecore_Idler *idler;
+
+ idler = ecore_idler_add(_quit_cb, &did);
+ fail_if(idler == NULL);
+
+ ecore_main_loop_begin();
+
+ fail_if(did == EINA_FALSE);
+}
+EFL_END_TEST
+
+EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
+{
+ Eina_Bool did = EINA_FALSE;
+ Ecore_Idle_Enterer *idle_enterer;
+
+
+ idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
+ fail_if(idle_enterer == NULL);
+
+ ecore_main_loop_begin();
+
+ fail_if(did == EINA_FALSE);
+
+}
+EFL_END_TEST
+
+EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
+{
+ Eina_Bool did = EINA_FALSE;
+ Ecore_Idle_Enterer *idle_enterer;
+
+
+ idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did);
+ fail_if(idle_enterer == NULL);
+
+ ecore_main_loop_begin();
+
+ fail_if(did == EINA_FALSE);
+
+}
+EFL_END_TEST
+
+EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
+{
+ Eina_Bool did = EINA_FALSE;
+ Ecore_Timer *timer;
+ Ecore_Idle_Exiter *idle_exiter;
+
+
+ /* make system exit idle */
+ timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
+ fail_if(timer == NULL);
+
+ idle_exiter = ecore_idle_exiter_add(_quit_cb, &did);
+ fail_if(idle_exiter == NULL);
+
+ ecore_main_loop_begin();
+
+ fail_if(did == EINA_FALSE);
+
+}
+EFL_END_TEST
+
+
+void ecore_test_ecore_idle(TCase *tc)
+{
+ tcase_add_test(tc, ecore_test_ecore_main_loop_idler);
+ tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
+ tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
+ tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
+}