diff options
Diffstat (limited to 'tests/auto/declarative/qquickimage')
-rw-r--r-- | tests/auto/declarative/qquickimage/data/qtbug_22125.qml | 44 | ||||
-rw-r--r-- | tests/auto/declarative/qquickimage/tst_qquickimage.cpp | 22 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/auto/declarative/qquickimage/data/qtbug_22125.qml b/tests/auto/declarative/qquickimage/data/qtbug_22125.qml new file mode 100644 index 0000000000..9b68c0a125 --- /dev/null +++ b/tests/auto/declarative/qquickimage/data/qtbug_22125.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + +Item { + id: root + width: 800 + height: 800 + + GridView { + anchors.fill: parent + delegate: Image { + source: imagePath; + asynchronous: true + smooth: true + width: 200 + height: 200 + } + model: ListModel { + ListElement { + imagePath: "http://127.0.0.1:14451/big256.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/big256.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/big256.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/colors.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/colors1.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/big.jpeg" + } + ListElement { + imagePath: "http://127.0.0.1:14451/heart.png" + } + ListElement { + imagePath: "http://127.0.0.1:14451/green.png" + } + } + } +} diff --git a/tests/auto/declarative/qquickimage/tst_qquickimage.cpp b/tests/auto/declarative/qquickimage/tst_qquickimage.cpp index 1dd88ca743..3223f0be1d 100644 --- a/tests/auto/declarative/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/declarative/qquickimage/tst_qquickimage.cpp @@ -88,6 +88,7 @@ private slots: void sourceSize_QTBUG_14303(); void sourceSize_QTBUG_16389(); void nullPixmapPaint(); + void imageCrash_QTBUG_22125(); private: template<typename T> @@ -653,6 +654,27 @@ void tst_qquickimage::nullPixmapPaint() delete image; } +void tst_qquickimage::imageCrash_QTBUG_22125() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(TESTDATA(""), TestHTTPServer::Delay); + + { + QQuickView view(QUrl::fromLocalFile(TESTDATA("qtbug_22125.qml"))); + view.show(); + qApp->processEvents(); + qApp->processEvents(); + // shouldn't crash when the view drops out of scope due to + // QDeclarativePixmapData attempting to dereference a pointer to + // the destroyed reader. + } + + // shouldn't crash when deleting cancelled QDeclarativePixmapReplys. + QTest::qWait(520); // Delay mode delays for 500 ms. + qApp->processEvents(QEventLoop::DeferredDeletion); +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index |