on xenial help sign in
edge hinting tweaks
d894886Michael Zanetti
Greeter/Greeter.qml+2−2
@@ -48,7 +48,7 @@ Showable {
48 signal unlocked(int uid)
48 signal unlocked(int uid)
49
49
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 @@ Showable {
81 states: [
81 states: [
82 State {
82 State {
83 name: "teasing"
83 name: "teasing"
84− when: greeter.rightTeaserPressed || teasingTimer.running
84+ when: teasingTimer.running
85 PropertyChanges {
85 PropertyChanges {
86 target: greeter
86 target: greeter
87 x: -units.gu(2)
87 x: -units.gu(2)
Launcher/Launcher.qml+3−4
@@ -25,7 +25,6 @@ Item {
25
25
26 property bool available: true // can be used to disable all interactions
26 property bool available: true // can be used to disable all interactions
27
27
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 : 0
30 property real progress: dragArea.dragging && dragArea.touchX > panel.width ? dragArea.touchX : 0
@@ -58,8 +57,8 @@ Item {
58 animateTimer.start();
57 animateTimer.start();
59 }
58 }
60
59
61− onTeasingChanged: {
60+ function tease() {
62− if (teasing) {
61+ if (available) {
63 teaseTimer.start();
62 teaseTimer.start();
64 }
63 }
65 }
64 }
@@ -237,7 +236,7 @@ Item {
237 },
236 },
238 State {
237 State {
239 name: "teasing"
238 name: "teasing"
240− when: root.teasing || teaseTimer.running
239+ when: teaseTimer.running
241 PropertyChanges {
240 PropertyChanges {
242 target: panel
241 target: panel
243 x: -root.panelWidth + units.gu(2)
242 x: -root.panelWidth + units.gu(2)
Shell.qml+6−1
@@ -439,6 +439,12 @@ FocusScope {
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_background
440 shell.background = bgPath ? bgPath : default_background
441 }
441 }
442+
443+ onLeftTeaserPressedChanged: {
444+ if (leftTeaserPressed) {
445+ launcher.tease();
446+ }
447+ }
442 }
448 }
443
449
444 InputFilterArea {
450 InputFilterArea {
@@ -532,7 +538,6 @@ FocusScope {
532 width: parent.width
538 width: parent.width
533 dragAreaWidth: shell.edgeSize
539 dragAreaWidth: shell.edgeSize
534 available: !greeter.locked
540 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 dash
543 // Animate if moving between application and dash
tests/qmltests/Greeter/tst_Phone.qml+40−1
@@ -28,7 +28,17 @@ Item {
28
28
29 Greeter {
29 Greeter {
30 id: greeter
30 id: greeter
31− anchors.fill: parent
31+ 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 }
33
43
34 SignalSpy {
44 SignalSpy {
@@ -63,5 +73,34 @@ Item {
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}
tests/qmltests/Launcher/tst_Launcher.qml+40
@@ -43,6 +43,18 @@ Item {
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 }
47
59
48 UT.UnityTestCase {
60 UT.UnityTestCase {
@@ -126,5 +138,33 @@ Item {
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}