diff options
Diffstat (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp')
-rw-r--r-- | tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
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" |