summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractitemmodel
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2010-10-13 09:42:10 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-10-13 09:52:10 (GMT)
commit62dc9c9602987f4381481cc5642e3ea0782bb418 (patch)
tree3072b0afe3201f80299123d7de6c9358fe31ec91 /tests/auto/qabstractitemmodel
parent6f1f1317e68a261173ddb24a045dcc823b16a3bd (diff)
downloadQt-62dc9c9602987f4381481cc5642e3ea0782bb418.zip
Qt-62dc9c9602987f4381481cc5642e3ea0782bb418.tar.gz
Qt-62dc9c9602987f4381481cc5642e3ea0782bb418.tar.bz2
Adjust the parent index for the itemsMoved call.
Not doing this causes the parent QModelIndexes to be out of sync with the model. The fix in fe350ca756df6392b3d0b7840351fccc89f9ef6f is extended to also use adjusted indexes in the itemMove call. Merge-request: 849 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qabstractitemmodel')
-rw-r--r--tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
index dbcccc9..b723253 100644
--- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -1167,6 +1167,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent_data()
// Moving everything from one parent to another
QTest::newRow("move12") << 0 << 9 << 10;
+ QTest::newRow("move13") << 0 << 9 << 0;
}
void tst_QAbstractItemModel::testMoveToGrandParent()
@@ -1314,6 +1315,11 @@ void tst_QAbstractItemModel::testMoveToSibling_data()
QTest::newRow("move09") << 8 << 8 << 4;
QTest::newRow("move10") << 8 << 8 << 5;
QTest::newRow("move11") << 8 << 8 << 6;
+
+ // Move such that the destination parent no longer valid after the move.
+ // The destination parent is always QMI(5, 0), but after this move the
+ // row count is 5, so (5, 0) (used internally in QAIM) no longer refers to a valid index.
+ QTest::newRow("move12") << 0 << 4 << 0;
}
void tst_QAbstractItemModel::testMoveToSibling()