diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2017-04-03 22:09:04 -0700 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2017-04-03 22:09:04 -0700 |
commit | 32d130f1a5829acc5827d43735e15e9198c2971d (patch) | |
tree | d495fd39a015fd3123e22b376574e9aa3021f554 /tests/gimarshallingtests.c | |
parent | 01018a78de0fe47cb9f4b7f27b3c8c1c20b1693d (diff) | |
download | gobject-introspection-32d130f1a5829acc5827d43735e15e9198c2971d.tar.gz |
tests: Add marshalling tests for GValue-valued properties
This is to test GJS's support of GValues boxed inside GValues.
https://bugzilla.gnome.org/show_bug.cgi?id=688128
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r-- | tests/gimarshallingtests.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 54702a35..40ba5730 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -5351,6 +5351,7 @@ enum SOME_BOXED_STRUCT_PROPERTY, SOME_VARIANT_PROPERTY, SOME_BOXED_GLIST_PROPERTY, + SOME_GVALUE_PROPERTY, SOME_OBJECT_PROPERTY, SOME_FLAGS_PROPERTY, SOME_ENUM_PROPERTY, @@ -5373,6 +5374,11 @@ gi_marshalling_tests_properties_object_finalize (GObject *obj) self->some_strv = NULL; } + if (self->some_gvalue) { + g_boxed_free (G_TYPE_VALUE, self->some_gvalue); + self->some_gvalue = NULL; + } + G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj); } @@ -5426,6 +5432,9 @@ gi_marshalling_tests_properties_object_get_property (GObject *object, case SOME_BOXED_GLIST_PROPERTY: g_value_set_boxed (value, self->some_boxed_glist); break; + case SOME_GVALUE_PROPERTY: + g_value_set_boxed (value, self->some_gvalue); + break; case SOME_VARIANT_PROPERTY: g_value_set_variant (value, self->some_variant); break; @@ -5497,6 +5506,11 @@ gi_marshalling_tests_properties_object_set_property (GObject *object, g_list_free (self->some_boxed_glist); self->some_boxed_glist = g_list_copy (g_value_get_boxed (value)); break; + case SOME_GVALUE_PROPERTY: + if (self->some_gvalue) + g_boxed_free (G_TYPE_VALUE, self->some_gvalue); + self->some_gvalue = g_value_dup_boxed (value); + break; case SOME_VARIANT_PROPERTY: if (self->some_variant != NULL) g_variant_unref (self->some_variant); @@ -5631,6 +5645,13 @@ static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTest gi_marshalling_tests_boxed_glist_get_type (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (object_class, SOME_GVALUE_PROPERTY, + g_param_spec_boxed ("some-gvalue", + "some-gvalue", + "some-gvalue", + G_TYPE_VALUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (object_class, SOME_VARIANT_PROPERTY, g_param_spec_variant ("some-variant", "some-variant", |