diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-11-24 01:25:07 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-11-24 01:32:12 (GMT) |
commit | d32360bb33e830f8c17a6db1a31f529436c2915e (patch) | |
tree | 1cab53106f9fb075c814248c5a588af237c2716f /tests/auto | |
parent | 5d0be38c15acf28969bd8bf984ab23a29fa8e354 (diff) | |
download | Qt-d32360bb33e830f8c17a6db1a31f529436c2915e.zip Qt-d32360bb33e830f8c17a6db1a31f529436c2915e.tar.gz Qt-d32360bb33e830f8c17a6db1a31f529436c2915e.tar.bz2 |
Avoid lockup in ListView when animating delegates.
Animating delegates results in the content height changing, which
may result in fixup being called if at the ends of the view, which
may in turn cause refill to be called, which will change the content
height, which repeats. Prevent this recusion from happening.
Task-number: QTBUG-14821
Reviewed-by: Bea Lam
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml | 31 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 21 |
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml new file mode 100644 index 0000000..e0303ec --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug14821.qml @@ -0,0 +1,31 @@ +import QtQuick 1.0 + +ListView { + id: view + width: 300; height: 200 + focus: true + keyNavigationWraps: true + + model: 100 + + preferredHighlightBegin: 90 + preferredHighlightEnd: 110 + + highlightRangeMode: ListView.StrictlyEnforceRange + highlight: Component { + Rectangle { + border.color: "blue" + border.width: 3 + color: "transparent" + width: 300; height: 15 + } + } + + delegate: Component { + Item { + height: 15 + (view.currentIndex == index ? 20 : 0) + width: 200 + Text { text: 'Index: ' + index; anchors.verticalCenter: parent.verticalCenter } + } + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index a4b4f21..37d836d 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -101,6 +101,7 @@ private slots: void footer(); void resizeView(); void sizeLessThan1(); + void QTBUG_14821(); private: template <class T> void items(); @@ -1768,6 +1769,26 @@ void tst_QDeclarativeListView::sizeLessThan1() delete canvas; } +void tst_QDeclarativeListView::QTBUG_14821() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug14821.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + listview->decrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 99); + + listview->incrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 0); +} + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); |