tests: migrate client tests

This migrates all the client tests that have nothing special in them to the new
test harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2019-11-13 15:45:10 +02:00 committed by Daniel Stone
parent 3fb67936a9
commit 701676d8c6
10 changed files with 162 additions and 48 deletions

View File

@ -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 files size,

View File

@ -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)

View File

@ -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 };

View File

@ -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')

View File

@ -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 };

View File

@ -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)

View File

@ -29,6 +29,18 @@
#include <string.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);
#define NUM_SUBSURFACES 3

View File

@ -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;

View File

@ -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 };

View File

@ -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)