Adding extra tests to QVariant
This commit is contained in:
parent
ecf529ce6a
commit
6e33903fe2
1 changed files with 18 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from PySide.QtCore import QObject, QVariant
|
from PySide.QtCore import QObject, QVariant, QString
|
||||||
|
|
||||||
class PropertyCase(unittest.TestCase):
|
class PropertyCase(unittest.TestCase):
|
||||||
'''Test case for QObject properties'''
|
'''Test case for QObject properties'''
|
||||||
|
|
@ -41,6 +41,23 @@ class PropertyCase(unittest.TestCase):
|
||||||
# QVariant.toInt has a bool* arg in C++, so returns a tuple
|
# QVariant.toInt has a bool* arg in C++, so returns a tuple
|
||||||
self.assertEqual(obj.property('dummy').toInt(), (42, True))
|
self.assertEqual(obj.property('dummy').toInt(), (42, True))
|
||||||
|
|
||||||
|
def testQStringProperty(self):
|
||||||
|
obj = QObject()
|
||||||
|
self.assert_(not obj.setProperty('dummy', QString('data')))
|
||||||
|
prop = obj.property('dummy')
|
||||||
|
|
||||||
|
self.assert_(isinstance(prop, QVariant))
|
||||||
|
self.assert_(prop.isValid())
|
||||||
|
self.assertEqual(obj.property('dummy').toString(), QString('data'))
|
||||||
|
|
||||||
|
def testImplicitQVariantProperty(self):
|
||||||
|
obj = QObject()
|
||||||
|
self.assert_(not obj.setProperty('dummy', 'data'))
|
||||||
|
prop = obj.property('dummy')
|
||||||
|
|
||||||
|
self.assert_(isinstance(prop, QVariant))
|
||||||
|
self.assert_(prop.isValid())
|
||||||
|
self.assertEqual(obj.property('dummy').toString(), 'data')
|
||||||
|
|
||||||
def testInvalidProperty(self):
|
def testInvalidProperty(self):
|
||||||
#QObject.property() for invalid properties
|
#QObject.property() for invalid properties
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue