Fix some issues with QVariant, including the QAbstractKinectScroller one.

This commit is contained in:
Hugo Lima 2010-04-01 18:12:40 -03:00 • committed by Hugo Parente Lima
commit 956d6fd530
3 changed files with 82 additions and 44 deletions

View file

@ -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()