Fix QAbstractItemModelTester false positive
When inserting rows to a branch with no columns the tester should not complain about indexes being invalid Pick-to: 6.1 6.0 5.15 Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
3f98ff474f
commit
fcea8e7aa8
@ -455,7 +455,7 @@ void QAbstractItemModelTesterPrivate::parent()
|
||||
|
||||
// Common error test #2, make sure that a second level index has a parent
|
||||
// that is the first level index.
|
||||
if (model->rowCount(topIndex) > 0) {
|
||||
if (model->rowCount(topIndex) > 0 && model->columnCount(topIndex) > 0) {
|
||||
QModelIndex childIndex = model->index(0, 0, topIndex);
|
||||
MODELTESTER_VERIFY(childIndex.isValid());
|
||||
MODELTESTER_COMPARE(model->parent(childIndex), topIndex);
|
||||
|
@ -116,6 +116,10 @@ void tst_QAbstractItemModelTester::standardItemModelZeroColumns()
|
||||
// QTBUG-92886
|
||||
model.insertRows(0, 5);
|
||||
model.removeRows(1, 2);
|
||||
|
||||
const QModelIndex parentIndex = model.index(0, 0);
|
||||
model.insertRows(0, 5, parentIndex);
|
||||
model.removeRows(1, 2, parentIndex);
|
||||
}
|
||||
|
||||
void tst_QAbstractItemModelTester::testInsertThroughProxy()
|
||||
|
Loading…
Reference in New Issue
Block a user