Removed QVariant from PySide.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
d8a192b5e1
commit
1b6337d8b4
18 changed files with 170 additions and 601 deletions
|
|
@ -46,7 +46,6 @@ PYSIDE_TEST(qtabwidget_test.py)
|
|||
PYSIDE_TEST(qtextedit_test.py)
|
||||
PYSIDE_TEST(qtoolbar_test.py)
|
||||
PYSIDE_TEST(qtoolbox_test.py)
|
||||
PYSIDE_TEST(qvariant_test.py)
|
||||
PYSIDE_TEST(qwidget_setlayout_test.py)
|
||||
PYSIDE_TEST(qwidget_test.py TRUE) #Bug 237
|
||||
PYSIDE_TEST(reference_count_test.py)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import unittest
|
|||
|
||||
from sys import getrefcount
|
||||
from helper import UsesQApplication
|
||||
from PySide.QtCore import QAbstractTableModel, QVariant
|
||||
from PySide.QtCore import *
|
||||
from PySide.QtGui import QTableView
|
||||
|
||||
class TestModel(QAbstractTableModel):
|
||||
|
|
@ -15,7 +15,7 @@ class TestModel(QAbstractTableModel):
|
|||
def columnCount(self, parent):
|
||||
return 0
|
||||
def data(self, index, role):
|
||||
return QVariant()
|
||||
return None
|
||||
|
||||
class KeepReferenceTest(UsesQApplication):
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ from PySide.QtCore import *
|
|||
|
||||
class QPixmapTest(UsesQApplication):
|
||||
def testQVariantConstructor(self):
|
||||
obj = QObject()
|
||||
pixmap = QPixmap()
|
||||
v = QVariant(pixmap)
|
||||
pixmap_copy = QPixmap(v)
|
||||
obj.setProperty('foo', pixmap)
|
||||
self.assertEqual(type(obj.property('foo')), QPixmap)
|
||||
|
||||
def testQSizeConstructor(self):
|
||||
pixmap = QPixmap(QSize(10,20))
|
||||
|
|
@ -18,12 +19,6 @@ class QPixmapTest(UsesQApplication):
|
|||
def testQStringConstructor(self):
|
||||
pixmap = QPixmap("Testing!")
|
||||
|
||||
def testQVariantConstructor2(self):
|
||||
v = QVariant(QPixmap())
|
||||
pixmap2 = QPixmap(v)
|
||||
v = QVariant(QImage())
|
||||
pixmap2 = QPixmap(v)
|
||||
|
||||
def testQPixmapLoadFromDataWithQFile(self):
|
||||
f = QFile(os.path.join(os.path.dirname(__file__), 'sample.png'))
|
||||
self.assert_(f.open(QIODevice.ReadOnly))
|
||||
|
|
|
|||
|
|
@ -1,85 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''Test cases for QVariant with QtGui types'''
|
||||
|
||||
import unittest
|
||||
|
||||
from PySide.QtCore import *
|
||||
from PySide.QtGui import *
|
||||
|
||||
from helper import UsesQApplication
|
||||
|
||||
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)
|
||||
|
||||
class QVariantQPixmap(UsesQApplication):
|
||||
'''QVariant(QPixmap)'''
|
||||
|
||||
def testBasic(self):
|
||||
'''QVariant(QPixmap)'''
|
||||
pixmap = QPixmap(10,20)
|
||||
pixmap.fill(Qt.blue)
|
||||
variant = QVariant(pixmap)
|
||||
|
||||
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)
|
||||
|
||||
def testMatrix2x2(self):
|
||||
m = QMatrix2x2()
|
||||
v = QVariant(m)
|
||||
self.assertEqual('QMatrix2x2', v.typeName())
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue