diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2021-04-09 05:15:04 +0200 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2022-01-11 19:01:16 +0000 |
commit | 3dd0b22c4ecf69689575d24d28ac9a1afa020b53 (patch) | |
tree | f605ee7d7e0a9ce00395bc116bf85484957438ae /tests | |
parent | 1482ab986e51c098c7225b31cc7126ce0ee2f1a4 (diff) | |
download | gobject-introspection-3dd0b22c4ecf69689575d24d28ac9a1afa020b53.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gimarshallingtests.c | 29 | ||||
-rw-r--r-- | tests/gimarshallingtests.h | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 37960ea5..d15b2f10 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3562,6 +3562,35 @@ gi_marshalling_tests_return_gvalue_flat_array (void) } /** + * 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 * @two: The second GValue diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 2a8279e6..2f4b259b 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -1148,6 +1148,12 @@ 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, const GValue three); |