summaryrefslogtreecommitdiffstats
path: root/tests
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
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')
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml4
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp11
4 files changed, 23 insertions, 9 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()
diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
index d8cfd9a..a32a194 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
@@ -28,7 +28,7 @@ Item {
objectName: "highlight"
width: 180; height: 20
color: "lightsteelblue"; radius: 5
- y: list.currentItem.y
+ y: list.currentItem.y+5
}
}
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 22ebb1a..ff90d32 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1609,13 +1609,20 @@ void tst_QDeclarativeListView::manualHighlight()
QTRY_COMPARE(listview->currentIndex(), 0);
QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 0));
- QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
listview->setCurrentIndex(2);
QTRY_COMPARE(listview->currentIndex(), 2);
QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
- QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ // QTBUG-15972
+ listview->positionViewAtIndex(3, QDeclarativeListView::Contain);
+
+ QTRY_COMPARE(listview->currentIndex(), 2);
+ QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
delete canvas;
}