on xenial help sign in
Make revealByEdgePush more stable
293f8c1Albert Astals Cid
qml/Launcher/Launcher.qml+18−19
@@ -51,9 +51,9 @@ Item {
51
51
52 onStateChanged: {
52 onStateChanged: {
53 if (state == "") {
53 if (state == "") {
54− dismissTimer.stop()
54+ panel.dismissTimer.stop()
55 } else {
55 } else {
56− dismissTimer.restart()
56+ panel.dismissTimer.restart()
57 }
57 }
58 }
58 }
59
59
@@ -96,21 +96,6 @@ Item {
96 property string mode: "teasing"
96 property string mode: "teasing"
97 }
97 }
98
98
99− Timer {
100− id: dismissTimer
101− objectName: "dismissTimer"
102− interval: 500
103− onTriggered: {
104− if (root.autohideEnabled) {
105− if (!panel.preventHiding) {
106− root.state = ""
107− } else {
108− dismissTimer.restart()
109− }
110− }
111− }
112− }
113−
114 // Because the animation on x is disabled while dragging
99 // Because the animation on x is disabled while dragging
115 // switching state directly in the drag handlers would not animate
100 // switching state directly in the drag handlers would not animate
116 // the completion of the hide/reveal gesture. Lets update the state
101 // the completion of the hide/reveal gesture. Lets update the state
@@ -238,6 +223,20 @@ Item {
238 visible: root.x > 0 || x > -width || dragArea.pressed
223 visible: root.x > 0 || x > -width || dragArea.pressed
239 model: LauncherModel
224 model: LauncherModel
240
225
226+ property var dismissTimer: Timer { interval: 500 }
227+ Connections {
228+ target: panel.dismissTimer
229+ onTriggered: {
230+ if (root.autohideEnabled) {
231+ if (!panel.preventHiding) {
232+ root.state = ""
233+ } else {
234+ panel.dismissTimer.restart()
235+ }
236+ }
237+ }
238+ }
239+
241 property bool animate: true
240 property bool animate: true
242
241
243 onApplicationSelected: {
242 onApplicationSelected: {
@@ -250,8 +249,8 @@ Item {
250 }
249 }
251
250
252 onPreventHidingChanged: {
251 onPreventHidingChanged: {
253− if (dismissTimer.running) {
252+ if (panel.dismissTimer.running) {
254− dismissTimer.restart();
253+ panel.dismissTimer.restart();
255 }
254 }
256 }
255 }
257
256
tests/qmltests/Launcher/tst_Launcher.qml+24
@@ -159,6 +159,20 @@ Item {
159 target: LauncherModel
159 target: LauncherModel
160 }
160 }
161
161
162+ Item {
163+ id: fakeDismissTimer
164+ property bool running: false
165+ signal triggered
166+
167+ function stop() {
168+ running = false;
169+ }
170+
171+ function restart() {
172+ running = true;
173+ }
174+ }
175+
162 UnityTestCase {
176 UnityTestCase {
163 id: testCase
177 id: testCase
164 name: "Launcher"
178 name: "Launcher"
@@ -177,6 +191,11 @@ Item {
177 launcherLoader.active = true;
191 launcherLoader.active = true;
178 }
192 }
179 function init() {
193 function init() {
194+ var panel = findChild(launcher, "launcherPanel");
195+ verify(!!panel);
196+
197+ panel.dismissTimer = fakeDismissTimer;
198+
180 // Make sure we don't start the test with the mouse hovering the launcher
199 // Make sure we don't start the test with the mouse hovering the launcher
181 mouseMove(root, root.width, root.height / 2);
200 mouseMove(root, root.width, root.height / 2);
182
201
@@ -897,6 +916,11 @@ Item {
897 // Now move the mouse away and make sure it hides in less than a second
916 // Now move the mouse away and make sure it hides in less than a second
898 mouseMove(root, root.width, root.height / 2)
917 mouseMove(root, root.width, root.height / 2)
899
918
919+ // trigger the hide timer
920+ compare(fakeDismissTimer.running, true);
921+ fakeDismissTimer.triggered();
922+ tryCompare(panel, "x", 0);
923+
900 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
924 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
901 waitUntilLauncherDisappears();
925 waitUntilLauncherDisappears();
902 }
926 }
tests/qmltests/tst_Shell.qml+19−4
@@ -296,6 +296,20 @@ Rectangle {
296 phoneNumber: "+447812221111"
296 phoneNumber: "+447812221111"
297 }
297 }
298
298
299+ Item {
300+ id: fakeDismissTimer
301+ property bool running: false
302+ signal triggered
303+
304+ function stop() {
305+ running = false;
306+ }
307+
308+ function restart() {
309+ running = true;
310+ }
311+ }
312+
299 UnityTestCase {
313 UnityTestCase {
300 id: testCase
314 id: testCase
301 name: "Shell"
315 name: "Shell"
@@ -333,6 +347,11 @@ Rectangle {
333 var launcher = findChild(shell, "launcher");
347 var launcher = findChild(shell, "launcher");
334 launcherShowDashHomeSpy.target = launcher;
348 launcherShowDashHomeSpy.target = launcher;
335
349
350+ var panel = findChild(launcher, "launcherPanel");
351+ verify(!!panel);
352+
353+ panel.dismissTimer = fakeDismissTimer;
354+
336 waitForGreeterToStabilize();
355 waitForGreeterToStabilize();
337 }
356 }
338
357
@@ -1240,10 +1259,6 @@ Rectangle {
1240
1259
1241 var launcher = findChild(shell, "launcher");
1260 var launcher = findChild(shell, "launcher");
1242
1261
1243− // ensure the launcher dimissal timer never gets triggered during the test run
1244− var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
1245− dismissTimer.interval = 60 * 60 * 1000;
1246−
1247 dragLauncherIntoView();
1262 dragLauncherIntoView();
1248
1263
1249 // Emulate a tap with a finger, where the touch position drifts during the tap.
1264 // Emulate a tap with a finger, where the touch position drifts during the tap.
tests/qmltests/tst_ShellWithPin.qml+19−5
@@ -128,6 +128,20 @@ Item {
128 phoneNumber: "+447812221111"
128 phoneNumber: "+447812221111"
129 }
129 }
130
130
131+ Item {
132+ id: fakeDismissTimer
133+ property bool running: false
134+ signal triggered
135+
136+ function stop() {
137+ running = false;
138+ }
139+
140+ function restart() {
141+ running = true;
142+ }
143+ }
144+
131 UT.UnityTestCase {
145 UT.UnityTestCase {
132 id: testCase
146 id: testCase
133 name: "ShellWithPin"
147 name: "ShellWithPin"
@@ -143,6 +157,11 @@ Item {
143 waitForLockscreen()
157 waitForLockscreen()
144 greeter.failedLoginsDelayAttempts = -1;
158 greeter.failedLoginsDelayAttempts = -1;
145 greeter.maxFailedLogins = -1;
159 greeter.maxFailedLogins = -1;
160+
161+ var launcher = findChild(shell, "launcher");
162+ var panel = findChild(launcher, "launcherPanel");
163+ verify(!!panel);
164+ panel.dismissTimer = fakeDismissTimer;
146 }
165 }
147
166
148 function cleanup() {
167 function cleanup() {
@@ -565,11 +584,6 @@ Item {
565 tryCompare(coverPage, "showProgress", 1);
584 tryCompare(coverPage, "showProgress", 1);
566
585
567 var launcher = testCase.findChild(shell, "launcher")
586 var launcher = testCase.findChild(shell, "launcher")
568− {
569− var dismissTimer = testCase.findInvisibleChild(launcher, "dismissTimer");
570− // effectively disable the dismiss timer
571− dismissTimer.interval = 24 * 60 * 60 * 1000 // 24 hours
572− }
573 var launcherPanel = testCase.findChild(launcher, "launcherPanel");
587 var launcherPanel = testCase.findChild(launcher, "launcherPanel");
574
588
575 var toX = shell.width * 0.45;
589 var toX = shell.width * 0.45;