diff options
author | Stef Walter <stefw@gnome.org> | 2013-10-20 20:47:13 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-10-28 20:54:27 +0100 |
commit | 2a569cb68ca4e4ce08ff66fc20a79bc57222c2e2 (patch) | |
tree | 49af0867f76eb5f916f417f19cd54f864dd252aa /tests | |
parent | f7acdd34e28456d706a38e51b8332569d7a0f271 (diff) | |
download | gobject-introspection-2a569cb68ca4e4ce08ff66fc20a79bc57222c2e2.tar.gz |
giscanner: Correctly consume field annotations on structs
A hidden exception was being thrown (which we now log), due to fields
being treated as function parameters. Fixed to make field array
annotations be transformed and written out to the gir correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=710561
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields.page | 25 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 14 | ||||
-rw-r--r-- | tests/scanner/annotation.h | 15 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields.page b/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields.page new file mode 100644 index 00000000..74c6eab8 --- /dev/null +++ b/tests/scanner/Regress-1.0-C-expected/Regress.AnnotationFields.page @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<page id="Regress.AnnotationFields" + type="topic" + style="record" + 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="record" type="guide"/> + + </info> + <title>Regress.AnnotationFields</title> + + + + <p>This is a struct for testing field documentation and annotations</p> + + + + + + + +</page> diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index bb83e225..925fe538 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -87,6 +87,20 @@ and/or use gtk-doc annotations. --> </parameter> </parameters> </callback> + <record name="AnnotationFields" c:type="RegressAnnotationFields"> + <doc xml:space="preserve">This is a struct for testing field documentation and annotations</doc> + <field name="field1" writable="1"> + <type name="gint" c:type="int"/> + </field> + <field name="arr" writable="1"> + <array length="2" zero-terminated="0" c:type="guchar*"> + <type name="guint8" c:type="guchar"/> + </array> + </field> + <field name="len" writable="1"> + <type name="gulong" c:type="gulong"/> + </field> + </record> <callback name="AnnotationForeachFunc" c:type="RegressAnnotationForeachFunc"> <return-value transfer-ownership="none"> diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 2084da29..b0cbe42d 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -159,6 +159,21 @@ struct RegressAnnotationStruct RegressAnnotationObject *objects[10]; }; +/** + * RegressAnnotationFields: + * @field1: Some documentation + * @arr: (array length=len): an array of length @len + * @len: the length of array + * + * This is a struct for testing field documentation and annotations + */ +struct RegressAnnotationFields +{ + int field1; + guchar *arr; + gulong len; +}; + void regress_annotation_ptr_array (GPtrArray *array); GObject * regress_annotation_test_parsing_bug630862 (void); |