[vala/0.48] tests: Add more "gir" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] tests: Add more "gir" tests to increase coverage
- Date: Sun, 14 Mar 2021 15:47:44 +0000 (UTC)
commit 79052b80e062877aaa04851ed7ca88f112bca6ea
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Mar 4 19:12:15 2021 +0100
tests: Add more "gir" tests to increase coverage
tests/Makefile.am | 2 ++
tests/gir/method-class.test | 41 +++++++++++++++++++++++++++++++++
tests/gir/method-nowrapper.test | 51 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4d9df9ee3..1c5ca4ba0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -710,6 +710,8 @@ TESTS = \
gir/gtype-struct-name.test \
gir/instance-parameter-owned.test \
gir/method-array-length-type.test \
+ gir/method-class.test \
+ gir/method-nowrapper.test \
gir/parameter-array-length-type.test \
gir/parameter-nullable-out-simple-type.test \
gir/property-non-readable.test \
diff --git a/tests/gir/method-class.test b/tests/gir/method-class.test
new file mode 100644
index 000000000..adb7ec105
--- /dev/null
+++ b/tests/gir/method-class.test
@@ -0,0 +1,41 @@
+GIR
+
+Input:
+
+<class name="Foo"
+ c:symbol-prefix="foo"
+ c:type="TestFoo"
+ parent="GLib.Object"
+ abstract="1"
+ glib:type-name="TestFoo"
+ glib:get-type="test_foo_get_type"
+ glib:type-struct="FooClass">
+ <field name="parent">
+ <type name="GLib.Object" c:type="GObject"/>
+ </field>
+</class>
+<record name="FooClass"
+ c:type="TestFooClass"
+ glib:is-gtype-struct-for="Foo">
+ <method name="bar"
+ c:identifier="test_foo_class_bar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="klass" transfer-ownership="none">
+ <type name="FooClass" c:type="TestFooClass*"/>
+ </instance-parameter>
+ </parameters>
+ </method>
+</record>
+
+Output:
+
+[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+public abstract class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [CCode (cname = "test_foo_class_bar")]
+ public class void bar ();
+}
diff --git a/tests/gir/method-nowrapper.test b/tests/gir/method-nowrapper.test
new file mode 100644
index 000000000..ed2c1deca
--- /dev/null
+++ b/tests/gir/method-nowrapper.test
@@ -0,0 +1,51 @@
+GIR
+
+Input:
+
+<class name="Foo"
+ c:symbol-prefix="foo"
+ c:type="TestFoo"
+ parent="GLib.Object"
+ abstract="1"
+ glib:type-name="TestFoo"
+ glib:get-type="test_foo_get_type"
+ glib:type-struct="FooClass">
+ <virtual-method name="bar">
+ <return-value transfer-ownership="none">
+ <type name="gboolean" c:type="gboolean"/>
+ </return-value>
+ </virtual-method>
+ <field name="parent">
+ <type name="GLib.Object" c:type="GObject"/>
+ </field>
+</class>
+<record name="FooClass"
+ c:type="TestFooClass"
+ glib:is-gtype-struct-for="Foo">
+ <field name="parent_class">
+ <type name="GLig.ObjectClass"
+ c:type="GObjectClass"/>
+ </field>
+ <field name="bar">
+ <callback name="bar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="self" transfer-ownership="none">
+ <type name="Foo" c:type="TestFoo*"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </field>
+</record>
+
+Output:
+
+[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+public abstract class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Foo ();
+ [NoWrapper]
+ public virtual bool bar ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]