@@ -45,6 +45,7 @@ private Q_SLOTS:
45 void releaseAndPressRecognisedGestureDoesNotRejectForPeriod();
45 void releaseAndPressRecognisedGestureDoesNotRejectForPeriod();
46 void topAreaReceivesOwnershipFirstWithEqualPoints();
46 void topAreaReceivesOwnershipFirstWithEqualPoints();
47 void topAreaReceivesOwnershipFirstWithMorePoints();
47 void topAreaReceivesOwnershipFirstWithMorePoints();
48+ void newTouchAfterRejectionIsPassedThrough();
50 void initGestureComponent(TouchGestureArea *area);
51 void initGestureComponent(TouchGestureArea *area);
@@ -265,6 +266,35 @@ void tst_TouchGestureArea::topAreaReceivesOwnershipFirstWithMorePoints()
265 QCOMPARE((int)m_gestureMiddle->status(), (int)TouchGestureArea::Rejected);
266 QCOMPARE((int)m_gestureMiddle->status(), (int)TouchGestureArea::Rejected);
269+void tst_TouchGestureArea::newTouchAfterRejectionIsPassedThrough() {
270+ m_gestureTop->setEnabled(true);
271+ m_gestureTop->setMinimumTouchPoints(2);
272+ m_gestureTop->setMaximumTouchPoints(2);
273+ m_gestureTop->setRecognitionPeriod(30);
275+ m_gestureBottom->setEnabled(true);
276+ m_gestureBottom->setMinimumTouchPoints(2);
277+ m_gestureBottom->setMaximumTouchPoints(2);
278+ m_gestureBottom->setRecognitionPeriod(50);
280+ QPointF touchPoint = calculateInitialTouchPos(m_gestureBottom);
282+ QTest::touchEvent(m_view, m_device).press(0, touchPoint.toPoint());
283+ QCOMPARE((int)m_gestureTop->status(), (int)TouchGestureArea::Undecided);
284+ QCOMPARE((int)m_gestureBottom->status(), (int)TouchGestureArea::Undecided);
286+ passTime(40); // 10ms after top item's recognition period.
287+ QCOMPARE((int)m_gestureTop->status(), (int)TouchGestureArea::Rejected);
288+ QCOMPARE((int)m_gestureBottom->status(), (int)TouchGestureArea::Undecided);
290+ // If the top item passes the event down the line, now the bottom one will
291+ // recognize the gesture.
292+ QTest::touchEvent(m_view, m_device).stationary(0)
293+ .press(1, touchPoint.toPoint());
294+ QCOMPARE((int)m_gestureTop->status(), (int)TouchGestureArea::Rejected);
295+ QCOMPARE((int)m_gestureBottom->status(), (int)TouchGestureArea::Recognized);
268QTEST_MAIN(tst_TouchGestureArea)
298QTEST_MAIN(tst_TouchGestureArea)
270#include "tst_TouchGestureArea.moc"
300#include "tst_TouchGestureArea.moc"