aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2013-12-04 22:18:36 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-11 02:31:29 +0100
commit4b2fae2a900f4e66db36ee9e0ee2615346eeccdc (patch)
tree177d5dbca669977b5ea10798d35b53041733b749 /tests
parent059ffd2d37446a095b3b01f615c4aea200cf6ef8 (diff)
Set highlight size for both dimensions, irrespective of ListView orientation
The assumption that all list delegates are the same size (dependent on ListView orientation) is not a correct one, even if it is correct most of the time. Task-number: QTBUG-31626 Change-Id: Iba6f3bc5f38d60e3be7632ab17d0c66ab8e73965 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicklistview/data/HighlightResize.qml23
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp21
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/HighlightResize.qml b/tests/auto/quick/qquicklistview/data/HighlightResize.qml
new file mode 100644
index 0000000000..2b07b39d20
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/HighlightResize.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+ListView {
+ id: view
+
+ width: 400
+ height: 400
+ model: 5
+
+ highlight: Rectangle {
+ color: "skyblue"
+ }
+
+ delegate: Item {
+ width: 100 + index * 20
+ height: 100 + index * 10
+
+ Text {
+ anchors.centerIn: parent
+ text: model.index
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index d888ba2b5c..d207a7eadc 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -216,6 +216,8 @@ private slots:
void typedModel();
+ void highlightItemGeometryChanges();
+
private:
template <class T> void items(const QUrl &source);
template <class T> void changed(const QUrl &source);
@@ -7012,6 +7014,25 @@ void tst_QQuickListView::typedModel()
QCOMPARE(listview->count(), 0);
}
+void tst_QQuickListView::highlightItemGeometryChanges()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("HighlightResize.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listview);
+
+ QCOMPARE(listview->count(), 5);
+
+ for (int i = 0; i < listview->count(); ++i) {
+ listview->setCurrentIndex(i);
+ QTRY_COMPARE(listview->highlightItem()->width(), qreal(100 + i * 20));
+ QTRY_COMPARE(listview->highlightItem()->height(), qreal(100 + i * 10));
+ }
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"