diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2020-03-16 23:03:44 +0100 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2020-03-16 23:03:44 +0100 |
commit | d716945125543b999f892fbf6297ff6a37ee111f (patch) | |
tree | dc814584a9da1e77cf5706f0c7f781a5edc452e6 /tests/gimarshallingtests.c | |
parent | 137952c03abd2acd454b834d8cc7ae10915c8aa0 (diff) | |
download | gobject-introspection-d716945125543b999f892fbf6297ff6a37ee111f.tar.gz |
gimarshallingtests: Add marshalling tests for virtual functions with inout parameters
Virtual functions may use input/output parameters but this is not currently
well handled by gjs, so adding test cases to gobject-introspection to verify
that virtual functions correctly receive valid input values and can return
them.
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r-- | tests/gimarshallingtests.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 92868016..44971506 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -4584,6 +4584,33 @@ gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *s } /** + * gi_marshalling_tests_object_vfunc_one_inout_parameter: + * @a: (inout): + */ +void +gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a) +{ + /* make sure that local variables don't get smashed */ + gulong local = 0x12345678; + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_inout_parameter (self, a); + g_assert_cmpint (local, ==, 0x12345678); +} + +/** + * gi_marshalling_tests_object_vfunc_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ +void +gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b) +{ + /* make sure that local variables don't get smashed */ + gulong local = 0x12345678; + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_inout_parameters (self, a, b); + g_assert_cmpint (local, ==, 0x12345678); +} + +/** * gi_marshalling_tests_object_vfunc_multiple_out_parameters: * @a: (out): * @b: (out): @@ -4652,6 +4679,37 @@ glong } /** + * gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter: + * @a: (inout): + */ +glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a) +{ + /* make sure that local variables don't get smashed */ + gulong return_value; + gulong local = 0x12345678; + return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_inout_parameter (self, a); + g_assert_cmpint (local, ==, 0x12345678); + return return_value; +} + +/** + * gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ +glong + gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters + (GIMarshallingTestsObject *self, glong *a, glong *b) +{ + gulong return_value; + gulong local = 0x12345678; + return_value = + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_inout_parameters (self, a, b); + g_assert_cmpint (local, ==, 0x12345678); + return return_value; +} + +/** * gi_marshalling_tests_callback_owned_boxed: * @callback: (scope call) (closure callback_data): * @callback_data: (allow-none): |