tests/monitor-unit-tests: Run a client while testing
Run a client while testing and check that it's alive when checking each monitor configuration. https://bugzilla.gnome.org/show_bug.cgi?id=730551
This commit is contained in:
parent
fa9c09feee
commit
e2d904c32b
@ -43,6 +43,8 @@ mutter_test_runner_SOURCES = \
|
|||||||
mutter_test_runner_LDADD = $(MUTTER_LIBS) libmutter-$(LIBMUTTER_API_VERSION).la
|
mutter_test_runner_LDADD = $(MUTTER_LIBS) libmutter-$(LIBMUTTER_API_VERSION).la
|
||||||
|
|
||||||
mutter_test_unit_tests_SOURCES = \
|
mutter_test_unit_tests_SOURCES = \
|
||||||
|
tests/test-utils.c \
|
||||||
|
tests/test-utils.h \
|
||||||
tests/unit-tests.c \
|
tests/unit-tests.c \
|
||||||
tests/meta-backend-test.c \
|
tests/meta-backend-test.c \
|
||||||
tests/meta-backend-test.h \
|
tests/meta-backend-test.h \
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "backends/meta-monitor-config-store.h"
|
#include "backends/meta-monitor-config-store.h"
|
||||||
#include "tests/meta-monitor-manager-test.h"
|
#include "tests/meta-monitor-manager-test.h"
|
||||||
#include "tests/monitor-test-utils.h"
|
#include "tests/monitor-test-utils.h"
|
||||||
|
#include "tests/test-utils.h"
|
||||||
|
|
||||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||||
|
|
||||||
@ -313,6 +314,53 @@ static MonitorTestCase initial_test_case = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static TestClient *monitor_test_client = NULL;
|
||||||
|
|
||||||
|
#define TEST_CLIENT_NAME "client1"
|
||||||
|
#define TEST_CLIENT_WINDOW "window1"
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_monitor_test_client (void)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
monitor_test_client = test_client_new (TEST_CLIENT_NAME,
|
||||||
|
META_WINDOW_CLIENT_TYPE_WAYLAND,
|
||||||
|
&error);
|
||||||
|
if (!monitor_test_client)
|
||||||
|
g_error ("Failed to launch test client: %s", error->message);
|
||||||
|
|
||||||
|
if (!test_client_do (monitor_test_client, &error,
|
||||||
|
"create", TEST_CLIENT_WINDOW,
|
||||||
|
NULL))
|
||||||
|
g_error ("Failed to create window: %s", error->message);
|
||||||
|
|
||||||
|
if (!test_client_do (monitor_test_client, &error,
|
||||||
|
"show", TEST_CLIENT_WINDOW,
|
||||||
|
NULL))
|
||||||
|
g_error ("Failed to show the window: %s", error->message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_monitor_test_client_state (void)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (!test_client_wait (monitor_test_client, &error))
|
||||||
|
g_error ("Failed to sync test client: %s", error->message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
destroy_monitor_test_client (void)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (!test_client_quit (monitor_test_client, &error))
|
||||||
|
g_error ("Failed to quit test client: %s", error->message);
|
||||||
|
|
||||||
|
test_client_destroy (monitor_test_client);
|
||||||
|
}
|
||||||
|
|
||||||
static MetaOutput *
|
static MetaOutput *
|
||||||
output_from_winsys_id (MetaMonitorManager *monitor_manager,
|
output_from_winsys_id (MetaMonitorManager *monitor_manager,
|
||||||
long winsys_id)
|
long winsys_id)
|
||||||
@ -782,6 +830,8 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_monitor_test_client_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4876,3 +4926,15 @@ init_monitor_tests (void)
|
|||||||
add_monitor_test ("/backends/monitor/migrated/rotated",
|
add_monitor_test ("/backends/monitor/migrated/rotated",
|
||||||
meta_test_monitor_migrated_rotated);
|
meta_test_monitor_migrated_rotated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pre_run_monitor_tests (void)
|
||||||
|
{
|
||||||
|
create_monitor_test_client ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish_monitor_tests (void)
|
||||||
|
{
|
||||||
|
destroy_monitor_test_client ();
|
||||||
|
}
|
||||||
|
@ -22,4 +22,8 @@
|
|||||||
|
|
||||||
void init_monitor_tests (void);
|
void init_monitor_tests (void);
|
||||||
|
|
||||||
|
void pre_run_monitor_tests (void);
|
||||||
|
|
||||||
|
void finish_monitor_tests (void);
|
||||||
|
|
||||||
#endif /* MONITOR_UNIT_TESTS_H */
|
#endif /* MONITOR_UNIT_TESTS_H */
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "tests/monitor-config-migration-unit-tests.h"
|
#include "tests/monitor-config-migration-unit-tests.h"
|
||||||
#include "tests/monitor-unit-tests.h"
|
#include "tests/monitor-unit-tests.h"
|
||||||
#include "tests/monitor-store-unit-tests.h"
|
#include "tests/monitor-store-unit-tests.h"
|
||||||
|
#include "tests/test-utils.h"
|
||||||
#include "wayland/meta-wayland.h"
|
#include "wayland/meta-wayland.h"
|
||||||
|
|
||||||
typedef struct _MetaTestLaterOrderCallbackData
|
typedef struct _MetaTestLaterOrderCallbackData
|
||||||
@ -225,8 +226,12 @@ run_tests (gpointer data)
|
|||||||
settings,
|
settings,
|
||||||
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
|
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
|
||||||
|
|
||||||
|
pre_run_monitor_tests ();
|
||||||
|
|
||||||
ret = g_test_run ();
|
ret = g_test_run ();
|
||||||
|
|
||||||
|
finish_monitor_tests ();
|
||||||
|
|
||||||
meta_quit (ret != 0);
|
meta_quit (ret != 0);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -252,6 +257,7 @@ init_tests (int argc, char **argv)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
test_init (argc, argv);
|
||||||
init_tests (argc, argv);
|
init_tests (argc, argv);
|
||||||
|
|
||||||
meta_plugin_manager_load ("default");
|
meta_plugin_manager_load ("default");
|
||||||
|
Loading…
Reference in New Issue
Block a user