[gobject-introspection] Add tests for non-gtype Enum
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Add tests for non-gtype Enum
- Date: Thu, 22 Apr 2010 13:55:40 +0000 (UTC)
commit 781db9e3967604e234be28f178617ed275fa60aa
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Thu Apr 22 15:11:29 2010 +0200
Add tests for non-gtype Enum
gir/gimarshallingtests.c | 44 +++++++++++++++++++++++++++++++++++++++-----
gir/gimarshallingtests.h | 26 ++++++++++++++++++++++----
2 files changed, 61 insertions(+), 9 deletions(-)
---
diff --git a/gir/gimarshallingtests.c b/gir/gimarshallingtests.c
index 25ce484..5f09633 100644
--- a/gir/gimarshallingtests.c
+++ b/gir/gimarshallingtests.c
@@ -2124,23 +2124,57 @@ g_i_marshalling_tests_pointer_in_return (gpointer pointer)
}
GType
-g_i_marshalling_tests_enum_get_type (void)
+g_i_marshalling_tests_genum_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY(type == 0)) {
static const GEnumValue values[] = {
- { G_I_MARSHALLING_TESTS_ENUM_VALUE1, "G_I_MARSHALLING_TESTS_ENUM_VALUE1", "value1" },
- { G_I_MARSHALLING_TESTS_ENUM_VALUE2, "G_I_MARSHALLING_TESTS_ENUM_VALUE2", "value2" },
- { G_I_MARSHALLING_TESTS_ENUM_VALUE3, "G_I_MARSHALLING_TESTS_ENUM_VALUE3", "value3" },
+ { G_I_MARSHALLING_TESTS_GENUM_VALUE1, "G_I_MARSHALLING_TESTS_GENUM_VALUE1", "value1" },
+ { G_I_MARSHALLING_TESTS_GENUM_VALUE2, "G_I_MARSHALLING_TESTS_GENUM_VALUE2", "value2" },
+ { G_I_MARSHALLING_TESTS_GENUM_VALUE3, "G_I_MARSHALLING_TESTS_GENUM_VALUE3", "value3" },
{ 0, NULL, NULL }
};
- type = g_enum_register_static (g_intern_static_string ("GIMarshallingTestsEnum"), values);
+ type = g_enum_register_static (g_intern_static_string ("GIMarshallingTestsGEnum"), values);
}
return type;
}
GIMarshallingTestsEnum
+g_i_marshalling_tests_genum_return (void)
+{
+ return G_I_MARSHALLING_TESTS_GENUM_VALUE3;
+}
+
+void
+g_i_marshalling_tests_genum_in (GIMarshallingTestsGEnum enum_)
+{
+ g_assert(enum_ == G_I_MARSHALLING_TESTS_GENUM_VALUE3);
+}
+
+/**
+ * g_i_marshalling_tests_genum_out:
+ * @enum_: (out):
+ */
+void
+g_i_marshalling_tests_genum_out (GIMarshallingTestsGEnum *enum_)
+{
+ *enum_ = G_I_MARSHALLING_TESTS_GENUM_VALUE3;
+}
+
+/**
+ * g_i_marshalling_tests_genum_inout:
+ * @enum_: (inout):
+ */
+void
+g_i_marshalling_tests_genum_inout (GIMarshallingTestsGEnum *enum_)
+{
+ g_assert(*enum_ == G_I_MARSHALLING_TESTS_GENUM_VALUE3);
+ *enum_ = G_I_MARSHALLING_TESTS_GENUM_VALUE1;
+}
+
+
+GIMarshallingTestsEnum
g_i_marshalling_tests_enum_return (void)
{
return G_I_MARSHALLING_TESTS_ENUM_VALUE3;
diff --git a/gir/gimarshallingtests.h b/gir/gimarshallingtests.h
index 998fd27..b38c9c9 100644
--- a/gir/gimarshallingtests.h
+++ b/gir/gimarshallingtests.h
@@ -378,7 +378,7 @@ void g_i_marshalling_tests_gclosure_in (GClosure *closure);
gpointer g_i_marshalling_tests_pointer_in_return (gpointer pointer);
-/* GEnum */
+/* Enum */
typedef enum
{
@@ -387,9 +387,6 @@ typedef enum
G_I_MARSHALLING_TESTS_ENUM_VALUE3 = 42
} GIMarshallingTestsEnum;
-GType g_i_marshalling_tests_enum_get_type (void) G_GNUC_CONST;
-#define G_I_MARSHALLING_TESTS_TYPE_ENUM (g_i_marshalling_tests_enum_get_type ())
-
GIMarshallingTestsEnum g_i_marshalling_tests_enum_return (void);
void g_i_marshalling_tests_enum_in (GIMarshallingTestsEnum enum_);
@@ -399,6 +396,27 @@ void g_i_marshalling_tests_enum_out (GIMarshallingTestsEnum *enum_);
void g_i_marshalling_tests_enum_inout (GIMarshallingTestsEnum *enum_);
+/* GEnum */
+
+typedef enum
+{
+ G_I_MARSHALLING_TESTS_GENUM_VALUE1,
+ G_I_MARSHALLING_TESTS_GENUM_VALUE2,
+ G_I_MARSHALLING_TESTS_GENUM_VALUE3 = 42
+} GIMarshallingTestsGEnum;
+
+GType g_i_marshalling_tests_genum_get_type (void) G_GNUC_CONST;
+#define G_I_MARSHALLING_TESTS_TYPE_GENUM (g_i_marshalling_tests_genum_get_type ())
+
+GIMarshallingTestsEnum g_i_marshalling_tests_genum_return (void);
+
+void g_i_marshalling_tests_genum_in (GIMarshallingTestsGEnum enum_);
+
+void g_i_marshalling_tests_genum_out (GIMarshallingTestsGEnum *enum_);
+
+void g_i_marshalling_tests_genum_inout (GIMarshallingTestsGEnum *enum_);
+
+
/* GFlags */
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]