summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativegridview
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-09 00:12:35 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-09 00:15:15 (GMT)
commit58ae252e5555dc379b4ed500532bc51ff7bebc25 (patch)
tree1b1ab1ae8d1f8f915b3161eefd81b42c51c58ba1 /tests/auto/declarative/qdeclarativegridview
parentf46883a6c507b0d6cf6a736fd90c016f82560435 (diff)
downloadQt-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.qml4
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp15
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()