summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 02:08:14 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 02:08:14 +0000
commit9ea2ce1041549c90f94062ce5ec145056e7fbdfa (patch)
tree3bcd3fb016bc498a72ff99c8d67c8b7ef2d91718 /src/tests/edje
parente2ce20e9a4dfd12bb383a1b60032f2ef7b507850 (diff)
efl: merge edje.
this is still in progress, mostly the multisense stuff is pending. it seems that when we merge ecore_audio in edje the libremix and similar are gone, at least from Edje, and will be in ecore_audio itself (or pulseaudio). Changes: * __UNUSED__ to EINA_UNUSED * binaries (epp, embryo_cc, edje_cc) now consider EFL_RUN_IN_TREE and will assume the binaries are still not installed, running from build tree location (needs more testing, maybe doesn't work with srcdir != builddir, still doesn't solve cross compile builds) SVN revision: 82139
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/edje_suite.c101
-rw-r--r--src/tests/edje/edje_suite.h9
-rw-r--r--src/tests/edje/edje_test_edje.c28
3 files changed, 138 insertions, 0 deletions
diff --git a/src/tests/edje/edje_suite.c b/src/tests/edje/edje_suite.c
new file mode 100644
index 0000000000..ad789b65df
--- /dev/null
+++ b/src/tests/edje/edje_suite.c
@@ -0,0 +1,101 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <Edje.h>
9
10#include "edje_suite.h"
11
12typedef struct _Edje_Test_Case Edje_Test_Case;
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 },
22 { NULL, NULL }
23};
24
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 tcase_set_timeout(tc, 0);
65 }
66
67 return s;
68}
69
70int
71main(int argc, char **argv)
72{
73 Suite *s;
74 SRunner *sr;
75 int i, failed_count;
76
77 for (i = 1; i < argc; i++)
78 if ((strcmp(argv[i], "-h") == 0) ||
79 (strcmp(argv[i], "--help") == 0))
80 {
81 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
82 argv[0]);
83 _list_tests();
84 return 0;
85 }
86 else if ((strcmp(argv[i], "-l") == 0) ||
87 (strcmp(argv[i], "--list") == 0))
88 {
89 _list_tests();
90 return 0;
91 }
92
93 s = edje_suite_build(argc - 1, (const char **)argv + 1);
94 sr = srunner_create(s);
95
96 srunner_run_all(sr, CK_ENV);
97 failed_count = srunner_ntests_failed(sr);
98 srunner_free(sr);
99
100 return (failed_count == 0) ? 0 : 255;
101}
diff --git a/src/tests/edje/edje_suite.h b/src/tests/edje/edje_suite.h
new file mode 100644
index 0000000000..35ab20d793
--- /dev/null
+++ b/src/tests/edje/edje_suite.h
@@ -0,0 +1,9 @@
1#ifndef _EDJE_SUITE_H
2#define _EDJE_SUITE_H
3
4#include <check.h>
5
6void edje_test_edje(TCase *tc);
7
8
9#endif /* _EDJE_SUITE_H */
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
new file mode 100644
index 0000000000..ad92c63d6b
--- /dev/null
+++ b/src/tests/edje/edje_test_edje.c
@@ -0,0 +1,28 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <unistd.h>
6#include <stdio.h>
7
8#include <Eina.h>
9#include <Edje.h>
10
11#include "edje_suite.h"
12
13START_TEST(edje_test_edje_init)
14{
15 int ret;
16
17 ret = edje_init();
18 fail_if(ret != 1);
19
20 ret = edje_shutdown();
21 fail_if(ret != 0);
22}
23END_TEST
24
25void edje_test_edje(TCase *tc)
26{
27 tcase_add_test(tc, edje_test_edje_init);
28}