[PATCH 4/7] Fill out dummy objects in tests so dispatchers will work

Jason Ekstrand jason at jlekstrand.net
Fri Feb 1 08:09:45 PST 2013


Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 tests/connection-test.c  | 35 +++++++++++++++++++++++++++++------
 tests/dispatcher-test.c  |  3 ++-
 tests/os-wrappers-test.c | 11 +++++++++--
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/tests/connection-test.c b/tests/connection-test.c
index 1ac88d2..49b968b 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -327,7 +327,14 @@ demarshal(struct marshal_data *data, const char *format,
 	struct wl_message message = { "test", format, NULL };
 	struct wl_closure *closure;
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
 	int size = msg[1];
 
 	assert(write(data->s[1], msg, size) == size);
@@ -338,7 +345,7 @@ demarshal(struct marshal_data *data, const char *format,
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
 	assert(closure);
-	wl_closure_invoke(closure, &object, func, data);
+	wl_closure_invoke(closure, &object, 0, data);
 	wl_closure_destroy(closure);
 }
 
@@ -399,7 +406,15 @@ marshal_demarshal(struct marshal_data *data,
 	static struct wl_object sender = { NULL, NULL, 1234 };
 	struct wl_message message = { "test", format, NULL };
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
+
 	va_list ap;
 	uint32_t msg[1] = { 1234 };
 
@@ -418,7 +433,7 @@ marshal_demarshal(struct marshal_data *data,
 	object.id = msg[0];
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
-	wl_closure_invoke(closure, &object, func, data);
+	wl_closure_invoke(closure, &object, 0, data);
 	wl_closure_destroy(closure);
 }
 
@@ -493,9 +508,17 @@ static void
 marshal_helper(const char *format, void *handler, ...)
 {
 	struct wl_closure *closure;
-	static struct wl_object sender = { NULL, NULL, 1234 }, object;
+	struct wl_object sender = { NULL, NULL, 1234 };
 	static const int opcode = 4444;
 	struct wl_message message = { "test", format, NULL };
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL
+	};
+	struct wl_object object = { &interface, &handler, 1234 };
 	va_list ap;
 	int done;
 
@@ -505,7 +528,7 @@ marshal_helper(const char *format, void *handler, ...)
 
 	assert(closure);
 	done = 0;
-	wl_closure_invoke(closure, &object, handler, &done);
+	wl_closure_invoke(closure, &object, 0, &done);
 	wl_closure_destroy(closure);
 	assert(done);
 }
diff --git a/tests/dispatcher-test.c b/tests/dispatcher-test.c
index 9f96a01..54b6a41 100644
--- a/tests/dispatcher-test.c
+++ b/tests/dispatcher-test.c
@@ -56,7 +56,8 @@ struct wl_interface test_interface = {
 	"test_interface",
 	1,
 	1, &test_message,
-	1, &test_message
+	1, &test_message,
+	NULL
 };
 
 void (* test_function_ptr)(void) = (void (*)(void))&test_function;
diff --git a/tests/os-wrappers-test.c b/tests/os-wrappers-test.c
index 515fd81..ddff618 100644
--- a/tests/os-wrappers-test.c
+++ b/tests/os-wrappers-test.c
@@ -233,7 +233,14 @@ marshal_demarshal(struct marshal_data *data,
 	static struct wl_object sender = { NULL, NULL, 1234 };
 	struct wl_message message = { "test", format, NULL };
 	struct wl_map objects;
-	struct wl_object object;
+	const struct wl_interface interface = {
+		"test",
+		(1 << 16) + 1,
+		1, &message,
+		1, &message,
+		NULL
+	};
+	struct wl_object object = { &interface, &func, 1234 };
 	va_list ap;
 	uint32_t msg[1] = { 1234 };
 
@@ -252,7 +259,7 @@ marshal_demarshal(struct marshal_data *data,
 	object.id = msg[0];
 	closure = wl_connection_demarshal(data->read_connection,
 					  size, &objects, &message);
-	wl_closure_invoke(closure, &object, func, data);
+	wl_closure_invoke(closure, &object, 0, data);
 	wl_closure_destroy(closure);
 }
 
-- 
1.8.1



More information about the wayland-devel mailing list