From 4b2fae2a900f4e66db36ee9e0ee2615346eeccdc Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 4 Dec 2013 22:18:36 +0100 Subject: 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 Reviewed-by: J-P Nurmi Reviewed-by: Alan Alpert --- .../quick/qquicklistview/tst_qquicklistview.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp') 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 void items(const QUrl &source); template 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 object(component.create()); + + QQuickListView *listview = qobject_cast(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" -- cgit v1.2.3