summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-08-23 18:32:59 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2020-09-28 15:30:09 +0200
commit8b92e8e75f6f89c463ef16e52081190bd2a49cc7 (patch)
tree7efc2c7513b90b156fd70c1a4410f89a97738dce
parentc1db8c63f8b715c1ddced5d4e3e227f1f1a2b7b5 (diff)
downloadgobject-introspection-8b92e8e75f6f89c463ef16e52081190bd2a49cc7.tar.gz
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>
-rw-r--r--tests/gimarshallingtests.c24
-rw-r--r--tests/gimarshallingtests.h6
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index fbb1273e..571b7a2e 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1523,6 +1523,20 @@ gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *v, gint length)
}
/**
+ * 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):
* @length:
@@ -3435,6 +3449,16 @@ gi_marshalling_tests_gvalue_in_enum (GValue *value)
}
/**
+ * 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 656cadd9..5df1035e 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -749,6 +749,9 @@ _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);
_GI_TEST_EXTERN
@@ -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);