[PATCH wayland 4/4] Fill out dummy objects in tests so dispatchers
Jason Ekstrand
jason at jlekstrand.net
Tue Jan 29 07:21:54 PST 2013
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
tests/connection-test.c | 35 +++++++++++++++++++++++++++++------
tests/os-wrappers-test.c | 11 +++++++++--
2 files changed, 38 insertions(+), 8 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/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