aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-11-19 14:04:42 -0500
committerIgor Gnatenko <ignatenko@redhat.com>2016-11-20 23:36:21 +0100
commit8dd32506f468b46ce196900e10c975d936084fcc (patch)
tree80070484f10899b3589fc9a14041435840d6ea76 /test cases
parent587a0bb3d14addcacd62282a46957b86d582f1be (diff)
downloadmeson-8dd32506f468b46ce196900e10c975d936084fcc.zip
meson-8dd32506f468b46ce196900e10c975d936084fcc.tar.gz
meson-8dd32506f468b46ce196900e10c975d936084fcc.tar.bz2
gnome.compile_resources(): Add ability to output gresource bundles
Closes #1061
Diffstat (limited to 'test cases')
-rw-r--r--test cases/frameworks/7 gnome/installed_files.txt1
-rw-r--r--test cases/frameworks/7 gnome/resources/meson.build9
-rw-r--r--test cases/frameworks/7 gnome/resources/resources.py10
3 files changed, 20 insertions, 0 deletions
diff --git a/test cases/frameworks/7 gnome/installed_files.txt b/test cases/frameworks/7 gnome/installed_files.txt
index 06f4163..2f18cb1 100644
--- a/test cases/frameworks/7 gnome/installed_files.txt
+++ b/test cases/frameworks/7 gnome/installed_files.txt
@@ -12,3 +12,4 @@ usr/share/gir-1.0/Meson-1.0.gir
usr/share/gir-1.0/MesonDep1-1.0.gir
usr/share/gir-1.0/MesonDep2-1.0.gir
usr/share/glib-2.0/schemas/com.github.meson.gschema.xml
+usr/share/simple-resources.gresource
diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build
index f17e469..bee99f0 100644
--- a/test cases/frameworks/7 gnome/resources/meson.build
+++ b/test cases/frameworks/7 gnome/resources/meson.build
@@ -11,6 +11,15 @@ simple_res_exe = executable('simple-resources-test',
dependencies: gio)
test('simple resource test', simple_res_exe)
+gnome.compile_resources('simple-resources',
+ 'simple.gresource.xml',
+ gresource_bundle: true,
+ install: true,
+ install_dir: get_option('datadir'),
+ source_dir : '../resources-data',
+)
+test('simple resource test (gresource)', find_program('resources.py'))
+
if glib.version() >= '2.52.0'
# This test cannot pass if GLib version is older than 9.99.9.
# Meson will raise an error if the user tries to use the 'dependencies'
diff --git a/test cases/frameworks/7 gnome/resources/resources.py b/test cases/frameworks/7 gnome/resources/resources.py
new file mode 100644
index 0000000..b351b04
--- /dev/null
+++ b/test cases/frameworks/7 gnome/resources/resources.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+import os
+from gi.repository import Gio
+
+if __name__ == '__main__':
+ res = Gio.resource_load(os.path.join('resources', 'simple-resources.gresource'))
+ Gio.Resource._register(res)
+
+ data = Gio.resources_lookup_data('/com/example/myprog/res1.txt', Gio.ResourceLookupFlags.NONE)
+ assert(data.get_data() == b'This is a resource.\n')