diff options
author | Johan Bilien <jobi@via.ecp.fr> | 2008-12-09 15:27:47 +0000 |
---|---|---|
committer | Johan Bilien <jobi@src.gnome.org> | 2008-12-09 15:27:47 +0000 |
commit | 96d1b5d0efb045dd6f7cc42f6ea48f773d643fec (patch) | |
tree | f0ebb556b1e3ae78a41ca1bc1f974b55fdddb384 | |
parent | 517888c7425e68fdaabd3bc2199bee31d454036c (diff) | |
download | gobject-introspection-96d1b5d0efb045dd6f7cc42f6ea48f773d643fec.tar.gz |
Bug 562545 – Add function taking / returning GValue
2008-12-09 Johan Bilien <jobi@via.ecp.fr>
Bug 562545 – Add function taking / returning GValue
* tests/everything/everything.[ch]: add a test of function taking and
returning "const GValue *"
svn path=/trunk/; revision=990
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | tests/everything/everything.c | 31 | ||||
-rw-r--r-- | tests/everything/everything.h | 4 |
3 files changed, 42 insertions, 0 deletions
@@ -1,3 +1,10 @@ +2008-12-09 Johan Bilien <jobi@via.ecp.fr> + + Bug 562545 – Add function taking / returning GValue + + * tests/everything/everything.[ch]: add a test of function taking and + returning "const GValue *" + 2008-12-09 Johan Dahlin <johan@async.com.br> * giscanner/cachestore.py (CacheStore.store): Use diff --git a/tests/everything/everything.c b/tests/everything/everything.c index c0bff6ad..4c72692e 100644 --- a/tests/everything/everything.c +++ b/tests/everything/everything.c @@ -142,6 +142,37 @@ int test_closure_one_arg (GClosure *closure, int arg) return ret; } +/** + * test_value_arg + * @v: (transfer none): a GValue expected to contain an int + * + * Return value: the int contained in the GValue. + */ +int test_int_value_arg(const GValue *v) { + int i; + + i = g_value_get_int (v); + + return i; +} + +static GValue value; +/** + * test_value_return: + * @i: an int + * + * Return value: (transfer none): the int wrapped in a GValue. + */ +const GValue *test_value_return(int i) { + memset(&value, '\0', sizeof(GValue)); + + g_value_init (&value, G_TYPE_INT); + g_value_set_int (&value, i); + + return &value; +} + + #if 0 /************************************************************************/ /* utf8 */ diff --git a/tests/everything/everything.h b/tests/everything/everything.h index 76f76fee..61a6b7d9 100644 --- a/tests/everything/everything.h +++ b/tests/everything/everything.h @@ -70,6 +70,10 @@ void test_gslist_free (GSList *in); int test_closure (GClosure *closure); int test_closure_one_arg (GClosure *closure, int arg); +/* value */ +int test_int_value_arg(const GValue *v); +const GValue *test_value_return(int i); + /* enums / flags */ typedef enum |