summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <icq@gnome.org>2011-10-10 11:24:42 +0200
committerIgnacio Casal Quinteiro <icq@gnome.org>2011-10-10 11:24:42 +0200
commitbef8d385117dd0295c9ba7567710d76fc2bb729a (patch)
tree2e6bb76dcbf1b7a9ce60507ae006376a3ee51dfc
parent77123ffeb1585837033848f4d5a90cfa63fdaee0 (diff)
downloadpygobject-bef8d385117dd0295c9ba7567710d76fc2bb729a.tar.gz
Add tests for boxed properties.
-rw-r--r--tests/test_properties.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test_properties.py b/tests/test_properties.py
index d02dac9b..35216479 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -15,6 +15,7 @@ from gi.repository.GObject import \
G_MAXULONG
from gi.repository import Gio
+from gi.repository import GLib
if sys.version_info < (3, 0):
TEST_UTF8 = "\xe2\x99\xa5"
@@ -39,6 +40,9 @@ class PropertyObject(GObject.GObject):
enum = GObject.property(
type=Gio.SocketType, default=Gio.SocketType.STREAM)
+ boxed = GObject.property(
+ type=GLib.Regex, flags=PARAM_READWRITE|PARAM_CONSTRUCT)
+
class TestProperties(unittest.TestCase):
def testGetSet(self):
obj = PropertyObject()
@@ -67,8 +71,9 @@ class TestProperties(unittest.TestCase):
'construct',
'construct-only',
'uint64',
- 'enum'])
- self.assertEqual(len(obj), 5)
+ 'enum',
+ 'boxed'])
+ self.assertEqual(len(obj), 6)
def testNormal(self):
obj = new(PropertyObject, normal="123")
@@ -161,6 +166,17 @@ class TestProperties(unittest.TestCase):
self.assertRaises(TypeError, GObject.property, type=Gio.SocketType,
default=1)
+ def textBoxed(self):
+ obj = new(PropertyObject)
+
+ regex = GLib.Regex.new('[a-z]*', 0, 0)
+ obj.props.boxed = regex
+ self.assertEqual(obj.props.boxed.get_pattern(), '[a-z]*')
+ self.assertEqual(obj.boxed.get_patttern(), '[a-z]*')
+
+ self.assertRaises(TypeError, setattr, obj, 'boxed', 'foo')
+ self.assertRaises(TypeError, setattr, obj, 'boxed', object())
+
def testRange(self):
# kiwi code
def max(c):