Created unit test for bug #854.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente <hugo.lima@openbossa.org>
This commit is contained in:
parent
29cd3b1351
commit
82fc89093c
2 changed files with 41 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ PYSIDE_TEST(bug_811.py)
|
||||||
PYSIDE_TEST(bug_834.py)
|
PYSIDE_TEST(bug_834.py)
|
||||||
PYSIDE_TEST(bug_836.py)
|
PYSIDE_TEST(bug_836.py)
|
||||||
PYSIDE_TEST(bug_844.py)
|
PYSIDE_TEST(bug_844.py)
|
||||||
|
PYSIDE_TEST(bug_854.py)
|
||||||
PYSIDE_TEST(customproxywidget_test.py)
|
PYSIDE_TEST(customproxywidget_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
||||||
|
|
|
||||||
40
tests/QtGui/bug_854.py
Normal file
40
tests/QtGui/bug_854.py
Normal file
|
|
@ -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()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue