[gobject-introspection] test: Add a test for GList containing GType.



commit 0376a2083480c3b9d50c33737e507a56dd2ad1bb
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Jul 5 11:32:13 2015 +0200

    test: Add a test for GList containing GType.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=749696
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751978

 .../Regress.test_glist_gtype_container_in.page     |   38 ++++++++++++++++++++
 .../Regress.test_glist_gtype_container_in.page     |   36 ++++++++++++++++++
 .../Regress.test_glist_gtype_container_in.page     |   37 +++++++++++++++++++
 tests/scanner/Regress-1.0-expected.gir             |   13 +++++++
 tests/scanner/Regress-1.0-sections-expected.txt    |    1 +
 tests/scanner/regress.c                            |   18 +++++++++
 tests/scanner/regress.h                            |    3 ++
 7 files changed, 146 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_glist_gtype_container_in.page 
b/tests/scanner/Regress-1.0-C-expected/Regress.test_glist_gtype_container_in.page
new file mode 100644
index 0000000..899b614
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_glist_gtype_container_in.page
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<page id="Regress.test_glist_gtype_container_in"
+      type="topic"
+      style="function"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="function" type="guide"/>
+    <api:function>
+      <api:returns>
+        <api:type>void</api:type>
+      </api:returns>
+      <api:name>regress_test_glist_gtype_container_in</api:name>
+      <api:arg>
+        <api:type>GList*</api:type>
+        <api:name>in</api:name>
+      </api:arg>
+    </api:function>
+  </info>
+  <title>regress_test_glist_gtype_container_in</title>
+  <synopsis><code mime="text/x-csrc">
+void regress_test_glist_gtype_container_in (GList* in);
+  </code></synopsis>
+
+
+<terms>
+<item>
+<title><code>in</code></title>
+
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_glist_gtype_container_in.page 
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_glist_gtype_container_in.page
new file mode 100644
index 0000000..84b59d0
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_glist_gtype_container_in.page
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<page id="Regress.test_glist_gtype_container_in"
+      type="topic"
+      style="function"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="function" type="guide"/>
+    <api:function>
+      <api:returns>
+        <api:type>void</api:type>
+      </api:returns>
+      <api:name>regress_test_glist_gtype_container_in</api:name>
+      <api:arg>
+        <api:type>Array(GObject.Type)</api:type>
+        <api:name>in</api:name>
+      </api:arg>
+    </api:function>
+  </info>
+  <title>Regress.test_glist_gtype_container_in</title>
+  <synopsis><code mime="text/x-gjs">
+function test_glist_gtype_container_in(in: Array(GObject.Type)): void {
+    // Gjs wrapper for regress_test_glist_gtype_container_in()
+}
+  </code></synopsis>
+
+
+<terms>
+<item>
+<title><code>in</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_glist_gtype_container_in.page 
b/tests/scanner/Regress-1.0-Python-expected/Regress.test_glist_gtype_container_in.page
new file mode 100644
index 0000000..4e07d76
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_glist_gtype_container_in.page
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<page id="Regress.test_glist_gtype_container_in"
+      type="topic"
+      style="function"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="function" type="guide"/>
+    <api:function>
+      <api:returns>
+        <api:type>none</api:type>
+      </api:returns>
+      <api:name>regress_test_glist_gtype_container_in</api:name>
+      <api:arg>
+        <api:type>[GType]</api:type>
+        <api:name>in</api:name>
+      </api:arg>
+    </api:function>
+  </info>
+  <title>Regress.test_glist_gtype_container_in</title>
+  <synopsis><code mime="text/x-python">
+ accepts([GType])
+ returns(none)
+def test_glist_gtype_container_in(in):
+    # Python wrapper for regress_test_glist_gtype_container_in()
+  </code></synopsis>
+
+
+<terms>
+<item>
+<title><code>in</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 288d393..e8e497a 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -5718,6 +5718,19 @@ element-type annotation.</doc>
         </type>
       </return-value>
     </function>
+    <function name="test_glist_gtype_container_in"
+              c:identifier="regress_test_glist_gtype_container_in">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="in" transfer-ownership="container">
+          <type name="GLib.List" c:type="GList*">
+            <type name="GType"/>
+          </type>
+        </parameter>
+      </parameters>
+    </function>
     <function name="test_glist_nothing_in"
               c:identifier="regress_test_glist_nothing_in">
       <return-value transfer-ownership="none">
diff --git a/tests/scanner/Regress-1.0-sections-expected.txt b/tests/scanner/Regress-1.0-sections-expected.txt
index 8dd11b1..f2286e3 100644
--- a/tests/scanner/Regress-1.0-sections-expected.txt
+++ b/tests/scanner/Regress-1.0-sections-expected.txt
@@ -119,6 +119,7 @@ regress_test_ghash_null_out
 regress_test_ghash_null_return
 regress_test_glist_container_return
 regress_test_glist_everything_return
+regress_test_glist_gtype_container_in
 regress_test_glist_nothing_in
 regress_test_glist_nothing_in2
 regress_test_glist_nothing_return
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 4315fd0..021a17a 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -990,6 +990,24 @@ regress_assert_test_sequence_list (const GList *in)
 }
 
 /**
+ * regress_test_glist_gtype_container_in:
+ * @in: (element-type GType) (transfer container):
+ */
+void
+regress_test_glist_gtype_container_in (GList *in)
+{
+  GList *l = in;
+
+  g_assert (GPOINTER_TO_SIZE (l->data) == REGRESS_TEST_TYPE_OBJ);
+  l = l->next;
+  g_assert (GPOINTER_TO_SIZE (l->data) == REGRESS_TEST_TYPE_SUB_OBJ);
+  l = l->next;
+  g_assert (l == NULL);
+
+  g_list_free (in);
+}
+
+/**
  * regress_test_glist_nothing_in:
  * @in: (element-type utf8):
  */
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 5174073..9df558b 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -206,6 +206,9 @@ _GI_TEST_EXTERN
 GList *regress_test_glist_everything_return (void);
 
 _GI_TEST_EXTERN
+void regress_test_glist_gtype_container_in (GList *in);
+
+_GI_TEST_EXTERN
 void regress_test_glist_nothing_in (const GList *in);
 
 _GI_TEST_EXTERN


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]