forked from enlightenment/efl
elm_code: Remove a render test and complex workarounds required
Fixes issues with Windows and general unused method warnings
This commit is contained in:
parent
3b60da0e37
commit
cc2b7a10a8
|
@ -81,7 +81,6 @@ _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 *),
|
||||
|
@ -107,7 +106,6 @@ 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)
|
||||
|
|
|
@ -58,8 +58,6 @@ static Eina_Unicode status_icons[] = {
|
|||
|
||||
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 *
|
||||
|
@ -72,8 +70,6 @@ elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
|
|||
|
||||
#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)
|
||||
{
|
||||
|
@ -2361,6 +2357,4 @@ _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
|
||||
|
|
|
@ -38,8 +38,6 @@ _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)
|
||||
|
@ -90,8 +88,6 @@ 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)
|
||||
{
|
||||
|
@ -112,8 +108,6 @@ 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)
|
||||
{
|
||||
|
@ -170,8 +164,6 @@ 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)
|
||||
{
|
||||
|
@ -279,24 +271,18 @@ _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)
|
||||
{
|
||||
|
@ -315,8 +301,6 @@ 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)
|
||||
{
|
||||
|
@ -333,8 +317,6 @@ _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)
|
||||
{
|
||||
|
@ -393,8 +375,6 @@ 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)
|
||||
{
|
||||
|
@ -405,8 +385,6 @@ _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)
|
||||
{
|
||||
|
@ -486,5 +464,3 @@ elm_code_widget_selection_is_empty(Evas_Object *widget)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // ELM_CODE_TEST
|
||||
|
|
|
@ -24,59 +24,6 @@
|
|||
#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;
|
||||
|
@ -150,7 +97,6 @@ END_TEST
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue