diff options
author | Michael Brasser <michael.brasser@jollamobile.com> | 2014-01-28 08:59:59 -0600 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-30 04:58:20 +0100 |
commit | fc218a91ce03187f51058deba9d5cdde9c3e6d05 (patch) | |
tree | 0a24390a3e12f9c1abe7abc33e5277e0a01bba53 /tests | |
parent | 4eb6f67f10da3431e5a68db2bf4b0fed804b01e7 (diff) |
Fix crash in header when regenerating view.
Unregister for geometry changes before reparenting, as
reparenting may trigger those changes.
Task-number: QTBUG-36481
Change-Id: Ia94f1f88880b232dd583b7e63e5da73fb338f7c6
Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/headerCrash.qml | 20 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/headerCrash.qml b/tests/auto/quick/qquicklistview/data/headerCrash.qml new file mode 100644 index 0000000000..124fa894f2 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/headerCrash.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +ListView { + id: myList + + width: 400; height: 400 + model: 10 + + header: Item { + height: parent ? 20 : 10 + width: 400 + } + + delegate: Rectangle { + width: parent.width; height: 20 + color: index % 2 ? "green" : "red" + } + + Component.onCompleted: myList.verticalLayoutDirection = ListView.BottomToTop +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index a0045a244f..4b52ad0071 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -218,6 +218,8 @@ private slots: void highlightItemGeometryChanges(); + void QTBUG_36481(); + private: template <class T> void items(const QUrl &source); template <class T> void changed(const QUrl &source); @@ -7058,6 +7060,15 @@ void tst_QQuickListView::highlightItemGeometryChanges() } } +void tst_QQuickListView::QTBUG_36481() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("headerCrash.qml")); + + // just testing that we don't crash when creating + QScopedPointer<QObject> object(component.create()); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |