summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-04-27 03:10:34 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-04-27 03:54:04 (GMT)
commit8878e2c53a0c9408d4b468e2dad485743c32f58b (patch)
treeb6bdd0c5a78e6f5f255b8b0d311b82d919cbc7ac /tests
parent10830210607d08eeb2af5d091639506a7d8cc634 (diff)
downloadQt-8878e2c53a0c9408d4b468e2dad485743c32f58b.zip
Qt-8878e2c53a0c9408d4b468e2dad485743c32f58b.tar.gz
Qt-8878e2c53a0c9408d4b468e2dad485743c32f58b.tar.bz2
PathView offset out of sync with currentIndex when items are removed.
If the view is animating due to currentIndex change and items are removed the target offset must be recalculated. Change-Id: Iee105712488070c086a24561a49daf17bcf14076 Task-number: QTBUG-18825 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 8000137..46c3519 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -458,6 +458,16 @@ void tst_QDeclarativePathView::dataModel()
model.removeItem(model.count()-1);
QCOMPARE(pathview->currentIndex(), model.count()-1);
+ // QTBUG-18825
+ // Confirm that the target offset is adjusted when removing items
+ pathview->setCurrentIndex(model.count()-1);
+ QTRY_COMPARE(pathview->offset(), 1.);
+ pathview->setCurrentIndex(model.count()-5);
+ model.removeItem(model.count()-1);
+ model.removeItem(model.count()-1);
+ model.removeItem(model.count()-1);
+ QTRY_COMPARE(pathview->offset(), 2.);
+
delete canvas;
}