Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Add mask flags to GIMarshallingTests to test for flags with the same …
Browse files Browse the repository at this point in the history
…value.

Glib uses flag aliases, multiple flag names with the same int
value. For example G_IO_FLAG_MASK and G_IO_FLAG_GET_MASK. We need
these flag values to test that gi bindings don't assume that all
flags have the same value.
  • Loading branch information
Laszlo Pandy committed Feb 23, 2011
1 parent c8e0405 commit aecea30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/gimarshallingtests.c
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,8 @@ gi_marshalling_tests_flags_get_type (void)
{ GI_MARSHALLING_TESTS_FLAGS_VALUE1, "GI_MARSHALLING_TESTS_FLAGS_VALUE1", "value1" },
{ GI_MARSHALLING_TESTS_FLAGS_VALUE2, "GI_MARSHALLING_TESTS_FLAGS_VALUE2", "value2" },
{ GI_MARSHALLING_TESTS_FLAGS_VALUE3, "GI_MARSHALLING_TESTS_FLAGS_VALUE3", "value3" },
{ GI_MARSHALLING_TESTS_FLAGS_MASK, "GI_MARSHALLING_TESTS_FLAGS_MASK", "mask" },
{ GI_MARSHALLING_TESTS_FLAGS_MASK2, "GI_MARSHALLING_TESTS_FLAGS_MASK2", "mask2" },
{ 0, NULL, NULL }
};
type = g_flags_register_static (g_intern_static_string ("GIMarshallingTestsFlags"), values);
Expand Down
10 changes: 8 additions & 2 deletions tests/gimarshallingtests.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,10 @@ typedef enum
{
GI_MARSHALLING_TESTS_FLAGS_VALUE1 = 1 << 0,
GI_MARSHALLING_TESTS_FLAGS_VALUE2 = 1 << 1,
GI_MARSHALLING_TESTS_FLAGS_VALUE3 = 1 << 2
GI_MARSHALLING_TESTS_FLAGS_VALUE3 = 1 << 2,
GI_MARSHALLING_TESTS_FLAGS_MASK = GI_MARSHALLING_TESTS_FLAGS_VALUE1 |
GI_MARSHALLING_TESTS_FLAGS_VALUE2,
GI_MARSHALLING_TESTS_FLAGS_MASK2 = GI_MARSHALLING_TESTS_FLAGS_MASK
} GIMarshallingTestsFlags;

GType gi_marshalling_tests_flags_get_type (void) G_GNUC_CONST;
Expand All @@ -488,7 +491,10 @@ typedef enum
{
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE1 = 1 << 0,
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2 = 1 << 1,
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE3 = 1 << 2
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE3 = 1 << 2,
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_MASK = GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE1 |
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2,
GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_MASK2 = GI_MARSHALLING_TESTS_FLAGS_MASK
} GIMarshallingTestsNoTypeFlags;

GIMarshallingTestsNoTypeFlags gi_marshalling_tests_no_type_flags_returnv (void);
Expand Down

0 comments on commit aecea30

Please sign in to comment.