Merge lp:~dandrader/unity8/tutorial-launcher-gap into lp:unity8

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1836
Merged at revision: 1863
Proposed branch: lp:~dandrader/unity8/tutorial-launcher-gap
Merge into: lp:unity8
Prerequisite: lp:~dandrader/unity8/fixOrientedShellTests
Diff against target: 98 lines (+47/-7)
2 files modified
qml/Tutorial/TutorialLeft.qml (+16/-6)
tests/qmltests/Tutorial/tst_Tutorial.qml (+31/-1)
To merge this branch: bzr merge lp:~dandrader/unity8/tutorial-launcher-gap
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+263687@code.launchpad.net

This proposal supersedes a proposal from 2015-06-17.

Commit message

Ensure tutorial doesn't let user drag the launcher past screen edge.

This was because the bouncing animation on the left added a bit of extra offset to the launcher. So I just made sure that offset doesn't go past the screen edge as the user drags the launcher out.

And added a test.

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?
Yes

* Did you make sure that your branch does not contain spurious tags?
Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable

* If you changed the UI, has there been a design review?
Not applicable

* Did you have a look at the warnings when running tests? Can they be reduced?
The tons of warnings were already there.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Maybe it makes sense to base this on top of lp:~dandrader/unity8/fixOrientedShellTests so that the tutorial changes that are not because of the bugfix don't appear on the diff?

Also the merging once the other one lands will be easier.

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

running make testTutorial fails in the function you just added (xvfbtestTutorial works)

Can you please check?

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

FAIL! : qmltestrunner::Tutorial::test_launcherNoDragGap() 'verify()' returned FALSE. ()
   Loc: [/home/tsdgeos_work/phablet/unity8/tutorial-launcher-gap/tests/qmltests/Tutorial/tst_Tutorial.qml(336)]

is the error i get

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 03/07/15 06:19, Albert Astals Cid wrote:
> FAIL! : qmltestrunner::Tutorial::test_launcherNoDragGap() 'verify()' returned FALSE. ()
> Loc: [/home/tsdgeos_work/phablet/unity8/tutorial-launcher-gap/tests/qmltests/Tutorial/tst_Tutorial.qml(336)]
>
> is the error i get

"make xvfbtestTutorial" has been running for a while here (in a loop)
and didn't fail yet. :-/

1835. By Daniel d'Andrada <dandrader@panzer>

Merge trunk

