summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2007-08-29 19:34:01 +0000
committerJohan Dahlin <johan@src.gnome.org>2007-08-29 19:34:01 +0000
commitfb5f535dd9ade14ea0cb129fb548a3afd4dcfb96 (patch)
tree6d6aba629caac111d09e00676dfe2c9f7a0354fb /tests
parentfb5b39986fe7a23da5ab5f7217f037b4cbd740c1 (diff)
downloadpygtk-fb5f535dd9ade14ea0cb129fb548a3afd4dcfb96.tar.gz
Make the bindings a bit more pythonic, implement tp_str, tp_hash and
2007-08-29 Johan Dahlin <jdahlin@async.com.br> * pango.override: Make the bindings a bit more pythonic, implement tp_str, tp_hash and tp_compare for a few objects. * tests/test_pango.py: Add tests. svn path=/trunk/; revision=2897
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pango.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_pango.py b/tests/test_pango.py
index 6d48dd52..a0aeb82a 100644
--- a/tests/test_pango.py
+++ b/tests/test_pango.py
@@ -7,3 +7,34 @@ class MarkupTest(unittest.TestCase):
self.assertRaises(TypeError, pango.parse_markup, 'test', 0)
self.assertEqual(pango.parse_markup('test')[2], u'\x00')
self.assertEqual(pango.parse_markup('test', u't')[2], u'e')
+
+
+class TestColor(unittest.TestCase):
+ def testStr(self):
+ col = pango.Color('red')
+ self.assertEqual(str(col), '#ffff00000000')
+
+
+class TestLanguage(unittest.TestCase):
+ def testStr(self):
+ lang = pango.Language('sv')
+ self.assertEqual(str(lang), 'sv')
+
+
+class TestFontDescription(unittest.TestCase):
+ def testStr(self):
+ font = pango.FontDescription('monospace 10')
+ self.assertEqual(str(font), 'monospace 10')
+
+ def testHash(self):
+ font = pango.FontDescription('monospace 10')
+ font2 = pango.FontDescription('monospace 10')
+ self.assertNotEqual(hash(font), hash(font2))
+ # FIXME: How to test this properly?
+
+ def testEquals(self):
+ font = pango.FontDescription('monospace 10')
+ font2 = pango.FontDescription('monospace 10')
+ font3 = pango.FontDescription('monospace 12')
+ self.assertEqual(font, font2)
+ self.assertNotEqual(font, font3)