summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2011-09-13 11:57:28 -0300
committerJohan Dahlin <jdahlin@litl.com>2011-09-14 08:04:09 -0300
commitde5401b5c5760c5384f24161373e80bc50fdd442 (patch)
treeb71dde9bb3e9839a7b66df8170b22eefb5967107 /tests
parent128431773deae4545f9f3a6f0085efc082f49c92 (diff)
downloadgobject-introspection-de5401b5c5760c5384f24161373e80bc50fdd442.tar.gz
Add constant value annotation
Add an annotation tag "Value:" which can be used on constants to override the value.
Diffstat (limited to 'tests')
-rw-r--r--tests/scanner/Annotation-1.0-expected.gir15
-rw-r--r--tests/scanner/Foo-1.0-expected.gir8
-rw-r--r--tests/scanner/Regress-1.0-expected.gir18
-rw-r--r--tests/scanner/annotation.h21
4 files changed, 54 insertions, 8 deletions
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
index eae5b7c9..4449604c 100644
--- a/tests/scanner/Annotation-1.0-expected.gir
+++ b/tests/scanner/Annotation-1.0-expected.gir
@@ -20,6 +20,21 @@ and/or use gtk-doc annotations. -->
<member name="foo" value="1" c:identifier="ANN_FLAG_FOO"/>
<member name="bar" value="2" c:identifier="ANN_FLAG_BAR"/>
</bitfield>
+ <constant name="CALCULATED_DEFINE"
+ value="100"
+ c:type="ANNOTATION_CALCULATED_DEFINE">
+ <type name="gint" c:type="gint"/>
+ </constant>
+ <constant name="CALCULATED_LARGE"
+ value="10000000000UL"
+ c:type="ANNOTATION_CALCULATED_LARGE">
+ <type name="gint" c:type="gint"/>
+ </constant>
+ <constant name="CALCULATED_LARGE_DIV"
+ value="1000000UL"
+ c:type="ANNOTATION_CALCULATED_LARGE_DIV">
+ <type name="gint" c:type="gint"/>
+ </constant>
<callback name="Callback" c:type="AnnotationCallback">
<doc xml:whitespace="preserve">This is a callback.</doc>
<return-value transfer-ownership="none">
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index 371250f5..b8dc33f5 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -156,7 +156,9 @@ and/or use gtk-doc annotations. -->
</return-value>
</method>
</record>
- <constant name="DEFINE_SHOULD_BE_EXPOSED" value="should be exposed">
+ <constant name="DEFINE_SHOULD_BE_EXPOSED"
+ value="should be exposed"
+ c:type="FOO_DEFINE_SHOULD_BE_EXPOSED">
<type name="utf8" c:type="gchar*"/>
</constant>
<enumeration name="EnumFullname" c:type="FooEnumFullname">
@@ -631,7 +633,7 @@ uses a C sugar return type.</doc>
disguised="1"
glib:is-gtype-struct-for="OtherObject">
</record>
- <constant name="PIE_IS_TASTY" value="3.141590">
+ <constant name="PIE_IS_TASTY" value="3.141590" c:type="FOO_PIE_IS_TASTY">
<type name="gdouble" c:type="gdouble"/>
</constant>
<record name="Rectangle" c:type="FooRectangle">
@@ -680,7 +682,7 @@ it because it's not a boxed type.</doc>
</parameters>
</function>
</record>
- <constant name="SUCCESS_INT" value="4408">
+ <constant name="SUCCESS_INT" value="4408" c:type="FOO_SUCCESS_INT">
<type name="gint" c:type="gint"/>
</constant>
<enumeration name="Skippable" introspectable="0" c:type="FooSkippable">
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 79ca1d31..7d106f66 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -32,19 +32,25 @@ and/or use gtk-doc annotations. -->
<doc xml:whitespace="preserve">Typedef'd va_list for additional reasons</doc>
<type name="va_list" c:type="va_list"/>
</alias>
- <constant name="DOUBLE_CONSTANT" value="44.220000">
+ <constant name="DOUBLE_CONSTANT"
+ value="44.220000"
+ c:type="REGRESS_DOUBLE_CONSTANT">
<type name="gdouble" c:type="gdouble"/>
</constant>
- <constant name="INT_CONSTANT" value="4422">
+ <constant name="INT_CONSTANT" value="4422" c:type="REGRESS_INT_CONSTANT">
<type name="gint" c:type="gint"/>
</constant>
<record name="Intset" c:type="RegressIntset" disguised="1">
<doc xml:whitespace="preserve">Like telepathy-glib's TpIntset.</doc>
</record>
- <constant name="Mixed_Case_Constant" value="4423">
+ <constant name="Mixed_Case_Constant"
+ value="4423"
+ c:type="REGRESS_Mixed_Case_Constant">
<type name="gint" c:type="gint"/>
</constant>
- <constant name="STRING_CONSTANT" value="Some String">
+ <constant name="STRING_CONSTANT"
+ value="Some String"
+ c:type="REGRESS_STRING_CONSTANT">
<type name="utf8" c:type="gchar*"/>
</constant>
<record name="SkippedStructure"
@@ -1307,7 +1313,9 @@ TpAccount::status-changed</doc>
<type name="GObject.ObjectClass" c:type="GObjectClass"/>
</field>
</record>
- <constant name="UTF8_CONSTANT" value="const ♥ utf8">
+ <constant name="UTF8_CONSTANT"
+ value="const ♥ utf8"
+ c:type="REGRESS_UTF8_CONSTANT">
<type name="utf8" c:type="gchar*"/>
</constant>
<function name="aliased_caller_alloc"
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index c7de0f1b..8bfbfd21 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -169,5 +169,26 @@ void annotation_space_after_comment_bug631690 (void);
gchar* annotation_return_filename (void);
+/* This one we can handle properly */
+#define ANNOTATION_CALCULATED_DEFINE (10 * 10)
+
+/**
+ * ANNOTATION_CALCULATED_LARGE:
+ *
+ * Constant to define a calculated large value
+ *
+ * Value: 10000000000UL
+ */
+#define ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000))
+
+/**
+ * ANNOTATION_CALCULATED_LARGE_DIV:
+ *
+ * Constant to define a calculated large value
+ *
+ * Value: 1000000UL
+ */
+#define ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000))
+
#endif /* __ANNOTATION_OBJECT_H__ */