mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-17 05:34:23 -04:00
tests: Pass argument to client main
Change the API to pass an "void *" argument to the client main function, allowing the caller to call the same main function with different input. A helper (client_create_noarg) is added for when no argument is passed, and the existing test cases are changed to use this function instead. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
7efe8fbd89
commit
046012a6cf
6 changed files with 45 additions and 37 deletions
|
|
@ -78,8 +78,8 @@ int stop_display(struct client *, int);
|
|||
* wl_global_create(d->wl_display, ...);
|
||||
* ... other setups ...
|
||||
*
|
||||
* client_create(d, client_main);
|
||||
* client_create(d, client_main2);
|
||||
* client_create(d, client_main, data);
|
||||
* client_create(d, client_main2, data);
|
||||
*
|
||||
* display_run(d);
|
||||
* display_destroy(d);
|
||||
|
|
@ -95,6 +95,9 @@ void display_run(struct display *d);
|
|||
void display_resume(struct display *d);
|
||||
|
||||
struct client_info *client_create_with_name(struct display *d,
|
||||
void (*client_main)(void),
|
||||
void (*client_main)(void *data),
|
||||
void *data,
|
||||
const char *name);
|
||||
#define client_create(d, c) client_create_with_name((d), (c), (#c))
|
||||
#define client_create(d, c, data) client_create_with_name((d), (c), data, (#c))
|
||||
#define client_create_noarg(d, c) \
|
||||
client_create_with_name((d), (void(*)(void *)) (c), NULL, (#c))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue