diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-09-06 06:35:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-09-06 06:35:38 (GMT) |
commit | 35a51442ed21f58c06b21293eeb56e843251ee82 (patch) | |
tree | 80d22e67ff80df91ecc32d457c8b919b3c68fcae /tests/auto/declarative/qdeclarativepathview | |
parent | 00f34afa24a229915d1f2b00c02b93f5890fab3f (diff) | |
download | Qt-35a51442ed21f58c06b21293eeb56e843251ee82.zip Qt-35a51442ed21f58c06b21293eeb56e843251ee82.tar.gz Qt-35a51442ed21f58c06b21293eeb56e843251ee82.tar.bz2 |
Fix PathView item position on insertion and removal.
Ensure the offset is adjusted to account for the new or removed items.
Also minor optimizations to delegate updates.
Task-number: QTBUG-13416
Diffstat (limited to 'tests/auto/declarative/qdeclarativepathview')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index e2ccfd2..74d2f0a 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -367,9 +367,11 @@ void tst_QDeclarativePathView::dataModel() QCOMPARE(item->y(), 10.0); model.insertItem(4, "orange", "10"); + QTest::qWait(100); - int itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 10); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 10); + + QVERIFY(pathview->currentIndex() == 0); QDeclarativeText *text = findItem<QDeclarativeText>(pathview, "myText", 4); QVERIFY(text); @@ -384,26 +386,27 @@ void tst_QDeclarativePathView::dataModel() QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); QVERIFY(testObject->error() == false); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); QDeclarativeRectangle *testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 4); QVERIFY(testItem != 0); testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 5); QVERIFY(testItem == 0); + pathview->setCurrentIndex(1); + model.insertItem(2, "pink", "2"); + QTest::qWait(100); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); + QVERIFY(pathview->currentIndex() == 1); text = findItem<QDeclarativeText>(pathview, "myText", 2); QVERIFY(text); QCOMPARE(text->text(), model.name(2)); model.removeItem(3); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); text = findItem<QDeclarativeText>(pathview, "myText", 3); QVERIFY(text); QCOMPARE(text->text(), model.name(3)); |