[ Albert Astals Cid ]
* Save screenshots of suspended apps to disk
* Set width of title label when inside the title row (LP: #1461979)
* qmluitests was renamed to uitests
[ CI Train Bot ]
* Resync trunk.
[ Daniel d'Andrada ]
* Fix tst_OrientedShell and tst_Tutorial (LP: #1469761, #1466947)
[ Leo Arias ]
* Reorganized the python test helper modules. Deprecated the
  unity8.shell.emulators namespace. (LP: #1306340)
[ Leonardo Arias Fonseca ]
* Reorganized the python test helper modules. Deprecated the
  unity8.shell.emulators namespace. (LP: #1306340)
[ Lukáš Tinkl ]
* fix PO files extraction
[ Michael Zanetti ]
* Make use of QInputDeviceInfo in order to automatically switch
  between usage modes and hide the OSK.
[ Nick Dedekind ]
* Fixed qtmultimedia mock which was generating errors in tests
[ Richard Huddie ]
* Reorganized the python test helper modules. Deprecated the
  unity8.shell.emulators namespace. (LP: #1306340)
* Implement full-shell rotation (LP: #1210199)

Revision history for this message
Albert Astals Cid (aacid) wrote :

> On 03/07/15 06:19, Albert Astals Cid wrote:
> > FAIL! : qmltestrunner::Tutorial::test_launcherNoDragGap() 'verify()'
> returned FALSE. ()
> > Loc: [/home/tsdgeos_work/phablet/unity8/tutorial-launcher-
> gap/tests/qmltests/Tutorial/tst_Tutorial.qml(336)]
> >
> > is the error i get
>
> "make xvfbtestTutorial" has been running for a while here (in a loop)
> and didn't fail yet. :-/

Maybe my wording was weird, what i meant is that "make xvfbtestTutorial" works and "make testTutorial" fails.

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

FWIW

=== modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml'
--- tests/qmltests/Tutorial/tst_Tutorial.qml 2015-07-02 16:13:08 +0000
+++ tests/qmltests/Tutorial/tst_Tutorial.qml 2015-07-09 11:33:14 +0000
@@ -332,14 +332,14 @@
             verify(teaseAnimation.running);

             // Start a drag, make sure animation stops
- touchFlick(shell, 0, halfHeight, units.gu(3), halfHeight, true, false);
+ touchFlick(shell, 0, halfHeight, units.gu(4), halfHeight, true, false);
             verify(!teaseAnimation.running);
             verify(launcher.visibleWidth > 0);
             verify(launcher.x > 0);
             compare(launcher.x, teaseAnimation.bounce);

             // Continue drag, make sure we don't create a gap on the left hand side
- touchFlick(shell, units.gu(3), halfHeight, shell.width, halfHeight, false, false);
+ touchFlick(shell, units.gu(4), halfHeight, shell.width, halfHeight, false, false);
             verify(!teaseAnimation.running);
             compare(launcher.visibleWidth, launcher.panelWidth);
             compare(launcher.x, 0);

Fixes "make testTutorial" for me

1836. By Albert Astals Cid

Make test more reliable

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 09/07/15 09:39, Albert Astals Cid wrote:
> FWIW
>
> === modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml'
> --- tests/qmltests/Tutorial/tst_Tutorial.qml 2015-07-02 16:13:08 +0000
> +++ tests/qmltests/Tutorial/tst_Tutorial.qml 2015-07-09 11:33:14 +0000
> @@ -332,14 +332,14 @@
> verify(teaseAnimation.running);
>
> // Start a drag, make sure animation stops
> - touchFlick(shell, 0, halfHeight, units.gu(3), halfHeight, true, false);
> + touchFlick(shell, 0, halfHeight, units.gu(4), halfHeight, true, false);
> verify(!teaseAnimation.running);
> verify(launcher.visibleWidth > 0);
> verify(launcher.x > 0);
> compare(launcher.x, teaseAnimation.bounce);
>
> // Continue drag, make sure we don't create a gap on the left hand side
> - touchFlick(shell, units.gu(3), halfHeight, shell.width, halfHeight, false, false);
> + touchFlick(shell, units.gu(4), halfHeight, shell.width, halfHeight, false, false);
> verify(!teaseAnimation.running);
> compare(launcher.visibleWidth, launcher.panelWidth);
> compare(launcher.x, 0);
>
> Fixes "make testTutorial" for me

Added your patch.

Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
AP needs work :/

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve
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: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Tutorial/TutorialLeft.qml'
2--- qml/Tutorial/TutorialLeft.qml 2015-01-09 17:58:05 +0000
3+++ qml/Tutorial/TutorialLeft.qml 2015-07-09 12:45:25 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2014 Canonical, Ltd.
7+ * Copyright (C) 2014,2015 Canonical, Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11@@ -46,24 +46,34 @@
12
13 SequentialAnimation {
14 id: teaseAnimation
15+ objectName: "teaseAnimation"
16 paused: running && root.paused
17 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
18 loops: Animation.Infinite
19+ property real bounce: 0
20+ readonly property real maxBounce: units.gu(2)
21
22 UbuntuNumberAnimation {
23- target: root.launcher
24- property: "x"
25- to: units.gu(2)
26+ target: teaseAnimation
27+ property: "bounce"
28+ to: teaseAnimation.maxBounce
29 duration: UbuntuAnimation.SleepyDuration
30 }
31 UbuntuNumberAnimation {
32- target: root.launcher
33- property: "x"
34+ target: teaseAnimation
35+ property: "bounce"
36 to: 0
37 duration: UbuntuAnimation.SleepyDuration
38 }
39 }
40
41+ Binding {
42+ target: root.launcher
43+ when: root.shown
44+ property: "x"
45+ value: Math.min(root.launcher.panelWidth - root.launcher.visibleWidth, teaseAnimation.bounce)
46+ }
47+
48 Timer {
49 id: finishTimer
50 interval: 1
51
52=== modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml'
53--- tests/qmltests/Tutorial/tst_Tutorial.qml 2015-06-23 14:05:51 +0000
54+++ tests/qmltests/Tutorial/tst_Tutorial.qml 2015-07-09 12:45:25 +0000
55@@ -1,5 +1,5 @@
56 /*
57- * Copyright (C) 2013,2014 Canonical, Ltd.
58+ * Copyright (C) 2013,2014,2015 Canonical, Ltd.
59 *
60 * This program is free software; you can redistribute it and/or modify
61 * it under the terms of the GNU General Public License as published by
62@@ -319,6 +319,36 @@
63 tryCompare(left, "shown", true); // and we should still be on left
64 }
65
66+ function test_launcherNoDragGap() {
67+ // See bug 1454882, where if you dragged the launcher while it was
68+ // visible, you could pull it further than the edge of the screen.
69+
70+ var left = goToPage("tutorialLeft");
71+ var launcher = findChild(shell, "launcher");
72+ var teaseAnimation = findInvisibleChild(left, "teaseAnimation");
73+
74+ // Wait for launcher to be really out there
75+ tryCompareFunction(function() {return launcher.x > teaseAnimation.maxBounce/2}, true);
76+ verify(teaseAnimation.running);
77+
78+ // Start a drag, make sure animation stops
79+ touchFlick(shell, 0, halfHeight, units.gu(4), halfHeight, true, false);
80+ verify(!teaseAnimation.running);
81+ verify(launcher.visibleWidth > 0);
82+ verify(launcher.x > 0);
83+ compare(launcher.x, teaseAnimation.bounce);
84+
85+ // Continue drag, make sure we don't create a gap on the left hand side
86+ touchFlick(shell, units.gu(4), halfHeight, shell.width, halfHeight, false, false);
87+ verify(!teaseAnimation.running);
88+ compare(launcher.visibleWidth, launcher.panelWidth);
89+ compare(launcher.x, 0);
90+
91+ // Finish and make sure we continue animation
92+ touchFlick(shell, shell.width, halfHeight, shell.width, halfHeight, false, true);
93+ tryCompare(teaseAnimation, "running", true);
94+ }
95+
96 function test_spread() {
97 // Unfortunately, most of what we want to test of the spread is
98 // "did it render correctly?" but that's hard to test. So instead,

Subscribers

People subscribed via source and target branches