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 -#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 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 #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 #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 -#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 - -#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 */