elementary: merging in elm_code widget.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Jun 2016 00:19:08 +0000 (17:19 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Jun 2016 00:19:08 +0000 (17:19 -0700)
Theme is not there as it should be manually merged into the elementary
default theme.

43 files changed:
legacy/elm_code/src/tests/elm_code_suite.c [deleted file]
legacy/elm_code/src/tests/elm_code_suite.h [deleted file]
src/Makefile_Elementary.am
src/lib/elementary/Elementary.h.in
src/lib/elementary/elm_code.c [moved from legacy/elm_code/src/lib/elm_code.c with 97% similarity]
src/lib/elementary/elm_code.h [moved from legacy/elm_code/src/lib/Elm_Code.h with 77% similarity]
src/lib/elementary/elm_code_common.h [moved from legacy/elm_code/src/lib/elm_code_common.h with 100% similarity]
src/lib/elementary/elm_code_diff_widget.c [moved from legacy/elm_code/src/lib/elm_code_diff_widget.c with 98% similarity]
src/lib/elementary/elm_code_diff_widget.h [moved from legacy/elm_code/src/lib/elm_code_diff_widget.h with 100% similarity]
src/lib/elementary/elm_code_file.c [moved from legacy/elm_code/src/lib/elm_code_file.c with 99% similarity]
src/lib/elementary/elm_code_file.h [moved from legacy/elm_code/src/lib/elm_code_file.h with 100% similarity]
src/lib/elementary/elm_code_line.c [moved from legacy/elm_code/src/lib/elm_code_line.c with 98% similarity]
src/lib/elementary/elm_code_line.h [moved from legacy/elm_code/src/lib/elm_code_line.h with 100% similarity]
src/lib/elementary/elm_code_parse.c [moved from legacy/elm_code/src/lib/elm_code_parse.c with 98% similarity]
src/lib/elementary/elm_code_parse.h [moved from legacy/elm_code/src/lib/elm_code_parse.h with 100% similarity]
src/lib/elementary/elm_code_private.h [moved from legacy/elm_code/src/lib/elm_code_private.h with 100% similarity]
src/lib/elementary/elm_code_text.c [moved from legacy/elm_code/src/lib/elm_code_text.c with 98% similarity]
src/lib/elementary/elm_code_text.h [moved from legacy/elm_code/src/lib/elm_code_text.h with 100% similarity]
src/lib/elementary/elm_code_widget.c [moved from legacy/elm_code/src/lib/widget/elm_code_widget.c with 99% similarity]
src/lib/elementary/elm_code_widget.eo [moved from legacy/elm_code/src/lib/widget/elm_code_widget.eo with 99% similarity]
src/lib/elementary/elm_code_widget_legacy.h [moved from legacy/elm_code/src/lib/widget/elm_code_widget_legacy.h with 86% similarity]
src/lib/elementary/elm_code_widget_private.h [moved from legacy/elm_code/src/lib/widget/elm_code_widget_private.h with 100% similarity]
src/lib/elementary/elm_code_widget_selection.c [moved from legacy/elm_code/src/lib/widget/elm_code_widget_selection.c with 99% similarity]
src/lib/elementary/elm_code_widget_selection.h [moved from legacy/elm_code/src/lib/widget/elm_code_widget_selection.h with 100% similarity]
src/lib/elementary/elm_code_widget_text.c [moved from legacy/elm_code/src/lib/widget/elm_code_widget_text.c with 98% similarity]
src/lib/elementary/elm_code_widget_undo.c [moved from legacy/elm_code/src/lib/widget/elm_code_widget_undo.c with 95% similarity]
src/tests/elementary/elm_code_file_test_load.c [moved from legacy/elm_code/src/tests/elm_code_file_test_load.c with 80% similarity]
src/tests/elementary/elm_code_file_test_memory.c [moved from legacy/elm_code/src/tests/elm_code_file_test_memory.c with 82% similarity]
src/tests/elementary/elm_code_test_basic.c [moved from legacy/elm_code/src/tests/elm_code_test_basic.c with 59% similarity]
src/tests/elementary/elm_code_test_line.c [moved from legacy/elm_code/src/tests/elm_code_test_line.c with 88% similarity]
src/tests/elementary/elm_code_test_parse.c [moved from legacy/elm_code/src/tests/elm_code_test_parse.c with 88% similarity]
src/tests/elementary/elm_code_test_text.c [moved from legacy/elm_code/src/tests/elm_code_test_text.c with 91% similarity]
src/tests/elementary/elm_code_test_widget.c [moved from legacy/elm_code/src/tests/widget/elm_code_test_widget.c with 93% similarity]
src/tests/elementary/elm_code_test_widget_selection.c [moved from legacy/elm_code/src/tests/widget/elm_code_test_widget_selection.c with 98% similarity]
src/tests/elementary/elm_code_test_widget_text.c [moved from legacy/elm_code/src/tests/widget/elm_code_test_widget_text.c with 92% similarity]
src/tests/elementary/elm_code_test_widget_undo.c [moved from legacy/elm_code/src/tests/widget/elm_code_test_widget_undo.c with 97% similarity]
src/tests/elementary/elm_suite.c
src/tests/elementary/elm_suite.h
src/tests/elementary/elm_test_helper.h
src/tests/elementary/testdiff.diff [moved from legacy/elm_code/src/tests/testdiff.diff with 100% similarity]
src/tests/elementary/testfile-windows.txt [moved from legacy/elm_code/src/tests/testfile-windows.txt with 100% similarity]
src/tests/elementary/testfile-withblanks.txt [moved from legacy/elm_code/src/tests/testfile-withblanks.txt with 100% similarity]
src/tests/elementary/testfile.txt [moved from legacy/elm_code/src/tests/testfile.txt with 100% similarity]

diff --git a/legacy/elm_code/src/tests/elm_code_suite.c b/legacy/elm_code/src/tests/elm_code_suite.c
deleted file mode 100644 (file)
index 31ea7d9..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#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;
-}
diff --git a/legacy/elm_code/src/tests/elm_code_suite.h b/legacy/elm_code/src/tests/elm_code_suite.h
deleted file mode 100644 (file)
index 750bfd7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#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 */
index 550a54a..c122a75 100644 (file)
@@ -135,6 +135,7 @@ elm_public_eolian_files = \
        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
