Imported Upstream version 3.3.1
[platform/upstream/pygobject2.git] / gi / overrides / GIMarshallingTests.py
1 # -*- Mode: Python; py-indent-offset: 4 -*-
2 # vim: tabstop=4 shiftwidth=4 expandtab
3 #
4 # Copyright (C) 2010 Simon van der Linden <svdlinden@src.gnome.org>
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19 # USA
20
21 from ..overrides import override
22 from ..importer import modules
23
24 GIMarshallingTests = modules['GIMarshallingTests']._introspection_module
25
26 __all__ = []
27
28 OVERRIDES_CONSTANT = 7
29 __all__.append('OVERRIDES_CONSTANT')
30
31
32 class OverridesStruct(GIMarshallingTests.OverridesStruct):
33
34     def __new__(cls, long_):
35         return GIMarshallingTests.OverridesStruct.__new__(cls)
36
37     def __init__(self, long_):
38         GIMarshallingTests.OverridesStruct.__init__(self)
39         self.long_ = long_
40
41     def method(self):
42         return GIMarshallingTests.OverridesStruct.method(self) / 7
43
44 OverridesStruct = override(OverridesStruct)
45 __all__.append('OverridesStruct')
46
47
48 class OverridesObject(GIMarshallingTests.OverridesObject):
49
50     def __new__(cls, long_):
51         return GIMarshallingTests.OverridesObject.__new__(cls)
52
53     def __init__(self, long_):
54         GIMarshallingTests.OverridesObject.__init__(self)
55         # FIXME: doesn't work yet
56         #self.long_ = long_
57
58     @classmethod
59     def new(cls, long_):
60         self = GIMarshallingTests.OverridesObject.new()
61         # FIXME: doesn't work yet
62         #self.long_ = long_
63         return self
64
65     def method(self):
66         return GIMarshallingTests.OverridesObject.method(self) / 7
67
68 OverridesObject = override(OverridesObject)
69 __all__.append('OverridesObject')