From 3dd0b22c4ecf69689575d24d28ac9a1afa020b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 9 Apr 2021 05:15:04 +0200 Subject: gimarshallingtests: Add GValue round-trip and copy functions We can use them in Gjs to verify whether a value is properly packed and unpacked to GValue. --- tests/gimarshallingtests.c | 29 +++++++++++++++++++++++++++++ tests/gimarshallingtests.h | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 37960ea5..d15b2f10 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3561,6 +3561,35 @@ gi_marshalling_tests_return_gvalue_flat_array (void) return array; } +/** + * gi_marshalling_tests_gvalue_round_trip: + * @value: The first GValue + * + * Returns: (transfer none): + */ +GValue * +gi_marshalling_tests_gvalue_round_trip (GValue *value) +{ + return value; +} + +/** + * gi_marshalling_tests_gvalue_copy: + * @value: The first GValue + * + * Returns: (transfer none): + */ +GValue * +gi_marshalling_tests_gvalue_copy (GValue *value) +{ + GValue *return_value = g_new0 (GValue, 1); + + g_value_init (return_value, G_VALUE_TYPE (value)); + g_value_copy (value, return_value); + + return return_value; +} + /** * gi_marshalling_tests_gvalue_flat_array_round_trip: * @one: The first GValue diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 2a8279e6..2f4b259b 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -1147,6 +1147,12 @@ _GI_TEST_EXTERN GValue *gi_marshalling_tests_return_gvalue_flat_array (void); +_GI_TEST_EXTERN +GValue *gi_marshalling_tests_gvalue_round_trip (GValue *value); + +_GI_TEST_EXTERN +GValue *gi_marshalling_tests_gvalue_copy (GValue *value); + _GI_TEST_EXTERN GValue *gi_marshalling_tests_gvalue_flat_array_round_trip (const GValue one, const GValue two, -- cgit v1.2.1