summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2016-02-04 14:21:44 +0100
committerTom Hacohen <tom@stosb.com>2016-02-16 12:41:06 +0000
commit885a1d2f7db673d1103f180cc517f4874067bd55 (patch)
treeaf3647a515c503a5c47cb35febf5083b2b5a265e /src/tests
parent401eba1b53f07fd01309f5798ecaea10f336b323 (diff)
Test rework #5: Edje
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/edje/edje_suite.c94
-rw-r--r--src/tests/edje/edje_test_edje.c2
2 files changed, 8 insertions, 88 deletions
diff --git a/src/tests/edje/edje_suite.c b/src/tests/edje/edje_suite.c
index 9284dbf319..416a0ec3f8 100644
--- a/src/tests/edje/edje_suite.c
+++ b/src/tests/edje/edje_suite.c
@@ -2,106 +2,26 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <Edje.h>
9
10#include "edje_suite.h" 5#include "edje_suite.h"
6#include "../efl_check.h"
11 7
12typedef struct _Edje_Test_Case Edje_Test_Case; 8static const Efl_Test_Case etc[] = {
13
14struct _Edje_Test_Case
15{
16 const char *test_case;
17 void (*build)(TCase *tc);
18};
19
20static const Edje_Test_Case etc[] = {
21 { "Edje", edje_test_edje }, 9 { "Edje", edje_test_edje },
22 { NULL, NULL } 10 { NULL, NULL }
23}; 11};
24 12
25static void
26_list_tests(void)
27{
28 const Edje_Test_Case *itr;
29
30 itr = etc;
31 fputs("Available Test Cases:\n", stderr);
32 for (; itr->test_case; itr++)
33 fprintf(stderr, "\t%s\n", itr->test_case);
34}
35static Eina_Bool
36_use_test(int argc, const char **argv, const char *test_case)
37{
38 if (argc < 1)
39 return 1;
40
41 for (; argc > 0; argc--, argv++)
42 if (strcmp(test_case, *argv) == 0)
43 return 1;
44 return 0;
45}
46
47static Suite *
48edje_suite_build(int argc, const char **argv)
49{
50 TCase *tc;
51 Suite *s;
52 int i;
53
54 s = suite_create("Edje");
55
56 for (i = 0; etc[i].test_case; ++i)
57 {
58 if (!_use_test(argc, argv, etc[i].test_case)) continue;
59 tc = tcase_create(etc[i].test_case);
60
61 etc[i].build(tc);
62
63 suite_add_tcase(s, tc);
64#ifndef _WIN32
65 tcase_set_timeout(tc, 0);
66#endif
67 }
68
69 return s;
70}
71
72int 13int
73main(int argc, char **argv) 14main(int argc, char **argv)
74{ 15{
75 Suite *s; 16 int failed_count;
76 SRunner *sr;
77 int i, failed_count;
78 17
79 for (i = 1; i < argc; i++) 18 if (!_efl_test_option_disp(argc, argv, etc))
80 if ((strcmp(argv[i], "-h") == 0) || 19 return 0;
81 (strcmp(argv[i], "--help") == 0))
82 {
83 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
84 argv[0]);
85 _list_tests();
86 return 0;
87 }
88 else if ((strcmp(argv[i], "-l") == 0) ||
89 (strcmp(argv[i], "--list") == 0))
90 {
91 _list_tests();
92 return 0;
93 }
94 20
95 putenv("EFL_RUN_IN_TREE=1"); 21 putenv("EFL_RUN_IN_TREE=1");
96 22
97 s = edje_suite_build(argc - 1, (const char **)argv + 1); 23 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
98 sr = srunner_create(s); 24 "Edje", etc);
99
100 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
101
102 srunner_run_all(sr, CK_ENV);
103 failed_count = srunner_ntests_failed(sr);
104 srunner_free(sr);
105 25
106 return (failed_count == 0) ? 0 : 255; 26 return (failed_count == 0) ? 0 : 255;
107} 27}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 407ff9af30..8d5f725e64 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -363,7 +363,7 @@ START_TEST(edje_test_color_class)
363END_TEST 363END_TEST
364 364
365void edje_test_edje(TCase *tc) 365void edje_test_edje(TCase *tc)
366{ 366{
367 tcase_add_test(tc, edje_test_edje_init); 367 tcase_add_test(tc, edje_test_edje_init);
368 tcase_add_test(tc,edje_test_load_simple_layout); 368 tcase_add_test(tc,edje_test_load_simple_layout);
369 tcase_add_test(tc, edje_test_edje_load); 369 tcase_add_test(tc, edje_test_edje_load);