summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-07-28 14:25:57 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-07-28 14:25:57 +0000
commita0443783c880cf90b11886e3180e842e2c17a77a (patch)
tree938ef5ea44527c8d3a90d29e2be30c8f53792585
parent207489d4171eb275fe0c2b54cfcf092bdba6406a (diff)
downloadpygobject-a0443783c880cf90b11886e3180e842e2c17a77a.tar.gz
Test various other types aswell
-rw-r--r--tests/gtype.py55
1 files changed, 48 insertions, 7 deletions
diff --git a/tests/gtype.py b/tests/gtype.py
index b1091020..a20a2e8e 100644
--- a/tests/gtype.py
+++ b/tests/gtype.py
@@ -3,13 +3,54 @@ import unittest
from common import gobject, gtk
class GTypeTest(unittest.TestCase):
- def testBoolType(self):
- store = gtk.ListStore(gobject.TYPE_BOOLEAN)
- assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
- store = gtk.ListStore('gboolean')
- assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
- store = gtk.ListStore(bool)
- assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
+ def checkType(self, expected, *objects):
+ # Silly method to check pyg_type_from_object
+
+ store = gtk.ListStore(expected)
+ val = store.get_column_type(0)
+ assert val == expected, \
+ 'got %r while %r was expected' % (val, expected)
+ for object in objects:
+ store = gtk.ListStore(object)
+ val = store.get_column_type(0)
+ assert val == expected, \
+ 'got %r while %r was expected' % (val, expected)
+
+ def testBool(self):
+ self.checkType(gobject.TYPE_BOOLEAN, 'gboolean', bool)
+
+ def testInt(self):
+ self.checkType(gobject.TYPE_INT, 'gint', int)
+
+ def testInt64(self):
+ self.checkType(gobject.TYPE_INT64, 'gint64')
+
+ def testUint(self):
+ self.checkType(gobject.TYPE_UINT, 'guint')
+
+ def testUint64(self):
+ self.checkType(gobject.TYPE_UINT64, 'guint64')
+
+ def testLong(self):
+ self.checkType(gobject.TYPE_LONG, 'glong', long)
+
+ def testUlong(self):
+ self.checkType(gobject.TYPE_ULONG, 'gulong')
+
+ def testDouble(self):
+ self.checkType(gobject.TYPE_DOUBLE, 'gdouble', float)
+
+ def testFloat(self):
+ self.checkType(gobject.TYPE_FLOAT, 'gfloat')
+
+ def testPyObject(self):
+ self.checkType(gobject.TYPE_PYOBJECT, object)
+
+ def testObject(self):
+ self.checkType(gobject.TYPE_OBJECT)
+
+ # XXX: Flags, Enums
+
if __name__ == '__main__':
unittest.main()