Debian Codegraph @

vendored-meson/meson/test cases/wayland/1 client/meson.build

raw
1 project('wayland-test-client', 'c')
2
3 wl_protocols_dep = dependency('wayland-protocols', required : false)
4 if not wl_protocols_dep.found()
5 error('MESON_SKIP_TEST: wayland-protocols not installed')
6 endif
7
8 wl_client_dep = dependency('wayland-client')
9 wl_server_dep = dependency('wayland-server')
10 wl_mod = import('unstable-wayland')
11 fs = import('fs')
12
13 # Client side only
14 xdg_shell_xml = wl_mod.find_protocol('xdg-shell')
15 xdg_shell = wl_mod.scan_xml(xdg_shell_xml)
16 assert(xdg_shell.length() == 2)
17 assert(fs.name(xdg_shell[0].full_path()) == 'xdg-shell-protocol.c')
18 assert(fs.name(xdg_shell[1].full_path()) == 'xdg-shell-client-protocol.h')
19 exe = executable('client', 'client.c', xdg_shell, dependencies : wl_client_dep)
20 test('client', exe)
21
22 # Server side only
23 presentation_time_xml = wl_mod.find_protocol('presentation-time')
24 presentation_time = wl_mod.scan_xml(presentation_time_xml, client : false, server : true)
25 assert(presentation_time.length() == 2)
26 assert(fs.name(presentation_time[0].full_path()) == 'presentation-time-protocol.c')
27 assert(fs.name(presentation_time[1].full_path()) == 'presentation-time-server-protocol.h')
28 exe = executable('server', 'server.c', presentation_time, dependencies : wl_server_dep)
29 test('server', exe)
30
31 # Both sides
32 viewporter_xml = wl_mod.find_protocol('viewporter')
33 viewporter = wl_mod.scan_xml(viewporter_xml, client : true, server : true)
34 assert(viewporter.length() == 3)
35 assert(fs.name(viewporter[0].full_path()) == 'viewporter-protocol.c')
36 assert(fs.name(viewporter[1].full_path()) == 'viewporter-client-protocol.h')
37 assert(fs.name(viewporter[2].full_path()) == 'viewporter-server-protocol.h')
38 exe = executable('both', 'both.c', viewporter, dependencies : [wl_client_dep, wl_server_dep])
39 test('both', exe)
40
41 # Local xml
42 xmls = files('test.xml')
43 gen = wl_mod.scan_xml(xmls)
44 assert(gen.length() == 2)
45 assert(fs.name(gen[0].full_path()) == 'test-protocol.c')
46 assert(fs.name(gen[1].full_path()) == 'test-client-protocol.h')
47 exe = executable('local', 'local.c', gen, dependencies : wl_client_dep)
48 test('local', exe)