Test rework #20: Evas
authorVincent Torri <vincent dot torri at gmail dot com>
Thu, 4 Feb 2016 14:11:52 +0000 (15:11 +0100)
committerTom Hacohen <tom@stosb.com>
Tue, 16 Feb 2016 12:41:06 +0000 (12:41 +0000)
14 files changed:
src/tests/evas/evas_suite.c
src/tests/evas/evas_test_callbacks.c
src/tests/evas/evas_test_evasgl.c
src/tests/evas/evas_test_filters.c
src/tests/evas/evas_test_image.c
src/tests/evas/evas_test_init.c
src/tests/evas/evas_test_mask.c
src/tests/evas/evas_test_matrix.c
src/tests/evas/evas_test_mesh.c
src/tests/evas/evas_test_object.c
src/tests/evas/evas_test_object_smart.c
src/tests/evas/evas_test_render_engines.c
src/tests/evas/evas_test_text.c
src/tests/evas/evas_test_textblock.c

index 3654ab6..3021f2c 100644 (file)
@@ -2,22 +2,12 @@
 # include <config.h>
 #endif
 
-#include <stdlib.h>
-#include <stdio.h>
-
 #include <Evas.h>
 
 #include "evas_suite.h"
+#include "../efl_check.h"
 
-typedef struct _Evas_Test_Case Evas_Test_Case;
-
-struct _Evas_Test_Case
-{
-   const char *test_case;
-   void      (*build)(TCase *tc);
-};
-
-static const Evas_Test_Case etc[] = {
+static const Efl_Test_Case etc[] = {
   { "Evas", evas_test_init },
   { "Object", evas_test_object },
   { "Object Textblock", evas_test_textblock },
@@ -34,88 +24,22 @@ static const Evas_Test_Case etc[] = {
   { NULL, NULL }
 };
 
-static void
-_list_tests(void)
-{
-  const Evas_Test_Case *itr;
-
-   itr = etc;
-   fputs("Available Test Cases:\n", stderr);
-   for (; itr->test_case; itr++)
-     fprintf(stderr, "\t%s\n", itr->test_case);
-}
-static Eina_Bool
-_use_test(int argc, const char **argv, const char *test_case)
-{
-   if (argc < 1)
-     return 1;
-
-   for (; argc > 0; argc--, argv++)
-     if (strcmp(test_case, *argv) == 0)
-       return 1;
-   return 0;
-}
-
-static Suite *
-evas_suite_build(int argc, const char **argv)
-{
-   TCase *tc;
-   Suite *s;
-   int i;
-
-   s = suite_create("Evas");
-
-   for (i = 0; etc[i].test_case; ++i)
-     {
-       if (!_use_test(argc, argv, etc[i].test_case)) continue;
-       tc = tcase_create(etc[i].test_case);
-
-       etc[i].build(tc);
-
-       suite_add_tcase(s, tc);
-#ifndef _WIN32
-       tcase_set_timeout(tc, 0);
-#endif
-     }
-
-   return s;
-}
-
 int
 main(int argc, char **argv)
 {
-   Suite *s;
-   SRunner *sr;
-   int i, failed_count;
+   int failed_count;
 
-   for (i = 1; i < argc; i++)
-     if ((strcmp(argv[i], "-h") == 0) ||
-        (strcmp(argv[i], "--help") == 0))
-       {
-         fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
-                 argv[0]);
-         _list_tests();
-         return 0;
-       }
-     else if ((strcmp(argv[i], "-l") == 0) ||
-             (strcmp(argv[i], "--list") == 0))
-       {
-         _list_tests();
-         return 0;
-       }
+   if (!_efl_test_option_disp(argc, argv, etc))
+     return 0;
 
    putenv("EFL_RUN_IN_TREE=1");
 
    evas_init();
-   s = evas_suite_build(argc - 1, (const char **)argv + 1);
-   sr = srunner_create(s);
 
-   srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
-
-   srunner_run_all(sr, CK_ENV);
-   failed_count = srunner_ntests_failed(sr);
-   srunner_free(sr);
+   failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
+                                           "Evas", etc);
 
    evas_shutdown();
+
    return (failed_count == 0) ? 0 : 255;
 }
index f424435..3f83847 100644 (file)
@@ -1,12 +1,12 @@
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 #include <stdio.h>
 
