diff options
| author | Marek Chalupa <mchqwerty@gmail.com> | 2014-08-21 16:52:16 +0200 |
|---|---|---|
| committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-08-22 12:34:33 +0300 |
| commit | 85d08e8bd6d84694e2032f6fdb312f33036bfdda (patch) | |
| tree | 81d9b1bc8ac7d8998c97c3d4a8a7cfd38a01c638 /tests/queue-test.c | |
| parent | client: remove unused variable (diff) | |
| download | wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar.gz wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar.bz2 wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar.lz wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar.xz wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.tar.zst wayland-85d08e8bd6d84694e2032f6fdb312f33036bfdda.zip | |
tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
display_create()
display_destroy()
create_client()
display_run()
display_resume()
and on client side the user can use:
client_connect()
client_disconnect()
stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
void
client_main()
{
/* or client can use wl_display_connect(NULL)
* and do all the stuff manually */
struct client *c = client_connect();
/* do some stuff, ... */
/* stop the display so that it can
* do some other stuff */
stop_display(c, 1);
/* ... */
client_disconnect(c);
}
TEST(dummy_tst)
{
struct display *d = display_create();
/* set up the display */
wl_global_create(d->wl_display, ...);
/* ... */
create_client(d, client_main);
display_run();
/* if we are here, the display has been stopped
* and we can do some code, i. e. create another global or so */
wl_global_create(d->wl_display, ...);
/* ... */
display_resume(d); /* resume display and clients */
display_destroy(d);
}
v2:
added/changed message in few asserts that were not clear
fixed codying style issues and typo
client_create_with_name: fixed a condition in an assert
get_socket_name: use also pid
check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'tests/queue-test.c')
0 files changed, 0 insertions, 0 deletions
