@@ -58,7 +58,9 @@ private Q_SLOTS:
58 void cleanup(); // called right after each and every test function is executed
58 void cleanup(); // called right after each and every test function is executed
60 void dragThreshold_horizontal();
60 void dragThreshold_horizontal();
61+ void dragThreshold_horizontal_data();
61 void dragThreshold_vertical();
62 void dragThreshold_vertical();
63+ void dragThreshold_vertical_data();
62 void stretch_horizontal();
64 void stretch_horizontal();
63 void stretch_vertical();
65 void stretch_vertical();
64 void hintingAnimation();
66 void hintingAnimation();
@@ -145,17 +147,29 @@ void tst_DragHandle::tryCompare(std::function<qreal ()> actualFunc,
145namespace {
147namespace {
146QPointF calculateDirectionVector(DirectionalDragArea *edgeDragArea)
148QPointF calculateDirectionVector(DirectionalDragArea *edgeDragArea)
148−
150+ QPointF localOrigin(0., 0.);
151+ QPointF localDirection;
149 switch (edgeDragArea->direction()) {
152 switch (edgeDragArea->direction()) {
150 case Direction::Upwards:
153 case Direction::Upwards:
151− return QPointF(0, -1);
154+ localDirection.rx() = 0.;
155+ localDirection.ry() = -1.;
152 case Direction::Downwards:
157 case Direction::Downwards:
153− return QPointF(0, 1);
158+ localDirection.rx() = 0.;
159+ localDirection.ry() = 1;
154 case Direction::Leftwards:
161 case Direction::Leftwards:
155− return QPointF(-1, 0);
162+ localDirection.rx() = -1.;
163+ localDirection.ry() = 0.;
156 default: // Direction::Rightwards:
165 default: // Direction::Rightwards:
157− return QPointF(1, 0);
166+ localDirection.rx() = 1.;
167+ localDirection.ry() = 0.;
170+ QPointF sceneOrigin = edgeDragArea->mapToScene(localOrigin);
171+ QPointF sceneDirection = edgeDragArea->mapToScene(localDirection);
172+ return sceneDirection - sceneOrigin;
@@ -222,6 +236,11 @@ qreal tst_DragHandle::fetchDragThreshold(DirectionalDragArea *dragHandle)
223void tst_DragHandle::dragThreshold_horizontal()
237void tst_DragHandle::dragThreshold_horizontal()
239+ QFETCH(qreal, rotation);
241+ QQuickItem *baseItem = m_view->rootObject()->findChild<QQuickItem*>("baseItem");
242+ baseItem->setRotation(rotation);
225 DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
244 DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("rightwardsDragHandle");
227 qreal dragThreshold = fetchDragThreshold(dragHandle);
246 qreal dragThreshold = fetchDragThreshold(dragHandle);
@@ -260,8 +279,21 @@ void tst_DragHandle::dragThreshold_horizontal()
260 QCOMPARE(parentItem->property("shown").toBool(), false);
279 QCOMPARE(parentItem->property("shown").toBool(), false);
282+void tst_DragHandle::dragThreshold_horizontal_data()
284+ QTest::addColumn<qreal>("rotation");
286+ QTest::newRow("not rotated") << 0.;
287+ QTest::newRow("rotated 90") << 90.;
263void tst_DragHandle::dragThreshold_vertical()
290void tst_DragHandle::dragThreshold_vertical()
292+ QFETCH(qreal, rotation);
294+ QQuickItem *baseItem = m_view->rootObject()->findChild<QQuickItem*>("baseItem");
295+ baseItem->setRotation(rotation);
265 DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
297 DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
267 qreal dragThreshold = fetchDragThreshold(dragHandle);
299 qreal dragThreshold = fetchDragThreshold(dragHandle);
@@ -300,6 +332,14 @@ void tst_DragHandle::dragThreshold_vertical()
300 QCOMPARE(parentItem->property("shown").toBool(), false);
332 QCOMPARE(parentItem->property("shown").toBool(), false);
335+void tst_DragHandle::dragThreshold_vertical_data()
337+ QTest::addColumn<qreal>("rotation");
339+ QTest::newRow("not rotated") << 0.;
340+ QTest::newRow("rotated 90") << 90.;
304 Checks that when the stretch property is true, dragging the DragHandle increases
344 Checks that when the stretch property is true, dragging the DragHandle increases
305 the width or height (depending on its direction) of its parent Showable
345 the width or height (depending on its direction) of its parent Showable