diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-05-20 14:36:25 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-05-20 14:36:25 (GMT) |
commit | e4dc3567af533df2e57425952c4609726515d2cd (patch) | |
tree | 72824b5efc9a4d6ed9f099d34404076245e164fa /tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | |
parent | a36e8ca7afd0c15e5ec73bf4ea21464ab89a3662 (diff) | |
parent | dbfedcb31961579499fcb5342ccc42311191bcd4 (diff) | |
download | Qt-e4dc3567af533df2e57425952c4609726515d2cd.zip Qt-e4dc3567af533df2e57425952c4609726515d2cd.tar.gz Qt-e4dc3567af533df2e57425952c4609726515d2cd.tar.bz2 |
Merge remote branch 'origin/master'
Conflicts:
src/gui/dialogs/qnspanelproxy_mac.mm
Diffstat (limited to 'tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 89be151..2db3ee6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -75,6 +75,7 @@ private slots: void resetModel(); void enforceRange(); void QTBUG_8456(); + void manualHighlight(); private: QDeclarativeView *createView(); @@ -1107,6 +1108,35 @@ void tst_QDeclarativeGridView::QTBUG_8456() QTRY_COMPARE(gridview->currentIndex(), 0); } +void tst_QDeclarativeGridView::manualHighlight() +{ + QDeclarativeView *canvas = createView(); + + QString filename(SRCDIR "/data/manual-highlight.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QTRY_VERIFY(viewport != 0); + + QTRY_COMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + + gridview->setCurrentIndex(2); + + QTRY_COMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 2)); + QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); +} + + QDeclarativeView *tst_QDeclarativeGridView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); |