diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-04-01 18:12:40 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-04-05 14:36:01 -0300 |
commit | 956d6fd530a5c1c526dc64a357addd790ab87c12 (patch) | |
tree | 3f5827124f1318245338b3ab1c864319e8809a68 /tests | |
parent | 77c2be562b00166172caf7fc460765488e47e3a4 (diff) |
Fix some issues with QVariant, including the QAbstractKinectScroller one.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtgui/qvariant_test.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/qtgui/qvariant_test.py b/tests/qtgui/qvariant_test.py index 7f9f10987..92d3381f8 100644 --- a/tests/qtgui/qvariant_test.py +++ b/tests/qtgui/qvariant_test.py @@ -48,6 +48,33 @@ class QVariantQPixmap(UsesQApplication): self.assertEqual(variant.typeName(), "QPixmap") + def testQObject(self): + obj = QObject() + v = QVariant(obj) + self.assertEqual(v.typeName(), 'QObject*') + + def testQWidget(self): + obj = QWidget() + v = QVariant(obj) + self.assertEqual(v.typeName(), 'QWidget*') + +class MyColor(QColor): + pass + +class MyPrimitive(int): + pass + +class QVariantMess(unittest.TestCase): + def testMyColor(self): + c1 = MyColor() + v = QVariant(c1) + self.assertEqual(type(v.toPyObject()), MyColor) + + def testMyPrimitive(self): + p = MyPrimitive(3) + v = QVariant(p) + self.assertNotEqual(v.type(), QVariant.Int) + self.assertTrue(v.toPyObject() is p) if __name__ == '__main__': unittest.main() |