elementary: fix compilation of elm_code test on windows

Summary:
Added some guards to avoid redefinition of functions.

Partially fixes T5866, as there is still the question whether we should
test internal functions or not, as stated by jpeg in the comments.

Reviewers: vtorri, felipealmeida, jpeg, cedric

Reviewed By: cedric

Subscribers: jenkins, cedric

Maniphest Tasks: T5866

Differential Revision: https://phab.enlightenment.org/D5521

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
This commit is contained in:
Lauro Moura 2017-11-23 15:30:29 -08:00 committed by Cedric Bail
parent a1ea022cf6
commit 0dbeb91bb9
4 changed files with 31 additions and 0 deletions

View File

@ -79,6 +79,7 @@ _elm_code_parser_new(void (*parse_line)(Elm_Code_Line *, void *),
return parser;
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_parser_add(Elm_Code *code,
void (*parse_line)(Elm_Code_Line *, void *),
@ -104,6 +105,7 @@ elm_code_parser_standard_add(Elm_Code *code, Elm_Code_Parser *parser)
parser->standard = EINA_TRUE;
code->parsers = eina_list_append(code->parsers, parser);
}
#endif // ELM_CODE_TEST
static void
_elm_code_parser_diff_trim_leading(Elm_Code_Line *line, unsigned int count)

View File

@ -58,12 +58,14 @@ static Eina_Unicode status_icons[] = {
static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline);
#ifndef ELM_CODE_TEST
EAPI Evas_Object *
elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
return elm_legacy_add(MY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code));
}
#endif // ELM_CODE_TEST
EOLIAN static Eo *
_elm_code_widget_efl_object_constructor(Eo *obj, Elm_Code_Widget_Data *pd)
@ -2273,4 +2275,6 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
#include "elm_code_widget_text.c"
#include "elm_code_widget_undo.c"
#ifndef ELM_CODE_TEST
#include "elm_code_widget.eo.c"
#endif // ELM_CODE_TEST

View File

@ -38,6 +38,8 @@ _elm_code_widget_selection_limit(Evas_Object *widget EINA_UNUSED, Elm_Code_Widge
*col = width + 1;
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_widget_selection_start(Evas_Object *widget,
unsigned int line, unsigned int col)
@ -88,6 +90,8 @@ elm_code_widget_selection_end(Evas_Object *widget,
efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget);
}
#endif // ELM_CODE_TEST
EAPI void
elm_code_widget_selection_select_all(Evas_Object *widget)
{
@ -150,6 +154,8 @@ elm_code_widget_selection_normalized_get(Evas_Object *widget)
return selection;
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_widget_selection_clear(Evas_Object *widget)
{
@ -165,6 +171,8 @@ elm_code_widget_selection_clear(Evas_Object *widget)
efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget);
}
#endif // ELM_CODE_TEST
static void
_elm_code_widget_selection_delete_single(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd)
{
@ -272,18 +280,24 @@ _elm_code_widget_selection_delete_do(Evas_Object *widget, Eina_Bool undo)
efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget);
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_widget_selection_delete(Evas_Object *widget)
{
_elm_code_widget_selection_delete_do(widget, EINA_TRUE);
}
#endif // ELM_CODE_TEST
void
_elm_code_widget_selection_delete_no_undo(Evas_Object *widget)
{
_elm_code_widget_selection_delete_do(widget, EINA_FALSE);
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
{
@ -300,6 +314,8 @@ elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
elm_code_widget_selection_end(widget, line, lineobj->length);
}
#endif // ELM_CODE_TEST
static Eina_Bool
_elm_code_widget_selection_char_breaks(char chr)
{
@ -316,6 +332,8 @@ _elm_code_widget_selection_char_breaks(char chr)
return EINA_FALSE;
}
#ifndef ELM_CODE_TEST
EAPI void
elm_code_widget_selection_select_word(Evas_Object *widget, unsigned int line, unsigned int col)
{
@ -374,6 +392,8 @@ elm_code_widget_selection_text_get(Evas_Object *widget)
return text;
}
#endif // ELM_CODE_TEST
static void
_selection_loss_cb(void *data EINA_UNUSED, Elm_Sel_Type selection EINA_UNUSED)
{

View File

@ -24,10 +24,15 @@
#undef DBG
#define DBG(...) do { } while (0);
// Guard against multiple redefinitions on Windows
#define ELM_CODE_TEST
#include "elm_code_parse.c"
#include "elm_code_widget_selection.c"
#include "elm_code_widget.c"
#undef ELM_CODE_TEST
static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id)
{
ck_assert_msg(cell.fg == type, "Wrong type for cell %d", id);