1
0
Fork 0

tests: Split up 'native-unit' test

It had three different parts that deserve their own actual test cases
  * virtual monitors
  * screen casting
  * bezier

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3973>
This commit is contained in:
Jonas Ådahl 2024-08-21 22:49:13 +02:00 committed by Marge Bot
parent 1a0be0232a
commit d9b6101b15
10 changed files with 71 additions and 135 deletions

View file

@ -353,21 +353,30 @@ test_cases += [
'sources': [ 'kms-utils-unit-tests.c', ], 'sources': [ 'kms-utils-unit-tests.c', ],
}, },
{ {
'name': 'native-unit', 'name': 'native-virtual-monitor',
'suite': 'backends/native', 'suite': 'backends/native',
'sources': [ 'sources': [
'native-headless.c',
'native-screen-cast.c',
'native-screen-cast.h',
'native-virtual-monitor.c', 'native-virtual-monitor.c',
'native-virtual-monitor.h', ],
'native-bezier-tests.c', },
{
'name': 'native-screen-cast',
'suite': 'backends/native',
'sources': [
'native-screen-cast.c',
], ],
'depends': [ 'depends': [
screen_cast_client, screen_cast_client,
], ],
'launch': [ 'pipewire', 'wireplumber' ], 'launch': [ 'pipewire', 'wireplumber' ],
}, },
{
'name': 'bezier',
'suite': 'backends/native',
'sources': [
'native-bezier-tests.c',
],
},
{ {
'name': 'pointer-constraints', 'name': 'pointer-constraints',
'suite': 'backends/native', 'suite': 'backends/native',

View file

@ -18,9 +18,8 @@
#include "config.h" #include "config.h"
#include "native-bezier-tests.h"
#include "backends/native/meta-bezier.h" #include "backends/native/meta-bezier.h"
#include "tests/meta-test/meta-context-test.h"
static void static void
meta_test_bezier_linear (void) meta_test_bezier_linear (void)
@ -116,8 +115,8 @@ meta_test_bezier_snake (void)
} }
} }
void static void
init_bezier_tests (void) init_tests (void)
{ {
g_test_add_func ("/backends/bezier/linear", meta_test_bezier_linear); g_test_add_func ("/backends/bezier/linear", meta_test_bezier_linear);
g_test_add_func ("/backends/bezier/steep", meta_test_bezier_steep); g_test_add_func ("/backends/bezier/steep", meta_test_bezier_steep);
@ -125,3 +124,18 @@ init_bezier_tests (void)
g_test_add_func ("/backends/bezier/snake", meta_test_bezier_snake); g_test_add_func ("/backends/bezier/snake", meta_test_bezier_snake);
} }
int
main (int argc,
char **argv)
{
g_autoptr (MetaContext) context = NULL;
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
META_CONTEXT_TEST_FLAG_NO_X11);
g_assert (meta_context_configure (context, &argc, &argv, NULL));
init_tests ();
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View file

