summaryrefslogtreecommitdiff
path: root/tests/test_gtype.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2005-03-16 13:49:10 +0000
committerJohan Dahlin <johan@src.gnome.org>2005-03-16 13:49:10 +0000
commit33039b3716cd62744af5d11992a9b22bcb45ce32 (patch)
treed0ad1c0a0edc9eb12ba80f0201ee6313c0842454 /tests/test_gtype.py
parent8df9133eb9600278e5be6c9dc5906608c081e129 (diff)
downloadpygobject-33039b3716cd62744af5d11992a9b22bcb45ce32.tar.gz
New test.
* tests/test_radiobutton.py (RadioButtonTest): New test. * tests: Renamed *.py to test_*.py
Diffstat (limited to 'tests/test_gtype.py')
-rw-r--r--tests/test_gtype.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/test_gtype.py b/tests/test_gtype.py
new file mode 100644
index 00000000..a891ba2c
--- /dev/null
+++ b/tests/test_gtype.py
@@ -0,0 +1,60 @@
+import unittest
+
+from common import gobject
+
+class GTypeTest(unittest.TestCase):
+ def checkType(self, expected, *objects):
+ # First, double check so we get back what we sent
+ str = gobject.type_name(expected) # pyg_type_from_object
+ val = gobject.type_from_name(str) # pyg_type_wrapper_new
+ assert val == expected, \
+ 'got %r while %r was expected' % (val, expected)
+
+ # Then test the objects
+ for object in objects:
+ str = gobject.type_name(expected)
+ val = gobject.type_from_name(str)
+ 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)
+ import gtk
+ model = gtk.ListStore(str, int)
+ iter = model.append()
+ model.set(iter, 1, 100000000)
+
+ 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, 'GObject', object)
+
+ def testObject(self):
+ self.checkType(gobject.TYPE_OBJECT, 'PyObject')
+
+ # XXX: Flags, Enums
+
+if __name__ == '__main__':
+ unittest.main()