@@ -252,7 +253,16 @@ includesunstable_HEADERS = \
        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 = \
@@ -562,6 +572,16 @@ lib_elementary_libelementary_la_SOURCES = \
        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 \
@@ -1214,6 +1234,11 @@ edje_external_elementary_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
 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
 
@@ -1291,12 +1316,24 @@ tests_elementary_elm_suite_SOURCES = \
        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@ \
@@ -1339,4 +1376,7 @@ tests/elementary/elm_suite.h \
 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
+
index b85eaff..59d4081 100644 (file)
@@ -202,6 +202,7 @@ EAPI extern Elm_Version *elm_version;
 #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>
similarity index 97%
rename from legacy/elm_code/src/lib/elm_code.c
rename to src/lib/elementary/elm_code.c
index 598f928..ff26ea0 100644 (file)
@@ -1,11 +1,11 @@
 #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"
 
similarity index 77%
rename from legacy/elm_code/src/lib/Elm_Code.h
rename to src/lib/elementary/elm_code.h
index 9d14b40..046cb6e 100644 (file)
@@ -1,46 +1,14 @@
 #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
similarity index 98%
rename from legacy/elm_code/src/lib/elm_code_diff_widget.c
rename to src/lib/elementary/elm_code_diff_widget.c
index 7efb848..c874805 100644 (file)
@@ -1,8 +1,8 @@
-#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"
 
similarity index 99%
rename from legacy/elm_code/src/lib/elm_code_file.c
rename to src/lib/elementary/elm_code_file.c
index 5db1bfa..4e8dee4 100644 (file)
@@ -1,8 +1,8 @@
-#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"
 
