[gobject-introspection/gnome-3-38: 2/4] gimarshallingtests: Add more tests for flags




commit 8b92e8e75f6f89c463ef16e52081190bd2a49cc7
Author: Simon McVittie <smcv debian org>
Date:   Sun Aug 23 18:32:59 2020 +0100

    gimarshallingtests: Add more tests for flags
    
    Bindings sometimes need to handle flags and enums separately, so
    everything that is tested for enums should ideally be tested separately
    for flags.
    
    Signed-off-by: Simon McVittie <smcv debian org>

 tests/gimarshallingtests.c | 24 ++++++++++++++++++++++++
 tests/gimarshallingtests.h |  6 ++++++
 2 files changed, 30 insertions(+)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index fbb1273e4..571b7a2e2 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1522,6 +1522,20 @@ gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *v, gint length)
   g_assert_cmpint (v[2], ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
 }
 
+/**
+ * gi_marshalling_tests_array_flags_in:
+ * @flags: (array length=length) (transfer none):
+ * @length:
+ */
+void
+gi_marshalling_tests_array_flags_in (GIMarshallingTestsFlags *v, gint length)
+{
+  g_assert_cmpint (length, ==, 3);
+  g_assert_cmpint (v[0], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE1);
+  g_assert_cmpint (v[1], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE2);
+  g_assert_cmpint (v[2], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE3);
+}
+
 /**
  * gi_marshalling_tests_array_in_guint64_len:
  * @ints: (array length=length) (transfer none):
@@ -3434,6 +3448,16 @@ gi_marshalling_tests_gvalue_in_enum (GValue *value)
   g_assert (g_value_get_enum (value) == GI_MARSHALLING_TESTS_ENUM_VALUE3);
 }
 
+/**
+ * gi_marshalling_tests_gvalue_in_flags:
+ * @value: (transfer none):
+ */
+void
+gi_marshalling_tests_gvalue_in_flags (GValue *value)
+{
+  g_assert_cmpint (g_value_get_flags (value), ==, GI_MARSHALLING_TESTS_FLAGS_VALUE3);
+}
+
 /**
  * gi_marshalling_tests_gvalue_out:
  * @value: (out) (transfer none):
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 656cadd9a..5df1035eb 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -748,6 +748,9 @@ void gi_marshalling_tests_multi_array_key_value_in (gint length, const gchar **k
 _GI_TEST_EXTERN
 void gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *_enum, gint length);
 
+_GI_TEST_EXTERN
+void gi_marshalling_tests_array_flags_in (GIMarshallingTestsFlags *flags, gint length);
+
 _GI_TEST_EXTERN
 void gi_marshalling_tests_array_in_guint64_len (const gint *ints, guint64 length);
 
@@ -1117,6 +1120,9 @@ void gi_marshalling_tests_gvalue_in_with_modification (GValue *value);
 _GI_TEST_EXTERN
 void gi_marshalling_tests_gvalue_in_enum (GValue *value);
 
+_GI_TEST_EXTERN
+void gi_marshalling_tests_gvalue_in_flags (GValue *value);
+
 
 _GI_TEST_EXTERN
 void gi_marshalling_tests_gvalue_out (GValue **value);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]