summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-03 14:21:40 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:48:07 -0300
commit7a3e7b6f86a514c661bf61c65d1098339e4ffba3 (patch)
tree9fa6c3c010a96cf566cce94a5c8f3b549d80589a
parent1ed2877743ce786e1d71f804f1b4aa4f433aa4be (diff)
Fix QTreeWidgetItem.parent function.
Create unit test for new use case. Fixes bug #547 Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml2
-rw-r--r--tests/QtGui/bug_547.py21
2 files changed, 20 insertions, 3 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 8884c63f..b6516ab4 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -3231,7 +3231,7 @@
<parent index="this" action="add"/>
</modify-argument>
</modify-function>
- <modify-function signature="parent()">
+ <modify-function signature="parent() const">
<modify-argument index="this">
<parent index="return" action="add"/>
</modify-argument>
diff --git a/tests/QtGui/bug_547.py b/tests/QtGui/bug_547.py
index 5636fb6f..6b652540 100644
--- a/tests/QtGui/bug_547.py
+++ b/tests/QtGui/bug_547.py
@@ -6,8 +6,8 @@ import sys
import unittest
class MyMainWindow(unittest.TestCase):
- def testClearFunction(self):
- app = QtGui.QApplication(sys.argv)
+ app = QtGui.QApplication(sys.argv)
+ def testCase1(self):
self._tree = QtGui.QTreeWidget()
self._tree.setColumnCount(2)
self._i1 = None
@@ -24,6 +24,21 @@ class MyMainWindow(unittest.TestCase):
self.assertEqual(sys.getrefcount(self._i1), 3)
self.assertEqual(sys.getrefcount(self._i11), 3)
+ def testCase2(self):
+ self._tree = QtGui.QTreeWidget()
+ self._tree.setColumnCount(2)
+ self._i1 = None
+ self._i11 = None
+
+ self._updateTree()
+ self.assertEqual(sys.getrefcount(self._i1), 3)
+ self.assertEqual(sys.getrefcount(self._i11), 3)
+
+ self._i11.parent().setExpanded(True)
+ self._i11.setExpanded(True)
+
+ self.assertEqual(sys.getrefcount(self._i1), 3)
+ self.assertEqual(sys.getrefcount(self._i11), 3)
def _updateTree(self):
self._tree.clear()
@@ -32,7 +47,9 @@ class MyMainWindow(unittest.TestCase):
self.assertEqual(sys.getrefcount(self._i11), 2)
self._i1 = QtGui.QTreeWidgetItem(self._tree, ['1', ])
+ self.assertEqual(sys.getrefcount(self._i1), 3)
self._i11 = QtGui.QTreeWidgetItem(self._i1, ['11', ])
+ self.assertEqual(sys.getrefcount(self._i11), 3)
if __name__ == '__main__':
unittest.main()