diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-13 05:07:21 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-13 05:07:21 (GMT) |
commit | ae8e4afcadc9ff084e1d1859c29fbc8b629e3392 (patch) | |
tree | 675801312aa5740bc68f67444cb5754dd9e5abe1 /tests | |
parent | a19df56265e59bb26f927638aa5c75ccd666c388 (diff) | |
download | Qt-ae8e4afcadc9ff084e1d1859c29fbc8b629e3392.zip Qt-ae8e4afcadc9ff084e1d1859c29fbc8b629e3392.tar.gz Qt-ae8e4afcadc9ff084e1d1859c29fbc8b629e3392.tar.bz2 |
Add an example spinner.
Also add missing increment/decrementCurrentIndex() slots to PathView,
and tweak the number of points cached along a Path.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 62d0b89..0e16f66 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -438,7 +438,8 @@ void tst_QDeclarativePathView::pathMoved() for(int i=0; i<model.count(); i++){ QDeclarativeRectangle *curItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", i); - QCOMPARE(curItem->pos() + offset, path->pointAt(0.25 + i*0.25)); + QPointF itemPos(path->pointAt(0.25 + i*0.25)); + QCOMPARE(curItem->pos() + offset, QPointF(qRound(itemPos.x()), qRound(itemPos.y()))); } pathview->setOffset(0.0); @@ -479,13 +480,36 @@ void tst_QDeclarativePathView::setCurrentIndex() QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 0); pathview->setCurrentIndex(2); - QTest::qWait(1000); firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 2); - QCOMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->pos() + offset, start); QCOMPARE(canvas->rootObject()->property("currentA").toInt(), 2); QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 2); + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 1); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 1); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 3); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 3); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->incrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } |