File: test-client.c

package info (click to toggle)
phoc 0.52.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,052 kB
  • sloc: ansic: 107,165; xml: 3,765; sh: 138; makefile: 33; javascript: 5
file content (52 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) 2020 Purism SPC
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Author: Guido Günther <agx@sigxcpu.org>
 */

/* Test that wayland clients can connect to the compositor */

#include "testlib.h"

#include <wayland-client-protocol.h>

/* just run the test client, no extra tests */
static void
test_phoc_client_noop (void)
{
  PhocTestClientIface iface = { 0 };

  phoc_test_client_run (TEST_PHOC_CLIENT_TIMEOUT, &iface, NULL);
}

static gboolean
create_surface (PhocTestClientGlobals *globals, gpointer data)
{
  struct wl_surface *surface;

  surface = wl_compositor_create_surface (globals->compositor);

  g_assert_nonnull (surface);

  wl_surface_destroy (surface);
  return TRUE;
}

static void
test_phoc_client_surface (void)
{
  PhocTestClientIface iface = { .client_run = create_surface };

  phoc_test_client_run (TEST_PHOC_CLIENT_TIMEOUT, &iface, NULL);
}

int
main (int argc, char *argv[])
{
  g_test_init (&argc, &argv, NULL);

  PHOC_TEST_ADD ("/phoc/client/noop", test_phoc_client_noop);
  PHOC_TEST_ADD ("/phoc/client/surface", test_phoc_client_surface);

  return g_test_run ();
}