diff options
author | Simon van der Linden <svdlinden@src.gnome.org> | 2010-01-08 20:33:44 +0100 |
---|---|---|
committer | Simon van der Linden <svdlinden@src.gnome.org> | 2010-01-08 20:33:44 +0100 |
commit | b4189be2b2d3c350fdf33e27309bee5a72e4f72a (patch) | |
tree | 4647888a92fe7584ac99946ce343d2d88b5c3986 /tests | |
parent | 4db68b958ea11bd2c3a88067cae03fd6bdd1d24b (diff) | |
download | pygi-b4189be2b2d3c350fdf33e27309bee5a72e4f72a.tar.gz pygi-b4189be2b2d3c350fdf33e27309bee5a72e4f72a.tar.xz pygi-b4189be2b2d3c350fdf33e27309bee5a72e4f72a.zip |
Don't set a default constructor for structures.
Update tests accordingly.
The reason for this change is that setting __new__ in the metaclass doesn't let
one overrides it afterwards, in a subclass (in my experience, at least, even
though it seems weird).
https://bugzilla.gnome.org/show_bug.cgi?id=603536
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libtestgi.c | 33 | ||||
-rw-r--r-- | tests/libtestgi.h | 7 | ||||
-rw-r--r-- | tests/test_gi.py | 21 |
3 files changed, 10 insertions, 51 deletions
diff --git a/tests/libtestgi.c b/tests/libtestgi.c index d712b19..a8a77a5 100644 --- a/tests/libtestgi.c +++ b/tests/libtestgi.c @@ -3023,39 +3023,6 @@ test_gi__pointer_struct_inout (TestGIPointerStruct **struct_) } -TestGIBoxedWithoutConstructorStruct * -test_gi_boxed_without_constructor_struct_copy (TestGIBoxedWithoutConstructorStruct *struct_) -{ - TestGIBoxedWithoutConstructorStruct *new_struct; - - new_struct = g_slice_new (TestGIBoxedWithoutConstructorStruct); - - *new_struct = *struct_; - - return new_struct; -} - -static void -test_gi_boxed_without_constructor_struct_free (TestGIBoxedWithoutConstructorStruct *struct_) -{ - g_slice_free (TestGIBoxedWithoutConstructorStruct, struct_); -} - -GType -test_gi_boxed_without_constructor_struct_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static ("TestGIBoxedWithoutConstructorStruct", - (GBoxedCopyFunc) test_gi_boxed_without_constructor_struct_copy, - (GBoxedFreeFunc) test_gi_boxed_without_constructor_struct_free); - } - - return type; -} - - TestGIBoxedStruct * test_gi_boxed_struct_copy (TestGIBoxedStruct *struct_) { diff --git a/tests/libtestgi.h b/tests/libtestgi.h index db12fd3..1620096 100644 --- a/tests/libtestgi.h +++ b/tests/libtestgi.h @@ -544,13 +544,6 @@ void test_gi__pointer_struct_inout (TestGIPointerStruct **struct_); typedef struct { glong long_; -} TestGIBoxedWithoutConstructorStruct; - -GType test_gi_boxed_without_constructor_struct_get_type (void) G_GNUC_CONST; - - -typedef struct { - glong long_; } TestGIBoxedStruct; GType test_gi_boxed_struct_get_type (void) G_GNUC_CONST; diff --git a/tests/test_gi.py b/tests/test_gi.py index 9344edd..8de9114 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -1246,29 +1246,28 @@ class TestStructure(unittest.TestCase): del in_struct del out_struct - def test_boxed_without_constructor_struct(self): - self.assertTrue(issubclass(TestGI.BoxedWithoutConstructorStruct, gobject.GBoxed)) + def test_boxed_struct(self): + self.assertTrue(issubclass(TestGI.BoxedStruct, gobject.GBoxed)) - struct = TestGI.BoxedWithoutConstructorStruct() + struct = TestGI.BoxedStruct() + self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) - self.assertTrue(isinstance(struct, TestGI.BoxedWithoutConstructorStruct)) + del struct - new_struct = struct.copy() - self.assertTrue(isinstance(new_struct, TestGI.BoxedWithoutConstructorStruct)) + def test_boxed_struct_new(self): + struct = TestGI.BoxedStruct.new() + self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) del struct - del new_struct - def test_boxed_struct(self): + def test_boxed_struct_copy(self): struct = TestGI.BoxedStruct() - self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) - new_struct = struct.copy() self.assertTrue(isinstance(new_struct, TestGI.BoxedStruct)) - del struct del new_struct + del struct def test_boxed_struct_return(self): struct = TestGI.boxed_struct_return() |