summaryrefslogtreecommitdiffstats
path: root/src/testlib/qabstractitemmodeltester.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qabstractitemmodeltester.cpp')
-rw-r--r--src/testlib/qabstractitemmodeltester.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp
index 2348f8fdfe..1cd18b98bb 100644
--- a/src/testlib/qabstractitemmodeltester.cpp
+++ b/src/testlib/qabstractitemmodeltester.cpp
@@ -438,7 +438,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 |
@@ -570,7 +570,7 @@ void QAbstractItemModelTesterPrivate::checkChildren(const QModelIndex &parent, i
// recursively go down the children
if (model->hasChildren(index) && currentDepth < 10)
- checkChildren(index, ++currentDepth);
+ checkChildren(index, currentDepth + 1);
// make sure that after testing the children that the index doesn't change.
QModelIndex newerIndex = model->index(r, c, parent);
@@ -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);
@@ -845,3 +845,5 @@ bool QAbstractItemModelTesterPrivate::compare(const T1 &t1, const T2 &t2,
QT_END_NAMESPACE
+
+#include "moc_qabstractitemmodeltester.cpp"