diff options
author | Martin Pitt <martinpitt@gnome.org> | 2013-02-27 12:14:16 +0100 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-02-27 14:49:12 +0100 |
commit | 2af5386d6cc1deba21f03c398c6368a9de6ed4ba (patch) | |
tree | b4a3125e059de2473c7dbdeeb3589798050a350c /tests/scanner | |
parent | de6946c8a4ced56f7a24078b0d1aeacdb77e7f14 (diff) | |
download | gobject-introspection-2af5386d6cc1deba21f03c398c6368a9de6ed4ba.tar.gz |
Add test case for signal with a C array and length argument
By-product of https://bugzilla.gnome.org/show_bug.cgi?id=662241.
Diffstat (limited to 'tests/scanner')
5 files changed, 172 insertions, 0 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 new file mode 100644 index 00000000..9ec983b1 --- /dev/null +++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestObj-sig-with-array-len-prop.page @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<page id="Regress.TestObj-sig-with-array-len-prop" + type="topic" + style="signal" + 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="signal" type="guide"/> + <title type="link" role="topic">sig-with-array-len-prop</title> + + </info> + <title>Regress.TestObj::sig-with-array-len-prop</title> + +<synopsis><code mime="text/x-csrc"> +void sig-with-array-len-prop (guint* arr, + gint len); +</code></synopsis> + + + <p>This test signal similar to GSettings::change-event</p> + + + + +<terms> +<item> +<title><code>arr</code></title> +<p>numbers, or <code>NULL</code></p> +</item> +<item> +<title><code>len</code></title> +<p>length of <code>arr</code>, or 0</p> +</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 new file mode 100644 index 00000000..c359b137 --- /dev/null +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-sig-with-array-len-prop.page @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<page id="Regress.TestObj-sig-with-array-len-prop" + type="topic" + style="signal" + 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="signal" type="guide"/> + <title type="link" role="topic">sig-with-array-len-prop</title> + + </info> + <title>Regress.TestObj::sig-with-array-len-prop</title> + +<synopsis><code mime="text/x-python"> +function callback(test_obj, arr:[Number], ):void; +</code></synopsis> + + + <p>This test signal similar to GSettings::change-event</p> + + + + +<terms> +<item> +<title><code>test_obj</code></title> +<p>instance of <link xref="Regress.TestObj"/> that is emitting the signal</p> +</item> +<item> +<title><code>arr</code></title> +<p>numbers, or <code>null</code></p> +</item> +</terms> + + + +</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 new file mode 100644 index 00000000..a228de1f --- /dev/null +++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-sig-with-array-len-prop.page @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<page id="Regress.TestObj-sig-with-array-len-prop" + type="topic" + style="signal" + 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="signal" type="guide"/> + <title type="link" role="topic">sig-with-array-len-prop</title> + + </info> + <title>Regress.TestObj::sig-with-array-len-prop</title> + +<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> + + + + +<terms> +<item> +<title><code>test_obj</code></title> +<p>instance of <link xref="Regress.TestObj"/> that is emitting the signal</p> +</item> +<item> +<title><code>arr</code></title> +<p>numbers, or <code>None</code></p> +</item> +<item> +<title><code>len</code></title> +<p>length of <code>arr</code>, or 0</p> +</item> +<title><code>user_param1</code></title> +<p>first user parameter (if any) specified with the connect() method</p> +<item> +<title><code>...</code></title> +<p>additional user parameters (if any)</p> +</item> +</terms> + + + +</page> diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 35c7c694..53773cae 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -3331,6 +3331,24 @@ raise an error.</doc> <type name="none" c:type="void"/> </return-value> </glib:signal> + <glib:signal name="sig-with-array-len-prop" when="last"> + <doc xml:whitespace="preserve">This test signal similar to GSettings::change-event</doc> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="arr" transfer-ownership="none" allow-none="1"> + <doc xml:whitespace="preserve">numbers, or %NULL</doc> + <array length="1" zero-terminated="0" c:type="gpointer"> + <type name="guint"/> + </array> + </parameter> + <parameter name="len" transfer-ownership="none"> + <doc xml:whitespace="preserve">length of @arr, or 0</doc> + <type name="gint" c:type="gint"/> + </parameter> + </parameters> + </glib:signal> <glib:signal name="sig-with-array-prop" when="last"> <doc xml:whitespace="preserve">This test signal is like TelepathyGlib's TpChannel:: group-members-changed-detailed:</doc> diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index b5fc8585..f54c2f91 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -2173,6 +2173,7 @@ regress_test_obj_default_matrix (RegressTestObj *obj, const char *somestr) enum { REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_PROP, + REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_LEN_PROP, REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP, REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_STRV, REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ, @@ -2241,6 +2242,27 @@ regress_test_obj_class_init (RegressTestObjClass *klass) G_TYPE_ARRAY); /** + * RegressTestObj::sig-with-array-len-prop: + * @self: an object + * @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 + */ + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_LEN_PROP] = + g_signal_new ("sig-with-array-len-prop", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + NULL, + G_TYPE_NONE, + 2, + G_TYPE_POINTER, + G_TYPE_INT); + + /** * RegressTestObj::sig-with-hash-prop: * @self: an object * @hash: (element-type utf8 GObject.Value): |