mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-07 00:05:32 +00:00
tests: Rename wayland-test to weston-test
wayland-test isn't and will never be wayland protocol, it's weston internal. Renamed wayland-test to weston-test, and wl_test to weston_test. Also added a Big Fat Warning to the description of weston_test to try to keep people from thinking it's a good idea to use some of these functions outside of testing. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Acked-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
25c0ca5715
commit
f6a65928a8
16
Makefile.am
16
Makefile.am
|
@ -978,8 +978,8 @@ weston_test_la_LDFLAGS = $(test_module_ldflags)
|
||||||
weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
|
weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
|
||||||
weston_test_la_SOURCES = tests/weston-test.c
|
weston_test_la_SOURCES = tests/weston-test.c
|
||||||
nodist_weston_test_la_SOURCES = \
|
nodist_weston_test_la_SOURCES = \
|
||||||
protocol/wayland-test-protocol.c \
|
protocol/weston-test-protocol.c \
|
||||||
protocol/wayland-test-server-protocol.h
|
protocol/weston-test-server-protocol.h
|
||||||
|
|
||||||
if ENABLE_EGL
|
if ENABLE_EGL
|
||||||
weston_test_la_CFLAGS += $(EGL_TESTS_CFLAGS)
|
weston_test_la_CFLAGS += $(EGL_TESTS_CFLAGS)
|
||||||
|
@ -1004,8 +1004,8 @@ libtest_client_la_SOURCES = \
|
||||||
tests/weston-test-client-helper.c \
|
tests/weston-test-client-helper.c \
|
||||||
tests/weston-test-client-helper.h
|
tests/weston-test-client-helper.h
|
||||||
nodist_libtest_client_la_SOURCES = \
|
nodist_libtest_client_la_SOURCES = \
|
||||||
protocol/wayland-test-protocol.c \
|
protocol/weston-test-protocol.c \
|
||||||
protocol/wayland-test-client-protocol.h
|
protocol/weston-test-client-protocol.h
|
||||||
libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
|
libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
|
||||||
libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
|
libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
|
||||||
|
|
||||||
|
@ -1081,9 +1081,9 @@ endif
|
||||||
EXTRA_DIST += tests/weston-tests-env
|
EXTRA_DIST += tests/weston-tests-env
|
||||||
|
|
||||||
BUILT_SOURCES += \
|
BUILT_SOURCES += \
|
||||||
protocol/wayland-test-protocol.c \
|
protocol/weston-test-protocol.c \
|
||||||
protocol/wayland-test-server-protocol.h \
|
protocol/weston-test-server-protocol.h \
|
||||||
protocol/wayland-test-client-protocol.h \
|
protocol/weston-test-client-protocol.h \
|
||||||
protocol/text-protocol.c \
|
protocol/text-protocol.c \
|
||||||
protocol/text-client-protocol.h
|
protocol/text-client-protocol.h
|
||||||
|
|
||||||
|
@ -1094,7 +1094,7 @@ EXTRA_DIST += \
|
||||||
protocol/input-method.xml \
|
protocol/input-method.xml \
|
||||||
protocol/workspaces.xml \
|
protocol/workspaces.xml \
|
||||||
protocol/text-cursor-position.xml \
|
protocol/text-cursor-position.xml \
|
||||||
protocol/wayland-test.xml \
|
protocol/weston-test.xml \
|
||||||
protocol/xdg-shell.xml \
|
protocol/xdg-shell.xml \
|
||||||
protocol/fullscreen-shell.xml \
|
protocol/fullscreen-shell.xml \
|
||||||
protocol/presentation_timing.xml \
|
protocol/presentation_timing.xml \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<protocol name="wl_test">
|
<protocol name="weston_test">
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
Copyright © 2012 Intel Corporation
|
Copyright © 2012 Intel Corporation
|
||||||
|
@ -26,7 +26,16 @@
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="wl_test" version="1">
|
<interface name="weston_test" version="1">
|
||||||
|
<description summary="weston internal testing">
|
||||||
|
Internal testing facilities for the weston compositor.
|
||||||
|
|
||||||
|
It can't be stressed enough that these should never ever be used
|
||||||
|
outside of running weston's tests. The weston-test.so module should
|
||||||
|
never be installed.
|
||||||
|
|
||||||
|
These requests may allow clients to do very bad things.
|
||||||
|
</description>
|
||||||
<request name="move_surface">
|
<request name="move_surface">
|
||||||
<arg name="surface" type="object" interface="wl_surface"/>
|
<arg name="surface" type="object" interface="wl_surface"/>
|
||||||
<arg name="x" type="int"/>
|
<arg name="x" type="int"/>
|
|
@ -39,18 +39,18 @@ TEST(simple_button_test)
|
||||||
assert(pointer->button == 0);
|
assert(pointer->button == 0);
|
||||||
assert(pointer->state == 0);
|
assert(pointer->state == 0);
|
||||||
|
|
||||||
wl_test_move_pointer(client->test->wl_test, 150, 150);
|
weston_test_move_pointer(client->test->weston_test, 150, 150);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(pointer->x == 50);
|
assert(pointer->x == 50);
|
||||||
assert(pointer->y == 50);
|
assert(pointer->y == 50);
|
||||||
|
|
||||||
wl_test_send_button(client->test->wl_test, BTN_LEFT,
|
weston_test_send_button(client->test->weston_test, BTN_LEFT,
|
||||||
WL_POINTER_BUTTON_STATE_PRESSED);
|
WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(pointer->button == BTN_LEFT);
|
assert(pointer->button == BTN_LEFT);
|
||||||
assert(pointer->state == WL_POINTER_BUTTON_STATE_PRESSED);
|
assert(pointer->state == WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
|
|
||||||
wl_test_send_button(client->test->wl_test, BTN_LEFT,
|
weston_test_send_button(client->test->weston_test, BTN_LEFT,
|
||||||
WL_POINTER_BUTTON_STATE_RELEASED);
|
WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(pointer->button == BTN_LEFT);
|
assert(pointer->button == BTN_LEFT);
|
||||||
|
|
|
@ -59,7 +59,7 @@ check_pointer(struct client *client, int x, int y)
|
||||||
static void
|
static void
|
||||||
check_pointer_move(struct client *client, int x, int y)
|
check_pointer_move(struct client *client, int x, int y)
|
||||||
{
|
{
|
||||||
wl_test_move_pointer(client->test->wl_test, x, y);
|
weston_test_move_pointer(client->test->weston_test, x, y);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
check_pointer(client, x, y);
|
check_pointer(client, x, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,20 +44,21 @@ TEST(simple_keyboard_test)
|
||||||
|
|
||||||
if (keyboard->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (keyboard->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
expect_state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
expect_state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||||
wl_test_send_key(client->test->wl_test, expect_key,
|
weston_test_send_key(client->test->weston_test,
|
||||||
expect_state);
|
expect_key, expect_state);
|
||||||
} else if (keyboard->focus) {
|
} else if (keyboard->focus) {
|
||||||
expect_focus = NULL;
|
expect_focus = NULL;
|
||||||
wl_test_activate_surface(client->test->wl_test,
|
weston_test_activate_surface(
|
||||||
NULL);
|
client->test->weston_test, NULL);
|
||||||
} else if (expect_key < 10) {
|
} else if (expect_key < 10) {
|
||||||
expect_key++;
|
expect_key++;
|
||||||
expect_focus = client->surface;
|
expect_focus = client->surface;
|
||||||
expect_state = WL_KEYBOARD_KEY_STATE_PRESSED;
|
expect_state = WL_KEYBOARD_KEY_STATE_PRESSED;
|
||||||
wl_test_activate_surface(client->test->wl_test,
|
weston_test_activate_surface(
|
||||||
expect_focus->wl_surface);
|
client->test->weston_test,
|
||||||
wl_test_send_key(client->test->wl_test, expect_key,
|
expect_focus->wl_surface);
|
||||||
expect_state);
|
weston_test_send_key(client->test->weston_test,
|
||||||
|
expect_key, expect_state);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ TEST(text_test)
|
||||||
wl_text_input_add_listener(text_input, &text_input_listener, &state);
|
wl_text_input_add_listener(text_input, &text_input_listener, &state);
|
||||||
|
|
||||||
/* Make sure our test surface has keyboard focus. */
|
/* Make sure our test surface has keyboard focus. */
|
||||||
wl_test_activate_surface(client->test->wl_test,
|
weston_test_activate_surface(client->test->weston_test,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(client->input->keyboard->focus == client->surface);
|
assert(client->input->keyboard->focus == client->surface);
|
||||||
|
@ -210,7 +210,7 @@ TEST(text_test)
|
||||||
assert(state.activated == 2 && state.deactivated == 1);
|
assert(state.activated == 2 && state.deactivated == 1);
|
||||||
|
|
||||||
/* Take keyboard focus away and verify we get leave event. */
|
/* Take keyboard focus away and verify we get leave event. */
|
||||||
wl_test_activate_surface(client->test->wl_test, NULL);
|
weston_test_activate_surface(client->test->weston_test, NULL);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(state.activated == 2 && state.deactivated == 2);
|
assert(state.activated == 2 && state.deactivated == 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ move_client(struct client *client, int x, int y)
|
||||||
|
|
||||||
client->surface->x = x;
|
client->surface->x = x;
|
||||||
client->surface->y = y;
|
client->surface->y = y;
|
||||||
wl_test_move_surface(client->test->wl_test, surface->wl_surface,
|
weston_test_move_surface(client->test->weston_test, surface->wl_surface,
|
||||||
surface->x, surface->y);
|
surface->x, surface->y);
|
||||||
/* The attach here is necessary because commit() will call configure
|
/* The attach here is necessary because commit() will call configure
|
||||||
* only on surfaces newly attached, and the one that sets the surface
|
* only on surfaces newly attached, and the one that sets the surface
|
||||||
|
@ -109,7 +109,7 @@ get_n_egl_buffers(struct client *client)
|
||||||
{
|
{
|
||||||
client->test->n_egl_buffers = -1;
|
client->test->n_egl_buffers = -1;
|
||||||
|
|
||||||
wl_test_get_n_egl_buffers(client->test->wl_test);
|
weston_test_get_n_egl_buffers(client->test->weston_test);
|
||||||
wl_display_roundtrip(client->wl_display);
|
wl_display_roundtrip(client->wl_display);
|
||||||
|
|
||||||
return client->test->n_egl_buffers;
|
return client->test->n_egl_buffers;
|
||||||
|
@ -333,7 +333,7 @@ struct wl_shm_listener shm_listener = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_handle_pointer_position(void *data, struct wl_test *wl_test,
|
test_handle_pointer_position(void *data, struct weston_test *weston_test,
|
||||||
wl_fixed_t x, wl_fixed_t y)
|
wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
struct test *test = data;
|
struct test *test = data;
|
||||||
|
@ -345,14 +345,14 @@ test_handle_pointer_position(void *data, struct wl_test *wl_test,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_handle_n_egl_buffers(void *data, struct wl_test *wl_test, uint32_t n)
|
test_handle_n_egl_buffers(void *data, struct weston_test *weston_test, uint32_t n)
|
||||||
{
|
{
|
||||||
struct test *test = data;
|
struct test *test = data;
|
||||||
|
|
||||||
test->n_egl_buffers = n;
|
test->n_egl_buffers = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_test_listener test_listener = {
|
static const struct weston_test_listener test_listener = {
|
||||||
test_handle_pointer_position,
|
test_handle_pointer_position,
|
||||||
test_handle_n_egl_buffers,
|
test_handle_n_egl_buffers,
|
||||||
};
|
};
|
||||||
|
@ -475,12 +475,12 @@ handle_global(void *data, struct wl_registry *registry,
|
||||||
wl_output_add_listener(output->wl_output,
|
wl_output_add_listener(output->wl_output,
|
||||||
&output_listener, output);
|
&output_listener, output);
|
||||||
client->output = output;
|
client->output = output;
|
||||||
} else if (strcmp(interface, "wl_test") == 0) {
|
} else if (strcmp(interface, "weston_test") == 0) {
|
||||||
test = xzalloc(sizeof *test);
|
test = xzalloc(sizeof *test);
|
||||||
test->wl_test =
|
test->weston_test =
|
||||||
wl_registry_bind(registry, id,
|
wl_registry_bind(registry, id,
|
||||||
&wl_test_interface, 1);
|
&weston_test_interface, 1);
|
||||||
wl_test_add_listener(test->wl_test, &test_listener, test);
|
weston_test_add_listener(test->weston_test, &test_listener, test);
|
||||||
client->test = test;
|
client->test = test;
|
||||||
} else if (strcmp(interface, "wl_drm") == 0) {
|
} else if (strcmp(interface, "wl_drm") == 0) {
|
||||||
client->has_wl_drm = true;
|
client->has_wl_drm = true;
|
||||||
|
@ -586,7 +586,7 @@ client_create(int x, int y, int width, int height)
|
||||||
/* must have WL_SHM_FORMAT_ARGB32 */
|
/* must have WL_SHM_FORMAT_ARGB32 */
|
||||||
assert(client->has_argb);
|
assert(client->has_argb);
|
||||||
|
|
||||||
/* must have wl_test interface */
|
/* must have weston_test interface */
|
||||||
assert(client->test);
|
assert(client->test);
|
||||||
|
|
||||||
/* must have an output */
|
/* must have an output */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
#include "wayland-test-client-protocol.h"
|
#include "weston-test-client-protocol.h"
|
||||||
|
|
||||||
struct client {
|
struct client {
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
|
@ -52,7 +52,7 @@ struct global {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct test {
|
struct test {
|
||||||
struct wl_test *wl_test;
|
struct weston_test *weston_test;
|
||||||
int pointer_x;
|
int pointer_x;
|
||||||
int pointer_y;
|
int pointer_y;
|
||||||
uint32_t n_egl_buffers;
|
uint32_t n_egl_buffers;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "../src/compositor.h"
|
#include "../src/compositor.h"
|
||||||
#include "wayland-test-server-protocol.h"
|
#include "weston-test-server-protocol.h"
|
||||||
|
|
||||||
#ifdef ENABLE_EGL
|
#ifdef ENABLE_EGL
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
@ -85,7 +85,7 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
|
||||||
struct weston_seat *seat = get_seat(test);
|
struct weston_seat *seat = get_seat(test);
|
||||||
struct weston_pointer *pointer = seat->pointer;
|
struct weston_pointer *pointer = seat->pointer;
|
||||||
|
|
||||||
wl_test_send_pointer_position(resource, pointer->x, pointer->y);
|
weston_test_send_pointer_position(resource, pointer->x, pointer->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -233,10 +233,10 @@ get_n_buffers(struct wl_client *client, struct wl_resource *resource)
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_EGL */
|
#endif /* ENABLE_EGL */
|
||||||
|
|
||||||
wl_test_send_n_egl_buffers(resource, n_buffers);
|
weston_test_send_n_egl_buffers(resource, n_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_test_interface test_implementation = {
|
static const struct weston_test_interface test_implementation = {
|
||||||
move_surface,
|
move_surface,
|
||||||
move_pointer,
|
move_pointer,
|
||||||
send_button,
|
send_button,
|
||||||
|
@ -251,7 +251,7 @@ bind_test(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||||
struct weston_test *test = data;
|
struct weston_test *test = data;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
||||||
resource = wl_resource_create(client, &wl_test_interface, 1, id);
|
resource = wl_resource_create(client, &weston_test_interface, 1, id);
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
@ -304,7 +304,7 @@ module_init(struct weston_compositor *ec,
|
||||||
test->compositor = ec;
|
test->compositor = ec;
|
||||||
weston_layer_init(&test->layer, &ec->cursor_layer.link);
|
weston_layer_init(&test->layer, &ec->cursor_layer.link);
|
||||||
|
|
||||||
if (wl_global_create(ec->wl_display, &wl_test_interface, 1,
|
if (wl_global_create(ec->wl_display, &weston_test_interface, 1,
|
||||||
test, bind_test) == NULL)
|
test, bind_test) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue