summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2016-02-06 20:31:27 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2016-02-08 22:21:27 -0800
commitcd355e86a28bfed7744ac567f06ab18a12d1ad1d (patch)
treef7a5e2d6e30f111325c5412a8f95c5794a5ea642
parentcbd238445f23eff22e61d2f973c45339f089a4d8 (diff)
downloadgobject-introspection-cd355e86a28bfed7744ac567f06ab18a12d1ad1d.tar.gz
tests: Add regression test for signal w. array+len
This is a regression test for marshalling callback arguments from signals with an array parameter and separate length parameter into closures in the introspected language. https://bugzilla.gnome.org/show_bug.cgi?id=761659
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page4
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.TestObj.emit_sig_with_array_len_prop.page38
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page4
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.emit_sig_with_array_len_prop.page26
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page4
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.emit_sig_with_array_len_prop.page37
-rw-r--r--tests/scanner/Regress-1.0-expected.gir15
-rw-r--r--tests/scanner/Regress-1.0-sections-expected.txt1
-rw-r--r--tests/scanner/regress.c14
-rw-r--r--tests/scanner/regress.h3
10 files changed, 141 insertions, 5 deletions
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page
index dcb254b1..ab7407d5 100644
--- a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page
@@ -14,7 +14,9 @@
void sig-with-array-len-prop (guint* arr,
gint len);
</code></synopsis>
- <p>This test signal similar to GSettings::change-event</p>
+<p>This test signal similar to GSettings::change-event.
+You can use this with <link xref="Regress.TestObj.emit_sig_with_array_len_prop"/>, or
+raise from the introspection client language.</p>
<terms>
<item>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestObj.emit_sig_with_array_len_prop.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
new file mode 100644
index 00000000..331e3eb4
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj.emit_sig_with_array_len_prop"
+ type="topic"
+ style="method"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="method" type="guide"/>
+ <api:function>
+ <api:returns>
+ <api:type>void</api:type>
+ </api:returns>
+ <api:name>regress_test_obj_emit_sig_with_array_len_prop</api:name>
+ <api:arg>
+ <api:type>RegressTestObj*</api:type>
+ <api:name>obj</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>regress_test_obj_emit_sig_with_array_len_prop</title>
+ <synopsis><code mime="text/x-csrc">
+void regress_test_obj_emit_sig_with_array_len_prop (RegressTestObj* obj);
+ </code></synopsis>
+
+
+<terms>
+<item>
+<title><code>obj</code></title>
+
+</item>
+<item>
+<title><code>Returns</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page
index 6af8b356..588eab4a 100644
--- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page
@@ -13,7 +13,9 @@
<synopsis><code mime="text/x-gjs">
connect('sig-with-array-len-prop', function (testObj, arr: Array(Number(guint)), ): void);
</code></synopsis>
- <p>This test signal similar to GSettings::change-event</p>
+<p>This test signal similar to GSettings::change-event.
+You can use this with <link xref="Regress.TestObj.emit_sig_with_array_len_prop"/>, or
+raise from the introspection client language.</p>
<terms>
<item>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.emit_sig_with_array_len_prop.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
new file mode 100644
index 00000000..014e56db
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj.emit_sig_with_array_len_prop"
+ type="topic"
+ style="method"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="method" type="guide"/>
+ <api:function>
+ <api:returns>
+ <api:type>void</api:type>
+ </api:returns>
+ <api:name>regress_test_obj_emit_sig_with_array_len_prop</api:name>
+ </api:function>
+ </info>
+ <title>Regress.TestObj.prototype.emit_sig_with_array_len_prop</title>
+ <synopsis><code mime="text/x-gjs">
+function emit_sig_with_array_len_prop(): void {
+ // Gjs wrapper for regress_test_obj_emit_sig_with_array_len_prop()
+}
+ </code></synopsis>
+
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page
index 2b38065c..04c8eb25 100644
--- a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page
@@ -13,7 +13,9 @@
<synopsis><code mime="text/x-python">
def callback(test_obj, arr, len, user_param1, ...)
</code></synopsis>
- <p>This test signal similar to GSettings::change-event</p>
+<p>This test signal similar to GSettings::change-event.
+You can use this with <link xref="Regress.TestObj.emit_sig_with_array_len_prop"/>, or
+raise from the introspection client language.</p>
<terms>
<item>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.emit_sig_with_array_len_prop.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
new file mode 100644
index 00000000..8c768bb4
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj.emit_sig_with_array_len_prop.page
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<page id="Regress.TestObj.emit_sig_with_array_len_prop"
+ type="topic"
+ style="method"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestObj" group="method" type="guide"/>
+ <api:function>
+ <api:returns>
+ <api:type>none</api:type>
+ </api:returns>
+ <api:name>regress_test_obj_emit_sig_with_array_len_prop</api:name>
+ <api:arg>
+ <api:type>Regress.TestObj</api:type>
+ <api:name>self</api:name>
+ </api:arg>
+ </api:function>
+ </info>
+ <title>Regress.TestObj.emit_sig_with_array_len_prop</title>
+ <synopsis><code mime="text/x-python">
+@accepts(Regress.TestObj)
+@returns(none)
+def emit_sig_with_array_len_prop(self):
+ # Python wrapper for regress_test_obj_emit_sig_with_array_len_prop()
+ </code></synopsis>
+
+
+<terms>
+<item>
+<title><code>self</code></title>
+
+</item>
+</terms>
+
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 321a7c60..658b17fb 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -3056,6 +3056,17 @@ case.</doc>
</parameter>
</parameters>
</method>
+ <method name="emit_sig_with_array_len_prop"
+ c:identifier="regress_test_obj_emit_sig_with_array_len_prop">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="obj" transfer-ownership="none">
+ <type name="TestObj" c:type="RegressTestObj*"/>
+ </instance-parameter>
+ </parameters>
+ </method>
<method name="emit_sig_with_foreign_struct"
c:identifier="regress_test_obj_emit_sig_with_foreign_struct">
<return-value transfer-ownership="none">
@@ -3628,7 +3639,9 @@ raise an error.</doc>
</return-value>
</glib:signal>
<glib:signal name="sig-with-array-len-prop" when="last">
- <doc xml:space="preserve">This test signal similar to GSettings::change-event</doc>
+ <doc xml:space="preserve">This test signal similar to GSettings::change-event.
+You can use this with regress_test_obj_emit_sig_with_array_len_prop(), or
+raise from the introspection client language.</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
diff --git a/tests/scanner/Regress-1.0-sections-expected.txt b/tests/scanner/Regress-1.0-sections-expected.txt
index 26ace9ab..4c5100e4 100644
--- a/tests/scanner/Regress-1.0-sections-expected.txt
+++ b/tests/scanner/Regress-1.0-sections-expected.txt
@@ -336,6 +336,7 @@ RegressTestInterfaceIface
RegressTestObj
RegressTestObjClass
regress_test_obj_do_matrix
+regress_test_obj_emit_sig_with_array_len_prop
regress_test_obj_emit_sig_with_foreign_struct
regress_test_obj_emit_sig_with_int64
regress_test_obj_emit_sig_with_obj
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 6eac6f7b..c317682a 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -2329,7 +2329,9 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
* @arr: (array length=len) (element-type uint) (allow-none): numbers, or %NULL
* @len: length of @arr, or 0
*
- * This test signal similar to GSettings::change-event
+ * This test signal similar to GSettings::change-event.
+ * You can use this with regress_test_obj_emit_sig_with_array_len_prop(), or
+ * raise from the introspection client language.
*/
regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_LEN_PROP] =
g_signal_new ("sig-with-array-len-prop",
@@ -2756,6 +2758,16 @@ regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj)
g_assert (ret == G_MAXUINT64);
}
+/**
+ * regress_test_obj_emit_sig_with_array_len_prop:
+ */
+void
+regress_test_obj_emit_sig_with_array_len_prop (RegressTestObj *obj)
+{
+ int arr[] = { 0, 1, 2, 3, 4 };
+ g_signal_emit_by_name (obj, "sig-with-array-len-prop", &arr, 5);
+}
+
int
regress_test_obj_instance_method (RegressTestObj *obj)
{
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 780f8e21..c1106902 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -828,6 +828,9 @@ _GI_TEST_EXTERN
void regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj);
_GI_TEST_EXTERN
+void regress_test_obj_emit_sig_with_array_len_prop (RegressTestObj *obj);
+
+_GI_TEST_EXTERN
int regress_test_obj_instance_method (RegressTestObj *obj);
_GI_TEST_EXTERN