Added tests for bug #716 - QPersistentModelIndex isn't convertible to QModelIndex
The main test (exactly the same as reported) was added to QtGui tests, but also extended QAbstractItemModel test with a case that is the essence of the problem. http://bugs.pyside.org/show_bug.cgi?id=716 Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
bf4e4cdb89
commit
5ae1e6460b
3 changed files with 17 additions and 0 deletions
|
|
@ -16,6 +16,13 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
|
||||||
foo = Foo()
|
foo = Foo()
|
||||||
idx = m.createIndex(0,0, foo)
|
idx = m.createIndex(0,0, foo)
|
||||||
|
|
||||||
|
def testPassQPersistentModelIndexAsQModelIndex(self):
|
||||||
|
# Related to bug #716
|
||||||
|
m = MyModel()
|
||||||
|
idx = QPersistentModelIndex()
|
||||||
|
m.span(idx)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ PYSIDE_TEST(bug_688.py)
|
||||||
PYSIDE_TEST(bug_696.py)
|
PYSIDE_TEST(bug_696.py)
|
||||||
PYSIDE_TEST(bug_693.py)
|
PYSIDE_TEST(bug_693.py)
|
||||||
PYSIDE_TEST(bug_714.py)
|
PYSIDE_TEST(bug_714.py)
|
||||||
|
PYSIDE_TEST(bug_716.py)
|
||||||
PYSIDE_TEST(bug_722.py)
|
PYSIDE_TEST(bug_722.py)
|
||||||
PYSIDE_TEST(bug_728.py)
|
PYSIDE_TEST(bug_728.py)
|
||||||
PYSIDE_TEST(bug_736.py)
|
PYSIDE_TEST(bug_736.py)
|
||||||
|
|
|
||||||
9
tests/QtGui/bug_716.py
Normal file
9
tests/QtGui/bug_716.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
from PySide.QtCore import Qt, QPersistentModelIndex
|
||||||
|
from PySide.QtGui import QStringListModel
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
stringListModel = QStringListModel(['one', 'two'])
|
||||||
|
idx = stringListModel.index(1, 0)
|
||||||
|
persistentModelIndex = QPersistentModelIndex(idx)
|
||||||
|
stringListModel.data(persistentModelIndex, Qt.DisplayRole)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue