return parser;
}
-#ifndef ELM_CODE_TEST
EAPI void
elm_code_parser_add(Elm_Code *code,
void (*parse_line)(Elm_Code_Line *, void *),
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)
static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline);
-#ifndef ELM_CODE_TEST
-
#include "elm_code_widget_legacy.eo.h"
EAPI Evas_Object *
#include "elm_code_widget_legacy.eo.c"
-#endif // ELM_CODE_TEST
-
EOLIAN static Eo *
_elm_code_widget_efl_object_constructor(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
*col = width + 1;
}
-#ifndef ELM_CODE_TEST
-
EAPI void
elm_code_widget_selection_start(Evas_Object *widget,
unsigned int line, unsigned int col)
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)
{
efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget);
}
-#ifndef ELM_CODE_TEST
-
EAPI Elm_Code_Widget_Selection_Data *
elm_code_widget_selection_normalized_get(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)
{
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)
{
elm_code_widget_selection_end(widget, line, col);
}
-#endif // ELM_CODE_TEST
-
static Eina_Bool
_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)
{
return text;
}
-#endif // ELM_CODE_TEST
-
static void
_selection_loss_cb(void *data EINA_UNUSED, Elm_Sel_Type selection EINA_UNUSED)
{
// elm_code_widget_selection_clear(widget);
}
-#ifndef ELM_CODE_TEST
-
EAPI void
elm_code_widget_selection_cut(Evas_Object *widget)
{
return ret;
}
-
-#endif // ELM_CODE_TEST
#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);
-}
-
-START_TEST (elm_code_widget_token_render_simple_test)
-{
- Elm_Code_File *file;
- Elm_Code_Line *line;
- Elm_Code *code;
- Elm_Code_Widget *widget;
- Evas_Object *win;
-
- int length;
- unsigned int gutter;
-
- Evas_Textgrid_Cell cells[25];
-
- char *args[] = { "exe" };
- elm_init(1, args);
- code = elm_code_create();
-
- win = elm_win_add(NULL, "code", ELM_WIN_BASIC);
- widget = elm_code_widget_add(win, code);
-
- file = code->file;
- elm_code_file_line_append(file, "some \"test content\", 45", 23, NULL);
- line = elm_code_file_line_get(file, 1);
- length = line->length;
-
- elm_code_line_token_add(line, 5, 18, 1, ELM_CODE_TOKEN_TYPE_COMMENT);
- elm_code_line_token_add(line, 21, 22, 1, ELM_CODE_TOKEN_TYPE_NUMBER);
-
- _elm_code_widget_fill_line_tokens(widget, cells, length+1, line);
- gutter = elm_obj_code_widget_text_left_gutter_width_get(widget);
-
- _assert_cell_type(cells[gutter+15], ELM_CODE_TOKEN_TYPE_COMMENT, 16);
- _assert_cell_type(cells[gutter+21], ELM_CODE_TOKEN_TYPE_NUMBER, 22);
-
- elm_code_free(code);
- elm_shutdown();
-}
-END_TEST
-
START_TEST (elm_code_widget_construct)
{
Elm_Code *code;
void elm_code_test_widget(TCase *tc)
{
- tcase_add_test(tc, elm_code_widget_token_render_simple_test);
tcase_add_test(tc, elm_code_widget_construct);
tcase_add_test(tc, elm_code_widget_construct_nocode);
tcase_add_test(tc, elm_code_widget_position);