@@ -83,6 +83,7 @@ private Q_SLOTS:
8383 void twoFingerTap();
8484 void movingDDA();
8585 void ignoreOldFinger();
86+ void rotated();
8687
8788private:
8889 void passTime(qint64 timeSpan);
@@ -696,6 +697,49 @@ void tst_DirectionalDragArea::ignoreOldFinger()
696697 QCOMPARE((int)edgeDragArea->status(), (int)DirectionalDragArea::WaitingForTouch);
697698}
698699
700+/*
701+ A Rightwards DDA that is rotated 90 degrees clockwise should recognize gestures
702+ that are done downwards in scene coordinates. I.e. the gesture recognition direction
703+ should be in local coordinates, not scene coordinates.
704+ */
705+void tst_DirectionalDragArea::rotated()
706+{
707+ QQuickItem *baseItem = m_view->rootObject()->findChild<QQuickItem*>("baseItem");
708+ baseItem->setRotation(90.);
709+
710+ QQuickItem *rightwardsLauncher = m_view->rootObject()->findChild<QQuickItem*>("rightwardsLauncher");
711+ Q_ASSERT(rightwardsLauncher != 0);
712+
713+ DirectionalDragArea *edgeDragArea =
714+ rightwardsLauncher->findChild<DirectionalDragArea*>("hpDragArea");
715+ Q_ASSERT(edgeDragArea != 0);
716+ edgeDragArea->setRecognitionTimer(fakeTimer);
717+ edgeDragArea->setTimeSource(fakeTimeSource);
718+
719+ QPointF initialTouchPos = calculateInitialTouchPos(edgeDragArea);
720+ QPointF touchPoint = initialTouchPos;
721+
722+ qreal desiredDragDistance = edgeDragArea->distanceThreshold()*2.0f;
723+ QPointF dragDirectionVector(0.0f, 1.0f);
724+
725+ qreal movementStepDistance = edgeDragArea->distanceThreshold() * 0.1f;
726+ QPointF touchMovement = dragDirectionVector * movementStepDistance;
727+ int totalMovementSteps = qCeil(desiredDragDistance / movementStepDistance);
728+ int movementTimeStepMs = (edgeDragArea->compositionTime() * 1.5f) / totalMovementSteps;
729+
730+ QTest::touchEvent(m_view, m_device).press(0, touchPoint.toPoint());
731+
732+ for (int i = 0; i < totalMovementSteps; ++i) {
733+ touchPoint += touchMovement;
734+ passTime(movementTimeStepMs);
735+ QTest::touchEvent(m_view, m_device).move(0, touchPoint.toPoint());
736+ }
737+
738+ QCOMPARE((int)edgeDragArea->status(), (int)DirectionalDragArea::Recognized);
739+
740+ QTest::touchEvent(m_view, m_device).release(0, touchPoint.toPoint());
741+}
742+
699743QTEST_MAIN(tst_DirectionalDragArea)
700744
701745#include "tst_DirectionalDragArea.moc"