summaryrefslogtreecommitdiff
path: root/tests/test_properties.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_properties.py')
-rw-r--r--tests/test_properties.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_properties.py b/tests/test_properties.py
index 4b128f39..ef6b8674 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -69,6 +69,9 @@ class PropertyObject(GObject.GObject):
type=TYPE_VARIANT, flags=PARAM_READWRITE | PARAM_CONSTRUCT,
default=GLib.Variant('i', 42))
+ interface = GObject.Property(
+ type=Gio.File, flags=PARAM_READWRITE | PARAM_CONSTRUCT)
+
class PropertyInheritanceObject(Regress.TestObj):
# override property from the base class, with a different type
@@ -133,6 +136,7 @@ class TestPropertyObject(unittest.TestCase):
'enum',
'flags',
'gtype',
+ 'interface',
'normal',
'strings',
'uint64',
@@ -389,6 +393,17 @@ class TestPropertyObject(unittest.TestCase):
obj = new(PropertyObject, variant_def=GLib.Variant('u', 5))
self.assertEqual(obj.props.variant_def.print_(True), 'uint32 5')
+ def test_interface(self):
+ obj = new(PropertyObject)
+
+ file = Gio.File.new_for_path('/some/path')
+ obj.props.interface = file
+ self.assertEqual(obj.props.interface.get_path(), '/some/path')
+ self.assertEqual(obj.interface.get_path(), '/some/path')
+
+ self.assertRaises(TypeError, setattr, obj, 'interface', 'foo')
+ self.assertRaises(TypeError, setattr, obj, 'interface', object())
+
def test_range(self):
# kiwi code
def max(c):
@@ -827,6 +842,7 @@ class TestProperty(unittest.TestCase):
self.assertEqual(tester._type_from_python(GObject.GEnum), GObject.GEnum.__gtype__)
self.assertEqual(tester._type_from_python(GObject.GFlags), GObject.GFlags.__gtype__)
self.assertEqual(tester._type_from_python(GObject.GBoxed), GObject.GBoxed.__gtype__)
+ self.assertEqual(tester._type_from_python(GObject.GInterface), GObject.GInterface.__gtype__)
for type_ in [TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR,
TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG,