[gobject-introspection/wip/smcv/test-more-flags: 1/3] tests: Add a test-case for a vfunc returning flags in different ways
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/smcv/test-more-flags: 1/3] tests: Add a test-case for a vfunc returning flags in different ways
- Date: Sun, 20 Sep 2020 04:55:45 +0000 (UTC)
commit 3e2cca38b6b923fad018b56ab5f497a208170159
Author: Simon McVittie <smcv debian org>
Date: Sun Aug 23 16:50:30 2020 +0100
tests: Add a test-case for a vfunc returning flags in different ways
We already had a test for enums, but flags are not precisely the same,
so testing both can give bindings better coverage.
Signed-off-by: Simon McVittie <smcv debian org>
tests/gimarshallingtests.c | 27 +++++++++++++++++++++++++++
tests/gimarshallingtests.h | 17 +++++++++++++++++
2 files changed, 44 insertions(+)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 53c178189..fbb1273e4 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4767,6 +4767,33 @@ gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMa
g_assert_cmpint (local, ==, 0x12345678);
}
+/**
+ * gi_marshalling_tests_object_vfunc_return_flags:
+ */
+GIMarshallingTestsFlags
+gi_marshalling_tests_object_vfunc_return_flags (GIMarshallingTestsObject *self)
+{
+ /* make sure that local variables don't get smashed */
+ GIMarshallingTestsFlags return_value;
+ glong local = 0x12345678;
+ return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_flags (self);
+ g_assert_cmpint (local, ==, 0x12345678);
+ return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_out_flags:
+ * @flags: (out):
+ */
+void
+gi_marshalling_tests_object_vfunc_out_flags (GIMarshallingTestsObject *self, GIMarshallingTestsFlags *flags)
+{
+ /* make sure that local variables don't get smashed */
+ gulong local = 0x12345678;
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_flags (self, flags);
+ g_assert_cmpuint (local, ==, 0x12345678);
+}
+
/* NOTE:
*
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 747a075d8..656cadd9a 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1515,6 +1515,17 @@ struct _GIMarshallingTestsObjectClass
* @object: (in) (transfer full):
*/
void (* vfunc_in_object_transfer_full) (GIMarshallingTestsObject *self, GObject *object);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_return_flags:
+ */
+ GIMarshallingTestsFlags (* vfunc_return_flags) (GIMarshallingTestsObject *self);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_out_flags:
+ * @flags: (out):
+ */
+ void (* vfunc_out_flags) (GIMarshallingTestsObject *self, GIMarshallingTestsFlags *flags);
};
struct _GIMarshallingTestsObject
@@ -1620,6 +1631,12 @@ GIMarshallingTestsEnum gi_marshalling_tests_object_vfunc_return_enum (GIMarshall
_GI_TEST_EXTERN
void gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMarshallingTestsEnum
*_enum);
+_GI_TEST_EXTERN
+GIMarshallingTestsFlags gi_marshalling_tests_object_vfunc_return_flags (GIMarshallingTestsObject *self);
+
+_GI_TEST_EXTERN
+void gi_marshalling_tests_object_vfunc_out_flags (GIMarshallingTestsObject *self, GIMarshallingTestsFlags
*flags);
+
_GI_TEST_EXTERN
void gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none
(GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]