mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
tests/cogl: Add unit test framework
It consists of only a macro and build description logic. Adds a macro for simpler tests that doesn't require a context; unit tests requiring a context should use the same framework as conform tests. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
This commit is contained in:
parent
4ebaa433ee
commit
9a9e7e471c
@ -74,5 +74,6 @@
|
||||
#endif /* COGL_DISABLE_DEPRECATION_WARNINGS */
|
||||
|
||||
#define COGL_EXPORT __attribute__((visibility("default"))) extern
|
||||
#define COGL_EXPORT_TEST __attribute__((visibility("default"))) extern
|
||||
|
||||
#endif /* __COGL_MACROS_H__ */
|
||||
|
@ -66,6 +66,18 @@ main (int argc, \
|
||||
META_TEST_RUN_FLAG_NONE); \
|
||||
}
|
||||
|
||||
#define COGL_TEST_SUITE_MINIMAL(units) \
|
||||
int \
|
||||
main (int argc, \
|
||||
char **argv) \
|
||||
{ \
|
||||
g_test_init (&argc, &argv, NULL); \
|
||||
\
|
||||
units \
|
||||
\
|
||||
return g_test_run (); \
|
||||
}
|
||||
|
||||
MetaContext * meta_create_cogl_test_context (int argc,
|
||||
char **argv);
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
subdir('conform')
|
||||
subdir('unit')
|
||||
|
38
src/tests/cogl/unit/meson.build
Normal file
38
src/tests/cogl/unit/meson.build
Normal file
@ -0,0 +1,38 @@
|
||||
cogl_unit_tests = [
|
||||
]
|
||||
|
||||
test_env = environment()
|
||||
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
|
||||
test_env.set('MUTTER_TEST_PLUGIN_PATH', '@0@'.format(default_plugin.full_path()))
|
||||
|
||||
foreach unit_test: cogl_unit_tests
|
||||
test_name = 'cogl-' + unit_test
|
||||
|
||||
test_executable = executable(test_name,
|
||||
sources: [
|
||||
unit_test + '.c',
|
||||
cogl_test_utils,
|
||||
],
|
||||
c_args: [
|
||||
'-D__COGL_H_INSIDE__',
|
||||
'-DCOGL_ENABLE_MUTTER_API',
|
||||
'-DCOGL_ENABLE_EXPERIMENTAL_API',
|
||||
'-DCOGL_DISABLE_DEPRECATED',
|
||||
'-DCOGL_DISABLE_DEPRECATION_WARNINGS',
|
||||
],
|
||||
include_directories: [
|
||||
cogl_includepath,
|
||||
],
|
||||
dependencies: [
|
||||
libmutter_test_dep,
|
||||
],
|
||||
)
|
||||
|
||||
test(test_name, test_executable,
|
||||
suite: ['cogl', 'cogl/unit'],
|
||||
env: test_env,
|
||||
is_parallel: false,
|
||||
)
|
||||
endforeach
|
Loading…
Reference in New Issue
Block a user