@@ -319,4 +319,3 @@ EAPI Elm_Code_Line *elm_code_file_line_get(Elm_Code_File *file, unsigned int num
 {
    return eina_list_nth(file->lines, number - 1);
 }
-
similarity index 98%
rename from legacy/elm_code/src/lib/elm_code_line.c
rename to src/lib/elementary/elm_code_line.c
index b2ee714..2b3281d 100644 (file)
@@ -1,8 +1,8 @@
-#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"
 
similarity index 98%
rename from legacy/elm_code/src/lib/elm_code_parse.c
rename to src/lib/elementary/elm_code_parse.c
index f7fd97e..5869f8c 100644 (file)
@@ -1,8 +1,8 @@
-#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"
 
similarity index 98%
rename from legacy/elm_code/src/lib/elm_code_text.c
rename to src/lib/elementary/elm_code_text.c
index 901b6ae..f1503e7 100644 (file)
@@ -1,8 +1,8 @@
-#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"
 
similarity index 99%
rename from legacy/elm_code/src/lib/widget/elm_code_widget.c
rename to src/lib/elementary/elm_code_widget.c
index 9af37bd..9a9418e 100644 (file)
@@ -1,8 +1,11 @@
-#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"
 
similarity index 99%
rename from legacy/elm_code/src/lib/widget/elm_code_widget.eo
rename to src/lib/elementary/elm_code_widget.eo
index 65dd56a..2a977ab 100644 (file)
@@ -1,6 +1,7 @@
 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 */
@@ -10,4 +10,4 @@
  */
 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"
@@ -1,8 +1,8 @@
-#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"
 
@@ -1,8 +1,8 @@
-#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"
 
@@ -1,8 +1,8 @@
-#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"
 
@@ -1,16 +1,20 @@
 #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);
@@ -19,51 +23,58 @@ START_TEST (elm_code_file_load)
    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
 
@@ -81,10 +92,11 @@ static void _assert_line_content_eq(const char *content, Elm_Code_Line *line)
 
 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);
 
@@ -92,16 +104,18 @@ START_TEST (elm_code_file_load_content)
    _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);
 
@@ -111,16 +125,18 @@ START_TEST (elm_code_file_line_ending_unix)
 
    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);
 
@@ -130,6 +146,7 @@ START_TEST (elm_code_file_line_ending_windows)
 
    elm_code_file_close(file);
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -143,4 +160,3 @@ void elm_code_file_test_load(TCase *tc)
    tcase_add_test(tc, elm_code_file_line_ending_unix);
    tcase_add_test(tc, elm_code_file_line_ending_windows);
 }
-
@@ -1,13 +1,17 @@
 #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));
 
@@ -15,6 +19,7 @@ START_TEST (elm_code_file_memory_lines)
 
    ck_assert_uint_eq(1, elm_code_file_lines_get(code->file));
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -24,6 +29,7 @@ START_TEST (elm_code_file_memory_tokens)
    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);
@@ -32,6 +38,7 @@ START_TEST (elm_code_file_memory_tokens)
    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
 
@@ -40,4 +47,3 @@ void elm_code_file_test_memory(TCase *tc)
    tcase_add_test(tc, elm_code_file_memory_lines);
    tcase_add_test(tc, elm_code_file_memory_tokens);
 }
-
similarity index 59%
rename from legacy/elm_code/src/tests/elm_code_test_basic.c
rename to src/tests/elementary/elm_code_test_basic.c
index b968e90..9805a75 100644 (file)
@@ -1,19 +1,24 @@
 #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
 
@@ -21,4 +26,3 @@ void elm_code_test_basic(TCase *tc)
 {
    tcase_add_test(tc, elm_code_create_test);
 }
-
similarity index 88%
rename from legacy/elm_code/src/tests/elm_code_test_line.c
rename to src/tests/elementary/elm_code_test_line.c
index b19bf61..cdbc628 100644 (file)
@@ -1,8 +1,11 @@
 #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)
 {
@@ -10,6 +13,7 @@ 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);
 
