[PATCH wayland 3/3] tests: Test proxy versions

Derek Foreman derekf at osg.samsung.com
Tue Jan 12 14:28:47 PST 2016


Add a test that confirms that proxy versions are always 0 for display
and correct otherwise.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 tests/display-test.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tests/display-test.c b/tests/display-test.c
index 161a402..7a0aa91 100644
--- a/tests/display-test.c
+++ b/tests/display-test.c
@@ -609,3 +609,43 @@ TEST(threading_read_after_error_tst)
 
 	display_destroy(d);
 }
+
+static int expected_version;
+
+static void
+seat_version_main(void)
+{
+	struct client *c = client_connect();
+	struct wl_seat *seat = client_get_seat(c);
+	int ver;
+
+	/* display proxy should always be version 0 */
+	ver = wl_proxy_get_version((struct wl_proxy *) c->wl_display);
+	assert(ver == 0);
+
+	ver = wl_proxy_get_version((struct wl_proxy *) seat);
+	assert(ver == expected_version);
+
+	wl_proxy_destroy((struct wl_proxy *) seat);
+	client_disconnect_nocheck(c);
+}
+
+TEST(versions)
+{
+	struct display *d = display_create();
+	struct wl_global *global;
+	int i;
+
+	for (i = 0; i < 5; i++) {
+		expected_version = i;
+		global = wl_global_create(d->wl_display, &wl_seat_interface,
+					  expected_version, d, bind_seat);
+
+		client_create(d, seat_version_main);
+		display_run(d);
+
+		wl_global_destroy(global);
+	}
+
+	display_destroy(d);
+}
-- 
2.6.4



More information about the wayland-devel mailing list