diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-10 03:35:05 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-10 03:35:05 (GMT) |
commit | ca30cacd614b7de8a855a3b4a1dc254c5f9289c9 (patch) | |
tree | 791e38310aefabe1e90c78b9cb9f51aad6d4a0e2 /tests/auto | |
parent | cca8cbafbea02b946d571f2f656c81e8c20bdbeb (diff) | |
download | Qt-ca30cacd614b7de8a855a3b4a1dc254c5f9289c9.zip Qt-ca30cacd614b7de8a855a3b4a1dc254c5f9289c9.tar.gz Qt-ca30cacd614b7de8a855a3b4a1dc254c5f9289c9.tar.bz2 |
More highlight testing.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp | 17 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp index 7c32d14..f89e02f 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp +++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp @@ -534,9 +534,12 @@ void tst_QmlGraphicsGridView::currentIndex() QmlGraphicsItem *viewport = gridview->viewport(); QVERIFY(viewport != 0); + QTest::qWait(500); + // current item should be third item QCOMPARE(gridview->currentIndex(), 5); QCOMPARE(gridview->currentItem(), findItem<QmlGraphicsItem>(viewport, "wrapper", 5)); + QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); gridview->moveCurrentIndexRight(); QCOMPARE(gridview->currentIndex(), 6); @@ -605,6 +608,20 @@ void tst_QmlGraphicsGridView::currentIndex() QVERIFY(key.isAccepted()); QCOMPARE(gridview->currentIndex(), 0); + // turn off auto highlight + gridview->setHighlightFollowsCurrentItem(false); + QVERIFY(gridview->highlightFollowsCurrentItem() == false); + + QTest::qWait(500); + QVERIFY(gridview->highlightItem()); + qreal hlPosX = gridview->highlightItem()->x(); + qreal hlPosY = gridview->highlightItem()->y(); + + gridview->setCurrentIndex(5); + QTest::qWait(500); + QCOMPARE(gridview->highlightItem()->x(), hlPosX); + QCOMPARE(gridview->highlightItem()->y(), hlPosY); + delete canvas; } diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp index 2e797d8..a4949eb 100644 --- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp +++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp @@ -800,9 +800,12 @@ void tst_QmlGraphicsListView::currentIndex() QmlGraphicsItem *viewport = listview->viewport(); QVERIFY(viewport != 0); + QTest::qWait(500); + // current item should be third item QCOMPARE(listview->currentIndex(), 3); QCOMPARE(listview->currentItem(), findItem<QmlGraphicsItem>(viewport, "wrapper", 3)); + QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); // no wrap listview->setCurrentIndex(0); @@ -851,6 +854,18 @@ void tst_QmlGraphicsListView::currentIndex() QVERIFY(key.isAccepted()); QCOMPARE(listview->currentIndex(), 0); + // turn off auto highlight + listview->setHighlightFollowsCurrentItem(false); + QVERIFY(listview->highlightFollowsCurrentItem() == false); + + QTest::qWait(500); + QVERIFY(listview->highlightItem()); + qreal hlPos = listview->highlightItem()->y(); + + listview->setCurrentIndex(4); + QTest::qWait(500); + QCOMPARE(listview->highlightItem()->y(), hlPos); + delete canvas; } |