summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/7 gnome/gdbus
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/frameworks/7 gnome/gdbus')
-rw-r--r--test cases/frameworks/7 gnome/gdbus/data/com.example.Sample.xml14
-rw-r--r--test cases/frameworks/7 gnome/gdbus/gdbusprog.c8
-rw-r--r--test cases/frameworks/7 gnome/gdbus/meson.build95
3 files changed, 117 insertions, 0 deletions
diff --git a/test cases/frameworks/7 gnome/gdbus/data/com.example.Sample.xml b/test cases/frameworks/7 gnome/gdbus/data/com.example.Sample.xml
new file mode 100644
index 0000000..d7adc30
--- /dev/null
+++ b/test cases/frameworks/7 gnome/gdbus/data/com.example.Sample.xml
@@ -0,0 +1,14 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="com.example">
+ <method name="Hello">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="s" name="greeting"/>
+ </method>
+ <method name="Bye">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="s" name="greeting"/>
+ </method>
+ </interface>
+</node>
diff --git a/test cases/frameworks/7 gnome/gdbus/gdbusprog.c b/test cases/frameworks/7 gnome/gdbus/gdbusprog.c
new file mode 100644
index 0000000..b42b6fe
--- /dev/null
+++ b/test cases/frameworks/7 gnome/gdbus/gdbusprog.c
@@ -0,0 +1,8 @@
+#include"generated-gdbus.h"
+
+int main(int argc, char **argv) {
+ SampleComExample *s;
+ s = sample_com_example_skeleton_new();
+ g_object_unref(s);
+ return 0;
+}
diff --git a/test cases/frameworks/7 gnome/gdbus/meson.build b/test cases/frameworks/7 gnome/gdbus/meson.build
new file mode 100644
index 0000000..fdb3896
--- /dev/null
+++ b/test cases/frameworks/7 gnome/gdbus/meson.build
@@ -0,0 +1,95 @@
+gdbus_src = gnome.gdbus_codegen('generated-gdbus-no-docbook',
+ 'data/com.example.Sample.xml',
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [
+ ['com.example.Hello()', 'org.freedesktop.DBus.Deprecated', 'true']
+ ],
+)
+
+# check that empty annotations work
+gdbus_src2 = gnome.gdbus_codegen(
+ 'generated-gdbus-no-docbook2',
+ 'data/com.example.Sample.xml',
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [],
+)
+
+assert(gdbus_src.length() == 2, 'expected 2 targets')
+assert(gdbus_src[0].full_path().endswith('.c'), 'expected 1 c source file')
+assert(gdbus_src[1].full_path().endswith('.h'), 'expected 1 c header file')
+
+sample_xml = configure_file(input: 'data/com.example.Sample.xml',
+ output: 'com.example.Sample.xml',
+ copy: true)
+
+gdbus_src = gnome.gdbus_codegen('generated-gdbus-no-docbook-files-posarg',
+ sample_xml,
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [
+ ['com.example.Hello()', 'org.freedesktop.DBus.Deprecated', 'true']
+ ],
+)
+assert(gdbus_src.length() == 2, 'expected 2 targets')
+assert(gdbus_src[0].full_path().endswith('.c'), 'expected 1 c source file')
+assert(gdbus_src[1].full_path().endswith('.h'), 'expected 1 c header file')
+
+gdbus_src = gnome.gdbus_codegen('generated-gdbus',
+ sources : files('data/com.example.Sample.xml'),
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [
+ ['com.example.Hello()', 'org.freedesktop.DBus.Deprecated', 'true'],
+ ['com.example.Bye()', 'org.freedesktop.DBus.Deprecated', 'true'],
+ ],
+ docbook : 'generated-gdbus-doc',
+ install_header : true,
+ install_dir : get_option('includedir')
+)
+assert(gdbus_src.length() == 3, 'expected 3 targets')
+assert(gdbus_src[0].full_path().endswith('.c'), 'expected 1 c source file')
+assert(gdbus_src[1].full_path().endswith('.h'), 'expected 1 c header file')
+
+if not pretend_glib_old and glib.version().version_compare('>=2.51.3')
+ includes = []
+else
+ includes = include_directories('..')
+endif
+
+# check that custom targets work
+gdbus_xml_ct = custom_target('built xml sources for gdbus',
+ output: 'com.example.SampleCustomTarget.xml',
+ input: 'data/com.example.Sample.xml',
+ command : [copyfile, '@INPUT@', '@OUTPUT@'])
+
+gdbus_src_ct = gnome.gdbus_codegen(
+ 'generated-gdbus-customtarget-src',
+ gdbus_xml_ct,
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [],
+)
+gdbus_src_cti = gnome.gdbus_codegen(
+ 'generated-gdbus-customtargetindex-src',
+ gdbus_xml_ct[0],
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [],
+)
+
+gdbus_src_gen = gnome.gdbus_codegen(
+ 'generated-gdbus-generator-src',
+ copyfile_gen.process('data/com.example.Sample.xml'),
+ interface_prefix : 'com.example.',
+ namespace : 'Sample',
+ annotations : [],
+)
+
+gdbus_exe = executable('gdbus-test', 'gdbusprog.c',
+ gdbus_src,
+ include_directories : includes,
+ dependencies : giounix)
+
+test('gdbus', gdbus_exe)