[gobject-introspection] gimarshallingtests: Add GValue round-trip and copy functions
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] gimarshallingtests: Add GValue round-trip and copy functions
- Date: Wed, 12 Jan 2022 00:50:42 +0000 (UTC)
commit 3dd0b22c4ecf69689575d24d28ac9a1afa020b53
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri Apr 9 05:15:04 2021 +0200
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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]