diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-12-09 00:12:35 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-12-09 00:15:15 (GMT) |
commit | 58ae252e5555dc379b4ed500532bc51ff7bebc25 (patch) | |
tree | 1b1ab1ae8d1f8f915b3161eefd81b42c51c58ba1 /tests/auto/declarative/qdeclarativegridview | |
parent | f46883a6c507b0d6cf6a736fd90c016f82560435 (diff) | |
download | Qt-58ae252e5555dc379b4ed500532bc51ff7bebc25.zip Qt-58ae252e5555dc379b4ed500532bc51ff7bebc25.tar.gz Qt-58ae252e5555dc379b4ed500532bc51ff7bebc25.tar.bz2 |
highlightFollowsCurrentItem: false was not always honored
In some cases ListView and GridView would position the highlight
despite highlightFollowsCurrentItem: false being specified.
Task-number: QTBUG-15972
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativegridview')
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml | 4 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml index 7bb2c95..d082847 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml @@ -28,8 +28,8 @@ Item { objectName: "highlight" width: 80; height: 80 color: "lightsteelblue"; radius: 5 - y: grid.currentItem.y - x: grid.currentItem.x + y: grid.currentItem.y+5 + x: grid.currentItem.x+5 } } diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7998e30..fd5d140 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -1215,15 +1215,22 @@ void tst_QDeclarativeGridView::manualHighlight() QTRY_COMPARE(gridview->currentIndex(), 0); QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 0)); - QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); - QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); gridview->setCurrentIndex(2); QTRY_COMPARE(gridview->currentIndex(), 2); QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2)); - QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); - QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); + + gridview->positionViewAtIndex(8, QDeclarativeGridView::Contain); + + QTRY_COMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2)); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); } void tst_QDeclarativeGridView::footer() |