[gobject-introspection] Regress: Add GVariant tests
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Regress: Add GVariant tests
- Date: Wed, 25 May 2011 15:48:00 +0000 (UTC)
commit 8d64bc23d2b837421ecf9c7b0e4b8d5d95ca0d21
Author: Colin Walters <walters verbum org>
Date: Wed May 25 11:47:38 2011 -0400
Regress: Add GVariant tests
tests/scanner/Regress-1.0-expected.gir | 31 ++++++++++++++++
tests/scanner/regress.c | 63 ++++++++++++++++++++++++++++++++
tests/scanner/regress.h | 5 +++
3 files changed, 99 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 40bdf4e..08e276c 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -2171,6 +2171,37 @@ call and can be released on return.</doc>
</parameter>
</parameters>
</function>
+ <function name="test_gvariant_as" c:identifier="regress_test_gvariant_as">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">New variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
+ <function name="test_gvariant_asv"
+ c:identifier="regress_test_gvariant_asv">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">New variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
+ <function name="test_gvariant_i" c:identifier="regress_test_gvariant_i">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">New variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
+ <function name="test_gvariant_s" c:identifier="regress_test_gvariant_s">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">New variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
+ <function name="test_gvariant_v" c:identifier="regress_test_gvariant_v">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">New variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
<function name="test_int" c:identifier="regress_test_int">
<return-value transfer-ownership="none">
<type name="gint" c:type="gint"/>
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 3d8690f..9d4d781 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -324,6 +324,69 @@ regress_test_cairo_surface_full_out (cairo_surface_t **surface)
*surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
}
+/**
+ * regress_test_gvariant_i:
+ *
+ * Returns: (transfer full): New variant
+ */
+GVariant *
+regress_test_gvariant_i (void)
+{
+ return g_variant_new_int32 (1);
+}
+
+/**
+ * regress_test_gvariant_s:
+ *
+ * Returns: (transfer full): New variant
+ */
+GVariant *
+regress_test_gvariant_s (void)
+{
+ return g_variant_new_string ("one");
+}
+
+/**
+ * regress_test_gvariant_asv:
+ *
+ * Returns: (transfer full): New variant
+ */
+GVariant *
+regress_test_gvariant_asv (void)
+{
+ GVariantBuilder b;
+
+ g_variant_builder_init (&b, G_VARIANT_TYPE ("a{sv}"));
+
+ g_variant_builder_add (&b, "{sv}", "name", g_variant_new_string ("foo"));
+ g_variant_builder_add (&b, "{sv}", "timeout", g_variant_new_int32 (10));
+
+ return g_variant_builder_end (&b);
+}
+
+/**
+ * regress_test_gvariant_v:
+ *
+ * Returns: (transfer full): New variant
+ */
+GVariant *
+regress_test_gvariant_v (void)
+{
+ return g_variant_new_variant (g_variant_new_string ("contents"));
+}
+
+/**
+ * regress_test_gvariant_as:
+ *
+ * Returns: (transfer full): New variant
+ */
+GVariant *
+regress_test_gvariant_as (void)
+{
+ const char *as[] = { "one", "two", "three", NULL };
+
+ return g_variant_new_strv (as, -1);
+}
/************************************************************************/
/* utf8 */
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index ee535f6..f463a03 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -130,6 +130,11 @@ cairo_surface_t *regress_test_cairo_surface_full_return (void);
void regress_test_cairo_surface_none_in (cairo_surface_t *surface);
void regress_test_cairo_surface_full_out (cairo_surface_t **surface);
+GVariant *regress_test_gvariant_i (void);
+GVariant *regress_test_gvariant_s (void);
+GVariant *regress_test_gvariant_asv (void);
+GVariant *regress_test_gvariant_v (void);
+GVariant *regress_test_gvariant_as (void);
/* enums / flags */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]