aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-06-10 19:57:18 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-06-10 20:18:59 -0300
commit1b6337d8b4a65988dfbeb0eed67bc6584b25fdee (patch)
treee6efde3e5d00d4530f321894e62801ab8eac72e8 /tests/QtGui
parentd8a192b5e14e996992a98766cd39ca2028e6474e (diff)
Removed QVariant from PySide.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/QtGui')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/keep_reference_test.py4
-rw-r--r--tests/QtGui/qpixmap_test.py11
-rw-r--r--tests/QtGui/qvariant_test.py85
4 files changed, 5 insertions, 96 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index fa5de4a2c..d2d89ee98 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -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)
diff --git a/tests/QtGui/keep_reference_test.py b/tests/QtGui/keep_reference_test.py
index d0962d5df..310361a4a 100644
--- a/tests/QtGui/keep_reference_test.py
+++ b/tests/QtGui/keep_reference_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):
diff --git a/tests/QtGui/qpixmap_test.py b/tests/QtGui/qpixmap_test.py
index 7ba7454d4..1a0339f68 100644
--- a/tests/QtGui/qpixmap_test.py
+++ b/tests/QtGui/qpixmap_test.py
@@ -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))
diff --git a/tests/QtGui/qvariant_test.py b/tests/QtGui/qvariant_test.py
deleted file mode 100644
index 138e43291..000000000
--- a/tests/QtGui/qvariant_test.py
+++ /dev/null
@@ -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()