[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 2e5b981b4293012061686431fca94c5ea31fe2c5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Mar 5 19:32:38 2021 +0100
tests: Add more "gir" tests to increase coverage
tests/Makefile.am | 2 ++
tests/gir/async-creation-method.test | 70 ++++++++++++++++++++++++++++++++++++
tests/gir/signal-virtual.test | 49 +++++++++++++++++++++++++
3 files changed, 121 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6e414fe46..66ea265a8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -698,6 +698,7 @@ TESTS = \
gir/bug792998.test \
gir/alias.test \
gir/array-fixed-length.test \
+ gir/async-creation-method.test \
gir/async-result-pos.test \
gir/async-sync-out.test \
gir/class.test \
@@ -716,6 +717,7 @@ TESTS = \
gir/parameter-array-length-type.test \
gir/parameter-nullable-out-simple-type.test \
gir/property-non-readable.test \
+ gir/signal-virtual.test \
gir/symbol-type-csuffix.test \
gir/union.test \
gir/union-transparent.test \
diff --git a/tests/gir/async-creation-method.test b/tests/gir/async-creation-method.test
new file mode 100644
index 000000000..fccafb0b8
--- /dev/null
+++ b/tests/gir/async-creation-method.test
@@ -0,0 +1,70 @@
+GIR
+
+Input:
+
+<class name="Foo"
+ c:symbol-prefix="foo"
+ c:type="TestFoo"
+ parent="GObject.Object"
+ glib:type-name="TestFoo"
+ glib:get-type="test_foo_get_type"
+ glib:type-struct="FooClass">
+ <constructor name="new_finish"
+ c:identifier="test_foo_new_finish"
+ throws="1">
+ <return-value transfer-ownership="full">
+ <type name="Foo" c:type="TestFoo*"/>
+ </return-value>
+ <parameters>
+ <parameter name="async_result" transfer-ownership="none">
+ <type name="Gio.AsyncResult" c:type="GAsyncResult*"/>
+ </parameter>
+ </parameters>
+ </constructor>
+ <function name="new_async"
+ c:identifier="test_foo_new_async">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="cancellable"
+ transfer-ownership="none"
+ nullable="1"
+ allow-none="1">
+ <type name="Gio.Cancellable" c:type="GCancellable*"/>
+ </parameter>
+ <parameter name="callback"
+ transfer-ownership="none"
+ nullable="1"
+ allow-none="1"
+ scope="async"
+ closure="2">
+ <type name="Gio.AsyncReadyCallback" c:type="GAsyncReadyCallback"/>
+ </parameter>
+ <parameter name="user_data"
+ transfer-ownership="none"
+ nullable="1"
+ allow-none="1">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </function>
+ <field name="parent_instance">
+ <type name="GObject.Object" c:type="GObject"/>
+ </field>
+</class>
+<record name="FooClass"
+ c:type="TestFooClass"
+ glib:is-gtype-struct-for="Foo">
+ <field name="parent_class">
+ <type name="GObject.ObjectClass" c:type="GObjectClass"/>
+ </field>
+</record>
+
+Output:
+
+[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+public class Foo : GLib.Object {
+ [CCode (cname = "test_foo_new_async", has_construct_function = false)]
+ public async Foo (GLib.Cancellable? cancellable) throws GLib.Error;
+}
diff --git a/tests/gir/signal-virtual.test b/tests/gir/signal-virtual.test
new file mode 100644
index 000000000..b0073eddd
--- /dev/null
+++ b/tests/gir/signal-virtual.test
@@ -0,0 +1,49 @@
+GIR
+
+Input:
+
+<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
+ <virtual-method name="signal_virtual">
+ <return-value transfer-ownership="full">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <type name="Foo" c:type="TestFoo*"/>
+ </instance-parameter>
+ </parameters>
+ </virtual-method>
+ <constructor name="new" c:identifier="test_foo_new">
+ <return-value transfer-ownership="full">
+ <type name="Test.Foo" c:type="TestFoo*"/>
+ </return-value>
+ </constructor>
+ <glib:signal name="signal-virtual">
+ <return-value transfer-ownership="full">
+ <type name="none"/>
+ </return-value>
+ </glib:signal>
+</class>
+<record name="FooClass" c:type="TestFooClass" glib:is-gtype-struct-for="Foo">
+ <field name="signal_virtual">
+ <callback name="signal_virtual" c:type="signal_virtual">
+ <return-value transfer-ownership="full">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="self" transfer-ownership="none">
+ <type name="Test.Foo" c:type="TestFoo*"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </field>
+</record>
+
+Output:
+
+[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+public class Foo : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Foo ();
+ public virtual signal void signal_virtual ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]