QAbstractItemModelTester: fix false positive when model has zero columns
Regression introduced by me in commit 72e0d699cec09458ca9325035d477d4899e8e47b Fixes: QTBUG-92220 Change-Id: Ic7dd4eda0a1993f9763933882baf928bfc83b08b Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b4aac2af19690917553f93660e3ad760fc15d0b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
117e0a4369
commit
1b1f2b265e
@ -439,7 +439,7 @@ void QAbstractItemModelTesterPrivate::parent()
|
|||||||
// when asked for the parent of an invalid index.
|
// when asked for the parent of an invalid index.
|
||||||
MODELTESTER_VERIFY(!model->parent(QModelIndex()).isValid());
|
MODELTESTER_VERIFY(!model->parent(QModelIndex()).isValid());
|
||||||
|
|
||||||
if (model->rowCount() == 0)
|
if (model->rowCount() == 0 || model->columnCount() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Column 0 | Column 1 |
|
// Column 0 | Column 1 |
|
||||||
|
@ -41,6 +41,7 @@ private slots:
|
|||||||
void stringListModel();
|
void stringListModel();
|
||||||
void treeWidgetModel();
|
void treeWidgetModel();
|
||||||
void standardItemModel();
|
void standardItemModel();
|
||||||
|
void standardItemModelZeroColumns();
|
||||||
void testInsertThroughProxy();
|
void testInsertThroughProxy();
|
||||||
void moveSourceItems();
|
void moveSourceItems();
|
||||||
void testResetThroughProxy();
|
void testResetThroughProxy();
|
||||||
@ -105,6 +106,15 @@ void tst_QAbstractItemModelTester::standardItemModel()
|
|||||||
model.insertColumns(0, 5, model.index(1, 3));
|
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()
|
void tst_QAbstractItemModelTester::testInsertThroughProxy()
|
||||||
{
|
{
|
||||||
DynamicTreeModel *model = new DynamicTreeModel(this);
|
DynamicTreeModel *model = new DynamicTreeModel(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user