@@ -19,6 +23,7 @@ START_TEST (elm_code_line_create_test)
    ck_assert(!!line);
 
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -28,6 +33,7 @@ START_TEST (elm_code_line_token_count_test)
    Elm_Code_File *file;
    Elm_Code_Line *line;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -41,6 +47,7 @@ START_TEST (elm_code_line_token_count_test)
    ck_assert_int_eq(0, eina_list_count(line->tokens));
 
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -50,6 +57,7 @@ START_TEST (elm_code_line_split_test)
    Elm_Code_File *file;
    Elm_Code_Line *line, *newline;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -63,6 +71,7 @@ START_TEST (elm_code_line_split_test)
    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
 
@@ -72,4 +81,3 @@ void elm_code_test_line(TCase *tc)
    tcase_add_test(tc, elm_code_line_token_count_test);
    tcase_add_test(tc, elm_code_line_split_test);
 }
-
similarity index 88%
rename from legacy/elm_code/src/tests/elm_code_test_parse.c
rename to src/tests/elementary/elm_code_test_parse.c
index e91845c..4bd35b4 100644 (file)
@@ -1,8 +1,11 @@
 #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;
@@ -25,6 +28,7 @@ START_TEST (elm_code_parse_hook_memory_test)
    line_calls = 0;
    file_calls = 0;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -35,6 +39,7 @@ START_TEST (elm_code_parse_hook_memory_test)
    ck_assert_int_eq(0, file_calls);
 
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -42,11 +47,12 @@ START_TEST (elm_code_parse_hook_file_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);
@@ -57,6 +63,7 @@ START_TEST (elm_code_parse_hook_file_test)
 
    elm_code_file_close(file);
    elm_code_free(code);
+   elm_shutdown();
 }
 END_TEST
 
@@ -66,6 +73,7 @@ START_TEST (elm_code_parse_todo_test)
    Elm_Code_File *file;
    Elm_Code_Line *line;
 
+   elm_init(1, NULL);
    elm_code_init();
 
    code = elm_code_create();
@@ -82,6 +90,7 @@ START_TEST (elm_code_parse_todo_test)
    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
 
@@ -91,4 +100,3 @@ void elm_code_test_parse(TCase *tc)
    tcase_add_test(tc, elm_code_parse_hook_file_test);
    tcase_add_test(tc, elm_code_parse_todo_test);
 }
-
similarity index 91%
rename from legacy/elm_code/src/tests/elm_code_test_text.c
rename to src/tests/elementary/elm_code_test_text.c
index 26e1aa1..934b98b 100644 (file)
@@ -1,8 +1,11 @@
 #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)
@@ -11,12 +14,14 @@ 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
 
@@ -26,6 +31,7 @@ START_TEST (elm_code_text_insert_test)
    Elm_Code_File *file;
    Elm_Code_Line *line;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -34,6 +40,7 @@ START_TEST (elm_code_text_insert_test)
 
    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
 
@@ -43,6 +50,7 @@ START_TEST (elm_code_text_contains_test)
    Elm_Code_File *file;
    Elm_Code_Line *line;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -54,6 +62,7 @@ START_TEST (elm_code_text_contains_test)
 
    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
 
@@ -63,6 +72,7 @@ START_TEST (elm_code_text_strpos_test)
    Elm_Code_File *file;
    Elm_Code_Line *line;
 
+   elm_init(1, NULL);
    code = elm_code_create();
    file = elm_code_file_new(code);
 
@@ -78,6 +88,7 @@ START_TEST (elm_code_text_strpos_test)
    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
 
