Commit efb9b272 authored by Tomasz Miąsko's avatar Tomasz Miąsko

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
parent 44a5ab2d
Pipeline #50139 passed with stages
in 6 minutes and 13 seconds
......@@ -10,4 +10,6 @@
<title type="link" role="topic">write-only</title>
</info>
<title>Regress.TestObj:write-only</title>
</page>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
......@@ -13,4 +13,6 @@
<synopsis><code mime="text/x-gjs">
TestObj.write_only: Boolean (Write)
</code></synopsis>
</page>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
......@@ -13,4 +13,6 @@
<synopsis><code mime="text/x-python">
"write-only" bool : Write
</code></synopsis>
</page>
<?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>
<?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>
<?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>
<?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)