diff options
author | Luca Beldi <v.ronin@yahoo.it> | 2021-04-15 23:41:28 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-19 21:47:32 +0000 |
commit | cbec5527903a6ee8fc711b1a352dc17b6efada71 (patch) | |
tree | cf1e55115faf57abbde595a5fdc2e1dc9199cbce /src/testlib/qabstractitemmodeltester.cpp | |
parent | cf00353f303de3956a4116f4cec826e16aa6181f (diff) |
Fix QAbstractItemModelTester false positive
When rows are removed from a model with no columns,
the test should not report a problem if indexes are invalid
Fixes: QTBUG-92886
Change-Id: I7a042dfdb2575f87208a00cbed13db3869807f84
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit fed2c0d23614df1b96dcc8746223501b07597a52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/testlib/qabstractitemmodeltester.cpp')
-rw-r--r-- | src/testlib/qabstractitemmodeltester.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp index d11c59b8e8..4acbf42e00 100644 --- a/src/testlib/qabstractitemmodeltester.cpp +++ b/src/testlib/qabstractitemmodeltester.cpp @@ -720,12 +720,12 @@ void QAbstractItemModelTesterPrivate::rowsAboutToBeRemoved(const QModelIndex &pa Changing c; c.parent = parent; c.oldSize = model->rowCount(parent); - if (start > 0) { + if (start > 0 && model->columnCount(parent) > 0) { const QModelIndex startIndex = model->index(start - 1, 0, parent); MODELTESTER_VERIFY(startIndex.isValid()); c.last = model->data(startIndex); } - if (end < c.oldSize - 1) { + if (end < c.oldSize - 1 && model->columnCount(parent) > 0) { const QModelIndex endIndex = model->index(end + 1, 0, parent); MODELTESTER_VERIFY(endIndex.isValid()); c.next = model->data(endIndex); |