summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro1
-rw-r--r--tests/auto/other/modeltest/dynamictreemodel.cpp12
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
index 8bfe6628da..9e59251379 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
@@ -6,4 +6,3 @@ mtdir = ../../../other/modeltest
INCLUDEPATH += $$PWD/$${mtdir}
SOURCES = tst_qabstractitemmodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp
HEADERS = $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h
-CONFIG += insignificant_test # QTBUG-25325
diff --git a/tests/auto/other/modeltest/dynamictreemodel.cpp b/tests/auto/other/modeltest/dynamictreemodel.cpp
index 325fc19db2..ab783d0ba2 100644
--- a/tests/auto/other/modeltest/dynamictreemodel.cpp
+++ b/tests/auto/other/modeltest/dynamictreemodel.cpp
@@ -372,7 +372,17 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
}
}
- foreach (const QModelIndex &idx, m_model->persistentIndexList()) {
+ // If we're changing one of the parent indexes, we need to ensure that we do that before
+ // changing any children of that parent. The reason is that we're keeping parent1 and parent2
+ // around as QPersistentModelIndex instances, and we query idx.parent() in the loop.
+ QModelIndexList persistent = m_model->persistentIndexList();
+ foreach (const QModelIndex &parent, parents) {
+ int idx = persistent.indexOf(parent);
+ if (idx != -1)
+ persistent.move(idx, 0);
+ }
+
+ foreach (const QModelIndex &idx, persistent) {
if (idx.parent() == parent1) {
if (idx.row() == rowSize1 - 1) {
m_model->changePersistentIndex(idx, m_model->createIndex(0, idx.column(), idx.internalPointer()));