aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-01-22 18:33:26 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-25 18:26:36 +0100
commit55b545b5926fd2ecbb54c0d7bdeba0d79b4cf656 (patch)
treeb933c6044073541b32f78862ff26de8b3ca98902 /tests
parentafb5bf71c942d411d6102ce637bc7499d8ae467c (diff)
Flickable: fix crash in delayed press handling
Task-number: QTBUG-31328 Change-Id: Ic87e9b4db09242b49f104a8f38e4e420c62db75c Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml18
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp18
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml b/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml
new file mode 100644
index 0000000000..7ef4e70c95
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Loader {
+ id: loader
+
+ width: 300
+ height: 300
+
+ sourceComponent: Flickable {
+ pressDelay: 1000
+ contentWidth: loader.width
+ contentHeight: loader.height
+ MouseArea {
+ anchors.fill: parent
+ onPressed: loader.sourceComponent = null
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 33e753df57..8ab86bf2d3 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -97,6 +97,7 @@ private slots:
void stopAtBounds();
void stopAtBounds_data();
void nestedMouseAreaUsingTouch();
+ void pressDelayWithLoader();
private:
void flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
@@ -1580,6 +1581,23 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch()
QVERIFY(nested->y() < 100.0);
}
+// QTBUG-31328
+void tst_qquickflickable::pressDelayWithLoader()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("pressDelayWithLoader.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ // do not crash
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"