diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-11-27 12:06:59 +0000 |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-11-27 12:48:16 +0000 |
commit | ac80e64c9f7d257865aa820753e52d56cf2871c8 (patch) | |
tree | 3edd28b8fd14ff34fb0031f7d5e7b526f7a36639 /tests | |
parent | 4a373b8ad6ec137e911b92a3e745e0fd76541292 (diff) | |
download | pygi-ac80e64c9f7d257865aa820753e52d56cf2871c8.tar.gz pygi-ac80e64c9f7d257865aa820753e52d56cf2871c8.tar.xz pygi-ac80e64c9f7d257865aa820753e52d56cf2871c8.zip |
Structs in arrays are not marshalled correctly
https://bugzilla.gnome.org/show_bug.cgi?id=602709
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libtestgi.c | 23 | ||||
-rw-r--r-- | tests/libtestgi.h | 7 | ||||
-rw-r--r-- | tests/test_gi.py | 8 |
3 files changed, 35 insertions, 3 deletions
diff --git a/tests/libtestgi.c b/tests/libtestgi.c index 3677fca..87f95ae 100644 --- a/tests/libtestgi.c +++ b/tests/libtestgi.c @@ -1781,6 +1781,28 @@ test_gi_array_fixed_out (gint **ints) } /** + * test_gi_array_fixed_out_struct: + * @structs: (out) (array fixed-size=2) (transfer none): + */ +void +test_gi_array_fixed_out_struct (TestGISimpleStruct **structs) +{ + static TestGISimpleStruct *values; + + if (values == NULL) { + values = g_new(TestGISimpleStruct, 2); + + values[0].long_ = 7; + values[0].int8 = 6; + + values[1].long_ = 6; + values[1].int8 = 7; + } + + *structs = values; +} + +/** * test_gi_array_fixed_inout: * @ints: (inout) (array fixed-size=4) (transfer none): */ @@ -1858,7 +1880,6 @@ test_gi_array_inout (gint **ints, gint *length) *ints = values; } - /** * test_gi_array_zero_terminated_return: * Returns: (array zero-terminated=1) (transfer none): diff --git a/tests/libtestgi.h b/tests/libtestgi.h index 685dcff..1ec4777 100644 --- a/tests/libtestgi.h +++ b/tests/libtestgi.h @@ -7,6 +7,7 @@ #ifndef __TEST_GI_H__ #define __TEST_GI_H__ +typedef struct _TestGISimpleStruct TestGISimpleStruct; /* Constants */ @@ -345,6 +346,8 @@ void test_gi_array_fixed_short_in (const gshort *shorts); void test_gi_array_fixed_out (gint **ints); +void test_gi_array_fixed_out_struct (TestGISimpleStruct **structs); + void test_gi_array_fixed_inout (gint **ints); /* Variable-size */ @@ -499,10 +502,10 @@ void test_gi_flags_inout (TestGIFlags *flags_); /* Structure */ -typedef struct { +struct _TestGISimpleStruct { glong long_; gint8 int8; -} TestGISimpleStruct; +}; typedef struct { TestGISimpleStruct simple_struct; diff --git a/tests/test_gi.py b/tests/test_gi.py index 1b0cadb..e8654b6 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -823,6 +823,14 @@ class TestArray(unittest.TestCase): self.assertEquals((-2, -1, 0, 1, 2), TestGI.array_inout(Sequence((-1, 0, 1, 2)))) + def test_array_fixed_out_struct(self): + struct1, struct2 = TestGI.array_fixed_out_struct() + + self.assertEquals(7, struct1.long_) + self.assertEquals(6, struct1.int8) + self.assertEquals(6, struct2.long_) + self.assertEquals(7, struct2.int8) + def test_array_zero_terminated_return(self): self.assertEquals(('0', '1', '2'), TestGI.array_zero_terminated_return()) |