diff options
Diffstat (limited to 'tests/QtGui/parent_method_test.py')
-rw-r--r-- | tests/QtGui/parent_method_test.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/QtGui/parent_method_test.py b/tests/QtGui/parent_method_test.py new file mode 100644 index 000000000..8d0ba9601 --- /dev/null +++ b/tests/QtGui/parent_method_test.py @@ -0,0 +1,25 @@ + +import unittest + +from PySide.QtCore import QObject, QTimer, QThread +from PySide.QtGui import * + +class Foo(QTableView): + def __init__(self, parent=None): + QTableView.__init__(self, parent) + +from helper import UsesQApplication + +class TestParentType(UsesQApplication): + + def testParentType(self): + # Test the problem with calling QObject.parent from a QWidget + # when the parent is a python class derived from a QWidget-derived + # class. The method was returning the last C++ class in the hierarchy + parent = Foo() + w2 = QWidget(parent) + self.assert_(isinstance(w2.parentWidget(), Foo)) + self.assert_(isinstance(w2.parent(), Foo)) + +if __name__ == '__main__': + unittest.main() |