+#include <Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 #define START_CALLBACK_TEST() \
index 3263cfa..181ed2b 100644 (file)
 #endif
 
 #define EFL_GFX_FILTER_BETA
+
+#include <Evas.h>
+#include <Evas_GL.h>
+#include <Ecore_Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
-#include "Evas_GL.h"
-#include "Ecore_Evas.h"
 
 static int
 _detect_osmesa(void)
index 188bb0b..47e9b4c 100644 (file)
 #include <stdio.h>
 
 #define EFL_GFX_FILTER_BETA
-#include "evas_suite.h"
-#include "Evas.h"
-#include "Ecore_Evas.h"
+
+#include <Evas.h>
 #include "../../lib/evas/include/evas_filter.h"
+#include <Ecore_Evas.h>
+
+#include "evas_suite.h"
 
 #define TEST_FONT_NAME "DejaVuSans,UnDotum"
 #define TEST_FONT_SOURCE TESTS_SRC_DIR "/TestFont.eet"
index cfb0f94..e56db7e 100644 (file)
@@ -2,13 +2,14 @@
 # include "config.h"
 #endif
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <stdio.h>
+
+#include <Evas.h>
 
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 #define TESTS_IMG_DIR TESTS_SRC_DIR"/images"
index 7637d9c..827798f 100644 (file)
@@ -1,12 +1,12 @@
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 #include <stdio.h>
 
+#include <Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
 
 START_TEST(evas_simple)
 {
index 1f05512..d3518d0 100644 (file)
@@ -4,9 +4,10 @@
 
 #ifdef BUILD_ENGINE_BUFFER
 
+#include <Evas.h>
+#include <Ecore_Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
-#include "Ecore_Evas.h"
 #include "evas_tests_helpers.h"
 
 #define TEST_FONT_NAME "DejaVuSans,UnDotum"
index d365d24..b6df8f2 100644 (file)
@@ -2,15 +2,16 @@
 # include "config.h"
 #endif
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <stdio.h>
 
+#include <Evas.h>
 #include "../../lib/evas/include/evas_common_private.h"
 #include "../../lib/evas/include/evas_private.h"
+
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 START_TEST(evas_matrix)
index fe82f57..d70ab32 100644 (file)
@@ -2,13 +2,14 @@
 # include "config.h"
 #endif
 
-#include <unistd.h>
 #include <stdio.h>
+#include <unistd.h>
 
+#include <Evas.h>
 #include "../../lib/evas/include/evas_common_private.h"
 #include "../../lib/evas/include/evas_private.h"
+
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 #define TESTS_MESH_DIR TESTS_SRC_DIR"/meshes"
index 48770b7..6b722a5 100644 (file)
@@ -4,8 +4,9 @@
 
 #include <stdio.h>
 
+#include <Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 START_TEST(evas_object_various)
index 6f31197..23a43b7 100644 (file)
@@ -8,10 +8,11 @@
 #endif
 
 #include <stdio.h>
+
 #include <Eina.h>
+#include <Evas.h>
 
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 #define TEST_FONT_SOURCE TESTS_SRC_DIR "/TestFont.eet"
index 0f98bcc..3f3ab09 100644 (file)
@@ -4,8 +4,9 @@
 
 #include <stdio.h>
 
+#include <Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
 
 static Eina_Bool
 _find_list(const Eina_List *lst, const char *item)
index fe5644a..746fbee 100644 (file)
@@ -5,8 +5,9 @@
 
 #include <stdio.h>
 
+#include <Evas.h>
+
 #include "evas_suite.h"
-#include "Evas.h"
 #include "evas_tests_helpers.h"
 
 #define TEST_FONT_NAME "DejaVuSans,UnDotum"
index 895021b..379bc2e 100644 (file)
@@ -8,16 +8,14 @@
 #endif
 
 #include <stdio.h>
+#include <locale.h>
 
 #include <Eina.h>
+#include <Evas.h>
 
 #include "evas_suite.h"
-#include "Evas.h"
-
 #include "evas_tests_helpers.h"
 
-#include <locale.h>
-
 /* Functions defined in evas_object_textblock.c */
 EAPI Eina_Bool
 _evas_textblock_check_item_node_link(Evas_Object *obj);