Merge lp:~dandrader/unity8/ddaDraggingFix into lp:unity8

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 58
Merged at revision: 59
Proposed branch: lp:~dandrader/unity8/ddaDraggingFix
Merge into: lp:unity8
Prerequisite: lp:~dandrader/unity8/ddaScenePos
Diff against target: 64 lines (+36/-0)
2 files modified
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp (+4/-0)
tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp (+32/-0)
To merge this branch: bzr merge lp:~dandrader/unity8/ddaDraggingFix
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+171904@code.launchpad.net

Commit message

DirectionalDragArea: emit draggingChanged() on direct recognition

draggingChanged() should be emited when status change from
WaitingForTouch directly to Recognized.

Description of the change

DirectionalDragArea: emit draggingChanged() on direct recognition (i.e. when gesture recognition is actually disable so anything goes through).

draggingChanged() should be emited when status change from
WaitingForTouch directly to Recognized.

Needed by upcoming patches.

Depends on https://code.launchpad.net/~dandrader/unity8/ddaScenePos/+merge/171902

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

This proposal is only about revision 55.

Revision 54 comes from https://code.launchpad.net/~dandrader/unity8/ddaScenePos/+merge/171902

Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Ubuntu/Gestures/DirectionalDragArea.cpp'
2--- plugins/Ubuntu/Gestures/DirectionalDragArea.cpp 2013-06-27 20:00:09 +0000
3+++ plugins/Ubuntu/Gestures/DirectionalDragArea.cpp 2013-06-28 16:24:25 +0000
4@@ -391,6 +391,10 @@
5 m_recognitionTimer->start();
6 Q_EMIT draggingChanged(true);
7 break;
8+ case Recognized:
9+ if (oldStatus == WaitingForTouch)
10+ Q_EMIT draggingChanged(true);
11+ break;
12 case Rejected:
13 Q_EMIT draggingChanged(false);
14 break;
15
16=== modified file 'tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp'
17--- tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp 2013-06-27 20:00:09 +0000
18+++ tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp 2013-06-28 16:24:25 +0000
19@@ -67,6 +67,7 @@
20 void maxSilenceTime();
21 void sceneXAndX();
22 void sceneYAndY();
23+ void emitDraggingChangedOnDirectRecognition();
24
25 private:
26 QQuickView *createView();
27@@ -514,6 +515,37 @@
28 QCOMPARE(edgeDragArea->touchSceneY(), touchScenePos.y());
29 }
30
31+/*
32+ Emit draggingChanged() when status change from WaitingForTouch directly to Recognized.
33+ This happens when the gesture recognition is effectively disabled (e.g. by setting a
34+ distanceThreshold of zero)
35+ */
36+void tst_DirectionalDragArea::emitDraggingChangedOnDirectRecognition()
37+{
38+ DirectionalDragArea *edgeDragArea =
39+ view->rootObject()->findChild<DirectionalDragArea*>("hpDragArea");
40+ QVERIFY(edgeDragArea != 0);
41+ edgeDragArea->setRecognitionTimer(fakeTimer);
42+ edgeDragArea->setTimeSource(fakeTimeSource);
43+
44+ QPointF touchPos = calculateInitialTouchPos(edgeDragArea, view);
45+
46+ QSignalSpy draggingSpy(edgeDragArea, SIGNAL(draggingChanged(bool)));
47+
48+ // That will make it completetly skip the recognition phase ("Undecided" status).
49+ edgeDragArea->setDistanceThreshold(0.0);
50+
51+ QCOMPARE((int)edgeDragArea->status(), (int)DirectionalDragArea::WaitingForTouch);
52+ QCOMPARE(edgeDragArea->dragging(), false);
53+
54+ fakeTimeSource->m_msecsSinceReference = 0;
55+ QTest::touchEvent(view, device).press(0, touchPos.toPoint());
56+
57+ QCOMPARE((int)edgeDragArea->status(), (int)DirectionalDragArea::Recognized);
58+ QCOMPARE(draggingSpy.count(), 1);
59+ QCOMPARE(edgeDragArea->dragging(), true);
60+}
61+
62 QTEST_MAIN(tst_DirectionalDragArea)
63
64 #include "tst_DirectionalDragArea.moc"

Subscribers

People subscribed via source and target branches