1
0
Fork 0

tests: Move clutter-test-utils.[ch] to src/tests

And add the necessary glue so those initialize a X11 clutter backend.
This should get Clutter tests that are dependent on windowing to work
again, thus they were enabled back again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
This commit is contained in:
Carlos Garnacho 2019-07-03 13:43:25 +02:00 committed by Jonas Ådahl
parent cfb8f18cef
commit cc7e843c44
29 changed files with 86 additions and 23 deletions

View file

@ -204,6 +204,7 @@ guint _clutter_pixel_to_id (guchar pixel[4]);
void _clutter_id_to_color (guint id, void _clutter_id_to_color (guint id,
ClutterColor *col); ClutterColor *col);
CLUTTER_EXPORT
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank); void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
/* use this function as the accumulator if you have a signal with /* use this function as the accumulator if you have a signal with

View file

@ -103,7 +103,6 @@
#include "clutter-stage-manager.h" #include "clutter-stage-manager.h"
#include "clutter-stage-view.h" #include "clutter-stage-view.h"
#include "clutter-tap-action.h" #include "clutter-tap-action.h"
#include "clutter-test-utils.h"
#include "clutter-texture.h" #include "clutter-texture.h"
#include "clutter-text.h" #include "clutter-text.h"
#include "clutter-timeline.h" #include "clutter-timeline.h"

View file

@ -77,7 +77,6 @@ clutter_headers = [
'clutter-stage-manager.h', 'clutter-stage-manager.h',
'clutter-stage-view.h', 'clutter-stage-view.h',
'clutter-tap-action.h', 'clutter-tap-action.h',
'clutter-test-utils.h',
'clutter-texture.h', 'clutter-texture.h',
'clutter-text.h', 'clutter-text.h',
'clutter-text-buffer.h', 'clutter-text-buffer.h',
@ -168,7 +167,6 @@ clutter_sources = [
'clutter-stage-view.c', 'clutter-stage-view.c',
'clutter-stage-window.c', 'clutter-stage-window.c',
'clutter-tap-action.c', 'clutter-tap-action.c',
'clutter-test-utils.c',
'clutter-text.c', 'clutter-text.c',
'clutter-text-buffer.c', 'clutter-text-buffer.c',
'clutter-transition-group.c', 'clutter-transition-group.c',

View file

@ -1,17 +1,8 @@
#include "clutter-build-config.h"
#include "clutter-test-utils.h" #include "clutter-test-utils.h"
#include <stdlib.h> #include <stdlib.h>
#include <glib-object.h> #include <glib-object.h>
#include <clutter/clutter.h>
#include "clutter-actor.h"
#include "clutter-color.h"
#include "clutter-event.h"
#include "clutter-keysyms.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-stage.h"
typedef struct { typedef struct {
ClutterActor *stage; ClutterActor *stage;

View file

@ -19,16 +19,23 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#ifndef __CLUTTER_TEST_UTILS_H__ #ifndef __CLUTTER_TEST_UTILS_H__
#define __CLUTTER_TEST_UTILS_H__ #define __CLUTTER_TEST_UTILS_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) #define __CLUTTER_H_INSIDE__
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-types.h> #include "clutter/clutter-types.h"
#include <clutter/clutter-actor.h> #include "clutter/clutter-actor.h"
#include <clutter/clutter-color.h> #include "clutter/clutter-color.h"
#include "clutter/clutter-private.h"
#include "core/main-private.h"
#include "meta/common.h"
#include "meta/main.h"
#include "backends/x11/nested/meta-backend-x11-nested.h"
#include "wayland/meta-wayland.h"
#include "wayland/meta-xwayland.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -79,12 +86,22 @@ G_BEGIN_DECLS
int \ int \
main (int argc, char *argv[]) \ main (int argc, char *argv[]) \
{ \ { \
char *display_name = g_strdup ("mutter-test-display-XXXXXX");\
int fd = g_mkstemp (display_name);\
meta_wayland_override_display_name (display_name);\
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,\
META_TYPE_BACKEND_X11_NESTED);\
\
meta_init ();\
\
clutter_test_init (&argc, &argv); \ clutter_test_init (&argc, &argv); \
\ \
{ \ { \
units \ units \
} \ } \
\ \
close (fd);\
g_free (display_name);\
return clutter_test_run (); \ return clutter_test_run (); \
} }

View file

@ -4,6 +4,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define NOTIFY_ANCHOR_X (1 << 0) #define NOTIFY_ANCHOR_X (1 << 0)
#define NOTIFY_ANCHOR_Y (1 << 1) #define NOTIFY_ANCHOR_Y (1 << 1)
#define NOTIFY_ANCHOR_GRAVITY (1 << 2) #define NOTIFY_ANCHOR_GRAVITY (1 << 2)

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TEST_TYPE_DESTROY (test_destroy_get_type ()) #define TEST_TYPE_DESTROY (test_destroy_get_type ())
#define TEST_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DESTROY, TestDestroy)) #define TEST_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DESTROY, TestDestroy))
#define TEST_IS_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_DESTROY)) #define TEST_IS_DESTROY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_DESTROY))

View file

@ -1,5 +1,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
actor_add_child (void) actor_add_child (void)
{ {

View file

@ -4,6 +4,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
actor_initial_state (void) actor_initial_state (void)
{ {

View file

@ -1,6 +1,8 @@
#include <glib.h> #include <glib.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
actor_iter_traverse_children (void) actor_iter_traverse_children (void)
{ {

View file

@ -1,5 +1,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
actor_basic_layout (void) actor_basic_layout (void)
{ {

View file

@ -3,6 +3,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
actor_meta_clear (void) actor_meta_clear (void)
{ {

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
typedef struct _FooActor FooActor; typedef struct _FooActor FooActor;
typedef struct _FooActorClass FooActorClass; typedef struct _FooActorClass FooActorClass;

View file

@ -1,6 +1,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <stdlib.h> #include <stdlib.h>
#include "tests/clutter-test-utils.h"
static void static void
opacity_label (void) opacity_label (void)
{ {

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define STAGE_WIDTH 640 #define STAGE_WIDTH 640
#define STAGE_HEIGHT 480 #define STAGE_HEIGHT 480
#define ACTORS_X 12 #define ACTORS_X 12

View file

@ -2,6 +2,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
/**************************************************************** /****************************************************************
Old style shader effect Old style shader effect
This uses clutter_shader_effect_set_source This uses clutter_shader_effect_set_source

View file

@ -3,6 +3,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TEST_TYPE_ACTOR (test_actor_get_type ()) #define TEST_TYPE_ACTOR (test_actor_get_type ())
typedef struct _TestActor TestActor; typedef struct _TestActor TestActor;

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
behaviour_opacity (void) behaviour_opacity (void)
{ {
@ -65,6 +67,12 @@ main (int argc, char *argv[])
{ {
int i; int i;
meta_wayland_override_display_name ("mutter-test-display");
meta_xwayland_override_display_number (512);
meta_override_compositor_configuration (META_COMPOSITOR_TYPE_WAYLAND,
META_TYPE_BACKEND_X11_NESTED);
meta_init ();
clutter_test_init (&argc, &argv); clutter_test_init (&argc, &argv);
for (i = 0; i < n_behaviour_tests; i++) for (i = 0; i < n_behaviour_tests; i++)

View file

@ -2,6 +2,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TYPE_KEY_GROUP (key_group_get_type ()) #define TYPE_KEY_GROUP (key_group_get_type ())
#define KEY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KEY_GROUP, KeyGroup)) #define KEY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KEY_GROUP, KeyGroup))
#define IS_KEY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_KEY_GROUP)) #define IS_KEY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_KEY_GROUP))

View file

@ -1,5 +1,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
color_hls_roundtrip (void) color_hls_roundtrip (void)
{ {

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
group_depth_sorting (void) group_depth_sorting (void)
{ {

View file

@ -1,5 +1,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
interval_initial_state (void) interval_initial_state (void)
{ {

View file

@ -59,6 +59,7 @@ foreach test : clutter_conform_tests
test_executable = executable('@0@'.format(test), test_executable = executable('@0@'.format(test),
sources: [ sources: [
'@0@.c'.format(test), '@0@.c'.format(test),
clutter_test_utils,
], ],
include_directories: clutter_includes, include_directories: clutter_includes,
c_args: clutter_tests_conform_c_args, c_args: clutter_tests_conform_c_args,
@ -66,7 +67,8 @@ foreach test : clutter_conform_tests
dependencies: [ dependencies: [
clutter_deps, clutter_deps,
libmutter_clutter_dep, libmutter_clutter_dep,
libmutter_cogl_path_dep libmutter_cogl_path_dep,
libmutter_dep
], ],
install: false, install: false,
) )

View file

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
rectangle_set_size (void) rectangle_set_size (void)
{ {

View file

@ -4,6 +4,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TEST_TYPE_GROUP (test_group_get_type ()) #define TEST_TYPE_GROUP (test_group_get_type ())
#define TEST_TYPE_GROUP_META (test_group_meta_get_type ()) #define TEST_TYPE_GROUP_META (test_group_meta_get_type ())

View file

@ -2,6 +2,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <string.h> #include <string.h>
#include "tests/clutter-test-utils.h"
typedef struct { typedef struct {
gunichar unichar; gunichar unichar;
const char bytes[6]; const char bytes[6];

View file

@ -2,6 +2,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <string.h> #include <string.h>
#include "tests/clutter-test-utils.h"
static CoglHandle static CoglHandle
make_texture (void) make_texture (void)
{ {

View file

@ -1,5 +1,7 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void static void
units_cache (void) units_cache (void)
{ {

View file

@ -1,6 +1,11 @@
#if have_clutter_tests clutter_test_utils = files (
# subdir('clutter') 'clutter-test-utils.c',
#endif 'clutter-test-utils.h',
)
if have_clutter_tests
subdir('clutter')
endif
tests_includepath = mutter_includes tests_includepath = mutter_includes
tests_c_args = mutter_c_args tests_c_args = mutter_c_args