summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2019-01-08 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2019-01-08 22:29:30 +0100
commitefb9b272f7910836ee8ea7a70562d34a1b481d54 (patch)
treecfd2c3396ea8eeafec5e64edcba150a9f76439b1
parent44a5ab2d2912c486ed9bf85e25b33d173a45f06d (diff)
downloadgobject-introspection-efb9b272f7910836ee8ea7a70562d34a1b481d54.tar.gz
tests: Add functions using flat struct arrays
Relatively common in practice are: * output with transfer full, which is already covered by `regress_test_array_struct_out`, * input with transfer none, covered by a new `regress_test_array_struct_in_none` Other variants are quite esoteric, but it still might be useful to include them so that bindings can verify that they are handled gracefully, e.g., by reporting an error instead of crashing. Issue #90
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page2
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_full.page49
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_none.page47
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_caller_alloc.page47
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_container.page47
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_full_fixed.page38
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_none.page50
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page2
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_full.page38
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_none.page36
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_caller_alloc.page32
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_container.page32
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_full_fixed.page32
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_none.page35
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page2
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_full.page47
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_none.page45
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_caller_alloc.page45
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_container.page45
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_full_fixed.page37
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_none.page48
-rw-r--r--tests/scanner/Regress-1.0-expected.gir188
-rw-r--r--tests/scanner/Regress-1.0-sections-expected.txt6
-rw-r--r--tests/scanner/regress.c123
-rw-r--r--tests/scanner/regress.h18
25 files changed, 1091 insertions, 0 deletions
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page
index bb366613..5af5da29 100644
--- a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-write-only.page
@@ -10,4 +10,6 @@
<title type="link" role="topic">write-only</title>
</info>
<title>Regress.TestObj:write-only</title>
+
+
</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_full.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_full.page
new file mode 100644
index 00000000..2fd3b56b
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_full.page
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_full"
+ 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_array_struct_in_full</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA*</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_in_full</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_in_full (RegressTestStructA* arr,
+ gsize len);
+ </code></synopsis>
+ <p>Test flat array input with transfer full.</p> <p>Similar to:
+- gsf_property_settings_free() with structs but they contain pointers
+- <link href="../GLib-2.0/GLib.byte_array_new_take.html">g_byte_array_new_take</link> with guint8s</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_none.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_none.page
new file mode 100644
index 00000000..5fda2950
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_in_none.page
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_none"
+ 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_array_struct_in_none</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA*</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_in_none</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_in_none (RegressTestStructA* arr,
+ gsize len);
+ </code></synopsis>
+ <p>Test flat array input with transfer none.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.check.html">g_main_context_check</link> or gtk_target_list_new().</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array.</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_caller_alloc.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_caller_alloc.page
new file mode 100644
index 00000000..1bb3f618
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_caller_alloc.page
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_caller_alloc"
+ 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_array_struct_out_caller_alloc</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA*</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_out_caller_alloc</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_out_caller_alloc (RegressTestStructA* arr,
+ gsize len);
+ </code></synopsis>
+ <p>Test flat caller-allocated array output.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.query.html">g_main_context_query</link>.</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_container.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_container.page
new file mode 100644
index 00000000..42eb5751
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_container.page
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_container"
+ 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_array_struct_out_container</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA**</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize*</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_out_container</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_out_container (RegressTestStructA** arr,
+ gsize* len);
+ </code></synopsis>
+ <p>Test flat array output with transfer container.</p> <p>Similar to pango_layout_get_log_attrs().</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_full_fixed.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_full_fixed.page
new file mode 100644
index 00000000..3bddf881
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_full_fixed.page
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_full_fixed"
+ 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_array_struct_out_full_fixed</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA**</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_out_full_fixed</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_out_full_fixed (RegressTestStructA** arr);
+ </code></synopsis>
+ <p>Test flat fixed-size array output with transfer full.</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_none.page b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_none.page
new file mode 100644
index 00000000..8fbcb4ae
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.test_array_struct_out_none.page
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_none"
+ 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_array_struct_out_none</api:name>
+ <api:arg>
+ <api:type>RegressTestStructA**</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize*</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_array_struct_out_none</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_array_struct_out_none (RegressTestStructA** arr,
+ gsize* len);
+ </code></synopsis>
+ <p>Test flat array output with transfer none.</p> <p>Similar to:
+- mm_modem_peek_ports() with structs
+- gdk_query_visual_types() with enums
+- gdk_event_get_axes() with doubles</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page
index 9fd19255..01e966ca 100644
--- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-write-only.page
@@ -13,4 +13,6 @@
<synopsis><code mime="text/x-gjs">
TestObj.write_only: Boolean (Write)
</code></synopsis>
+
+
</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_full.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_full.page
new file mode 100644
index 00000000..4d259654
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_full.page
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_full"
+ 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_array_struct_in_full</api:name>
+ <api:arg>
+ <api:type>Array(Regress.TestStructA)</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_in_full</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_in_full(arr: Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>)): void {
+ // Gjs wrapper for regress_test_array_struct_in_full()
+}
+ </code></synopsis>
+ <p>Test flat array input with transfer full.</p> <p>Similar to:
+- gsf_property_settings_free() with structs but they contain pointers
+- <link href="../GLib-2.0/GLib.byte_array_new_take.html">GLib.byte_array_new_take</link> with guint8s</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_none.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_none.page
new file mode 100644
index 00000000..a86c000f
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_in_none.page
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_none"
+ 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_array_struct_in_none</api:name>
+ <api:arg>
+ <api:type>Array(Regress.TestStructA)</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_in_none</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_in_none(arr: Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>)): void {
+ // Gjs wrapper for regress_test_array_struct_in_none()
+}
+ </code></synopsis>
+ <p>Test flat array input with transfer none.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.check.html">GLib.MainContext.prototype.check</link> or gtk_target_list_new().</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array.</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_caller_alloc.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_caller_alloc.page
new file mode 100644
index 00000000..e1b14ce7
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_caller_alloc.page
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_caller_alloc"
+ 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_array_struct_out_caller_alloc</api:name>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_caller_alloc</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_out_caller_alloc(): Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>) {
+ // Gjs wrapper for regress_test_array_struct_out_caller_alloc()
+}
+ </code></synopsis>
+ <p>Test flat caller-allocated array output.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.query.html">GLib.MainContext.prototype.query</link>.</p>
+
+<terms>
+<item>
+<title><code>Returns</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_container.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_container.page
new file mode 100644
index 00000000..659bedea
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_container.page
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_container"
+ 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_array_struct_out_container</api:name>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_container</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_out_container(): Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>) {
+ // Gjs wrapper for regress_test_array_struct_out_container()
+}
+ </code></synopsis>
+ <p>Test flat array output with transfer container.</p> <p>Similar to pango_layout_get_log_attrs().</p>
+
+<terms>
+<item>
+<title><code>Returns</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_full_fixed.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_full_fixed.page
new file mode 100644
index 00000000..9bb5a1d0
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_full_fixed.page
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_full_fixed"
+ 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_array_struct_out_full_fixed</api:name>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_full_fixed</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_out_full_fixed(): Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>) {
+ // Gjs wrapper for regress_test_array_struct_out_full_fixed()
+}
+ </code></synopsis>
+ <p>Test flat fixed-size array output with transfer full.</p>
+
+<terms>
+<item>
+<title><code>Returns</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_none.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_none.page
new file mode 100644
index 00000000..73e0fc3c
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.test_array_struct_out_none.page
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_none"
+ 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_array_struct_out_none</api:name>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_none</title>
+ <synopsis><code mime="text/x-gjs">
+function test_array_struct_out_none(): Array(<link xref="Regress.TestStructA">Regress.TestStructA</link>) {
+ // Gjs wrapper for regress_test_array_struct_out_none()
+}
+ </code></synopsis>
+ <p>Test flat array output with transfer none.</p> <p>Similar to:
+- mm_modem_peek_ports() with structs
+- gdk_query_visual_types() with enums
+- gdk_event_get_axes() with doubles</p>
+
+<terms>
+<item>
+<title><code>Returns</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page
index 8281a78e..632dd8dd 100644
--- a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-write-only.page
@@ -13,4 +13,6 @@
<synopsis><code mime="text/x-python">
"write-only" bool : Write
</code></synopsis>
+
+
</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_full.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_full.page
new file mode 100644
index 00000000..639489d1
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_full.page
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_full"
+ 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_array_struct_in_full</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_in_full</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA], gsize)
+@returns(none)
+def test_array_struct_in_full(arr, len):
+ # Python wrapper for regress_test_array_struct_in_full()
+ </code></synopsis>
+ <p>Test flat array input with transfer full.</p> <p>Similar to:
+- gsf_property_settings_free() with structs but they contain pointers
+- <link href="../GLib-2.0/GLib.byte_array_new_take.html">GLib.byte_array_new_take</link> with guint8s</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_none.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_none.page
new file mode 100644
index 00000000..10296067
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_in_none.page
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_in_none"
+ 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_array_struct_in_none</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_in_none</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA], gsize)
+@returns(none)
+def test_array_struct_in_none(arr, len):
+ # Python wrapper for regress_test_array_struct_in_none()
+ </code></synopsis>
+ <p>Test flat array input with transfer none.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.check.html">GLib.MainContext.check</link> or gtk_target_list_new().</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array.</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_caller_alloc.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_caller_alloc.page
new file mode 100644
index 00000000..92ba1aef
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_caller_alloc.page
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_caller_alloc"
+ 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_array_struct_out_caller_alloc</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_caller_alloc</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA], gsize)
+@returns(none)
+def test_array_struct_out_caller_alloc(arr, len):
+ # Python wrapper for regress_test_array_struct_out_caller_alloc()
+ </code></synopsis>
+ <p>Test flat caller-allocated array output.</p> <p>Similar to <link href="../GLib-2.0/GLib.MainContext.query.html">GLib.MainContext.query</link>.</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_container.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_container.page
new file mode 100644
index 00000000..27347a3e
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_container.page
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_container"
+ 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_array_struct_out_container</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_container</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA], gsize)
+@returns(none)
+def test_array_struct_out_container(arr, len):
+ # Python wrapper for regress_test_array_struct_out_container()
+ </code></synopsis>
+ <p>Test flat array output with transfer container.</p> <p>Similar to pango_layout_get_log_attrs().</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_full_fixed.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_full_fixed.page
new file mode 100644
index 00000000..306f3bbe
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_full_fixed.page
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_full_fixed"
+ 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_array_struct_out_full_fixed</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_full_fixed</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA])
+@returns(none)
+def test_array_struct_out_full_fixed(arr):
+ # Python wrapper for regress_test_array_struct_out_full_fixed()
+ </code></synopsis>
+ <p>Test flat fixed-size array output with transfer full.</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_none.page b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_none.page
new file mode 100644
index 00000000..ec0a9b9e
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.test_array_struct_out_none.page
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<page id="Regress.test_array_struct_out_none"
+ 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_array_struct_out_none</api:name>
+ <api:arg>
+ <api:type>[Regress.TestStructA]</api:type>
+ <api:name>arr</api:name>
+ </api:arg>
+ <api:arg>
+ <api:type>gsize</api:type>
+ <api:name>len</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.test_array_struct_out_none</title>
+ <synopsis><code mime="text/x-python">
+@accepts([Regress.TestStructA], gsize)
+@returns(none)
+def test_array_struct_out_none(arr, len):
+ # Python wrapper for regress_test_array_struct_out_none()
+ </code></synopsis>
+ <p>Test flat array output with transfer none.</p> <p>Similar to:
+- mm_modem_peek_ports() with structs
+- gdk_query_visual_types() with enums
+- gdk_event_get_axes() with doubles</p>
+
+<terms>
+<item>
+<title><code>arr</code></title>
+ <p>An array</p>
+</item>
+<item>
+<title><code>len</code></title>
+ <p>Length of <code>arr</code></p>
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index c10d50e4..3053b907 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -6427,6 +6427,64 @@ libgnome-keyring.</doc>
</parameter>
</parameters>
</function>
+ <function name="test_array_struct_in_full"
+ c:identifier="regress_test_array_struct_in_full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4579">Test flat array input with transfer full.
+
+Similar to:
+- gsf_property_settings_free() with structs but they contain pointers
+- g_byte_array_new_take() with guint8s</doc>
+ <source-position filename="regress.h" line="1519"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr" transfer-ownership="full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4581">An array</doc>
+ <array length="1" zero-terminated="0" c:type="RegressTestStructA*">
+ <type name="TestStructA" c:type="RegressTestStructA"/>
+ </array>
+ </parameter>
+ <parameter name="len" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4582">Length of @arr</doc>
+ <type name="gsize" c:type="gsize"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_array_struct_in_none"
+ c:identifier="regress_test_array_struct_in_none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4599">Test flat array input with transfer none.
+
+Similar to g_main_context_check() or gtk_target_list_new().</doc>
+ <source-position filename="regress.h" line="1522"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4601">An array.</doc>
+ <array length="1" zero-terminated="0" c:type="RegressTestStructA*">
+ <type name="TestStructA" c:type="RegressTestStructA"/>
+ </array>
+ </parameter>
+ <parameter name="len" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4602">Length of @arr</doc>
+ <type name="gsize" c:type="gsize"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_array_struct_out"
c:identifier="regress_test_array_struct_out">
<doc xml:space="preserve"
@@ -6453,6 +6511,136 @@ libgnome-keyring.</doc>
</parameter>
</parameters>
</function>
+ <function name="test_array_struct_out_caller_alloc"
+ c:identifier="regress_test_array_struct_out_caller_alloc">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4558">Test flat caller-allocated array output.
+
+Similar to g_main_context_query().</doc>
+ <source-position filename="regress.h" line="1516"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr"
+ direction="out"
+ caller-allocates="1"
+ transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4560">An array</doc>
+ <array length="1" zero-terminated="0" c:type="RegressTestStructA*">
+ <type name="TestStructA" c:type="RegressTestStructA"/>
+ </array>
+ </parameter>
+ <parameter name="len"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4561">Length of @arr</doc>
+ <type name="gsize" c:type="gsize"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_array_struct_out_container"
+ c:identifier="regress_test_array_struct_out_container">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4520">Test flat array output with transfer container.
+
+Similar to pango_layout_get_log_attrs().</doc>
+ <source-position filename="regress.h" line="1510"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="container">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4522">An array</doc>
+ <array length="1" zero-terminated="0" c:type="RegressTestStructA**">
+ <type name="TestStructA" c:type="RegressTestStructA*"/>
+ </array>
+ </parameter>
+ <parameter name="len"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4523">Length of @arr</doc>
+ <type name="gsize" c:type="gsize*"/>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_array_struct_out_full_fixed"
+ c:identifier="regress_test_array_struct_out_full_fixed">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4542">Test flat fixed-size array output with transfer full.</doc>
+ <source-position filename="regress.h" line="1513"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4544">An array</doc>
+ <array zero-terminated="0"
+ c:type="RegressTestStructA**"
+ fixed-size="4">
+ <type name="TestStructA" c:type="RegressTestStructA*"/>
+ </array>
+ </parameter>
+ </parameters>
+ </function>
+ <function name="test_array_struct_out_none"
+ c:identifier="regress_test_array_struct_out_none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4495">Test flat array output with transfer none.
+
+Similar to:
+- mm_modem_peek_ports() with structs
+- gdk_query_visual_types() with enums
+- gdk_event_get_axes() with doubles</doc>
+ <source-position filename="regress.h" line="1507"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arr"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4497">An array</doc>
+ <array length="1" zero-terminated="0" c:type="RegressTestStructA**">
+ <type name="TestStructA" c:type="RegressTestStructA*"/>
+ </array>
+ </parameter>
+ <parameter name="len"
+ direction="out"
+ caller-allocates="0"
+ transfer-ownership="full">
+ <doc xml:space="preserve"
+ filename="regress.c"
+ line="4498">Length of @arr</doc>
+ <type name="gsize" c:type="gsize*"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_async_ready_callback"
c:identifier="regress_test_async_ready_callback">
<source-position filename="regress.h" line="1161"/>
diff --git a/tests/scanner/Regress-1.0-sections-expected.txt b/tests/scanner/Regress-1.0-sections-expected.txt
index b7aa62f2..ba180b4d 100644
--- a/tests/scanner/Regress-1.0-sections-expected.txt
+++ b/tests/scanner/Regress-1.0-sections-expected.txt
@@ -73,7 +73,13 @@ regress_test_array_int_none_out
regress_test_array_int_null_in
regress_test_array_int_null_out
regress_test_array_int_out
+regress_test_array_struct_in_full
+regress_test_array_struct_in_none
regress_test_array_struct_out
+regress_test_array_struct_out_caller_alloc
+regress_test_array_struct_out_container
+regress_test_array_struct_out_full_fixed
+regress_test_array_struct_out_none
regress_test_async_ready_callback
regress_test_boolean
regress_test_boolean_false
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 6f1c4c3b..58220f35 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -4491,3 +4491,126 @@ regress_get_variant (void)
{
return g_variant_new_int32 (42);
}
+
+/**
+ * regress_test_array_struct_out_none:
+ * @arr: (out) (array length=len) (transfer none): An array
+ * @len: (out): Length of @arr
+ *
+ * Test flat array output with transfer none.
+ *
+ * Similar to:
+ * - mm_modem_peek_ports() with structs
+ * - gdk_query_visual_types() with enums
+ * - gdk_event_get_axes() with doubles
+ */
+void
+regress_test_array_struct_out_none (RegressTestStructA **arr, gsize *len)
+{
+ static RegressTestStructA array[3] = {
+ {111},
+ {222},
+ {333},
+ };
+
+ *arr = array;
+ *len = 3;
+}
+
+/**
+ * regress_test_array_struct_out_container:
+ * @arr: (out) (array length=len) (transfer container): An array
+ * @len: (out): Length of @arr
+ *
+ * Test flat array output with transfer container.
+ *
+ * Similar to pango_layout_get_log_attrs().
+ */
+void
+regress_test_array_struct_out_container (RegressTestStructA **arr, gsize *len)
+{
+
+ *arr = g_new0 (RegressTestStructA, 5);
+ (*arr)[0].some_int = 11;
+ (*arr)[1].some_int = 13;
+ (*arr)[2].some_int = 17;
+ (*arr)[3].some_int = 19;
+ (*arr)[4].some_int = 23;
+ *len = 5;
+}
+
+/**
+ * regress_test_array_struct_out_full_fixed:
+ * @arr: (out) (array fixed-size=4) (transfer full): An array
+ *
+ * Test flat fixed-size array output with transfer full.
+ */
+void
+regress_test_array_struct_out_full_fixed (RegressTestStructA **arr)
+{
+ *arr = g_new0 (RegressTestStructA, 4);
+ (*arr)[0].some_int = 2;
+ (*arr)[1].some_int = 3;
+ (*arr)[2].some_int = 5;
+ (*arr)[3].some_int = 7;
+}
+
+/**
+ * regress_test_array_struct_out_caller_alloc:
+ * @arr: (out caller-allocates) (array length=len): An array
+ * @len: Length of @arr
+ *
+ * Test flat caller-allocated array output.
+ *
+ * Similar to g_main_context_query().
+ */
+void
+regress_test_array_struct_out_caller_alloc (RegressTestStructA *arr, gsize len)
+{
+ guint i;
+
+ g_assert (arr != NULL);
+
+ memset (arr, 0, sizeof (RegressTestStructA) * len);
+ for (i=0; i != len; ++i)
+ arr[i].some_int = 111 * (i + 1);
+}
+
+/**
+ * regress_test_array_struct_in_full:
+ * @arr: (in) (array length=len) (transfer full): An array
+ * @len: Length of @arr
+ *
+ * Test flat array input with transfer full.
+ *
+ * Similar to:
+ * - gsf_property_settings_free() with structs but they contain pointers
+ * - g_byte_array_new_take() with guint8s
+ */
+void
+regress_test_array_struct_in_full (RegressTestStructA *arr, gsize len)
+{
+ g_assert_cmpint (len, ==, 2);
+ g_assert_cmpint (arr[0].some_int, ==, 201);
+ g_assert_cmpint (arr[1].some_int, ==, 202);
+ g_free (arr);
+}
+
+/**
+ * regress_test_array_struct_in_none:
+ * @arr: (in) (array length=len) (transfer none): An array.
+ * @len: Length of @arr
+ *
+ * Test flat array input with transfer none.
+ *
+ * Similar to g_main_context_check() or gtk_target_list_new().
+ */
+void
+regress_test_array_struct_in_none (RegressTestStructA *arr, gsize len)
+{
+ g_assert_cmpint (len, ==, 3);
+ g_assert_cmpint (arr[0].some_int, ==, 301);
+ g_assert_cmpint (arr[1].some_int, ==, 302);
+ g_assert_cmpint (arr[2].some_int, ==, 303);
+}
+
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 44d36e15..82fd6b55 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -1503,4 +1503,22 @@ struct _RegressTestReferenceCounters {
gatomicrefcount atomicrefcount;
};
+_GI_TEST_EXTERN
+void regress_test_array_struct_out_none (RegressTestStructA **arr, gsize *len);
+
+_GI_TEST_EXTERN
+void regress_test_array_struct_out_container (RegressTestStructA **arr, gsize *len);
+
+_GI_TEST_EXTERN
+void regress_test_array_struct_out_full_fixed (RegressTestStructA **arr);
+
+_GI_TEST_EXTERN
+void regress_test_array_struct_out_caller_alloc (RegressTestStructA *arr, gsize len);
+
+_GI_TEST_EXTERN
+void regress_test_array_struct_in_full (RegressTestStructA *arr, gsize len);
+
+_GI_TEST_EXTERN
+void regress_test_array_struct_in_none (RegressTestStructA *arr, gsize len);
+
#endif /* __GITESTTYPES_H__ */