diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtCore/qobject_property_test.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/QtCore/qobject_property_test.py b/tests/QtCore/qobject_property_test.py index 233d1e8a1..7d53e0a26 100644 --- a/tests/QtCore/qobject_property_test.py +++ b/tests/QtCore/qobject_property_test.py @@ -16,6 +16,16 @@ class MySize(QSize): class ExtQObject(QObject): registeredproperty = QProperty(int) +class MyObject(QObject): + '''Test Property''' + + def readPP(self): + return 42 + + def trySetPP(self): + self.pp = 0 + + pp = QProperty(int, readPP) class PropertyCase(unittest.TestCase): '''Test case for QObject properties''' @@ -115,6 +125,11 @@ class PropertyWithConstructorCase(unittest.TestCase): obj = QTimer(objectName='dummy') self.assertEqual(obj.objectName(), 'dummy') + def testPythonProperty(self): + o = MyObject() + self.assertEqual(o.pp, 42) + o.pp = 0 + self.assertRaises(AttributeError, o.trySetPP) if __name__ == '__main__': unittest.main() |