diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2018-10-22 10:08:22 -0400 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2018-10-22 20:57:56 -0400 |
commit | d3b2ee90e47cc10c6dcf7c246847b005882adbd9 (patch) | |
tree | 65eff760d5a1efcea72905fd5dcd876f3b7a5334 /tests/scanner/regress.c | |
parent | 54e12c0182cfce6bf90b35b2781d18f53c8263cb (diff) | |
download | gobject-introspection-d3b2ee90e47cc10c6dcf7c246847b005882adbd9.tar.gz |
regress: Add test for write-only property
GTK contains a few write-only properties, so it makes sense to have one
in the regress test suite.
See gjs!246
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r-- | tests/scanner/regress.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index 330a8d16..f998a498 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -2103,6 +2103,7 @@ enum PROP_TEST_OBJ_GTYPE, PROP_TEST_OBJ_NAME_CONFLICT, PROP_TEST_OBJ_BYTE_ARRAY, + PROP_TEST_OBJ_WRITE_ONLY, }; static void @@ -2169,6 +2170,11 @@ regress_test_obj_set_property (GObject *object, self->byte_array = g_value_get_boxed (value); break; + case PROP_TEST_OBJ_WRITE_ONLY: + if (g_value_get_boolean (value)) + self->some_int8 = 0; + break; + default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -2737,6 +2743,14 @@ regress_test_obj_class_init (RegressTestObjClass *klass) PROP_TEST_OBJ_BYTE_ARRAY, pspec); + /** + * TestObj:write-only: + */ + pspec = g_param_spec_boolean ("write-only", "Write-only property", + "A write-only bool property that resets the value of TestObj:int to 0 when true", + FALSE, G_PARAM_WRITABLE); + g_object_class_install_property (gobject_class, PROP_TEST_OBJ_WRITE_ONLY, pspec); + klass->matrix = regress_test_obj_default_matrix; } |