diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2017-11-23 15:30:29 -0800 |
---|---|---|
committer | Cedric Bail <cedric@osg.samsung.com> | 2017-11-23 15:30:32 -0800 |
commit | 0dbeb91bb90decd862e7c421c638c34dd91fc2de (patch) | |
tree | b3e59d0bd018fbb3a7aaf97d7f4ba79a0bff3cfe | |
parent | a1ea022cf666698edd1ff5405c817373496fbb1d (diff) | |
download | efl-0dbeb91bb90decd862e7c421c638c34dd91fc2de.tar.gz |
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>
-rw-r--r-- | src/lib/elementary/elm_code_parse.c | 2 | ||||
-rw-r--r-- | src/lib/elementary/elm_code_widget.c | 4 | ||||
-rw-r--r-- | src/lib/elementary/elm_code_widget_selection.c | 20 | ||||
-rw-r--r-- | src/tests/elementary/elm_code_test_widget.c | 5 |
4 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_code_parse.c b/src/lib/elementary/elm_code_parse.c index f4eac48595..11f046f1ef 100644 --- a/src/lib/elementary/elm_code_parse.c +++ b/src/lib/elementary/elm_code_parse.c @@ -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) diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 55a8ed86c1..ce42ab53e4 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -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 diff --git a/src/lib/elementary/elm_code_widget_selection.c b/src/lib/elementary/elm_code_widget_selection.c index a510cde5bf..fd2c161785 100644 --- a/src/lib/elementary/elm_code_widget_selection.c +++ b/src/lib/elementary/elm_code_widget_selection.c @@ -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) { diff --git a/src/tests/elementary/elm_code_test_widget.c b/src/tests/elementary/elm_code_test_widget.c index 3a5860aeb0..c9fd6e8740 100644 --- a/src/tests/elementary/elm_code_test_widget.c +++ b/src/tests/elementary/elm_code_test_widget.c @@ -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); |