diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:47 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:47 +0300 |
commit | 960a980dc885622cb84990c4da75d5060318302d (patch) | |
tree | b02009bb0e08ec4f94f2ef1d4318679700347d9a /tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | |
parent | 540c4e4a5def8c350a49bb68380b787ae62490c6 (diff) | |
parent | cecf9b52904ab790e1a531698e9c5e33585227f0 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Change-Id: I7b6e0ef657d1278405738f682b2795f8c345c3d4
Diffstat (limited to 'tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp')
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 34 |
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 |