+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <Ecore_Getopt.h>
-
-#include "Elm_Code.h"
-#include "elm_code_suite.h"
-
-#define COPYRIGHT "Copyright © 2014 Andy Williams <andy@andyilliams.me> and various contributors (see AUTHORS)."
-
-static const struct {
- const char *name;
- void (*build)(TCase *tc);
-} tests[] = {
- { "file_load", elm_code_file_test_load },
- { "file_memory", elm_code_file_test_memory },
- { "parse", elm_code_test_parse },
- { "text", elm_code_test_text },
- { "basic", elm_code_test_basic },
- { "widget", elm_code_test_widget },
- { "widget_text", elm_code_test_widget_text },
- { "widget_selection", elm_code_test_widget_selection },
- { "widget_undo", elm_code_test_widget_undo },
-};
-
-START_TEST(elm_code_initialization)
-{
- fail_if(elm_code_init() != 1);
-
-// TODO add other init checks here
-
- fail_if(elm_code_shutdown() != 0);
-}
-END_TEST
-
-void
-edi_test_basic(TCase *tc)
-{
- tcase_add_test(tc, elm_code_initialization);
-}
-
-static const Ecore_Getopt optdesc = {
- "elm_code",
- "%prog [options]",
- PACKAGE_VERSION,
- COPYRIGHT,
- "BSD with advertisement clause",
- "Elm Code",
- 0,
- {
- ECORE_GETOPT_STORE_TRUE('l', "list", "list available tests"),
- ECORE_GETOPT_STORE_STR('t', "test", "test to run"),
- ECORE_GETOPT_LICENSE('L', "license"),
- ECORE_GETOPT_COPYRIGHT('C', "copyright"),
- ECORE_GETOPT_VERSION('V', "version"),
- ECORE_GETOPT_HELP('h', "help"),
- ECORE_GETOPT_SENTINEL
- }
-};
-
-int
-main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
-{
- Suite *s;
- SRunner *sr;
- TCase *tc = NULL;
- char *test = NULL;
- unsigned int i;
- int failed_count = -1;
- int args;
- Eina_Bool quit_option = EINA_FALSE;
- Eina_Bool list_option = EINA_FALSE;
-
- Ecore_Getopt_Value values[] = {
- ECORE_GETOPT_VALUE_BOOL(list_option),
- ECORE_GETOPT_VALUE_STR(test),
- ECORE_GETOPT_VALUE_BOOL(quit_option),
- ECORE_GETOPT_VALUE_BOOL(quit_option),
- ECORE_GETOPT_VALUE_BOOL(quit_option),
- ECORE_GETOPT_VALUE_BOOL(quit_option),
- ECORE_GETOPT_VALUE_NONE
- };
-
- eina_init();
-
- args = ecore_getopt_parse(&optdesc, values, argc, argv);
- if (args < 0)
- {
- EINA_LOG_CRIT("Could not parse arguments.");
- goto end;
- }
- else if (quit_option)
- {
- goto end;
- }
- else if (list_option)
- {
- fprintf(stdout, "Available tests :\n");
- for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
- fprintf(stdout, "\t%s\n", tests[i].name);
- goto end;
- }
-
- s = suite_create("Elm_Code");
-
- for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
- {
- if (test && strcmp(tests[i].name, test))
- continue ;
-
- tc = tcase_create(tests[i].name);
- tcase_set_timeout(tc, 0);
-
- tests[i].build(tc);
- suite_add_tcase(s, tc);
- }
-
- sr = srunner_create(s);
- srunner_set_xml(sr, PACKAGE_BUILD_DIR "/check-results.xml");
-
- srunner_run_all(sr, CK_ENV);
- failed_count = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- end:
- eina_shutdown();
-
- return (failed_count == 0) ? 0 : 255;
-}
+++ /dev/null
-#ifndef _ELM_CODE_SUITE_H
-#define _ELM_CODE_SUITE_H
-
-#include <check.h>
-
-#define ck_assert_strn_eq(s1, s2, len) \
- { \
- char expected[len+1], actual[len+1]; \
-\
- strncpy(expected, s1, len); \
- expected[len] = '\0'; \
- strncpy(actual, s2, len); \
- actual[len] = '\0'; \
-\
- ck_assert_str_eq(expected, actual); \
- }
-
-#include <Elm_Code.h>
-
-void elm_code_file_test_load(TCase *tc);
-void elm_code_file_test_memory(TCase *tc);
-void elm_code_test_basic(TCase *tc);
-void elm_code_test_line(TCase *tc);
-void elm_code_test_parse(TCase *tc);
-void elm_code_test_text(TCase *tc);
-void elm_code_test_widget(TCase *tc);
-void elm_code_test_widget_text(TCase *tc);
-void elm_code_test_widget_selection(TCase *tc);
-void elm_code_test_widget_undo(TCase *tc);
-
-#endif /* _EDLM_CODE_SUITE_H */
lib/elementary/elm_progressbar_internal_part.eo \
lib/elementary/elm_popup_internal_part.eo \
lib/elementary/elm_scroller_internal_part.eo \
+ lib/elementary/elm_code_widget.eo \
$(NULL)
# Legacy classes - not part of public EO API
lib/elementary/elm_widget_thumb.h \
lib/elementary/elm_widget_toolbar.h \
lib/elementary/elm_widget_video.h \
- lib/elementary/elm_widget_web.h
+ lib/elementary/elm_widget_web.h \
+ lib/elementary/elm_code.h \
+ lib/elementary/elm_code_widget_legacy.h \
+ lib/elementary/elm_code_widget_selection.h \
+ lib/elementary/elm_code_diff_widget.h \
+ lib/elementary/elm_code_common.h \
+ lib/elementary/elm_code_line.h \
+ lib/elementary/elm_code_text.h \
+ lib/elementary/elm_code_file.h \
+ lib/elementary/elm_code_parse.h
includesunstabledir = $(includedir)/elementary-@VMAJ@
nodist_includesunstable_HEADERS = \
lib/elementary/elm_check.c \
lib/elementary/elm_clock.c \
lib/elementary/elm_cnp.c \
+ lib/elementary/elm_code_line.c \
+ lib/elementary/elm_code_text.c \
+ lib/elementary/elm_code_file.c \
+ lib/elementary/elm_code_parse.c \
+ lib/elementary/elm_code_widget_selection.c \
+ lib/elementary/elm_code_widget.c \
+ lib/elementary/elm_code_diff_widget.c \
+ lib/elementary/elm_code.c \
+ lib/elementary/elm_code_private.h \
+ lib/elementary/elm_code_widget_private.h \
lib/elementary/elm_colorselector.c \
lib/elementary/elm_color_class.c \
lib/elementary/elc_combobox.c \
edje_external_elementary_module_la_LIBTOOLFLAGS = --tag=disable-static
### Tests
+EXTRA_DIST += \
+tests/elementary/testfile.txt \
+tests/elementary/testfile-windows.txt \
+tests/elementary/testfile-withblanks.txt \
+tests/elementary/testdiff.diff
if EFL_ENABLE_TESTS
tests/elementary/elm_test_panes.c \
tests/elementary/elm_test_slideshow.c \
tests/elementary/elm_test_spinner.c \
- tests/elementary/elm_test_plug.c
+ tests/elementary/elm_test_plug.c \
+ tests/elementary/elm_code_file_test_load.c \
+ tests/elementary/elm_code_file_test_memory.c \
+ tests/elementary/elm_code_test_basic.c \
+ tests/elementary/elm_code_test_line.c \
+ tests/elementary/elm_code_test_parse.c \
+ tests/elementary/elm_code_test_text.c \
+ tests/elementary/elm_code_test_widget.c \
+ tests/elementary/elm_code_test_widget_text.c \
+ tests/elementary/elm_code_test_widget_selection.c \
+ tests/elementary/elm_code_test_widget_undo.c
tests_elementary_elm_suite_CPPFLAGS = \
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
+ -DTESTS_SRC_DIR=\"${top_srcdir}/src/tests/elementary\" \
-DELM_IMAGE_DATA_DIR=\"${top_srcdir}/data/elementary\" \
-DELM_TEST_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
+ -DPACKAGE_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
-I$(top_srcdir)/src/lib/elementary \
-I$(top_builddir)/src/lib/elementary \
@CHECK_CFLAGS@ \
tests/elementary/elm_test_helper.h \
lib/elementary/Makefile.am \
lib/elementary/Makefile.in \
-lib/elementary/Elementary.h.in
+lib/elementary/Elementary.h.in \
+lib/elementary/elm_code_widget_text.c \
+lib/elementary/elm_code_widget_undo.c
+
#include <elm_check.h>
#include <elm_clock.h>
#include <elm_cnp.h>
+#include <elm_code.h>
#include <elm_colorselector.h>
#include <elm_color_class.h>
#include <elm_conform.h>
#ifdef HAVE_CONFIG
-# include "config.h"
+# include "elementary_config.h"
#endif
#include <Eo.h>
#include <Evas.h>
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
#ifndef ELM_CODE_H_
# define ELM_CODE_H_
-#include <Eina.h>
-#include <Eo.h>
-#include <Elementary.h>
-#define ELM_INTERNAL_API_ARGESFSDFEFC
-#include <elm_widget.h>
-
-#ifdef EAPI
-# undef EAPI
-#endif
-
-#ifdef _WIN32
-# ifdef EFL_ELM_CODE_BUILD
-# ifdef DLL_EXPORT
-# define EAPI __declspec(dllexport)
-# else
-# define EAPI
-# endif /* ! DLL_EXPORT */
-# else
-# define EAPI __declspec(dllimport)
-# endif /* ! EFL_ELM_CODE_BUILD */
-#else
-# ifdef __GNUC__
-# if __GNUC__ >= 4
-# define EAPI __attribute__ ((visibility("default")))
-# else
-# define EAPI
-# endif
-# else
-# define EAPI
-# endif
-#endif /* ! _WIN32 */
-
#include "elm_code_common.h"
#include "elm_code_line.h"
#include "elm_code_text.h"
#include "elm_code_file.h"
#include "elm_code_parse.h"
-#include "widget/elm_code_widget.eo.h"
-#include "widget/elm_code_widget_legacy.h"
-#include "widget/elm_code_widget_selection.h"
+#include "elm_code_widget.eo.h"
+#include "elm_code_widget_legacy.h"
+#include "elm_code_widget_selection.h"
#include "elm_code_diff_widget.h"
#ifdef __cplusplus
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
{
return eina_list_nth(file->lines, number - 1);
}
-
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include <Elementary.h>
+
+#include "elm_priv.h"
+
#include "elm_code_private.h"
#include "elm_code_widget_private.h"
import evas_types;
import edje_types;
import elm_interface_scrollable;
+import elm_general;
struct @extern Elm_Code; /* The main interface currently defined in code */
struct @extern Elm_Code_Line; /* Parts of the interface currently defined in code */
*/
EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code);
-#include "widget/elm_code_widget.eo.legacy.h"
+#include "elm_code_widget.eo.legacy.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_widget_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_widget_private.h"
-#ifdef HAVE_CONFIG
-# include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
#endif
-#include "Elm_Code.h"
+#include "Elementary.h"
#include "elm_code_widget_private.h"
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
START_TEST (elm_code_file_load)
{
- char *path = TESTS_DIR "testfile.txt";
+ char *path = TESTS_SRC_DIR "/testfile.txt";
char real[EINA_PATH_MAX];
Elm_Code_File *file;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
realpath(path, real);
ck_assert_str_eq(real, elm_code_file_path_get(file));
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_load_lines)
{
- char *path = TESTS_DIR "testfile.txt";
+ char *path = TESTS_SRC_DIR "/testfile.txt";
Elm_Code_File *file;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
ck_assert_uint_eq(4, elm_code_file_lines_get(file));
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_load_blank_lines)
{
- char *path = TESTS_DIR "testfile-withblanks.txt";
+ char *path = TESTS_SRC_DIR "/testfile-withblanks.txt";
Elm_Code_File *file;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
ck_assert_uint_eq(8, elm_code_file_lines_get(file));
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_load_windows)
{
- char *path = TESTS_DIR "testfile-windows.txt";
+ char *path = TESTS_SRC_DIR "/testfile-windows.txt";
Elm_Code_File *file;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
ck_assert_uint_eq(4, elm_code_file_lines_get(file));
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_load_content)
{
- char *path = TESTS_DIR "testfile.txt";
+ char *path = TESTS_SRC_DIR "/testfile.txt";
Elm_Code_File *file;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
_assert_line_content_eq("another line", elm_code_file_line_get(file, 4));
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_line_ending_unix)
{
- char *path = TESTS_DIR "testfile.txt";
+ char *path = TESTS_SRC_DIR "/testfile.txt";
Elm_Code_File *file;
Elm_Code *code;
short len;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
START_TEST (elm_code_file_line_ending_windows)
{
- char *path = TESTS_DIR "testfile-windows.txt";
+ char *path = TESTS_SRC_DIR "/testfile-windows.txt";
Elm_Code_File *file;
Elm_Code *code;
short len;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_open(code, path);
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_file_line_ending_unix);
tcase_add_test(tc, elm_code_file_line_ending_windows);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
START_TEST (elm_code_file_memory_lines)
{
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
ck_assert_uint_eq(0, elm_code_file_lines_get(code->file));
ck_assert_uint_eq(1, elm_code_file_lines_get(code->file));
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
Elm_Code_Line *line;
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
file = code->file;
elm_code_file_line_append(file, "a line", 6, NULL);
elm_code_line_token_add(line, 2, 5, 1, ELM_CODE_TOKEN_TYPE_COMMENT);
ck_assert_uint_eq(1, eina_list_count(line->tokens));
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_file_memory_lines);
tcase_add_test(tc, elm_code_file_memory_tokens);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
START_TEST (elm_code_create_test)
{
- char *path = "elm_code/src/tests/testfile.txt";
+ char *path = TESTS_SRC_DIR "/testfile.txt";
Elm_Code *code;
+ elm_init(1, NULL);
code = elm_code_create();
elm_code_file_open(code, path);
ck_assert(!!code);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
{
tcase_add_test(tc, elm_code_create_test);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
START_TEST (elm_code_line_create_test)
{
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
ck_assert(!!line);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
ck_assert_int_eq(0, eina_list_count(line->tokens));
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line, *newline;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
newline = elm_code_file_line_get(file, 2);
ck_assert_int_eq(5, line->length);
ck_assert_int_eq(5, newline->length);
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_line_token_count_test);
tcase_add_test(tc, elm_code_line_split_test);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
#include "elm_code_parse.h"
static int line_calls, file_calls;
line_calls = 0;
file_calls = 0;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
ck_assert_int_eq(0, file_calls);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
{
Elm_Code *code;
Elm_Code_File *file;
- char *path = TESTS_DIR "testfile.txt";
+ char *path = TESTS_SRC_DIR "testfile.txt";
line_calls = 0;
file_calls = 0;
+ elm_init(1, NULL);
code = elm_code_create();
elm_code_parser_add(code, _parser_line_callback, _parser_file_callback, NULL);
elm_code_file_close(file);
elm_code_free(code);
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
elm_code_init();
code = elm_code_create();
elm_code_line_text_set(line, "TOFIX", 5);
ck_assert_int_eq(ELM_CODE_STATUS_TYPE_DEFAULT, line->status);
elm_code_shutdown();
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_parse_hook_file_test);
tcase_add_test(tc, elm_code_parse_todo_test);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
#include "elm_code_text.h"
START_TEST (elm_code_text_get_test)
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
elm_code_file_line_append(file, "test", 4, NULL);
line = elm_code_file_line_get(file, 1);
ck_assert_str_eq("test", elm_code_line_text_get(line, NULL));
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
elm_code_line_text_insert(line, 4, "ing", 3);
ck_assert_str_eq("testing", elm_code_line_text_get(line, NULL));
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
ck_assert_int_eq(EINA_TRUE, elm_code_line_text_contains(line, "a t"));
ck_assert_int_eq(EINA_TRUE, elm_code_line_text_contains(line, "..."));
+ elm_shutdown();
}
END_TEST
Elm_Code_File *file;
Elm_Code_Line *line;
+ elm_init(1, NULL);
code = elm_code_create();
file = elm_code_file_new(code);
ck_assert_int_eq(0, elm_code_line_text_strpos(line, "a t", 0));
ck_assert_int_eq(ELM_CODE_TEXT_NOT_FOUND, elm_code_line_text_strpos(line, "a t", 2));
ck_assert_int_eq(13, elm_code_line_text_strpos(line, "...", 0));
+ elm_shutdown();
}
END_TEST
const char *unixtext = "a test\nwith newline";
const char *wintext = "a windows\r\nnewline";
+ elm_init(1, NULL);
ck_assert_int_eq(6, elm_code_text_newlinenpos(unixtext, strlen(unixtext), &nllen));
ck_assert_int_eq(1, nllen);
ck_assert_int_eq(9, elm_code_text_newlinenpos(wintext, strlen(wintext), &nllen));
ck_assert_int_eq(2, nllen);
+ elm_shutdown();
}
END_TEST
{
const char *text;
+ elm_init(1, NULL);
text = "testing";
ck_assert_int_eq(0, elm_code_text_leading_whitespace_length(text, strlen(text)));
text = " \t mix";
ck_assert_int_eq(3, elm_code_text_leading_whitespace_length(text, strlen(text)));
+ elm_shutdown();
}
END_TEST
{
const char *text;
+ elm_init(1, NULL);
text = "testing";
ck_assert_int_eq(0, elm_code_text_trailing_whitespace_length(text, strlen(text)));
text = "mix \t ";
ck_assert_int_eq(3, elm_code_text_trailing_whitespace_length(text, strlen(text)));
+ elm_shutdown();
}
END_TEST
{
const char *text;
+ elm_init(1, NULL);
text = " ";
ck_assert_int_eq(1, elm_code_text_is_whitespace(text, strlen(text)));
text = " . ";
ck_assert_int_eq(0, elm_code_text_is_whitespace(text, strlen(text)));
+ elm_shutdown();
}
END_TEST
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
-#include "widget/elm_code_widget.c"
+#include "elm_suite.h"
+#include "Elementary.h"
+#include "elm_code_widget.c"
static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id)
{
tcase_add_test(tc, elm_code_widget_construct);
tcase_add_test(tc, elm_code_widget_construct_nocode);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+#include "elm_suite.h"
+#include "Elementary.h"
#include "elm_code_widget_private.h"
-
-#include "widget/elm_code_widget_selection.h"
+#include "elm_code_widget_selection.h"
START_TEST (elm_code_test_widget_selection_set)
{
selection = elm_code_widget_selection_text_get(widget);
ck_assert_str_eq("line2", selection);
free(selection);
+ elm_shutdown();
}
END_TEST
selection = elm_code_widget_selection_text_get(widget);
ck_assert_str_eq("stuff", selection);
free(selection);
+ elm_shutdown();
}
END_TEST
selection = elm_code_widget_selection_text_get(widget);
ck_assert_str_eq("mark", selection);
free(selection);
+ elm_shutdown();
}
END_TEST
selection = elm_code_widget_selection_text_get(widget);
ck_assert_str_eq("braces", selection);
free(selection);
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_test_widget_selection_select_word_punctuation);
tcase_add_test(tc, elm_code_test_widget_selection_select_word_symbols);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include "elm_suite.h"
+#include "Elementary.h"
START_TEST (elm_code_test_widget_text_tab_width)
{
ck_assert_int_eq(2, elm_code_widget_line_text_position_for_column_get(widget, line, 9));
ck_assert_int_eq(1, elm_code_widget_line_text_position_for_column_get(widget, line, 7));
+ elm_shutdown();
}
END_TEST
tcase_add_test(tc, elm_code_test_widget_text_tab_width);
tcase_add_test(tc, elm_code_test_widget_text_position);
}
-
#ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "elementary_config.h"
#endif
-#include "elm_code_suite.h"
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+#include "elm_suite.h"
+#include "Elementary.h"
#include "elm_code_widget_private.h"
START_TEST (elm_code_test_widget_undo_text_insert)
tcase_add_test(tc, elm_code_test_widget_undo_newline);
tcase_add_test(tc, elm_code_test_widget_undo_delete);
}
-
{ "elm_slideshow", elm_test_slideshow},
{ "elm_spinner", elm_test_spinner},
{ "elm_plug", elm_test_plug},
+ { "file_load", elm_code_file_test_load },
+ { "file_memory", elm_code_file_test_memory },
+ { "parse", elm_code_test_parse },
+ { "text", elm_code_test_text },
+ { "basic", elm_code_test_basic },
+ { "widget", elm_code_test_widget },
+ { "widget_text", elm_code_test_widget_text },
+ { "widget_selection", elm_code_test_widget_selection },
+ { "widget_undo", elm_code_test_widget_undo },
{ NULL, NULL }
};
void elm_test_spinner(TCase *tc);
void elm_test_plug(TCase *tc);
+void elm_code_file_test_load(TCase *tc);
+void elm_code_file_test_memory(TCase *tc);
+void elm_code_test_basic(TCase *tc);
+void elm_code_test_line(TCase *tc);
+void elm_code_test_parse(TCase *tc);
+void elm_code_test_text(TCase *tc);
+void elm_code_test_widget(TCase *tc);
+void elm_code_test_widget_text(TCase *tc);
+void elm_code_test_widget_selection(TCase *tc);
+void elm_code_test_widget_undo(TCase *tc);
+
#endif /* _ELM_SUITE_H */
#include <Eina.h>
+#define ck_assert_strn_eq(s1, s2, len) \
+ { \
+ char expected[len+1], actual[len+1]; \
+ \
+ strncpy(expected, s1, len); \
+ expected[len] = '\0'; \
+ strncpy(actual, s2, len); \
+ actual[len] = '\0'; \
+ \
+ ck_assert_str_eq(expected, actual); \
+ }
+
+
Eina_Bool elm_test_helper_wait_flag(double in, Eina_Bool *done);
#endif /* _ELM_TEST_HELPER_H */