aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickmultipointtoucharea
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickmultipointtoucharea')
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/BLACKLIST4
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/CMakeLists.txt6
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/cancel.qml12
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml6
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml8
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/nested.qml2
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/nestedTouchPosCheck.qml52
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml4
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml14
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/touchOverMouseArea.qml21
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml4
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp157
12 files changed, 217 insertions, 73 deletions
diff --git a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
index 2488eff270..c79f4b6a29 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
+++ b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
@@ -4,3 +4,7 @@ ubuntu-22.04
[nested]
ubuntu-20.04
ubuntu-22.04
+
+# QTBUG-118065
+[mouseGestureStarted]
+opensuse-leap
diff --git a/tests/auto/quick/qquickmultipointtoucharea/CMakeLists.txt b/tests/auto/quick/qquickmultipointtoucharea/CMakeLists.txt
index 38e91d5683..277df556cc 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/CMakeLists.txt
+++ b/tests/auto/quick/qquickmultipointtoucharea/CMakeLists.txt
@@ -7,6 +7,12 @@
## tst_qquickmultipointtoucharea Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qquickmultipointtoucharea LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/cancel.qml b/tests/auto/quick/qquickmultipointtoucharea/data/cancel.qml
index e108003bca..493257ac7e 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/cancel.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/cancel.qml
@@ -30,12 +30,12 @@ MultiPointTouchArea {
property int touchCount: 0
property bool touchUpdatedHandled: false
- onPressed: { touchPointPressCount = touchPoints.length }
- onUpdated: { touchPointUpdateCount = touchPoints.length }
- onReleased: { touchPointReleaseCount = touchPoints.length }
- onCanceled: { touchPointCancelCount = touchPoints.length }
- onTouchUpdated: {
- touchCount = touchPoints.length
+ onPressed: (points) => { touchPointPressCount = points.length }
+ onUpdated: (points) => { touchPointUpdateCount = points.length }
+ onReleased: (points) => { touchPointReleaseCount = v.length }
+ onCanceled: (points) => { touchPointCancelCount = points.length }
+ onTouchUpdated: (points) => {
+ touchCount = points.length
touchUpdatedHandled = true
}
}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml
index 32733613b3..e03ad43816 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml
@@ -32,7 +32,7 @@ Rectangle {
anchors.fill: parent
minimumTouchPoints: 2
maximumTouchPoints: 2
- onGestureStarted: {
+ onGestureStarted: (gesture) => {
if ((Math.abs(point2.x - point2.startX) > gesture.dragThreshold/2) &&
(Math.abs(point1.x - point1.startX) > gesture.dragThreshold/2)) {
gesture.grab()
@@ -43,8 +43,8 @@ Rectangle {
TouchPoint { id: point2; objectName: "point2" }
]
- onCanceled: root.cancelCount = touchPoints.length
- onTouchUpdated: root.touchCount = touchPoints.length
+ onCanceled: (touchPoints) => root.cancelCount = touchPoints.length
+ onTouchUpdated: (touchPoints) => root.touchCount = touchPoints.length
Text {
text: "①"
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml b/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml
index b0410dac4a..6b9dd5b7c7 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml
@@ -17,10 +17,10 @@ MultiPointTouchArea {
TouchPoint { objectName: "point2" }
]
- onPressed: { touchCount = touchPoints.length }
- onTouchUpdated: { touchCount = touchPoints.length }
- onCanceled: { cancelCount = touchPoints.length }
- onGestureStarted: {
+ onPressed: (points) => { touchCount = points.length }
+ onTouchUpdated: (points) => { touchCount = points.length }
+ onCanceled: (points) => { cancelCount = points.length }
+ onGestureStarted: (gesture) => {
gestureStartedX = gesture.touchPoints[0].startX
gestureStartedY = gesture.touchPoints[0].startY
if (grabGesture)
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml
index 8ab10a6926..dca1ffa07b 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml
@@ -66,7 +66,7 @@ MultiPointTouchArea {
anchors.fill: parent
minimumTouchPoints: 3
maximumTouchPoints: 3
- onGestureStarted: if (grabInnerArea) gesture.grab()
+ onGestureStarted: (gesture) => { if (grabInnerArea) gesture.grab() }
touchPoints: [
TouchPoint { id: point21; objectName: "point21" },
TouchPoint { id: point22; objectName: "point22" },
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nestedTouchPosCheck.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nestedTouchPosCheck.qml
new file mode 100644
index 0000000000..700f06a3ac
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/nestedTouchPosCheck.qml
@@ -0,0 +1,52 @@
+import QtQuick
+import QtTest
+
+Item {
+ width: 300; height: 200
+ id: topLevelItem
+ MultiPointTouchArea {
+ objectName: "topMPTA"
+ anchors.fill: parent
+ Column {
+ width: parent.width
+ height: parent.height
+
+ Rectangle {
+ width: parent.width
+ height: 100
+ color: "green"
+ }
+ Rectangle {
+ id: rect
+ width: parent.width
+ height: 600
+ color: "red"
+
+ MultiPointTouchArea {
+
+ property var xPressed: 0
+ property var yPressed: 0
+ property var xReleased: 0
+ property var yReleased: 0
+
+ objectName: "bottomMPTA"
+ anchors.fill: parent
+ onPressed: (touchPoints) => {
+ for (let tp in touchPoints) {
+ let touch = touchPoints[tp]
+ xPressed = touch.x
+ yPressed = touch.y
+ }
+ }
+ onReleased: (touchPoints) => {
+ for (let tp in touchPoints) {
+ let touch = touchPoints[tp]
+ xReleased = touch.x
+ yReleased = touch.y
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml
index 027f90c7f4..4130bc8dde 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml
@@ -9,7 +9,7 @@ Rectangle {
height: 160
minimumTouchPoints: 2
maximumTouchPoints: 2
- onGestureStarted: gesture.grab()
+ onGestureStarted: (gesture) => gesture.grab()
touchPoints: [
TouchPoint { id: point11; objectName: "point11" },
TouchPoint { id: point12; objectName: "point12" }
@@ -34,7 +34,7 @@ Rectangle {
y: 160
minimumTouchPoints: 3
maximumTouchPoints: 3
- onGestureStarted: gesture.grab()
+ onGestureStarted: (gesture) => gesture.grab()
touchPoints: [
TouchPoint { id: point21; objectName: "point21" },
TouchPoint { id: point22; objectName: "point22" },
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml b/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml
index 54b160c182..9ba3029193 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml
@@ -20,11 +20,17 @@ MultiPointTouchArea {
maximumTouchPoints: 5
- onPressed: { touchPointPressCount = touchPoints.length }
- onUpdated: { touchPointUpdateCount = touchPoints.length }
+ // recommended syntax for a signal handler
+ onPressed: (points) => { touchPointPressCount = points.length }
+
+ // one with "touchPoints" being the signal argument rather than the property
+ onUpdated: (touchPoints) => { touchPointUpdateCount = touchPoints.length }
+
+ // one without the formal parameter, to test that it still works (with a warning)
onReleased: { touchPointReleaseCount = touchPoints.length }
- onTouchUpdated: {
- touchCount = touchPoints.length
+
+ onTouchUpdated: (points) => {
+ touchCount = points.length
touchUpdatedHandled = true
}
}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/touchOverMouseArea.qml b/tests/auto/quick/qquickmultipointtoucharea/data/touchOverMouseArea.qml
new file mode 100644
index 0000000000..ffe3751ec3
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/touchOverMouseArea.qml
@@ -0,0 +1,21 @@
+
+import QtQuick
+
+Rectangle {
+ x: 20
+ y: 20
+ width: 300
+ height: 200
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ MultiPointTouchArea {
+ id: touchArea
+ anchors.fill: parent
+ enabled: false
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml b/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml
index 296bf7996f..02985581e0 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml
@@ -19,8 +19,8 @@ Rectangle {
property int pointCount: 0
- onPressed: pointCount = touchPoints.length;
- onTouchUpdated: pointCount = touchPoints.length;
+ onPressed: (points) => pointCount = points.length;
+ onTouchUpdated: (points) => pointCount = points.length;
}
}
}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 509465b174..b233ed0232 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2020 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
#include <QtTest/QSignalSpy>
@@ -19,6 +19,8 @@
Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests")
+using namespace Qt::StringLiterals;
+
class tst_QQuickMultiPointTouchArea : public QQmlDataTest
{
Q_OBJECT
@@ -34,6 +36,7 @@ private slots:
void reuse();
void nonOverlapping();
void nested();
+ void nestedTouchPosCheck();
void inFlickable();
void inFlickable2();
void inFlickableWithPressDelay();
@@ -50,6 +53,7 @@ private slots:
void stationaryTouchWithChangingPressure();
void touchFiltering();
void nestedPinchAreaMouse();
+ void disabledIgnoresHover();
private:
QQuickView *createAndShowView(const QString &file);
@@ -73,6 +77,12 @@ void tst_QQuickMultiPointTouchArea::properties()
void tst_QQuickMultiPointTouchArea::signalTest()
{
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QTest::ignoreMessage(QtWarningMsg, QString(testFileUrl("signalTest.qml").toString() +
+ u":30:5 Parameter \"touchPoints\" is not declared. Injection of parameters into signal handlers "
+ "is deprecated. Use JavaScript functions with formal parameters instead."_s).toLatin1().constData());
+#endif
+
QScopedPointer<QQuickView> window(createAndShowView("signalTest.qml"));
QVERIFY(window->rootObject() != nullptr);
@@ -551,6 +561,30 @@ void tst_QQuickMultiPointTouchArea::nested()
QQuickTouchUtils::flush(window.data());
}
+
+void tst_QQuickMultiPointTouchArea::nestedTouchPosCheck()
+{
+ QScopedPointer<QQuickView> window(createAndShowView("nestedTouchPosCheck.qml"));
+ QVERIFY(window->rootObject() != nullptr);
+
+ auto *bottomMPTA = window->rootObject()->findChild<QQuickMultiPointTouchArea *>("bottomMPTA");
+ QVERIFY(bottomMPTA != nullptr);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window.data(), device);
+
+ sequence.press(0, QPoint(10, 110)).commit();
+ QQuickTouchUtils::flush(window.data());
+
+ sequence.release(0, QPoint(10, 110)).commit();
+ QQuickTouchUtils::flush(window.data());
+
+ QCOMPARE(bottomMPTA->property("xPressed").toInt(), 10);
+ QCOMPARE(bottomMPTA->property("yPressed").toInt(), 10);
+ QCOMPARE(bottomMPTA->property("xReleased").toInt(), 10);
+ QCOMPARE(bottomMPTA->property("yReleased").toInt(), 10);
+
+}
+
void tst_QQuickMultiPointTouchArea::inFlickable()
{
QScopedPointer<QQuickView> window(createAndShowView("inFlickable.qml"));
@@ -571,7 +605,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
QPoint p1(20,100);
QPoint p2(40,100);
- // moving one point vertically
+ // moving one point vertically: flickable gets the grab
QTest::touchEvent(window.data(), device).press(0, p1);
QQuickTouchUtils::flush(window.data());
@@ -595,10 +629,14 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
QTRY_VERIFY(!flickable->isMoving());
- // moving two points vertically
+ // moving two points vertically: MPTAs handle them, Flickable ignores multi-touch.
+ // The stray mouse events simulate OS-level synth-from-touch, and should not interfere.
p1 = QPoint(20,100);
QTest::touchEvent(window.data(), device).press(0, p1).press(1, p2);
- QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::LeftButton, Qt::LeftButton, QEvent::MouseButtonPress,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QQuickTouchUtils::flush(window.data());
QCOMPARE(point11->pressed(), true);
@@ -611,20 +649,26 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
QTest::qWait(250);
p1 += delta; p2 += delta;
QTest::touchEvent(window.data(), device).move(0, p1).move(1, p2);
- QTest::mouseMove(window.data(), p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::LeftButton, Qt::NoButton, QEvent::MouseMove,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QQuickTouchUtils::flush(window.data());
qCDebug(lcTests, "after drags %d to %d,%d and %d,%d contentY is %lf",
i, p1.x(), p1.y(), p2.x(), p2.y(), flickable->contentY());
}
- QVERIFY(flickable->contentY() < 0);
- QCOMPARE(point11->pressed(), false);
- QCOMPARE(point12->pressed(), false);
- QCOMPARE(window->rootObject()->property("cancelCount").toInt(), 2);
- QCOMPARE(window->rootObject()->property("touchCount").toInt(), 0);
+ QCOMPARE(flickable->contentY(), 0);
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(window->rootObject()->property("cancelCount").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("touchCount").toInt(), 2);
QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2);
- QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QQuickTouchUtils::flush(window.data());
QTRY_VERIFY(!flickable->isMoving());
@@ -634,10 +678,15 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
p2 = QPoint(40,100);
QTest::touchEvent(window.data(), device).press(0, p1).press(1, p2);
QQuickTouchUtils::flush(window.data());
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
// ensure that mouse events do not fall through to the Flickable
mpta->setMaximumTouchPoints(3);
mpta->setAcceptedMouseButtons(Qt::LeftButton);
- QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::LeftButton, Qt::LeftButton, QEvent::MouseButtonPress,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QCOMPARE(point11->pressed(), true);
QCOMPARE(point12->pressed(), true);
@@ -650,32 +699,40 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
delta = QPoint(0, 15);
p1 += delta; p2 += delta;
QTest::touchEvent(window.data(), device).move(0, p1).move(1, p2);
- QTest::mouseMove(window.data(), p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::LeftButton, Qt::NoButton, QEvent::MouseMove,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QQuickTouchUtils::flush(window.data());
qCDebug(lcTests, "after drags %d to %d,%d and %d,%d contentY is %lf",
i, p1.x(), p1.y(), p2.x(), p2.y(), flickable->contentY());
}
- QEXPECT_FAIL("", "currently flickable does grab the actual mouse", Continue);
QCOMPARE(flickable->contentY(), qreal(0));
QCOMPARE(point11->pressed(), true);
- QEXPECT_FAIL("", "currently flickable does grab the actual mouse", Continue);
QCOMPARE(point12->pressed(), true);
QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2);
- QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
+ QWindowSystemInterface::handleMouseEvent(window.data(), device, p1, window->mapToGlobal(p1),
+ Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease,
+ Qt::NoModifier, Qt::MouseEventSynthesizedBySystem);
+ qApp->processEvents();
QQuickTouchUtils::flush(window.data());
}
// test that dragging out of a Flickable containing a MPTA doesn't harm Flickable's state.
void tst_QQuickMultiPointTouchArea::inFlickable2()
{
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
QScopedPointer<QQuickView> window(createAndShowView("inFlickable2.qml"));
QVERIFY(window->rootObject() != nullptr);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
QVERIFY(flickable != nullptr);
+ QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>();
+ QVERIFY(mpta);
+
QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
QVERIFY(point11);
@@ -688,25 +745,12 @@ void tst_QQuickMultiPointTouchArea::inFlickable2()
QQuickTouchUtils::flush(window.data());
QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
+ for (int i = 0; i < 4; ++i) {
+ p1 += QPoint(dragThreshold, 0);
+ QTest::touchEvent(window.data(), device).move(0, p1);
+ QQuickTouchUtils::flush(window.data());
+ QTest::mouseMove(window.data(), p1);
+ }
QVERIFY(!flickable->isMoving());
QVERIFY(point11->pressed());
@@ -719,27 +763,21 @@ void tst_QQuickMultiPointTouchArea::inFlickable2()
QTRY_VERIFY(!flickable->isMoving());
// Check that we can still move the Flickable
+ QSignalSpy gestureStartedSpy(mpta, &QQuickMultiPointTouchArea::gestureStarted);
p1 = QPoint(50,100);
QTest::touchEvent(window.data(), device).press(0, p1);
QQuickTouchUtils::flush(window.data());
QCOMPARE(point11->pressed(), true);
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
+ for (int i = 0; i < 4; ++i) {
+ p1 += QPoint(0, dragThreshold);
+ QTest::touchEvent(window.data(), device).move(0, p1);
+ QQuickTouchUtils::flush(window.data());
+ // QTBUG-113653: gestureStarted is emitted when touch delta exceeds drag threshold,
+ // regardless of the filtering Flickable parent
+ QCOMPARE(gestureStartedSpy.size(), i > 0 ? 1 : 0);
+ }
QVERIFY(flickable->contentY() < 0);
QVERIFY(flickable->isMoving());
@@ -1239,7 +1277,7 @@ void tst_QQuickMultiPointTouchArea::mouseGestureStarted() // QTBUG-70258
area->setProperty("grabGesture", grabGesture);
QQuickTouchPoint *point1 = view->rootObject()->findChild<QQuickTouchPoint*>("point1");
QCOMPARE(point1->pressed(), false);
- QSignalSpy gestureStartedSpy(area, SIGNAL(gestureStarted(QQuickGrabGestureEvent *)));
+ QSignalSpy gestureStartedSpy(area, SIGNAL(gestureStarted(QQuickGrabGestureEvent*)));
QPoint p1 = QPoint(distanceFromOrigin, distanceFromOrigin);
QTest::mousePress(view.data(), Qt::LeftButton, Qt::NoModifier, p1);
@@ -1420,6 +1458,23 @@ void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() // QTBUG-83662
QCOMPARE(mpta->property("releasedCount").toInt(), 1);
}
+/*
+ A disabled MultiPointTouchArea should not interfere with hover event
+ propagation to siblings underneath.
+*/
+void tst_QQuickMultiPointTouchArea::disabledIgnoresHover()
+{
+ QScopedPointer<QQuickView> window(createAndShowView("touchOverMouseArea.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem *>(window->rootObject());
+ QVERIFY(root);
+
+ QQuickMouseArea *mouseArea = root->findChild<QQuickMouseArea *>();
+
+ QTest::mouseMove(window.data(), QPoint(40, 40));
+ QTest::mouseMove(window.data(), QPoint(50, 50));
+ QVERIFY(mouseArea->hovered());
+}
+
QTEST_MAIN(tst_QQuickMultiPointTouchArea)
#include "tst_qquickmultipointtoucharea.moc"