From 6c0c0eeff5246facec1e5f102d9cc2a45a9db339 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Fri, 23 Jan 2009 14:12:21 +0000 Subject: [PATCH] Add an enum param test function 2009-01-23 Johan Dahlin * tests/everything/everything.c (test_enum_param): * tests/everything/everything.h: Add an enum param test function svn path=/trunk/; revision=1066 --- ChangeLog | 7 +++++++ tests/everything/everything.c | 14 ++++++++++++++ tests/everything/everything.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1bba343..d2f2dbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-23 Johan Dahlin + + * tests/everything/everything.c (test_enum_param): + * tests/everything/everything.h: + + Add an enum param test function + 2009-01-21 Johan Dahlin * configure.ac: diff --git a/tests/everything/everything.c b/tests/everything/everything.c index 434401f..c30fbb7 100644 --- a/tests/everything/everything.c +++ b/tests/everything/everything.c @@ -544,6 +544,20 @@ test_flags_get_type (void) return etype; } +const gchar * +test_enum_param(TestEnum e) +{ + GEnumValue *ev; + GEnumClass *ec; + + ec = g_type_class_ref (test_enum_get_type ()); + ev = g_enum_get_value (ec, e); + g_type_class_unref (ec); + + return ev->value_nick; + +} + /* structures */ /** diff --git a/tests/everything/everything.h b/tests/everything/everything.h index 22f1838..29ec8d7 100644 --- a/tests/everything/everything.h +++ b/tests/everything/everything.h @@ -95,6 +95,8 @@ GType test_enum_get_type (void) G_GNUC_CONST; GType test_flags_get_type (void) G_GNUC_CONST; #define TES_TYPE_FLAGS (test_flags_get_type ()) +const gchar * test_enum_param(TestEnum e); + /* structures */ typedef struct _TestStructA TestStructA; typedef struct _TestStructB TestStructB; -- 2.39.2