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,
ClutterColor *col);
CLUTTER_EXPORT
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
/* 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-view.h"
#include "clutter-tap-action.h"
#include "clutter-test-utils.h"
#include "clutter-texture.h"
#include "clutter-text.h"
#include "clutter-timeline.h"

View File

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

View File

@ -1,17 +1,8 @@
#include "clutter-build-config.h"
#include "clutter-test-utils.h"
#include <stdlib.h>
#include <glib-object.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"
#include <clutter/clutter.h>
typedef struct {
ClutterActor *stage;

View File

@ -19,16 +19,23 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifndef __CLUTTER_TEST_UTILS_H__
#define __CLUTTER_TEST_UTILS_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#define __CLUTTER_H_INSIDE__
#include <clutter/clutter-types.h>
#include <clutter/clutter-actor.h>
#include <clutter/clutter-color.h>
#include "clutter/clutter-types.h"
#include "clutter/clutter-actor.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
@ -79,12 +86,22 @@ G_BEGIN_DECLS
int \
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); \
\
{ \
units \
} \
\
close (fd);\
g_free (display_name);\
return clutter_test_run (); \
}

View File

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

View File

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TEST_TYPE_DESTROY (test_destroy_get_type ())
#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))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
static void
behaviour_opacity (void)
{
@ -65,6 +67,12 @@ main (int argc, char *argv[])
{
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);
for (i = 0; i < n_behaviour_tests; i++)

View File

@ -2,6 +2,8 @@
#include <clutter/clutter.h>
#include "tests/clutter-test-utils.h"
#define TYPE_KEY_GROUP (key_group_get_type ())
#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))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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