summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
diff options
context:
space:
mode:
authorStephen Kelly <stephen@kdab.com>2010-09-09 13:28:15 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-09-09 13:28:15 (GMT)
commitfe350ca756df6392b3d0b7840351fccc89f9ef6f (patch)
tree9236272b6a45fc7438a3eaff30c2a0f933ddc2ac /tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
parent7e9ac1bab3527de054552ff3f38ab70945f49512 (diff)
downloadQt-fe350ca756df6392b3d0b7840351fccc89f9ef6f.zip
Qt-fe350ca756df6392b3d0b7840351fccc89f9ef6f.tar.gz
Qt-fe350ca756df6392b3d0b7840351fccc89f9ef6f.tar.bz2
When a move is completed, report the source and destination correctly.
In rare cases source or destination is changed during the move, so it must be corrected afterward before being reported in the signal. Merge-request: 800 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp')
-rw-r--r--tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
index 6f158f0..dbcccc9 100644
--- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -1208,6 +1208,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent()
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QPersistentModelIndex persistentSource = sourceIndex;
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setAncestorRowNumbers(QList<int>() << 5);
@@ -1228,7 +1229,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent()
QCOMPARE(beforeSignal.at(4).toInt(), destRow);
QCOMPARE(afterSignal.size(), 5);
- QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex);
+ QCOMPARE(afterSignal.at(0).value<QModelIndex>(), static_cast<QModelIndex>(persistentSource));
QCOMPARE(afterSignal.at(1).toInt(), startRow);
QCOMPARE(afterSignal.at(2).toInt(), endRow);
QCOMPARE(afterSignal.at(3).value<QModelIndex>(), QModelIndex());
@@ -1351,6 +1352,7 @@ void tst_QAbstractItemModel::testMoveToSibling()
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QPersistentModelIndex persistentDest = destIndex;
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
@@ -1374,7 +1376,7 @@ void tst_QAbstractItemModel::testMoveToSibling()
QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex);
QCOMPARE(afterSignal.at(1).toInt(), startRow);
QCOMPARE(afterSignal.at(2).toInt(), endRow);
- QCOMPARE(afterSignal.at(3).value<QModelIndex>(), destIndex);
+ QCOMPARE(afterSignal.at(3).value<QModelIndex>(), static_cast<QModelIndex>(persistentDest));
QCOMPARE(afterSignal.at(4).toInt(), destRow);
for (int i = 0; i < indexList.size(); i++)