aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-13 18:44:44 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:23 -0300
commit0f1b57dc941544e1b5cee7b90d175aa46bb2fdde (patch)
tree97db3a901bb48d178bf9879f966215adc053eccf /tests/QtGui
parentddae00b6c429604c3f2459f022e30ca883b9275f (diff)
Created unit test for bug #854.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/QtGui')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_854.py40
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 3c58dcb93..44e4c520b 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -60,6 +60,7 @@ PYSIDE_TEST(bug_811.py)
PYSIDE_TEST(bug_834.py)
PYSIDE_TEST(bug_836.py)
PYSIDE_TEST(bug_844.py)
+PYSIDE_TEST(bug_854.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
diff --git a/tests/QtGui/bug_854.py b/tests/QtGui/bug_854.py
new file mode 100644
index 000000000..35a092a49
--- /dev/null
+++ b/tests/QtGui/bug_854.py
@@ -0,0 +1,40 @@
+from PySide.QtGui import QTableView, QVBoxLayout, QApplication
+from PySide.QtCore import QAbstractItemModel
+
+from helper import UsesQApplication
+import unittest
+
+
+class VirtualList(QAbstractItemModel):
+ def __getitem__(self, index):
+ self._getItemCalled = True
+ pass
+
+ def rowCount(self, parent):
+ return 5000
+
+ def columnCount(self, parent):
+ return 3
+
+ def index(self, row, column, parent):
+ return self.createIndex(row, column)
+
+ def parent(self, index):
+ return QModelIndex()
+
+ def data(self, index, role):
+ return "(%i, %i)" % (index.row(), index.column())
+
+
+class TestQAbstractItemModel(UsesQApplication):
+ def testSetModel(self):
+ model = VirtualList()
+ model._getItemCalled = False
+ table = QTableView()
+ table.setModel(model)
+ table.show()
+ self.assertFalse(model._getItemCalled)
+
+if __name__ == "__main__":
+ unittest.main()
+