9
10
#include "test-utils.h"
13
skip_init (TestUtilsGTestFixture *fixture,
20
skip_test (TestUtilsGTestFixture *fixture,
27
skip_fini (TestUtilsGTestFixture *fixture,
35
run_todo_test (TestUtilsGTestFixture *fixture,
39
TestUtilsSharedState *state = data;
41
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
43
state->todo_func (fixture, data);
47
g_test_trap_assert_failed ();
52
verify_failure (TestUtilsGTestFixture *fixture,
58
12
static TestUtilsSharedState *shared_state = NULL;
60
/* This is a bit of sugar for adding new conformance tests:
62
* - It adds an extern function definition just to save maintaining a header
63
* that lists test entry points.
64
* - It sets up callbacks for a fixture, which lets us share initialization
65
* code between tests. (see test-utils.c)
66
* - It passes in a shared data pointer that is initialised once in main(),
67
* that gets passed to the fixture setup and test functions. (See the
68
* definition in test-utils.h)
70
#define ADD_TEST(NAMESPACE, FUNC) G_STMT_START { \
71
extern void FUNC (TestUtilsGTestFixture *, void *); \
72
g_test_add ("/conform" NAMESPACE "/" #FUNC, \
73
TestUtilsGTestFixture, \
74
shared_state, /* data argument for test */ \
77
test_utils_fini); } G_STMT_END
79
/* this is a macro that conditionally executes a test if CONDITION
80
* evaluates to TRUE; otherwise, it will put the test under the
81
* "/skip" namespace and execute a dummy function that will always
84
#define ADD_CONDITIONAL_TEST(CONDITION, NAMESPACE, FUNC) G_STMT_START { \
86
g_test_add ("/skipped" NAMESPACE "/" #FUNC, \
87
TestUtilsGTestFixture, \
88
shared_state, /* data argument for test */ \
92
} else { ADD_TEST (NAMESPACE, FUNC); } } G_STMT_END
94
#define ADD_TODO_TEST(NAMESPACE, FUNC) G_STMT_START { \
95
extern void FUNC (TestUtilsGTestFixture *, void *); \
96
shared_state->todo_func = FUNC; \
97
g_test_add ("/todo" NAMESPACE "/" #FUNC, \
98
TestUtilsGTestFixture, \
101
(void *)(run_todo_test), \
102
test_utils_fini); } G_STMT_END
104
#define UNPORTED_TEST(NAMESPACE, FUNC)
107
clutter_test_get_data_file (const gchar *filename)
109
return g_build_filename (TESTS_DATADIR, filename, NULL);
14
/* A bit of sugar for adding new conformance tests */
15
#define ADD_TEST(FUNC, REQUIREMENTS) G_STMT_START { \
16
extern void FUNC (TestUtilsGTestFixture *, void *); \
17
if (strcmp (#FUNC, argv[1]) == 0) \
19
test_utils_init (shared_state, REQUIREMENTS); \
20
FUNC (NULL, shared_state); \
21
test_utils_fini (shared_state); \
26
#define UNPORTED_TEST(FUNC)
113
29
main (int argc, char **argv)
115
g_test_init (&argc, &argv, NULL);
117
g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=%s");
35
g_printerr ("usage %s UNIT_TEST\n", argv[0]);
39
/* Just for convenience in case people try passing the wrapper
40
* filenames for the UNIT_TEST argument we normalize '-' characters
41
* to '_' characters... */
42
for (i = 0; argv[1][i]; i++)
44
if (argv[1][i] == '-')
119
48
/* Initialise the state you need to share with everything.
125
54
/* This file is run through a sed script during the make step so the
126
55
* lines containing the tests need to be formatted on a single line
127
* each. To comment out a test use the SKIP or TODO macros. Using
128
* #if 0 would break the script. */
130
/* sanity check for the test suite itself */
131
ADD_TODO_TEST ("/suite", verify_failure);
133
UNPORTED_TEST ("/cogl", test_cogl_object);
134
UNPORTED_TEST ("/cogl", test_cogl_fixed);
135
UNPORTED_TEST ("/cogl", test_cogl_materials);
136
UNPORTED_TEST ("/cogl", test_cogl_pipeline_user_matrix);
137
UNPORTED_TEST ("/cogl", test_cogl_blend_strings);
138
UNPORTED_TEST ("/cogl", test_cogl_premult);
139
UNPORTED_TEST ("/cogl", test_cogl_readpixels);
140
UNPORTED_TEST ("/cogl", test_cogl_path);
141
ADD_TEST ("/cogl", test_cogl_depth_test);
142
ADD_TEST ("/cogl", test_cogl_color_mask);
143
ADD_TEST ("/cogl", test_cogl_backface_culling);
145
UNPORTED_TEST ("/cogl/texture", test_cogl_npot_texture);
146
UNPORTED_TEST ("/cogl/texture", test_cogl_multitexture);
147
UNPORTED_TEST ("/cogl/texture", test_cogl_texture_mipmaps);
148
UNPORTED_TEST ("/cogl/texture", test_cogl_sub_texture);
149
UNPORTED_TEST ("/cogl/texture", test_cogl_pixel_array);
150
UNPORTED_TEST ("/cogl/texture", test_cogl_texture_rectangle);
151
UNPORTED_TEST ("/cogl/texture", test_cogl_texture_3d);
152
UNPORTED_TEST ("/cogl/texture", test_cogl_wrap_modes);
153
UNPORTED_TEST ("/cogl/texture", test_cogl_texture_pixmap_x11);
154
UNPORTED_TEST ("/cogl/texture", test_cogl_texture_get_set_data);
155
UNPORTED_TEST ("/cogl/texture", test_cogl_atlas_migration);
157
UNPORTED_TEST ("/cogl/vertex-buffer", test_cogl_vertex_buffer_contiguous);
158
UNPORTED_TEST ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
159
UNPORTED_TEST ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
161
UNPORTED_TEST ("/cogl/vertex-array", test_cogl_primitive);
163
UNPORTED_TEST ("/cogl/shaders", test_cogl_just_vertex_shader);
165
/* left to the end because they aren't currently very orthogonal and tend to
166
* break subsequent tests! */
167
UNPORTED_TEST ("/cogl", test_cogl_viewport);
168
UNPORTED_TEST ("/cogl", test_cogl_offscreen);
170
return g_test_run ();
59
UNPORTED_TEST (test_cogl_object);
60
UNPORTED_TEST (test_cogl_fixed);
61
UNPORTED_TEST (test_cogl_materials);
62
ADD_TEST (test_cogl_pipeline_user_matrix, 0);
63
ADD_TEST (test_cogl_blend_strings, 0);
64
UNPORTED_TEST (test_cogl_premult);
65
UNPORTED_TEST (test_cogl_readpixels);
66
ADD_TEST (test_cogl_path, 0);
67
ADD_TEST (test_cogl_depth_test, 0);
68
ADD_TEST (test_cogl_color_mask, 0);
69
ADD_TEST (test_cogl_backface_culling, TEST_REQUIREMENT_NPOT);
71
ADD_TEST (test_cogl_sparse_pipeline, 0);
73
UNPORTED_TEST (test_cogl_npot_texture);
74
UNPORTED_TEST (test_cogl_multitexture);
75
UNPORTED_TEST (test_cogl_texture_mipmaps);
76
ADD_TEST (test_cogl_sub_texture, 0);
77
ADD_TEST (test_cogl_pixel_buffer, 0);
78
UNPORTED_TEST (test_cogl_texture_rectangle);
79
ADD_TEST (test_cogl_texture_3d, 0);
80
ADD_TEST (test_cogl_wrap_modes, 0);
81
UNPORTED_TEST (test_cogl_texture_pixmap_x11);
82
UNPORTED_TEST (test_cogl_texture_get_set_data);
83
UNPORTED_TEST (test_cogl_atlas_migration);
84
ADD_TEST (test_cogl_read_texture_formats, 0);
85
ADD_TEST (test_cogl_write_texture_formats, 0);
87
UNPORTED_TEST (test_cogl_vertex_buffer_contiguous);
88
UNPORTED_TEST (test_cogl_vertex_buffer_interleved);
89
UNPORTED_TEST (test_cogl_vertex_buffer_mutability);
91
ADD_TEST (test_cogl_primitive, 0);
93
ADD_TEST (test_cogl_just_vertex_shader, 0);
94
ADD_TEST (test_cogl_pipeline_uniforms, 0);
95
ADD_TEST (test_cogl_snippets, 0);
96
ADD_TEST (test_cogl_custom_attributes, 0);
98
ADD_TEST (test_cogl_bitmask, 0);
100
ADD_TEST (test_cogl_offscreen, 0);
102
UNPORTED_TEST (test_cogl_viewport);
104
g_printerr ("Unknown test name \"%s\"\n", argv[1]);