aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp')
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 27fee2aab3..941d6dc47b 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -129,6 +129,7 @@ private slots:
void invalidClick();
void pressedOrdering();
void preventStealing();
+ void preventStealingListViewChild();
void clickThrough();
void hoverPosition();
void hoverPropagation();
@@ -1212,6 +1213,39 @@ void tst_QQuickMouseArea::preventStealing()
QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p);
}
+// QTBUG-103522
+void tst_QQuickMouseArea::preventStealingListViewChild()
+{
+ QQuickView window;
+ QByteArray errorMessage;
+ QVERIFY2(QQuickTest::initView(window, testFileUrl("preventStealingListViewChild.qml"), true, &errorMessage), errorMessage.constData());
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window.rootObject());
+ QVERIFY(flickable);
+ QQuickMouseArea *mouseArea = flickable->findChild<QQuickMouseArea*>();
+ QVERIFY(mouseArea);
+ QPoint p = mouseArea->mapToScene(mouseArea->boundingRect().center()).toPoint();
+ const int threshold = qApp->styleHints()->startDragDistance();
+
+ flickable->flick(0, -10000);
+ for (int i = 0; i < 2; ++i) {
+ QVERIFY(flickable->isMovingVertically());
+ QTest::touchEvent(&window, device).press(0, p);
+ QQuickTouchUtils::flush(&window);
+ for (int j = 0; j < 4 && !mouseArea->drag()->active(); ++j) {
+ p += QPoint(0, threshold);
+ QTest::touchEvent(&window, device).move(0, p);
+ QQuickTouchUtils::flush(&window);
+ }
+ // MouseArea should be dragged because of preventStealing; ListView does not steal the grab.
+ QVERIFY(mouseArea->drag()->active());
+ QCOMPARE(flickable->isDragging(), false);
+ QTest::touchEvent(&window, device).release(0, p);
+ QCOMPARE(mouseArea->drag()->active(), false);
+ }
+}
+
void tst_QQuickMouseArea::clickThrough()
{
//With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers