@@ -24,6 +24,7 @@
2424
2525#include <AxisVelocityCalculator.h>
2626#include <Timer>
27+#include "Direction.h"
2728
2829using namespace UbuntuGestures;
2930
@@ -49,11 +50,11 @@ private Q_SLOTS:
4950 void hintingAnimation_dontRestartAfterFinishedAndStillPressed();
5051
5152private:
52− void flickAndHold(DirectionalDragArea *dragHandle, qreal distance);
53+ void flickAndHold(QQuickItem *dragHandle, qreal distance);
5354 void drag(QPointF &touchPoint, const QPointF& direction, qreal distance,
5455 int numSteps, qint64 timeMs = 500);
55− DirectionalDragArea *fetchAndSetupDragHandle(const char *objectName);
56− qreal fetchDragThreshold(DirectionalDragArea *dragHandle);
56+ QQuickItem *fetchAndSetupDragHandle(const char *objectName);
57+ qreal fetchDragThreshold(QQuickItem *dragHandle);
5758 void tryCompare(std::function<qreal ()> actualFunc, qreal expectedValue);
5859
5960 QQuickView *createView();
@@ -128,11 +129,11 @@ void tst_DragHandle::tryCompare(std::function<qreal ()> actualFunc,
128129}
129130
130131namespace {
131−QPointF calculateDirectionVector(DirectionalDragArea *edgeDragArea)
132+QPointF calculateDirectionVector(QQuickItem *edgeDragArea)
132133{
133134 QPointF localOrigin(0., 0.);
134135 QPointF localDirection;
135− switch (edgeDragArea->direction()) {
136+ switch (edgeDragArea->property("direction").toInt()) {
136137 case Direction::Upwards:
137138 localDirection.rx() = 0.;
138139 localDirection.ry() = -1.;
@@ -156,7 +157,7 @@ QPointF calculateDirectionVector(DirectionalDragArea *edgeDragArea)
156157}
157158}
158159
159−void tst_DragHandle::flickAndHold(DirectionalDragArea *dragHandle,
160+void tst_DragHandle::flickAndHold(QQuickItem *dragHandle,
160161 qreal distance)
161162{
162163 QPointF initialTouchPos = dragHandle->mapToScene(
@@ -194,13 +195,14 @@ void tst_DragHandle::drag(QPointF &touchPoint, const QPointF& direction, qreal d
194195 }
195196}
196197
197−DirectionalDragArea *tst_DragHandle::fetchAndSetupDragHandle(const char *objectName)
198+QQuickItem *tst_DragHandle::fetchAndSetupDragHandle(const char *objectName)
198199{
199− DirectionalDragArea *dragHandle =
200− m_view->rootObject()->findChild<DirectionalDragArea*>(objectName);
200+ QQuickItem *dragHandle =
201+ m_view->rootObject()->findChild<QQuickItem*>(objectName);
201202 Q_ASSERT(dragHandle != 0);
202− dragHandle->d->setRecognitionTimer(m_fakeTimer);
203− dragHandle->d->setTimeSource(m_fakeTimeSource);
203+ QObject *swipeAreaPrivate = dragHandle->findChild<QObject*>("UCSwipeAreaPrivate");
204+ QMetaObject::invokeMethod(swipeAreaPrivate, "setRecognitionTimer", Q_ARG(UbuntuGestures::AbstractTimer*, m_fakeTimer));
205+ QMetaObject::invokeMethod(swipeAreaPrivate, "setTimeSource", Q_ARG(UbuntuGestures::SharedTimeSource, m_fakeTimeSource));
204206
205207 AxisVelocityCalculator *edgeDragEvaluator =
206208 dragHandle->findChild<AxisVelocityCalculator*>("edgeDragEvaluator");
@@ -210,7 +212,7 @@ DirectionalDragArea *tst_DragHandle::fetchAndSetupDragHandle(const char *objectN
210212 return dragHandle;
211213}
212214
213−qreal tst_DragHandle::fetchDragThreshold(DirectionalDragArea *dragHandle)
215+qreal tst_DragHandle::fetchDragThreshold(QQuickItem *dragHandle)
214216{
215217 AxisVelocityCalculator *edgeDragEvaluator =
216218 dragHandle->findChild<AxisVelocityCalculator*>("edgeDragEvaluator");
@@ -231,7 +233,7 @@ void tst_DragHandle::dragThreshold_horizontal()
231233 QQuickItem *baseItem = m_view->rootObject()->findChild<QQuickItem*>("baseItem");
232234 baseItem->setRotation(rotation);
233235
234− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
236+ QQuickItem *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
235237 QQuickItem *parentItem = dragHandle->parentItem();
236238
237239 qreal dragThreshold = fetchDragThreshold(dragHandle);
@@ -284,7 +286,7 @@ void tst_DragHandle::dragThreshold_vertical()
284286 QQuickItem *baseItem = m_view->rootObject()->findChild<QQuickItem*>("baseItem");
285287 baseItem->setRotation(rotation);
286288
287− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
289+ QQuickItem *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
288290
289291 qreal dragThreshold = fetchDragThreshold(dragHandle);
290292
@@ -336,7 +338,7 @@ void tst_DragHandle::dragThreshold_vertical_data()
336338 */
337339void tst_DragHandle::stretch_horizontal()
338340{
339− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
341+ QQuickItem *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
340342 qreal totalDragDistance = dragHandle->property("maxTotalDragDistance").toReal();
341343 QQuickItem *parentItem = dragHandle->parentItem();
342344
@@ -366,7 +368,7 @@ void tst_DragHandle::stretch_horizontal()
366368
367369void tst_DragHandle::stretch_vertical()
368370{
369− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
371+ QQuickItem *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
370372 qreal totalDragDistance = dragHandle->property("maxTotalDragDistance").toReal();
371373 QQuickItem *parentItem = dragHandle->parentItem();
372374
@@ -402,7 +404,7 @@ void tst_DragHandle::stretch_vertical()
402404 */
403405void tst_DragHandle::hintingAnimation()
404406{
405− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
407+ QQuickItem *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
406408 QQuickItem *parentItem = dragHandle->parentItem();
407409 qreal hintDisplacement = 100.0;
408410
@@ -443,7 +445,7 @@ void tst_DragHandle::hintingAnimation()
443445 */
444446void tst_DragHandle::hintingAnimation_dontRestartAfterFinishedAndStillPressed()
445447{
446− DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
448+ QQuickItem *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
447449 QQuickItem *parentItem = dragHandle->parentItem();
448450 qreal hintDisplacement = 100.0;
449451