diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-06-07 14:43:45 -0300 |
---|---|---|
committer | Renato Filho <renato.filho@openbossa.org> | 2010-06-07 16:57:11 -0300 |
commit | ab918abc1e103e0ca86939f7d057e8a44ac8a4ef (patch) | |
tree | 53c6f57d089dcf5e145d766b1ceef704714046d8 /tests/QtGui/parent_method_test.py | |
parent | 471486732b03cbb42b884158604a59d5a18e8a35 (diff) |
Created new unittest model.
Separete unittest for module.
Only run unittest for compiled modules.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
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() |