diff --git a/tests/bad-buffer-test.c b/tests/bad-buffer-test.c index b7abda23..360a81ce 100644 --- a/tests/bad-buffer-test.c +++ b/tests/bad-buffer-test.c @@ -34,6 +34,18 @@ #include "shared/os-compatibility.h" #include "weston-test-client-helper.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); /* These three functions are copied from shared/os-compatibility.c in order to * behave like older clients, and allow ftruncate() to shrink the file’s size, diff --git a/tests/event-test.c b/tests/event-test.c index c1ba3ac1..75419a6c 100644 --- a/tests/event-test.c +++ b/tests/event-test.c @@ -27,6 +27,18 @@ #include "config.h" #include "weston-test-client-helper.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static int output_contains_client(struct client *client) diff --git a/tests/keyboard-test.c b/tests/keyboard-test.c index 37ef83d0..f2a769e3 100644 --- a/tests/keyboard-test.c +++ b/tests/keyboard-test.c @@ -30,6 +30,18 @@ #include "input-timestamps-helper.h" #include "shared/timespec-util.h" #include "weston-test-client-helper.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static const struct timespec t1 = { .tv_sec = 1, .tv_nsec = 1000001 }; static const struct timespec t2 = { .tv_sec = 2, .tv_nsec = 2000001 }; diff --git a/tests/meson.build b/tests/meson.build index 54bc4394..fc793ede 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -111,18 +111,72 @@ dep_zucmain = declare_dependency( ) tests = [ + { 'name': 'bad-buffer', }, { 'name': 'devices', }, + { 'name': 'event', }, { 'name': 'internal-screenshot', }, + { + 'name': 'keyboard', + 'sources': [ + 'keyboard-test.c', + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ], + }, { 'name': 'plugin-registry', }, + { + 'name': 'pointer', + 'sources': [ + 'pointer-test.c', + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ], + }, + { + 'name': 'presentation', + 'sources': [ + 'presentation-test.c', + presentation_time_client_protocol_h, + presentation_time_protocol_c, + ], + }, { 'name': 'roles', }, { 'name': 'string', }, + { 'name': 'subsurface', }, { 'name': 'subsurface-shot', }, { 'name': 'surface', }, { 'name': 'surface-global', }, + { + 'name': 'text', + 'sources': [ + 'text-test.c', + text_input_unstable_v1_client_protocol_h, + text_input_unstable_v1_protocol_c, + ], + }, + { + 'name': 'touch', + 'sources': [ + 'touch-test.c', + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ], + }, { 'name': 'vertex-clip', 'dep_objs': dep_vertex_clipping, }, + { + 'name': 'viewporter', + 'sources': [ + 'viewporter-test.c', + viewporter_client_protocol_h, + viewporter_protocol_c, + ], + }, ] tests_standalone = [ @@ -139,16 +193,6 @@ tests_standalone = [ ] tests_weston = [ - ['bad-buffer'], - ['event'], - [ - 'keyboard', - [ - 'input-timestamps-helper.c', - input_timestamps_unstable_v1_client_protocol_h, - input_timestamps_unstable_v1_protocol_c, - ] - ], [ 'linux-explicit-synchronization', [ @@ -156,44 +200,6 @@ tests_weston = [ linux_explicit_synchronization_unstable_v1_protocol_c, ] ], - [ - 'presentation', - [ - presentation_time_client_protocol_h, - presentation_time_protocol_c, - ] - ], - [ - 'pointer', - [ - 'input-timestamps-helper.c', - input_timestamps_unstable_v1_client_protocol_h, - input_timestamps_unstable_v1_protocol_c, - ] - ], - ['subsurface'], - [ - 'text', - [ - text_input_unstable_v1_client_protocol_h, - text_input_unstable_v1_protocol_c, - ] - ], - [ - 'touch', - [ - 'input-timestamps-helper.c', - input_timestamps_unstable_v1_client_protocol_h, - input_timestamps_unstable_v1_protocol_c, - ] - ], - [ - 'viewporter', - [ - viewporter_client_protocol_h, - viewporter_protocol_c, - ] - ], ] if get_option('xwayland') diff --git a/tests/pointer-test.c b/tests/pointer-test.c index eef52228..5d618c2e 100644 --- a/tests/pointer-test.c +++ b/tests/pointer-test.c @@ -31,6 +31,18 @@ #include "input-timestamps-helper.h" #include "shared/timespec-util.h" #include "weston-test-client-helper.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static const struct timespec t0 = { .tv_sec = 0, .tv_nsec = 100000000 }; static const struct timespec t1 = { .tv_sec = 1, .tv_nsec = 1000001 }; diff --git a/tests/presentation-test.c b/tests/presentation-test.c index 6790ab66..5e9d991f 100644 --- a/tests/presentation-test.c +++ b/tests/presentation-test.c @@ -37,6 +37,18 @@ #include "shared/timespec-util.h" #include "weston-test-client-helper.h" #include "presentation-time-client-protocol.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static struct wp_presentation * get_presentation(struct client *client) diff --git a/tests/subsurface-test.c b/tests/subsurface-test.c index cdf71a19..1f9c90c0 100644 --- a/tests/subsurface-test.c +++ b/tests/subsurface-test.c @@ -29,6 +29,18 @@ #include #include "weston-test-client-helper.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); #define NUM_SUBSURFACES 3 diff --git a/tests/text-test.c b/tests/text-test.c index 0436f9b6..84988f3d 100644 --- a/tests/text-test.c +++ b/tests/text-test.c @@ -31,6 +31,18 @@ #include "weston-test-client-helper.h" #include "text-input-unstable-v1-client-protocol.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); struct text_input_state { int activated; diff --git a/tests/touch-test.c b/tests/touch-test.c index baf5bc58..b2133bde 100644 --- a/tests/touch-test.c +++ b/tests/touch-test.c @@ -31,6 +31,18 @@ #include "shared/timespec-util.h" #include "weston-test-client-helper.h" #include "wayland-server-protocol.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static const struct timespec t1 = { .tv_sec = 1, .tv_nsec = 1000001 }; static const struct timespec t2 = { .tv_sec = 2, .tv_nsec = 2000001 }; diff --git a/tests/viewporter-test.c b/tests/viewporter-test.c index 2dd6be4c..ad4f3779 100644 --- a/tests/viewporter-test.c +++ b/tests/viewporter-test.c @@ -35,6 +35,18 @@ #include "shared/xalloc.h" #include "weston-test-client-helper.h" #include "viewporter-client-protocol.h" +#include "weston-test-fixture-compositor.h" + +static enum test_result_code +fixture_setup(struct weston_test_harness *harness) +{ + struct compositor_setup setup; + + compositor_setup_defaults(&setup); + + return weston_test_harness_execute_as_client(harness, &setup); +} +DECLARE_FIXTURE_SETUP(fixture_setup); static struct wp_viewporter * get_viewporter(struct client *client)