Merge lp:~mzanetti/unity8/edge-hinting-tweaks into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 63
Merged at revision: 67
Proposed branch: lp:~mzanetti/unity8/edge-hinting-tweaks
Merge into: lp:unity8
Diff against target: 193 lines (+91/-8)
5 files modified
Greeter/Greeter.qml (+2/-2)
Launcher/Launcher.qml (+3/-4)
Shell.qml (+6/-1)
tests/qmltests/Greeter/tst_Phone.qml (+40/-1)
tests/qmltests/Launcher/tst_Launcher.qml (+40/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/edge-hinting-tweaks
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel d'Andrada (community) Approve
Review via email: mp+172014@code.launchpad.net

Commit message

edge hinting tweaks

  - change edge hinting behavior to only happen on onPressed and immediately snap back
  - fix edge hinting to not happen if the Greeter is locked

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
Daniel d'Andrada (dandrader) wrote :

> FAILED: Continuous integration, rev:56
> [...]

Jenkins crashed. Asked for a rebuild.

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

> - fix edge hinting to not happen if the Greeter is locked

Would it make sense to test it?

eg:
 tap on greeter when not locked -> check that greeter bounces somehow (track its x coord)
 tap on greeter when locked -> check that greeter stays still (its x coord doesn't change at all)

Or it's not worth the effort?

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

PASS : qmltestrunner::Launcher::test_teaseLauncher(tease - available)
PASS : qmltestrunner::Launcher::test_teaseLauncher(tease - not available)

I think the tags can say just "available" and "not available". We can already see that it's about a "tease" test from the test name itself.

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

tests/qmltests/Launcher/tst_Launcher.qml: bad whitespace in line 156

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

tst_Launcher.qml:159
                tryCompareFunction(function(){return launcher.maxPanelX >= -launcher.panelWidth + units.gu(2) - 2;}, true)

That's 122 chars long. Our coding style sets a limit of 120 (hmm, I'm starting to think we should have an automatic checker for that, like we do for the whitespace)

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

Other than those coding style issues, the Launcher test looks good.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> > - fix edge hinting to not happen if the Greeter is locked
>
> Would it make sense to test it?
>
> eg:
> tap on greeter when not locked -> check that greeter bounces somehow (track
> its x coord)
> tap on greeter when locked -> check that greeter stays still (its x coord
> doesn't change at all)
>
> Or it's not worth the effort?

done

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> PASS : qmltestrunner::Launcher::test_teaseLauncher(tease - available)
> PASS : qmltestrunner::Launcher::test_teaseLauncher(tease - not available)
>
> I think the tags can say just "available" and "not available". We can already
> see that it's about a "tease" test from the test name itself.

done

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> tst_Launcher.qml:159
> tryCompareFunction(function(){return launcher.maxPanelX >=
> -launcher.panelWidth + units.gu(2) - 2;}, true)
>
> That's 122 chars long. Our coding style sets a limit of 120 (hmm, I'm starting
> to think we should have an automatic checker for that, like we do for the
> whitespace)

now it looks like shit and did not contribute to readability the smallest bit, but as long as the guideline is happy...

done

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

> > tst_Launcher.qml:159
> > tryCompareFunction(function(){return launcher.maxPanelX >=
> > -launcher.panelWidth + units.gu(2) - 2;}, true)
> >
> > That's 122 chars long. Our coding style sets a limit of 120 (hmm, I'm
> starting
> > to think we should have an automatic checker for that, like we do for the
> > whitespace)
>
> now it looks like shit and did not contribute to readability the smallest bit,
> but as long as the guideline is happy...
>
> done

"Beauty is in the eye of the beholder". And it's not only the guideline that is happy. I am too. :D

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

