blob: 052e67d7144d1165a5857649dede3dede7fc19c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Test cases for QVariant with QtGui types'''
import unittest
from PySide.QtCore import *
from PySide.QtGui import *
class Dummy(object):
pass
class QVariantTypeName(unittest.TestCase):
def testQPen(self):
obj = QVariant(QPen(Qt.red))
self.assertEqual('QPen', obj.typeName())
def testQColor(self):
obj = QVariant(QColor(Qt.red))
self.assertEqual('QColor', obj.typeName())
def testGlobalColor(self):
obj = QVariant(Qt.red)
# XXX: PyQt4 returns int instead of QColor like the C++ version
self.assertEqual('QColor', obj.typeName())
def testEnums(self):
obj = QVariant(Qt.SolidLine)
self.assertEqual('int', obj.typeName())
class QVariantQColorImplicitlyConvertion(unittest.TestCase):
def testConversions(self):
c1 = QColor(0, 0, 0)
v = QVariant(c1)
c2 = QColor(v)
self.assertEqual(c1, c2)
if __name__ == '__main__':
unittest.main()
|