[PATCH v2 weston] tests: Rename wayland-test to weston-test
Derek Foreman
derekf at osg.samsung.com
Tue Feb 24 07:32:14 PST 2015
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 at osg.samsung.com>
Acked-by: Bryce Harrington <bryce at osg.samsung.com>
---
Rebased on master.
Makefile.am | 16 ++++-----
protocol/wayland-test.xml | 62 ----------------------------------
protocol/weston-test.xml | 71 +++++++++++++++++++++++++++++++++++++++
tests/button-test.c | 6 ++--
tests/event-test.c | 2 +-
tests/keyboard-test.c | 17 +++++-----
tests/text-test.c | 4 +--
tests/weston-test-client-helper.c | 20 +++++------
tests/weston-test-client-helper.h | 4 +--
tests/weston-test.c | 12 +++----
10 files changed, 112 insertions(+), 102 deletions(-)
delete mode 100644 protocol/wayland-test.xml
create mode 100644 protocol/weston-test.xml
diff --git a/Makefile.am b/Makefile.am
index 32e8b0b..7fb9e17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -978,8 +978,8 @@ weston_test_la_LDFLAGS = $(test_module_ldflags)
weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
weston_test_la_SOURCES = tests/weston-test.c
nodist_weston_test_la_SOURCES = \
- protocol/wayland-test-protocol.c \
- protocol/wayland-test-server-protocol.h
+ protocol/weston-test-protocol.c \
+ protocol/weston-test-server-protocol.h
if ENABLE_EGL
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.h
nodist_libtest_client_la_SOURCES = \
- protocol/wayland-test-protocol.c \
- protocol/wayland-test-client-protocol.h
+ protocol/weston-test-protocol.c \
+ protocol/weston-test-client-protocol.h
libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
@@ -1081,9 +1081,9 @@ endif
EXTRA_DIST += tests/weston-tests-env
BUILT_SOURCES += \
- protocol/wayland-test-protocol.c \
- protocol/wayland-test-server-protocol.h \
- protocol/wayland-test-client-protocol.h \
+ protocol/weston-test-protocol.c \
+ protocol/weston-test-server-protocol.h \
+ protocol/weston-test-client-protocol.h \
protocol/text-protocol.c \
protocol/text-client-protocol.h
@@ -1094,7 +1094,7 @@ EXTRA_DIST += \
protocol/input-method.xml \
protocol/workspaces.xml \
protocol/text-cursor-position.xml \
- protocol/wayland-test.xml \
+ protocol/weston-test.xml \
protocol/xdg-shell.xml \
protocol/fullscreen-shell.xml \
protocol/presentation_timing.xml \
diff --git a/protocol/wayland-test.xml b/protocol/wayland-test.xml
deleted file mode 100644
index 18b6625..0000000
--- a/protocol/wayland-test.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="wl_test">
-
- <copyright>
- Copyright © 2012 Intel Corporation
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that copyright notice and this permission
- notice appear in supporting documentation, and that the name of
- the copyright holders not be used in advertising or publicity
- pertaining to distribution of the software without specific,
- written prior permission. The copyright holders make no
- representations about the suitability of this software for any
- purpose. It is provided "as is" without express or implied
- warranty.
-
- THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- THIS SOFTWARE.
- </copyright>
-
- <interface name="wl_test" version="1">
- <request name="move_surface">
- <arg name="surface" type="object" interface="wl_surface"/>
- <arg name="x" type="int"/>
- <arg name="y" type="int"/>
- </request>
- <request name="move_pointer">
- <arg name="x" type="int"/>
- <arg name="y" type="int"/>
- </request>
- <request name="send_button">
- <arg name="button" type="int"/>
- <arg name="state" type="uint"/>
- </request>
- <request name="activate_surface">
- <arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
- </request>
- <request name="send_key">
- <arg name="key" type="uint"/>
- <arg name="state" type="uint"/>
- </request>
- <event name="pointer_position">
- <arg name="x" type="fixed"/>
- <arg name="y" type="fixed"/>
- </event>
- <request name="get_n_egl_buffers">
- <!-- causes a n_egl_buffers event to be sent which reports how many
- buffer objects are live for the client -->
- </request>
- <event name="n_egl_buffers">
- <arg name="n" type="uint"/>
- </event>
- </interface>
-</protocol>
diff --git a/protocol/weston-test.xml b/protocol/weston-test.xml
new file mode 100644
index 0000000..17c7565
--- /dev/null
+++ b/protocol/weston-test.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="weston_test">
+
+ <copyright>
+ Copyright © 2012 Intel Corporation
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <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">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ </request>
+ <request name="move_pointer">
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ </request>
+ <request name="send_button">
+ <arg name="button" type="int"/>
+ <arg name="state" type="uint"/>
+ </request>
+ <request name="activate_surface">
+ <arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
+ </request>
+ <request name="send_key">
+ <arg name="key" type="uint"/>
+ <arg name="state" type="uint"/>
+ </request>
+ <event name="pointer_position">
+ <arg name="x" type="fixed"/>
+ <arg name="y" type="fixed"/>
+ </event>
+ <request name="get_n_egl_buffers">
+ <!-- causes a n_egl_buffers event to be sent which reports how many
+ buffer objects are live for the client -->
+ </request>
+ <event name="n_egl_buffers">
+ <arg name="n" type="uint"/>
+ </event>
+ </interface>
+</protocol>
diff --git a/tests/button-test.c b/tests/button-test.c
index a784258..7959fb7 100644
--- a/tests/button-test.c
+++ b/tests/button-test.c
@@ -39,18 +39,18 @@ TEST(simple_button_test)
assert(pointer->button == 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);
assert(pointer->x == 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);
client_roundtrip(client);
assert(pointer->button == BTN_LEFT);
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);
client_roundtrip(client);
assert(pointer->button == BTN_LEFT);
diff --git a/tests/event-test.c b/tests/event-test.c
index b60ad85..43540a5 100644
--- a/tests/event-test.c
+++ b/tests/event-test.c
@@ -59,7 +59,7 @@ check_pointer(struct client *client, int x, int y)
static void
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);
check_pointer(client, x, y);
}
diff --git a/tests/keyboard-test.c b/tests/keyboard-test.c
index a6d4ffa..10ffc60 100644
--- a/tests/keyboard-test.c
+++ b/tests/keyboard-test.c
@@ -44,20 +44,21 @@ TEST(simple_keyboard_test)
if (keyboard->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
expect_state = WL_KEYBOARD_KEY_STATE_RELEASED;
- wl_test_send_key(client->test->wl_test, expect_key,
- expect_state);
+ weston_test_send_key(client->test->weston_test,
+ expect_key, expect_state);
} else if (keyboard->focus) {
expect_focus = NULL;
- wl_test_activate_surface(client->test->wl_test,
- NULL);
+ weston_test_activate_surface(
+ client->test->weston_test, NULL);
} else if (expect_key < 10) {
expect_key++;
expect_focus = client->surface;
expect_state = WL_KEYBOARD_KEY_STATE_PRESSED;
- wl_test_activate_surface(client->test->wl_test,
- expect_focus->wl_surface);
- wl_test_send_key(client->test->wl_test, expect_key,
- expect_state);
+ weston_test_activate_surface(
+ client->test->weston_test,
+ expect_focus->wl_surface);
+ weston_test_send_key(client->test->weston_test,
+ expect_key, expect_state);
} else {
break;
}
diff --git a/tests/text-test.c b/tests/text-test.c
index 0d20add..62adf81 100644
--- a/tests/text-test.c
+++ b/tests/text-test.c
@@ -187,7 +187,7 @@ TEST(text_test)
wl_text_input_add_listener(text_input, &text_input_listener, &state);
/* 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_roundtrip(client);
assert(client->input->keyboard->focus == client->surface);
@@ -210,7 +210,7 @@ TEST(text_test)
assert(state.activated == 2 && state.deactivated == 1);
/* 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);
assert(state.activated == 2 && state.deactivated == 2);
}
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index 518e899..fa11bc1 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -88,7 +88,7 @@ move_client(struct client *client, int x, int y)
client->surface->x = x;
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);
/* The attach here is necessary because commit() will call configure
* 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;
- 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);
return client->test->n_egl_buffers;
@@ -333,7 +333,7 @@ struct wl_shm_listener shm_listener = {
};
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)
{
struct test *test = data;
@@ -345,14 +345,14 @@ test_handle_pointer_position(void *data, struct wl_test *wl_test,
}
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;
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_n_egl_buffers,
};
@@ -475,12 +475,12 @@ handle_global(void *data, struct wl_registry *registry,
wl_output_add_listener(output->wl_output,
&output_listener, output);
client->output = output;
- } else if (strcmp(interface, "wl_test") == 0) {
+ } else if (strcmp(interface, "weston_test") == 0) {
test = xzalloc(sizeof *test);
- test->wl_test =
+ test->weston_test =
wl_registry_bind(registry, id,
- &wl_test_interface, 1);
- wl_test_add_listener(test->wl_test, &test_listener, test);
+ &weston_test_interface, 1);
+ weston_test_add_listener(test->weston_test, &test_listener, test);
client->test = test;
} else if (strcmp(interface, "wl_drm") == 0) {
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 */
assert(client->has_argb);
- /* must have wl_test interface */
+ /* must have weston_test interface */
assert(client->test);
/* must have an output */
diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
index a6ea524..3208cc4 100644
--- a/tests/weston-test-client-helper.h
+++ b/tests/weston-test-client-helper.h
@@ -28,7 +28,7 @@
#include <assert.h>
#include <stdbool.h>
#include "weston-test-runner.h"
-#include "wayland-test-client-protocol.h"
+#include "weston-test-client-protocol.h"
struct client {
struct wl_display *wl_display;
@@ -52,7 +52,7 @@ struct global {
};
struct test {
- struct wl_test *wl_test;
+ struct weston_test *weston_test;
int pointer_x;
int pointer_y;
uint32_t n_egl_buffers;
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 8777f70..649bdda 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -28,7 +28,7 @@
#include <unistd.h>
#include "../src/compositor.h"
-#include "wayland-test-server-protocol.h"
+#include "weston-test-server-protocol.h"
#ifdef ENABLE_EGL
#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_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
@@ -233,10 +233,10 @@ get_n_buffers(struct wl_client *client, struct wl_resource *resource)
}
#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_pointer,
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 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) {
wl_client_post_no_memory(client);
return;
@@ -304,7 +304,7 @@ module_init(struct weston_compositor *ec,
test->compositor = ec;
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)
return -1;
--
2.1.4
More information about the wayland-devel
mailing list