@ -1,21 +0,0 @@
/*
* Copyright (C) 2023 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
void init_bezier_tests (void);

View file

@ -1,48 +0,0 @@
/*
* Copyright (C) 2021 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include "meta-test/meta-context-test.h"
#include "tests/native-bezier-tests.h"
#include "tests/native-screen-cast.h"
#include "tests/native-virtual-monitor.h"
static void
init_tests (MetaContext *context)
{
init_virtual_monitor_tests (context);
init_screen_cast_tests ();
init_bezier_tests ();
}
int
main (int argc,
char **argv)
{
g_autoptr (MetaContext) context = NULL;
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
META_CONTEXT_TEST_FLAG_NO_X11);
g_assert (meta_context_configure (context, &argc, &argv, NULL));
init_tests (context);
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View file

@ -31,8 +31,6 @@
#include "tests/meta-test-utils.h" #include "tests/meta-test-utils.h"
#include "tests/meta-wayland-test-driver.h" #include "tests/meta-wayland-test-driver.h"
#include "tests/meta-wayland-test-utils.h" #include "tests/meta-wayland-test-utils.h"
#include "tests/native-screen-cast.h"
#include "tests/native-virtual-monitor.h"
#include "wayland/meta-cursor-sprite-wayland.h" #include "wayland/meta-cursor-sprite-wayland.h"
#include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-seat.h" #include "wayland/meta-wayland-seat.h"

View file

@ -24,8 +24,6 @@
#include "meta-test/meta-context-test.h" #include "meta-test/meta-context-test.h"
#include "meta/meta-backend.h" #include "meta/meta-backend.h"
#include "tests/meta-test-utils.h" #include "tests/meta-test-utils.h"
#include "tests/native-screen-cast.h"
#include "tests/native-virtual-monitor.h"
static MetaContext *test_context; static MetaContext *test_context;

View file

@ -18,13 +18,12 @@
#include "config.h" #include "config.h"
#include "tests/native-screen-cast.h"
#include <errno.h> #include <errno.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <unistd.h> #include <unistd.h>
#include "meta/util.h" #include "meta/util.h"
#include "tests/meta-test/meta-context-test.h"
static void static void
test_client_exited (GObject *source_object, test_client_exited (GObject *source_object,
@ -82,9 +81,25 @@ meta_test_screen_cast_record_virtual (void)
meta_remove_verbose_topic (META_DEBUG_SCREEN_CAST); meta_remove_verbose_topic (META_DEBUG_SCREEN_CAST);
} }
void static void
init_screen_cast_tests (void) init_tests (void)
{ {
g_test_add_func ("/backends/native/screen-cast/record-virtual", g_test_add_func ("/backends/native/screen-cast/record-virtual",
meta_test_screen_cast_record_virtual); meta_test_screen_cast_record_virtual);
} }
int
main (int argc,
char **argv)
{
g_autoptr (MetaContext) context = NULL;
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
META_CONTEXT_TEST_FLAG_NO_X11);
g_assert (meta_context_configure (context, &argc, &argv, NULL));
init_tests ();
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View file

@ -1,21 +0,0 @@
/*
* Copyright (C) 2021 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
void init_screen_cast_tests (void);

View file

@ -18,14 +18,13 @@
#include "config.h" #include "config.h"
#include "tests/native-virtual-monitor.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h" #include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-config-manager.h" #include "backends/meta-monitor-config-manager.h"
#include "backends/meta-virtual-monitor.h" #include "backends/meta-virtual-monitor.h"
#include "backends/native/meta-renderer-native.h" #include "backends/native/meta-renderer-native.h"
#include "tests/meta-ref-test.h" #include "tests/meta-ref-test.h"
#include "tests/meta-test/meta-context-test.h"
static MetaContext *test_context; static MetaContext *test_context;
@ -127,11 +126,27 @@ meta_test_virtual_monitor_create (void)
clutter_actor_destroy (actor); clutter_actor_destroy (actor);
} }
void static void
init_virtual_monitor_tests (MetaContext *context) init_tests (MetaContext *context)
{ {
test_context = context; test_context = context;
g_test_add_func ("/backends/native/virtual-monitor/create", g_test_add_func ("/backends/native/virtual-monitor/create",
meta_test_virtual_monitor_create); meta_test_virtual_monitor_create);
} }
int
main (int argc,
char **argv)
{
g_autoptr (MetaContext) context = NULL;
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
META_CONTEXT_TEST_FLAG_NO_X11);
g_assert (meta_context_configure (context, &argc, &argv, NULL));
init_tests (context);
return meta_context_test_run_tests (META_CONTEXT_TEST (context),
META_TEST_RUN_FLAG_NONE);
}

View file

@ -1,23 +0,0 @@
/*
* Copyright (C) 2021 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
typedef struct _MetaContext MetaContext;
void init_virtual_monitor_tests (MetaContext *context);