1# There are two tests here, because the 2nd one depends on a version of
2# GLib (2.51.1) that is very recent at the time of writing.
3
4copyfile = find_program('copyfile.py')
5
6simple_gresource = configure_file(
7  input : 'simple.gresource.xml',
8  output : 'simple-gen.gresource.xml',
9  command : [copyfile, '@INPUT@', '@OUTPUT@'])
10
11simple_resources = gnome.compile_resources('simple-resources',
12  simple_gresource,
13  install_header : true,
14  export : true,
15  source_dir : '../resources-data',
16  c_name : 'simple_resources')
17
18simple_res_exe = executable('simple-resources-test',
19  'simple-main.c', simple_resources,
20  dependencies: gio)
21test('simple resource test', simple_res_exe)
22
23gnome.compile_resources('simple-resources',
24  'simple.gresource.xml',
25  gresource_bundle: true,
26  install: true,
27  install_dir: get_option('datadir'),
28  source_dir : '../resources-data',
29)
30test('simple resource test (gresource)', find_program('resources.py'))
31
32if not pretend_glib_old and glib.version() >= '2.52.0'
33  # This test cannot pass if GLib version is older than 9.99.9.
34  # Meson will raise an error if the user tries to use the 'dependencies'
35  # argument and the version of GLib is too old for generated resource
36  # dependencies to work correctly.
37  generated_resources = gnome.compile_resources('generated-resources',
38    'generated.gresource.xml',
39    source_dir : '../resources-data',
40    c_name : 'generated_resources',
41    dependencies : [res3_txt, res4_txt])
42
43  generated_res_exe = executable('generated-resources-test',
44    'generated-main.c', generated_resources,
45    dependencies: gio)
46  test('generated resource test', generated_res_exe)
47endif
48
49# Test build_by_default
50gnome.compile_resources('build-resources',
51  'simple.gresource.xml',
52  gresource_bundle : true,
53  build_by_default : true,
54  source_dir : '../resources-data',
55)
56