aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-11-23 11:47:29 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-23 16:17:44 +0000
commit52835e18c78794daf3d1508c2358e853c6a12de2 (patch)
treeeed79af997659fecab10256a847a97c295c191db /tests
parent61d83693f9ddda885c812444287e926833c6cc9f (diff)
Fix tst_PointHandler::pressedMultipleButtons
QQuickWindowPrivate::deliverPressOrReleaseEvent() calls QPointerEvent::clearPassiveGrabbers() for every QEventPoint that has the Pressed state. This is consistent with the idea that for every press (a different mouse button or a different touchpoint), we start over with event delivery so that different items and handlers can see what's going on and decide whether it's relevant for them. But QQuickPointerHandler::onGrabChanged() reacts with setActive(false). So for example if we press left mouse button, then keep holding it and press right mouse button, PointHandler changes its active state twice, because its passive grab was cleared and then we visit it again; it's still interested in tracking the mouse, so it takes another passive grab and becomes active again. Avoiding emitting activeStateChanged in this case would seem a bit contrived. As long as the release of one button doesn't make PointHandler completely lose interest prematurely, QTBUG-66360 can still be considered fixed, I think. Task-number: QTBUG-66360 Task-number: QTBUG-86729 Change-Id: I132a8c5d1878769481b8afcc62ba237b4498b069 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d15f6e0b237107d176a9790da609ff72ce3111f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpointhandler/BLACKLIST2
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickpointhandler/BLACKLIST b/tests/auto/quick/pointerhandlers/qquickpointhandler/BLACKLIST
index 7dea82dc30..f4d271c230 100644
--- a/tests/auto/quick/pointerhandlers/qquickpointhandler/BLACKLIST
+++ b/tests/auto/quick/pointerhandlers/qquickpointhandler/BLACKLIST
@@ -1,4 +1,2 @@
-[pressedMultipleButtons] # QTBUG-86729
-*
[tabletStylus]
macos ci
diff --git a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
index 900202f132..8e6f9deb7f 100644
--- a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
@@ -281,6 +281,7 @@ void tst_PointHandler::pressedMultipleButtons_data()
QTest::addColumn<QList<bool> >("active");
QTest::addColumn<QList<Qt::MouseButtons> >("pressedButtons");
QTest::addColumn<int>("changeCount");
+ QTest::addColumn<int>("activeChangeCount");
QList<Qt::MouseButtons> buttons;
QList<bool> active;
@@ -298,7 +299,7 @@ void tst_PointHandler::pressedMultipleButtons_data()
<< Qt::LeftButton
<< Qt::NoButton;
QTest::newRow("Accept Left - Press left, Press Right, Release Right")
- << Qt::MouseButtons(Qt::LeftButton) << buttons << active << pressedButtons << 4;
+ << Qt::MouseButtons(Qt::LeftButton) << buttons << active << pressedButtons << 4 << 4;
buttons.clear();
active.clear();
@@ -316,7 +317,7 @@ void tst_PointHandler::pressedMultipleButtons_data()
<< Qt::NoButton // Not the "truth" but filtered according to this handler's acceptedButtons
<< Qt::NoButton;
QTest::newRow("Accept Left - Press left, Press Right, Release Left")
- << Qt::MouseButtons(Qt::LeftButton) << buttons << active << pressedButtons << 3;
+ << Qt::MouseButtons(Qt::LeftButton) << buttons << active << pressedButtons << 3 << 4;
buttons.clear();
active.clear();
@@ -334,7 +335,7 @@ void tst_PointHandler::pressedMultipleButtons_data()
<< Qt::LeftButton
<< Qt::NoButton;
QTest::newRow("Accept Left|Right - Press left, Press Right, Release Right")
- << (Qt::LeftButton | Qt::RightButton) << buttons << active << pressedButtons << 4;
+ << (Qt::LeftButton | Qt::RightButton) << buttons << active << pressedButtons << 4 << 4;
buttons.clear();
active.clear();
@@ -352,7 +353,7 @@ void tst_PointHandler::pressedMultipleButtons_data()
<< Qt::NoButton // Not the "truth" but filtered according to this handler's acceptedButtons
<< Qt::NoButton;
QTest::newRow("Accept Right - Press Right, Press Left, Release Right")
- << Qt::MouseButtons(Qt::RightButton) << buttons << active << pressedButtons << 3;
+ << Qt::MouseButtons(Qt::RightButton) << buttons << active << pressedButtons << 3 << 4;
}
void tst_PointHandler::pressedMultipleButtons()
@@ -362,6 +363,7 @@ void tst_PointHandler::pressedMultipleButtons()
QFETCH(QList<bool>, active);
QFETCH(QList<Qt::MouseButtons>, pressedButtons);
QFETCH(int, changeCount);
+ QFETCH(int, activeChangeCount);
QScopedPointer<QQuickView> windowPtr;
createView(windowPtr, "pointTracker.qml");
@@ -397,7 +399,7 @@ void tst_PointHandler::pressedMultipleButtons()
QTest::mousePress(windowPtr.data(), Qt::NoButton, Qt::NoModifier, point);
QCOMPARE(handler->active(), false);
- QCOMPARE(activeSpy.count(), 2);
+ QCOMPARE(activeSpy.count(), activeChangeCount);
QCOMPARE(pointSpy.count(), changeCount);
}