summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/elementary/elm_code_parse.c2
-rw-r--r--src/lib/elementary/elm_code_widget.c4
-rw-r--r--src/lib/elementary/elm_code_widget_selection.c20
-rw-r--r--src/tests/elementary/elm_code_test_widget.c5
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 *),
79 return parser; 79 return parser;
80} 80}
81 81
82#ifndef ELM_CODE_TEST
82EAPI void 83EAPI void
83elm_code_parser_add(Elm_Code *code, 84elm_code_parser_add(Elm_Code *code,
84 void (*parse_line)(Elm_Code_Line *, void *), 85 void (*parse_line)(Elm_Code_Line *, void *),
@@ -104,6 +105,7 @@ elm_code_parser_standard_add(Elm_Code *code, Elm_Code_Parser *parser)
104 parser->standard = EINA_TRUE; 105 parser->standard = EINA_TRUE;
105 code->parsers = eina_list_append(code->parsers, parser); 106 code->parsers = eina_list_append(code->parsers, parser);
106} 107}
108#endif // ELM_CODE_TEST
107 109
108static void 110static void
109_elm_code_parser_diff_trim_leading(Elm_Code_Line *line, unsigned int count) 111_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[] = {
58 58
59static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline); 59static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline);
60 60
61#ifndef ELM_CODE_TEST
61EAPI Evas_Object * 62EAPI Evas_Object *
62elm_code_widget_add(Evas_Object *parent, Elm_Code *code) 63elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
63{ 64{
64 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 65 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
65 return elm_legacy_add(MY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 66 return elm_legacy_add(MY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code));
66} 67}
68#endif // ELM_CODE_TEST
67 69
68EOLIAN static Eo * 70EOLIAN static Eo *
69_elm_code_widget_efl_object_constructor(Eo *obj, Elm_Code_Widget_Data *pd) 71_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)
2273 2275
2274#include "elm_code_widget_text.c" 2276#include "elm_code_widget_text.c"
2275#include "elm_code_widget_undo.c" 2277#include "elm_code_widget_undo.c"
2278#ifndef ELM_CODE_TEST
2276#include "elm_code_widget.eo.c" 2279#include "elm_code_widget.eo.c"
2280#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
38 *col = width + 1; 38 *col = width + 1;
39} 39}
40 40
41#ifndef ELM_CODE_TEST
42
41EAPI void 43EAPI void
42elm_code_widget_selection_start(Evas_Object *widget, 44elm_code_widget_selection_start(Evas_Object *widget,
43 unsigned int line, unsigned int col) 45 unsigned int line, unsigned int col)
@@ -88,6 +90,8 @@ elm_code_widget_selection_end(Evas_Object *widget,
88 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); 90 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget);
89} 91}
90 92
93#endif // ELM_CODE_TEST
94
91EAPI void 95EAPI void
92elm_code_widget_selection_select_all(Evas_Object *widget) 96elm_code_widget_selection_select_all(Evas_Object *widget)
93{ 97{
@@ -150,6 +154,8 @@ elm_code_widget_selection_normalized_get(Evas_Object *widget)
150 return selection; 154 return selection;
151} 155}
152 156
157#ifndef ELM_CODE_TEST
158
153EAPI void 159EAPI void
154elm_code_widget_selection_clear(Evas_Object *widget) 160elm_code_widget_selection_clear(Evas_Object *widget)
155{ 161{
@@ -165,6 +171,8 @@ elm_code_widget_selection_clear(Evas_Object *widget)
165 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); 171 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget);
166} 172}
167 173
174#endif // ELM_CODE_TEST
175
168static void 176static void
169_elm_code_widget_selection_delete_single(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd) 177_elm_code_widget_selection_delete_single(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd)
170{ 178{
@@ -272,18 +280,24 @@ _elm_code_widget_selection_delete_do(Evas_Object *widget, Eina_Bool undo)
272 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget); 280 efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CLEARED, widget);
273} 281}
274 282
283#ifndef ELM_CODE_TEST
284
275EAPI void 285EAPI void
276elm_code_widget_selection_delete(Evas_Object *widget) 286elm_code_widget_selection_delete(Evas_Object *widget)
277{ 287{
278 _elm_code_widget_selection_delete_do(widget, EINA_TRUE); 288 _elm_code_widget_selection_delete_do(widget, EINA_TRUE);
279} 289}
280 290
291#endif // ELM_CODE_TEST
292
281void 293void
282_elm_code_widget_selection_delete_no_undo(Evas_Object *widget) 294_elm_code_widget_selection_delete_no_undo(Evas_Object *widget)
283{ 295{
284 _elm_code_widget_selection_delete_do(widget, EINA_FALSE); 296 _elm_code_widget_selection_delete_do(widget, EINA_FALSE);
285} 297}
286 298
299#ifndef ELM_CODE_TEST
300
287EAPI void 301EAPI void
288elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line) 302elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
289{ 303{
@@ -300,6 +314,8 @@ elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
300 elm_code_widget_selection_end(widget, line, lineobj->length); 314 elm_code_widget_selection_end(widget, line, lineobj->length);
301} 315}
302 316
317#endif // ELM_CODE_TEST
318
303static Eina_Bool 319static Eina_Bool
304_elm_code_widget_selection_char_breaks(char chr) 320_elm_code_widget_selection_char_breaks(char chr)
305{ 321{
@@ -316,6 +332,8 @@ _elm_code_widget_selection_char_breaks(char chr)
316 return EINA_FALSE; 332 return EINA_FALSE;
317} 333}
318 334
335#ifndef ELM_CODE_TEST
336
319EAPI void 337EAPI void
320elm_code_widget_selection_select_word(Evas_Object *widget, unsigned int line, unsigned int col) 338elm_code_widget_selection_select_word(Evas_Object *widget, unsigned int line, unsigned int col)
321{ 339{
@@ -374,6 +392,8 @@ elm_code_widget_selection_text_get(Evas_Object *widget)
374 return text; 392 return text;
375} 393}
376 394
395#endif // ELM_CODE_TEST
396
377static void 397static void
378_selection_loss_cb(void *data EINA_UNUSED, Elm_Sel_Type selection EINA_UNUSED) 398_selection_loss_cb(void *data EINA_UNUSED, Elm_Sel_Type selection EINA_UNUSED)
379{ 399{
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 @@
24#undef DBG 24#undef DBG
25#define DBG(...) do { } while (0); 25#define DBG(...) do { } while (0);
26 26
27// Guard against multiple redefinitions on Windows
28#define ELM_CODE_TEST
29
27#include "elm_code_parse.c" 30#include "elm_code_parse.c"
28#include "elm_code_widget_selection.c" 31#include "elm_code_widget_selection.c"
29#include "elm_code_widget.c" 32#include "elm_code_widget.c"
30 33
34#undef ELM_CODE_TEST
35
31static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id) 36static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id)
32{ 37{
33 ck_assert_msg(cell.fg == type, "Wrong type for cell %d", id); 38 ck_assert_msg(cell.fg == type, "Wrong type for cell %d", id);