From 61cfaee2d0e4ae106a00950e917b712a52049d6f Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 9 Mar 2015 16:47:16 +1000 Subject: Fix flickable stealing gestures when height >= contentHeight. Or width >= contentWidth. If newY is equal to both maxY and minY then the second assignment to rejectY can clobber the first. Changing the second assignment to an |= means rejectY is true if either is true. Secondly maxY became positive when height was greater than contentHeight instead of having a maximum of 0, which ensured rejectY evaluated to false in the case newY <= maxY and the mouse was stolen. Change-Id: I6416d0e23c3ef898887a7b3e3fcdc1dc12853548 Reviewed-by: Martin Jones --- .../quick/qquickflickable/tst_qquickflickable.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp') diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 86baed4e51..5c96cc151e 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -1493,6 +1493,40 @@ void tst_qquickflickable::nestedStopAtBounds() QTest::mouseRelease(&view, Qt::LeftButton, 0, position); QTRY_VERIFY(!outer->isMoving()); + + axis = 200; + inner->setContentX(0); + inner->setContentY(0); + inner->setContentWidth(inner->width()); + inner->setContentHeight(inner->height()); + + // Drag inner with equal size and contentSize + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? -threshold * 2 : threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? -threshold : threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->isDragging(), true); + QCOMPARE(inner->isDragging(), false); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + + axis = 200; + inner->setContentX(0); + inner->setContentY(0); + inner->setContentWidth(inner->width() - 100); + inner->setContentHeight(inner->height() - 100); + + // Drag inner with size greater than contentSize + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? -threshold * 2 : threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? -threshold : threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->isDragging(), true); + QCOMPARE(inner->isDragging(), false); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); } void tst_qquickflickable::stopAtBounds_data() -- cgit v1.2.3