aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-19 09:47:35 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-19 09:47:35 +0200
commitd2628d9d7015e4b75007471d150acedecaa0c6c1 (patch)
tree00ab012c7ae190d5a64788ee945ca006e3759e41 /tests/auto/quick/qquickwindow
parentb6a6a6387e279c431d520243345530fa19bd96c5 (diff)
parent566afc2d2e4156712ffec081715f12307cf46628 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: tests/auto/quick/qquickgridview/qquickgridview.pro tests/auto/quick/qquickitem/qquickitem.pro Change-Id: Ic54cafbdda1ac22757d2ee65dcc63a1b167c7556
Diffstat (limited to 'tests/auto/quick/qquickwindow')
-rw-r--r--tests/auto/quick/qquickwindow/data/hoverCrash.qml36
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp33
2 files changed, 63 insertions, 6 deletions
diff --git a/tests/auto/quick/qquickwindow/data/hoverCrash.qml b/tests/auto/quick/qquickwindow/data/hoverCrash.qml
new file mode 100644
index 0000000000..936d9e4f43
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/hoverCrash.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window {
+ width: 200
+ height: 200
+ color: "#00FF00"
+ Column {
+ Rectangle {
+ objectName: 'item1'
+ color: 'red'
+ width: 100
+ height: 100
+ MouseArea {
+ id: area
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ }
+
+ Loader {
+ objectName: 'item2'
+ width: 100
+ height: 100
+ active: area.containsMouse
+ sourceComponent: Rectangle {
+ color: 'blue'
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index fbbc77c31c..17999ed588 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -328,6 +328,8 @@ private slots:
void blockClosing();
+ void crashWhenHoverItemDeleted();
+
#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -1292,23 +1294,23 @@ void tst_qquickwindow::cursor()
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 100));
// Remove the cursor item from the scene. Theoretically this should make parentItem the
- // cursorItem, but given the situation will correct itself after the next mouse move it's
- // probably better left as is to avoid unnecessary work during tear down.
+ // cursorItem, but given the situation will correct itself after the next mouse move it
+ // simply unsets the window cursor for now.
childItem.setParentItem(0);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
parentItem.setCursor(Qt::SizeAllCursor);
QCOMPARE(parentItem.cursor().shape(), Qt::SizeAllCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
// Changing the cursor of an un-parented item doesn't affect the window's cursor.
childItem.setCursor(Qt::ClosedHandCursor);
QCOMPARE(childItem.cursor().shape(), Qt::ClosedHandCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
childItem.unsetCursor();
QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 101));
QCOMPARE(window.cursor().shape(), Qt::SizeAllCursor);
@@ -1487,6 +1489,25 @@ void tst_qquickwindow::blockClosing()
QTRY_VERIFY(!window->isVisible());
}
+void tst_qquickwindow::crashWhenHoverItemDeleted()
+{
+ // QTBUG-32771
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("hoverCrash.qml"));
+ QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ // Simulate a move from the first rectangle to the second. Crash will happen in here
+ // Moving instantaneously from (0, 99) to (0, 102) does not cause the crash
+ for (int i = 99; i < 102; ++i)
+ {
+ QTest::mouseMove(window, QPoint(0, i));
+ }
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"