diff options
Diffstat (limited to 'tests/auto/quick')
5 files changed, 128 insertions, 1 deletions
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml new file mode 100644 index 0000000000..1bd20c6bcb --- /dev/null +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 + +Item { + width: 640 + height: 480 + + Loader { + id: loader + + width: 480 + height: 480 + + sourceComponent: Rectangle { + id: item2 + anchors.fill: parent + color: "blue" + + DragHandler{} + } + } + + Rectangle { + color: "yellow" + width: 180 + height: 180 + + MultiPointTouchArea { + anchors.fill: parent + touchPoints: [ + TouchPoint { onPressedChanged: loader.sourceComponent = undefined } + ] + } + } +} + + diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index b994e0fc07..bf582b820b 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -55,6 +55,7 @@ private slots: void touchDrag(); void touchesThenPinch(); + void unloadHandlerWithPassiveGrab(); private: void createView(QScopedPointer<QQuickView> &window, const char *fileName); @@ -282,6 +283,24 @@ void tst_MptaInterop::touchesThenPinch() QTRY_COMPARE(mptaReleasedSpy.count(), 1); } +void tst_MptaInterop::unloadHandlerWithPassiveGrab() +{ + QScopedPointer<QQuickView> windowPtr; + createView(windowPtr, "unloadHandlerOnPress.qml"); + QQuickView * window = windowPtr.data(); + + QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>(); + QVERIFY(handler); + QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>(); + QVERIFY(mpta); + + QPoint point(90, 90); + QTest::mousePress(window, Qt::LeftButton, 0, point); + QCOMPARE(window->mouseGrabberItem(), mpta); + QTRY_VERIFY(handler.isNull()); // it got unloaded + QTest::mouseRelease(window, Qt::LeftButton, 0, point); // QTBUG-73819: don't crash +} + QTEST_MAIN(tst_MptaInterop) #include "tst_multipointtoucharea_interop.moc" diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml index 9045247e94..011dc4e75f 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml @@ -90,7 +90,7 @@ Rectangle { id: paddle objectName: "paddle" width: 100 - height: 40 + height: 100 color: paddleHH.hovered ? "indianred" : "#888" x: (parent.width - width) / 2 y: parent.height - 100 diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp index 52074aec4f..f141a2546c 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp @@ -60,6 +60,7 @@ private slots: void hoverHandlerAndUnderlyingHoverHandler(); void mouseAreaAndUnderlyingHoverHandler(); void hoverHandlerAndUnderlyingMouseArea(); + void movingItemWithHoverHandler(); private: void createView(QScopedPointer<QQuickView> &window, const char *fileName); @@ -229,6 +230,42 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea() QCOMPARE(buttonHoveredSpy.count(), 2); } +void tst_HoverHandler::movingItemWithHoverHandler() +{ + if (isPlatformWayland()) + QSKIP("Wayland: QCursor::setPos() doesn't work."); + + QScopedPointer<QQuickView> windowPtr; + createView(windowPtr, "lesHoverables.qml"); + QQuickView * window = windowPtr.data(); + QQuickItem * paddle = window->rootObject()->findChild<QQuickItem *>("paddle"); + QVERIFY(paddle); + QQuickHoverHandler *paddleHH = paddle->findChild<QQuickHoverHandler *>("paddleHH"); + QVERIFY(paddleHH); + + // Find the global coordinate of the paddle + const QPoint p(paddle->mapToScene(paddle->clipRect().center()).toPoint()); + const QPoint paddlePos = window->mapToGlobal(p); + + // Now hide the window, put the cursor where the paddle was and show it again + window->hide(); + QTRY_COMPARE(window->isVisible(), false); + QCursor::setPos(paddlePos); + window->show(); + QTest::qWaitForWindowExposed(window); + + QTRY_COMPARE(paddleHH->isHovered(), true); + + paddle->setX(100); + QTRY_COMPARE(paddleHH->isHovered(), false); + + paddle->setX(p.x()); + QTRY_COMPARE(paddleHH->isHovered(), true); + + paddle->setX(540); + QTRY_COMPARE(paddleHH->isHovered(), false); +} + QTEST_MAIN(tst_HoverHandler) #include "tst_qquickhoverhandler.moc" diff --git a/tests/auto/quick/qquickshortcut/BLACKLIST b/tests/auto/quick/qquickshortcut/BLACKLIST new file mode 100644 index 0000000000..ba7871dc2d --- /dev/null +++ b/tests/auto/quick/qquickshortcut/BLACKLIST @@ -0,0 +1,7 @@ +# QTBUG-74050 +[shortcuts] +opensuse-42.3 + +# QTBUG-74050 +[multiple] +opensuse-42.3 |