forked from enlightenment/efl
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
This commit is contained in:
parent
e47c2d7006
commit
672cacaaf6
|
@ -1480,7 +1480,6 @@ TESTS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
|
||||||
|
|
||||||
tests_elementary_elm_suite_SOURCES = \
|
tests_elementary_elm_suite_SOURCES = \
|
||||||
tests/elementary/elm_suite.c \
|
tests/elementary/elm_suite.c \
|
||||||
tests/elementary/elm_test_helper.c \
|
|
||||||
tests/elementary/elm_test_atspi.c \
|
tests/elementary/elm_test_atspi.c \
|
||||||
tests/elementary/elm_test_check.c \
|
tests/elementary/elm_test_check.c \
|
||||||
tests/elementary/elm_test_colorselector.c \
|
tests/elementary/elm_test_colorselector.c \
|
||||||
|
@ -1628,7 +1627,6 @@ endif
|
||||||
|
|
||||||
EXTRA_DIST2 += \
|
EXTRA_DIST2 += \
|
||||||
tests/elementary/elm_suite.h \
|
tests/elementary/elm_suite.h \
|
||||||
tests/elementary/elm_test_helper.h \
|
|
||||||
lib/elementary/Elementary_Options.h.in \
|
lib/elementary/Elementary_Options.h.in \
|
||||||
lib/elementary/elm_code_widget_text.c \
|
lib/elementary/elm_code_widget_text.c \
|
||||||
lib/elementary/elm_code_widget_undo.c
|
lib/elementary/elm_code_widget_undo.c
|
||||||
|
|
|
@ -2,8 +2,18 @@
|
||||||
#define _ELM_SUITE_H
|
#define _ELM_SUITE_H
|
||||||
|
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
#include "elm_test_helper.h"
|
|
||||||
#include "../efl_check.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>
|
#include <Evas.h>
|
||||||
void elm_test_init(TCase *tc);
|
void elm_test_init(TCase *tc);
|
||||||
|
|
|
@ -6,6 +6,46 @@
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include "elm_suite.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)
|
EFL_START_TEST (elm_fileselector_legacy_type_check)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *fileselector;
|
Evas_Object *win, *fileselector;
|
||||||
|
@ -84,13 +124,13 @@ EFL_START_TEST (elm_fileselector_selected)
|
||||||
|
|
||||||
open = EINA_FALSE;
|
open = EINA_FALSE;
|
||||||
ck_assert(elm_fileselector_selected_set(fileselector, path));
|
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);
|
ck_assert_str_eq(elm_fileselector_selected_get(fileselector), path);
|
||||||
|
|
||||||
selected = EINA_FALSE;
|
selected = EINA_FALSE;
|
||||||
ck_assert(elm_fileselector_selected_set(fileselector, exist));
|
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);
|
ck_assert_str_eq(elm_fileselector_selected_get(fileselector), exist);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#define EFL_ACCESS_OBJECT_BETA
|
#define EFL_ACCESS_OBJECT_BETA
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include "elm_suite.h"
|
#include "elm_suite.h"
|
||||||
#include "elm_test_helper.h"
|
|
||||||
|
|
||||||
EFL_START_TEST (elm_gengrid_legacy_type_check)
|
EFL_START_TEST (elm_gengrid_legacy_type_check)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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 */
|
|
Loading…
Reference in New Issue