@@ -87,10 +98,12 @@ START_TEST (elm_code_text_newline_position_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
 
@@ -98,6 +111,7 @@ START_TEST (elm_code_text_leading_whitespace_test)
 {
    const char *text;
 
+   elm_init(1, NULL);
    text = "testing";
    ck_assert_int_eq(0, elm_code_text_leading_whitespace_length(text, strlen(text)));
 
@@ -109,6 +123,7 @@ START_TEST (elm_code_text_leading_whitespace_test)
 
    text = " \t mix";
    ck_assert_int_eq(3, elm_code_text_leading_whitespace_length(text, strlen(text)));
+   elm_shutdown();
 }
 END_TEST
 
@@ -116,6 +131,7 @@ START_TEST (elm_code_text_trailing_whitespace_test)
 {
    const char *text;
 
+   elm_init(1, NULL);
    text = "testing";
    ck_assert_int_eq(0, elm_code_text_trailing_whitespace_length(text, strlen(text)));
 
@@ -127,6 +143,7 @@ START_TEST (elm_code_text_trailing_whitespace_test)
 
    text = "mix \t ";
    ck_assert_int_eq(3, elm_code_text_trailing_whitespace_length(text, strlen(text)));
+   elm_shutdown();
 }
 END_TEST
 
@@ -134,6 +151,7 @@ START_TEST (elm_code_text_is_whitespace_test)
 {
    const char *text;
 
+   elm_init(1, NULL);
    text = " ";
    ck_assert_int_eq(1, elm_code_text_is_whitespace(text, strlen(text)));
 
@@ -142,6 +160,7 @@ START_TEST (elm_code_text_is_whitespace_test)
 
    text = " . ";
    ck_assert_int_eq(0, elm_code_text_is_whitespace(text, strlen(text)));
+   elm_shutdown();
 }
 END_TEST
 
@@ -1,10 +1,12 @@
 #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)
 {
@@ -89,4 +91,3 @@ void elm_code_test_widget(TCase *tc)
    tcase_add_test(tc, elm_code_widget_construct);
    tcase_add_test(tc, elm_code_widget_construct_nocode);
 }
-
@@ -1,12 +1,13 @@
 #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)
 {
@@ -502,6 +503,7 @@ START_TEST (elm_code_test_widget_selection_select_line)
    selection = elm_code_widget_selection_text_get(widget);
    ck_assert_str_eq("line2", selection);
    free(selection);
+   elm_shutdown();
 }
 END_TEST
 
@@ -536,6 +538,7 @@ START_TEST (elm_code_test_widget_selection_select_word)
    selection = elm_code_widget_selection_text_get(widget);
    ck_assert_str_eq("stuff", selection);
    free(selection);
+   elm_shutdown();
 }
 END_TEST
 
@@ -574,6 +577,7 @@ START_TEST (elm_code_test_widget_selection_select_word_punctuation)
    selection = elm_code_widget_selection_text_get(widget);
    ck_assert_str_eq("mark", selection);
    free(selection);
+   elm_shutdown();
 }
 END_TEST
 
@@ -612,6 +616,7 @@ START_TEST (elm_code_test_widget_selection_select_word_symbols)
    selection = elm_code_widget_selection_text_get(widget);
    ck_assert_str_eq("braces", selection);
    free(selection);
+   elm_shutdown();
 }
 END_TEST
 
@@ -636,4 +641,3 @@ void elm_code_test_widget_selection(TCase *tc)
    tcase_add_test(tc, elm_code_test_widget_selection_select_word_punctuation);
    tcase_add_test(tc, elm_code_test_widget_selection_select_word_symbols);
 }
-
@@ -1,8 +1,11 @@
 #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)
 {
@@ -48,6 +51,7 @@ START_TEST (elm_code_test_widget_text_position)
 
    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
 
@@ -56,4 +60,3 @@ void elm_code_test_widget_text(TCase *tc)
    tcase_add_test(tc, elm_code_test_widget_text_tab_width);
    tcase_add_test(tc, elm_code_test_widget_text_position);
 }
-
@@ -1,9 +1,11 @@
 #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)
@@ -161,4 +163,3 @@ void elm_code_test_widget_undo(TCase *tc)
    tcase_add_test(tc, elm_code_test_widget_undo_newline);
    tcase_add_test(tc, elm_code_test_widget_undo_delete);
 }
-
index 75facc6..a612e7e 100644 (file)
@@ -71,6 +71,15 @@ static const Efl_Test_Case etc[] = {
   { "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 }
 };
 
index 1a19179..bf87d1b 100644 (file)
@@ -69,4 +69,15 @@ void elm_test_slideshow(TCase *tc);
 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 */
index 0bfc5ca..f0b44bb 100644 (file)
@@ -3,6 +3,19 @@
 
 #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 */