QAbstractItemModelTester: fix false positive when model has zero columns
Regression introduced by me in commit 72e0d699ce
Fixes: QTBUG-92220
Change-Id: Ic7dd4eda0a1993f9763933882baf928bfc83b08b
Pick-to: 6.1 6.0 5.15
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
c80f262258
commit
b4aac2af19
@ -439,7 +439,7 @@ void QAbstractItemModelTesterPrivate::parent()
|
||||
// when asked for the parent of an invalid index.
|
||||
MODELTESTER_VERIFY(!model->parent(QModelIndex()).isValid());
|
||||
|
||||
if (model->rowCount() == 0)
|
||||
if (model->rowCount() == 0 || model->columnCount() == 0)
|
||||
return;
|
||||
|
||||
// Column 0 | Column 1 |
|
||||
|
@ -41,6 +41,7 @@ private slots:
|
||||
void stringListModel();
|
||||
void treeWidgetModel();
|
||||
void standardItemModel();
|
||||
void standardItemModelZeroColumns();
|
||||
void testInsertThroughProxy();
|
||||
void moveSourceItems();
|
||||
void testResetThroughProxy();
|
||||
@ -105,6 +106,15 @@ void tst_QAbstractItemModelTester::standardItemModel()
|
||||
model.insertColumns(0, 5, model.index(1, 3));
|
||||
}
|
||||
|
||||
void tst_QAbstractItemModelTester::standardItemModelZeroColumns() // QTBUG-92220
|
||||
{
|
||||
QStandardItemModel model;
|
||||
|
||||
QAbstractItemModelTester t1(&model);
|
||||
model.insertRows(0, 5);
|
||||
model.removeRows(0, 5);
|
||||
}
|
||||
|
||||
void tst_QAbstractItemModelTester::testInsertThroughProxy()
|
||||
{
|
||||
DynamicTreeModel *model = new DynamicTreeModel(this);
|
||||
|
Loading…
Reference in New Issue
Block a user