summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-08-06 14:26:08 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2018-08-15 10:20:55 +0200
commit672cacaaf6766e3740a39d71b4379e3a62d42ab3 (patch)
treef923d58f4bebaa922eebd9d38efa0e7c4d0b7058
parente47c2d7006a1641910857a97e2a2f314841fe0cb (diff)
downloadefl-672cacaaf6766e3740a39d71b4379e3a62d42ab3.tar.gz
tests/elm: remove elm_test_helper.(c|h) files
these timer functions are only used by fileselector and I'm trying to consolidate timer usage no functional changes Differential Revision: https://phab.enlightenment.org/D6768
-rw-r--r--src/Makefile_Elementary.am2
-rw-r--r--src/tests/elementary/elm_suite.h12
-rw-r--r--src/tests/elementary/elm_test_fileselector.c44
-rw-r--r--src/tests/elementary/elm_test_gengrid.c1
-rw-r--r--src/tests/elementary/elm_test_helper.c45
-rw-r--r--src/tests/elementary/elm_test_helper.h21
6 files changed, 53 insertions, 72 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index e1ed314039..c83cc6efb3 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1480,7 +1480,6 @@ TESTS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
tests_elementary_elm_suite_SOURCES = \
tests/elementary/elm_suite.c \
- tests/elementary/elm_test_helper.c \
tests/elementary/elm_test_atspi.c \
tests/elementary/elm_test_check.c \
tests/elementary/elm_test_colorselector.c \
@@ -1628,7 +1627,6 @@ endif
EXTRA_DIST2 += \
tests/elementary/elm_suite.h \
-tests/elementary/elm_test_helper.h \
lib/elementary/Elementary_Options.h.in \
lib/elementary/elm_code_widget_text.c \
lib/elementary/elm_code_widget_undo.c
diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h
index f8ea895818..ea291376f9 100644
--- a/src/tests/elementary/elm_suite.h
+++ b/src/tests/elementary/elm_suite.h
@@ -2,8 +2,18 @@
#define _ELM_SUITE_H
#include <check.h>
-#include "elm_test_helper.h"
#include "../efl_check.h"
+#define ck_assert_strn_eq(s1, s2, len) \
+ { \
+ char expected[len+1], actual[len+1]; \
+ \
+ strncpy(expected, s1, len); \
+ expected[len] = '\0'; \
+ strncpy(actual, s2, len); \
+ actual[len] = '\0'; \
+ \
+ ck_assert_str_eq(expected, actual); \
+ }
#include <Evas.h>
void elm_test_init(TCase *tc);
diff --git a/src/tests/elementary/elm_test_fileselector.c b/src/tests/elementary/elm_test_fileselector.c
index dd22df1a57..52eb5c8840 100644
--- a/src/tests/elementary/elm_test_fileselector.c
+++ b/src/tests/elementary/elm_test_fileselector.c
@@ -6,6 +6,46 @@
#include <Elementary.h>
#include "elm_suite.h"
+static Eina_Bool
+timer_expired_cb(void *user_data)
+{
+ Eina_Bool *did_timeout = user_data;
+
+ *did_timeout = EINA_TRUE;
+ ecore_main_loop_quit();
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+idler_done_cb(void *user_data)
+{
+ Eina_Bool *done = user_data;
+
+ if (*done) ecore_main_loop_quit();
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+fileselector_test_helper_wait_flag(double in, Eina_Bool *done)
+{
+ Eina_Bool did_timeout = EINA_FALSE;
+ Ecore_Timer *tm;
+ Ecore_Idle_Enterer *idle;
+
+ tm = ecore_timer_add(in, timer_expired_cb, &did_timeout);
+ idle = ecore_idle_enterer_add(idler_done_cb, done);
+
+ ecore_main_loop_begin();
+
+ ecore_idle_enterer_del(idle);
+ ecore_timer_del(tm);
+
+ return !did_timeout;
+}
+
+
EFL_START_TEST (elm_fileselector_legacy_type_check)
{
Evas_Object *win, *fileselector;
@@ -84,13 +124,13 @@ EFL_START_TEST (elm_fileselector_selected)
open = EINA_FALSE;
ck_assert(elm_fileselector_selected_set(fileselector, path));
- ck_assert(elm_test_helper_wait_flag(10, &open));
+ ck_assert(fileselector_test_helper_wait_flag(10, &open));
ck_assert_str_eq(elm_fileselector_selected_get(fileselector), path);
selected = EINA_FALSE;
ck_assert(elm_fileselector_selected_set(fileselector, exist));
- ck_assert(elm_test_helper_wait_flag(10, &selected));
+ ck_assert(fileselector_test_helper_wait_flag(10, &selected));
ck_assert_str_eq(elm_fileselector_selected_get(fileselector), exist);
diff --git a/src/tests/elementary/elm_test_gengrid.c b/src/tests/elementary/elm_test_gengrid.c
index b388891ec0..53f2b47750 100644
--- a/src/tests/elementary/elm_test_gengrid.c
+++ b/src/tests/elementary/elm_test_gengrid.c
@@ -5,7 +5,6 @@
#define EFL_ACCESS_OBJECT_BETA
#include <Elementary.h>
#include "elm_suite.h"
-#include "elm_test_helper.h"
EFL_START_TEST (elm_gengrid_legacy_type_check)
{
diff --git a/src/tests/elementary/elm_test_helper.c b/src/tests/elementary/elm_test_helper.c
deleted file mode 100644
index 81ab0d1d23..0000000000
--- a/src/tests/elementary/elm_test_helper.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Ecore.h>
-#include "elm_suite.h"
-
-static Eina_Bool
-timer_expired_cb(void *user_data)
-{
- Eina_Bool *did_timeout = user_data;
-
- *did_timeout = EINA_TRUE;
- ecore_main_loop_quit();
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-idler_done_cb(void *user_data)
-{
- Eina_Bool *done = user_data;
-
- if (*done) ecore_main_loop_quit();
-
- return EINA_TRUE;
-}
-
-Eina_Bool
-elm_test_helper_wait_flag(double in, Eina_Bool *done)
-{
- Eina_Bool did_timeout = EINA_FALSE;
- Ecore_Timer *tm;
- Ecore_Idle_Enterer *idle;
-
- tm = ecore_timer_add(in, timer_expired_cb, &did_timeout);
- idle = ecore_idle_enterer_add(idler_done_cb, done);
-
- ecore_main_loop_begin();
-
- ecore_idle_enterer_del(idle);
- ecore_timer_del(tm);
-
- return !did_timeout;
-}
diff --git a/src/tests/elementary/elm_test_helper.h b/src/tests/elementary/elm_test_helper.h
deleted file mode 100644
index f0b44bb8ed..0000000000
--- a/src/tests/elementary/elm_test_helper.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _ELM_TEST_HELPER_H
-#define _ELM_TEST_HELPER_H
-
-#include <Eina.h>
-
-#define ck_assert_strn_eq(s1, s2, len) \
- { \
- char expected[len+1], actual[len+1]; \
- \
- strncpy(expected, s1, len); \
- expected[len] = '\0'; \
- strncpy(actual, s2, len); \
- actual[len] = '\0'; \
- \
- ck_assert_str_eq(expected, actual); \
- }
-
-
-Eina_Bool elm_test_helper_wait_flag(double in, Eina_Bool *done);
-
-#endif /* _ELM_TEST_HELPER_H */