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

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 649
Merged at revision: 657
Proposed branch: lp:~dandrader/unity8/draghandle_lp1269022
Merge into: lp:unity8
Diff against target: 147 lines (+74/-19)
2 files modified
qml/Components/DragHandle.qml (+7/-7)
tests/qmltests/Components/tst_DragHandle.cpp (+67/-12)
To merge this branch: bzr merge lp:~dandrader/unity8/draghandle_lp1269022
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+202484@code.launchpad.net

Commit message

DragHandle: Never restart hinting animation while still pressed

Description of the change

Are there any related MPs required for this MP to build/function as expected? Please list.
No

Did you perform an exploratory manual test run of your code change and any related functionality?
On the desktop, using "make tryDragHandle".

If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Didn't change

If you changed the UI, has there been a design review?
Didn't change

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:649
http://jenkins.qa.ubuntu.com/job/unity8-ci/2102/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2498
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/969
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/624
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/626
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/626/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/624
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2177
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2500
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2500/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2326
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2326/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4770
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3229

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2102/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:649
http://jenkins.qa.ubuntu.com/job/unity8-ci/2104/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2502/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2328
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/971
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/626
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/628
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/628/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/626
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2181/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2504
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2504/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2328
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2328/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4772
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3232

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2104/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:649
http://jenkins.qa.ubuntu.com/job/unity8-ci/2107/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2517
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2334
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/974
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/629
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/631
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/631/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/629
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2195
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2519
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2519/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2334
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2334/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4777
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3244

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2107/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Code looks sane, new test fails without the code and passes with it :-)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/957/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3951
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2529
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2346/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/980
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/343
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/343
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/343/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/343
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2207
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2531
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2531/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2346
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2346/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4789/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3262

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/959/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3957
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2546
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2351
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/983
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/345
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/345/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/345
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2223
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2548
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2548/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2352
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2352/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4794
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3280

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/960/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3961
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2550
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/984
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/346
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/346
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/346/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/346
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2226
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2552
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2552/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2354
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2354/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4796
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3284

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

 * you perform an exploratory manual test run of the code change and any related functionality?
   Yes, run on the phone and the bug was gone

 * Did CI run pass? If not, please explain why.
   No, notification tests are broken

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/DragHandle.qml'
2--- qml/Components/DragHandle.qml 2013-11-08 08:48:11 +0000
3+++ qml/Components/DragHandle.qml 2014-01-21 15:34:18 +0000
4@@ -97,7 +97,7 @@
5 // Private stuff
6 QtObject {
7 id: d
8- property var previousStatus: undefined
9+ property var previousStatus: DirectionalDragArea.WaitingForTouch
10 property real startValue
11 property real minValue: Direction.isPositive(direction) ? startValue
12 : startValue - maxTotalDragDistance
13@@ -193,14 +193,14 @@
14 d.rollbackDrag();
15 }
16 } else /* Undecided || Recognized */ {
17- if (d.previousStatus === DirectionalDragArea.WaitingForTouch ||
18- d.previousStatus === undefined) {
19+ if (d.previousStatus === DirectionalDragArea.WaitingForTouch) {
20 dragEvaluator.reset();
21 d.startValue = parent[d.targetProp];
22- }
23- if (hintDisplacement > 0) {
24- hintingAnimation.targetValue = d.startValue;
25- hintingAnimation.start();
26+
27+ if (hintDisplacement > 0) {
28+ hintingAnimation.targetValue = d.startValue;
29+ hintingAnimation.start();
30+ }
31 }
32 }
33
34
35=== modified file 'tests/qmltests/Components/tst_DragHandle.cpp'
36--- tests/qmltests/Components/tst_DragHandle.cpp 2013-10-22 15:56:37 +0000
37+++ tests/qmltests/Components/tst_DragHandle.cpp 2014-01-21 15:34:18 +0000
38@@ -62,9 +62,13 @@
39 void stretch_horizontal();
40 void stretch_vertical();
41 void hintingAnimation();
42+ void hintingAnimation_dontRestartAfterFinishedAndStillPressed();
43+
44
45 private:
46 void flickAndHold(DirectionalDragArea *dragHandle, qreal distance);
47+ void drag(QPointF &touchPoint, const QPointF& direction, qreal distance,
48+ int numSteps, qint64 timeMs = 500);
49 DirectionalDragArea *fetchAndSetupDragHandle(const char *objectName);
50 qreal fetchDragThreshold(DirectionalDragArea *dragHandle);
51 void tryCompare(std::function<qreal ()> actualFunc, qreal expectedValue);
52@@ -161,25 +165,29 @@
53 QPointF initialTouchPos = dragHandle->mapToScene(
54 QPointF(dragHandle->width() / 2.0, dragHandle->height() / 2.0));
55 QPointF touchPoint = initialTouchPos;
56+
57+ QTest::touchEvent(m_view, m_device).press(0, touchPoint.toPoint());
58+
59 int numSteps = 10;
60- qint64 flickTimeMs = 500;
61- qint64 timeStep = flickTimeMs / numSteps;
62-
63 QPointF dragDirectionVector = calculateDirectionVector(dragHandle);
64- QPointF touchMovement = dragDirectionVector * (distance / (qreal)numSteps);
65-
66- QTest::touchEvent(m_view, m_device).press(0, touchPoint.toPoint());
67-
68+ drag(touchPoint, dragDirectionVector, distance, numSteps);
69+
70+ // Wait for quite a bit before finally releasing to make a very low flick/release
71+ // speed.
72+ m_fakeTimeSource->m_msecsSinceReference += 5000;
73+ QTest::touchEvent(m_view, m_device).release(0, touchPoint.toPoint());
74+}
75+
76+void tst_DragHandle::drag(QPointF &touchPoint, const QPointF& direction, qreal distance,
77+ int numSteps, qint64 timeMs)
78+{
79+ qint64 timeStep = timeMs / numSteps;
80+ QPointF touchMovement = direction * (distance / (qreal)numSteps);
81 for (int i = 0; i < numSteps; ++i) {
82 touchPoint += touchMovement;
83 m_fakeTimeSource->m_msecsSinceReference += timeStep;
84 QTest::touchEvent(m_view, m_device).move(0, touchPoint.toPoint());
85 }
86-
87- // Wait for quite a bit before finally releasing to make a very low flick/release
88- // speed.
89- m_fakeTimeSource->m_msecsSinceReference += 5000;
90- QTest::touchEvent(m_view, m_device).release(0, touchPoint.toPoint());
91 }
92
93 DirectionalDragArea *tst_DragHandle::fetchAndSetupDragHandle(const char *objectName)
94@@ -389,6 +397,53 @@
95 QCOMPARE(parentItem->property("shown").toBool(), false);
96 }
97
98+/*
99+ Regression test for LP#1269022: https://bugs.launchpad.net/unity8/+bug/1269022
100+
101+ 1) Click on handle.
102+ 2) wait for hint portion to appear
103+ 3) slowly drag handle, only a few pixels
104+
105+ Expected outcome:
106+ Nothing happens
107+
108+ Actual outcome:
109+ Handle will momentarily move back to zero position, then back down to the
110+ hint displacement location.
111+ */
112+void tst_DragHandle::hintingAnimation_dontRestartAfterFinishedAndStillPressed()
113+{
114+ DirectionalDragArea *dragHandle = fetchAndSetupDragHandle("downwardsDragHandle");
115+ QQuickItem *parentItem = dragHandle->parentItem();
116+ qreal hintDisplacement = 100.0;
117+
118+ // enable hinting animations
119+ m_view->rootObject()->setProperty("hintDisplacement", QVariant(hintDisplacement));
120+ m_view->rootObject()->setProperty("stretch", QVariant(true));
121+
122+ QCOMPARE(parentItem->height(), 0.0);
123+
124+ QPointF initialTouchPos = dragHandle->mapToScene(
125+ QPointF(dragHandle->width() / 2.0, dragHandle->height() / 2.0));
126+ QPointF touchPoint = initialTouchPos;
127+
128+ // Pressing causes the Showable to be stretched by hintDisplacement pixels
129+ const int touchId = 0;
130+ QTest::touchEvent(m_view, m_device).press(touchId, touchPoint.toPoint());
131+ tryCompare([&](){ return parentItem->height(); }, hintDisplacement);
132+
133+
134+ QSignalSpy parentHeightChangedSpy(parentItem, SIGNAL(heightChanged()));
135+
136+ drag(touchPoint, QPointF(0.0, -1.0) /*dragDirectionVector*/, 15 /*distance*/, 3 /*numSteps*/);
137+
138+ // Give some time for animations to run, if any
139+ QTest::qWait(300);
140+
141+ // parentItem height shouldn't have changed at all
142+ QVERIFY(parentHeightChangedSpy.isEmpty());
143+}
144+
145 QTEST_MAIN(tst_DragHandle)
146
147 #include "tst_DragHandle.moc"

Subscribers

People subscribed via source and target branches