> function test_tease(data) {

That's a very inclusive name (could include even test_teasingArea). But what you're testing there is much more specific. You're testing the interaction between greeter being locked and its tease animation. If later you add a test about something else involving the tease animation you might have to rename this one. So I would call it like test_noTeaseIfLocked or test_teaseVsLock. Including a comment explaining what the test wanna check also wouldn't hurt (tests/qmltests/README!) but it's perfectly fine if you don't (test is rather small after all).

But I won't insist if you wanna keep it like that. It's already good as it is.

review: Approve
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> > function test_tease(data) {
>
> That's a very inclusive name (could include even test_teasingArea). But what
> you're testing there is much more specific. You're testing the interaction
> between greeter being locked and its tease animation. If later you add a test
> about something else involving the tease animation you might have to rename
> this one. So I would call it like test_noTeaseIfLocked or test_teaseVsLock.
> Including a comment explaining what the test wanna check also wouldn't hurt
> (tests/qmltests/README!) but it's perfectly fine if you don't (test is rather
> small after all).
>

Yep. I agree on this. I used test_tease mainly because test_teasingArea was already there, which checks if both teasingAreas work. As this one really does a tease, I named it lake that. Anyways, you're absolutely right on this and I renamed it to test_teaseLockedUnlocked().

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
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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Greeter/Greeter.qml'
--- Greeter/Greeter.qml 2013-06-19 08:29:34 +0000
+++ Greeter/Greeter.qml 2013-06-28 16:41:39 +0000
@@ -48,7 +48,7 @@
48 signal unlocked(int uid)48 signal unlocked(int uid)
4949
50 onRightTeaserPressedChanged: {50 onRightTeaserPressedChanged: {
51 if (rightTeaserPressed) {51 if (rightTeaserPressed && !locked) {
52 teasingTimer.start();52 teasingTimer.start();
53 }53 }
54 }54 }
@@ -81,7 +81,7 @@
81 states: [81 states: [
82 State {82 State {
83 name: "teasing"83 name: "teasing"
84 when: greeter.rightTeaserPressed || teasingTimer.running84 when: teasingTimer.running
85 PropertyChanges {85 PropertyChanges {
86 target: greeter86 target: greeter
87 x: -units.gu(2)87 x: -units.gu(2)
8888
=== modified file 'Launcher/Launcher.qml'
--- Launcher/Launcher.qml 2013-06-26 11:25:43 +0000
+++ Launcher/Launcher.qml 2013-06-28 16:41:39 +0000
@@ -25,7 +25,6 @@
2525
26 property bool available: true // can be used to disable all interactions26 property bool available: true // can be used to disable all interactions
2727
28 property bool teasing: false
29 property int panelWidth: units.gu(8.5)28 property int panelWidth: units.gu(8.5)
30 property int dragAreaWidth: units.gu(1)29 property int dragAreaWidth: units.gu(1)
31 property real progress: dragArea.dragging && dragArea.touchX > panel.width ? dragArea.touchX : 030 property real progress: dragArea.dragging && dragArea.touchX > panel.width ? dragArea.touchX : 0
@@ -58,8 +57,8 @@
58 animateTimer.start();57 animateTimer.start();
59 }58 }
6059
61 onTeasingChanged: {60 function tease() {
62 if (teasing) {61 if (available) {
63 teaseTimer.start();62 teaseTimer.start();
64 }63 }
65 }64 }
@@ -244,7 +243,7 @@
244 },243 },
245 State {244 State {
246 name: "teasing"245 name: "teasing"
247 when: root.teasing || teaseTimer.running246 when: teaseTimer.running
248 PropertyChanges {247 PropertyChanges {
249 target: panel248 target: panel
250 x: -root.panelWidth + units.gu(2)249 x: -root.panelWidth + units.gu(2)
251250
=== modified file 'Shell.qml'
--- Shell.qml 2013-06-27 16:25:18 +0000
+++ Shell.qml 2013-06-28 16:41:39 +0000
@@ -439,6 +439,12 @@
439 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)439 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
440 shell.background = bgPath ? bgPath : default_background440 shell.background = bgPath ? bgPath : default_background
441 }441 }
442
443 onLeftTeaserPressedChanged: {
444 if (leftTeaserPressed) {
445 launcher.tease();
446 }
447 }
442 }448 }
443449
444 InputFilterArea {450 InputFilterArea {
@@ -532,7 +538,6 @@
532 width: parent.width538 width: parent.width
533 dragAreaWidth: shell.edgeSize539 dragAreaWidth: shell.edgeSize
534 available: !greeter.locked540 available: !greeter.locked
535 teasing: available && greeter.leftTeaserPressed
536 onDashItemSelected: {541 onDashItemSelected: {
537 greeter.hide()542 greeter.hide()
538 // Animate if moving between application and dash543 // Animate if moving between application and dash
539544
=== modified file 'tests/qmltests/Greeter/tst_Phone.qml'
--- tests/qmltests/Greeter/tst_Phone.qml 2013-06-13 14:24:52 +0000
+++ tests/qmltests/Greeter/tst_Phone.qml 2013-06-28 16:41:39 +0000
@@ -28,7 +28,17 @@
2828
29 Greeter {29 Greeter {
30 id: greeter30 id: greeter
31 anchors.fill: parent31 width: parent.width
32 height: parent.height
33 x: 0; y: 0
34
35 property int minX: 0
36
37 onXChanged: {
38 if (x < minX) {
39 minX = x;
40 }
41 }
32 }42 }
3343
34 SignalSpy {44 SignalSpy {
@@ -63,5 +73,34 @@
63 tryCompare(greeter, "leftTeaserPressed", false)73 tryCompare(greeter, "leftTeaserPressed", false)
64 tryCompare(greeter, "rightTeaserPressed", false)74 tryCompare(greeter, "rightTeaserPressed", false)
65 }75 }
76
77 function test_teaseLockedUnlocked_data() {
78 return [
79 {tag: "unlocked", locked: false},
80 {tag: "locked", locked: true}
81 ];
82 }
83
84 function test_teaseLockedUnlocked(data) {
85 tryCompare(greeter, "rightTeaserPressed", false);
86 tryCompare(greeter, "x", 0);
87 greeter.locked = data.locked;
88
89 mouseClick(greeter, greeter.width - units.gu(5), greeter.height - units.gu(1));
90 greeter.minX = 0; // This is needed because the transition actually makes x jump once before animating
91
92 if (!data.locked) {
93 // Check if it has been moved over by 2 GUs. Give it a 2 pixel grace area
94 // because animation duration and teaseTimer are the same duration and
95 // might cause slight offsets
96 tryCompareFunction(function() { return greeter.minX <= -units.gu(2) + 2}, true);
97 } else {
98 // waiting 100ms to make sure nothing moves
99 wait(100);
100 compare(greeter.minX, 0, "Greeter moved even tho its locked");
101 }
102 // Wait until we're back to 0
103 tryCompareFunction(function() { return greeter.x;}, 0);
104 }
66 }105 }
67}106}
68107
=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
--- tests/qmltests/Launcher/tst_Launcher.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Launcher/tst_Launcher.qml 2013-06-28 16:41:39 +0000
@@ -43,6 +43,18 @@
43 onDashItemSelected: {43 onDashItemSelected: {
44 dashItemSelected_count++;44 dashItemSelected_count++;
45 }45 }
46
47 property int maxPanelX: 0
48 }
49
50 Connections {
51 target: testCase.findChild(launcher, "launcherPanel")
52
53 onXChanged: {
54 if (target.x > launcher.maxPanelX) {
55 launcher.maxPanelX = target.x;
56 }
57 }
46 }58 }
4759
48 UT.UnityTestCase {60 UT.UnityTestCase {
@@ -126,5 +138,33 @@
126 var panel = findChild(launcher, "launcherPanel")138 var panel = findChild(launcher, "launcherPanel")
127 tryCompare(panel, "x", -panel.width, 1000)139 tryCompare(panel, "x", -panel.width, 1000)
128 }140 }
141
142
143 function test_teaseLauncher_data() {
144 return [
145 {tag: "available", available: true},
146 {tag: "not available", available: false}
147 ];
148 }
149
150 function test_teaseLauncher(data) {
151 launcher.available = data.available;
152 launcher.maxPanelX = -launcher.panelWidth;
153 launcher.tease();
154
155 if (data.available) {
156 // Check if the launcher slides in for units.gu(2). However, as the animation is 200ms
157 // and the teaseTimer's timeout too, give it a 2 pixels grace distance
158 tryCompareFunction(
159 function(){
160 return launcher.maxPanelX >= -launcher.panelWidth + units.gu(2) - 2;
161 },
162 true)
163 } else {
164 wait(100)
165 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
166 }
167 waitUntilLauncherDisappears();
168 }
129 }169 }
130}170}

Subscribers

People subscribed via source and target branches