summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-10-07 00:37:50 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-10-07 00:37:50 (GMT)
commit0ed462973acc683882ac30ae6959340564f305a3 (patch)
treeda826b812a6c489275f4c6dd85b4b4ee8a27266a /tests/auto/declarative/qdeclarativepathview
parent7d79beeb4c88d4e5fb8d7aecd8dd07419b465f55 (diff)
downloadQt-0ed462973acc683882ac30ae6959340564f305a3.zip
Qt-0ed462973acc683882ac30ae6959340564f305a3.tar.gz
Qt-0ed462973acc683882ac30ae6959340564f305a3.tar.bz2
Fix setting PathView offset when all visible items are removed.
If we remove all items then we don't have a valid firstIndex with which to anchor item positions, so just use offset. Task-number: QTBUG-14199 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativepathview')
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 3a2a577..a2a5363 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -351,6 +351,10 @@ void tst_QDeclarativePathView::dataModel()
model.addItem("yellow", "7");
model.addItem("thistle", "8");
model.addItem("cyan", "9");
+ model.addItem("peachpuff", "10");
+ model.addItem("powderblue", "11");
+ model.addItem("gold", "12");
+ model.addItem("sandybrown", "13");
ctxt->setContextProperty("testData", &model);
@@ -371,7 +375,7 @@ void tst_QDeclarativePathView::dataModel()
model.insertItem(4, "orange", "10");
QTest::qWait(100);
- QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 10);
+ QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 14);
QVERIFY(pathview->currentIndex() == 0);
@@ -420,6 +424,11 @@ void tst_QDeclarativePathView::dataModel()
QVERIFY(item->property("onPath").toBool());
}
+ // QTBUG-14199
+ pathview->setOffset(7);
+ pathview->setOffset(0);
+ QCOMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5);
+
delete canvas;
}