on xenial help sign in
Simplify behavior launcher/greeter/dash when doing a long-left-drag; now we never show dash while locked
commit3b68792e911016a6148ce28d86f49aeae1c4f1fb authorMichael Terry <michael.terry@canonical.com> dateMon 23 Feb 2015, 10:43 (12 years ago) parent4619682
9 files changed+80−38
qml/Greeter/Greeter.qml+11−6 qml/Greeter/NarrowView.qml+2 qml/Greeter/WideView.qml+3 qml/Shell.qml+3−4 tests/qmltests/Greeter/TestView.qml+1 tests/qmltests/Greeter/tst_Greeter.qml+12 tests/qmltests/Greeter/tst_NarrowView.qml+8 tests/qmltests/tst_Shell.qml+15−28 tests/qmltests/tst_ShellWithPin.qml+25
qml/Greeter/Greeter.qml+11−6
@@ -91,15 +91,18 @@ Showable {
9191 d.startUnlock(false /* toTheRight */);
9292 }
9393
94+ // This is a just a glorified notifyAboutToFocusApp(), but it does one
95+ // other thing: it hides any cover pages to the RIGHT, because the user
96+ // just came from a launcher drag starting on the left.
97+ // It also returns a boolean value, indicating whether there was a visual
98+ // change or not (the shell only wants to hide the launcher if there was
99+ // a change).
94100 function notifyShowingDashFromDrag() {
95101 if (!active) {
96− return;
102+ return false;
97103 }
98104
99− // This is a just a glorified notifyAboutToFocusApp(), but it does one
100− // other thing: it hides any cover pages to the RIGHT, because the user
101− // just came from a launcher drag starting on the left.
102− d.startUnlock(true /* toTheRight */);
105+ return d.startUnlock(true /* toTheRight */);
103106 }
104107
105108 QtObject {
@@ -149,7 +152,9 @@ Showable {
149152
150153 function startUnlock(toTheRight) {
151154 if (loader.item) {
152− loader.item.tryToUnlock(toTheRight);
155+ return loader.item.tryToUnlock(toTheRight);
156+ } else {
157+ return false;
153158 }
154159 }
155160 }
qml/Greeter/NarrowView.qml+2
@@ -77,12 +77,14 @@ FocusScope {
7777 }
7878
7979 function tryToUnlock(toTheRight) {
80+ var coverChanged = coverPage.shown;
8081 lockscreen.maybeShow();
8182 if (toTheRight) {
8283 coverPage.hideRight();
8384 } else {
8485 coverPage.hide();
8586 }
87+ return coverChanged;
8688 }
8789
8890 onLockedChanged: {
qml/Greeter/WideView.qml+3
@@ -73,12 +73,15 @@ FocusScope {
7373 if (root.locked) {
7474 coverPage.show();
7575 loginList.tryToUnlock();
76+ return false;
7677 } else {
78+ var coverChanged = coverPage.shown;
7779 if (toTheRight) {
7880 coverPage.hideRight();
7981 } else {
8082 coverPage.hide();
8183 }
84+ return coverChanged;
8285 }
8386 }
8487
qml/Shell.qml+3−4
@@ -296,7 +296,7 @@ Item {
296296 Binding {
297297 target: applicationsDisplayLoader.item
298298 property: "inverseProgress"
299− value: launcher.progress
299+ value: greeter.locked ? 0 : launcher.progress
300300 }
301301 Binding {
302302 target: applicationsDisplayLoader.item
@@ -447,12 +447,11 @@ Item {
447447 }
448448
449449 function showDash() {
450− if (greeter.active) {
451− greeter.notifyShowingDashFromDrag();
450+ if (greeter.notifyShowingDashFromDrag()) {
452451 launcher.fadeOut();
453452 }
454453
455− if (ApplicationManager.focusedApplicationId != "unity8-dash") {
454+ if (!greeter.locked && ApplicationManager.focusedApplicationId != "unity8-dash") {
456455 ApplicationManager.requestFocusApplication("unity8-dash")
457456 launcher.fadeOut();
458457 }
tests/qmltests/Greeter/TestView.qml+1
@@ -83,6 +83,7 @@ Item {
8383
8484 function tryToUnlock(toTheRight) {
8585 _tryToUnlockCalled(toTheRight);
86+ return true;
8687 }
8788
8889 Rectangle {
tests/qmltests/Greeter/tst_Greeter.qml+12
@@ -344,6 +344,18 @@ Item {
344344 compare(view.background, Qt.resolvedUrl("testing"));
345345 }
346346
347+ function test_notifyAboutToFocusApp() {
348+ greeter.notifyAboutToFocusApp("fake-app");
349+ compare(viewTryToUnlockSpy.count, 1);
350+ compare(viewTryToUnlockSpy.signalArguments[0][0], false);
351+ }
352+
353+ function test_notifyShowingDashFromDrag() {
354+ compare(greeter.notifyShowingDashFromDrag("fake-app"), true);
355+ compare(viewTryToUnlockSpy.count, 1);
356+ compare(viewTryToUnlockSpy.signalArguments[0][0], true);
357+ }
358+
347359 function test_dragHandleLeftMargin() {
348360 compare(view.dragHandleLeftMargin, 0);
349361 greeter.dragHandleLeftMargin = 5;
tests/qmltests/Greeter/tst_NarrowView.qml+8
@@ -402,6 +402,14 @@ Item {
402402 tryCompare(view, "required", false);
403403 }
404404
405+ function test_tryToUnlock() {
406+ var coverPage = findChild(view, "coverPage");
407+ tryCompare(coverPage, "showProgress", 1);
408+ compare(view.tryToUnlock(false), true);
409+ tryCompare(coverPage, "showProgress", 0);
410+ compare(view.tryToUnlock(false), false);
411+ }
412+
405413 /*
406414 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1388359
407415 "User metrics can no longer be changed by double tap"
tests/qmltests/tst_Shell.qml+15−28
@@ -298,11 +298,13 @@ Item {
298298
299299 function test_leftEdgeDrag_data() {
300300 return [
301− {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
302− {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
303− {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false},
304− {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
305− {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false}
301+ {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
302+ {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
303+ {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: false},
304+ {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
305+ {tag: "small swipe with greeter", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: true},
306+ {tag: "long swipe with greeter", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: true},
307+ {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false, greeterShown: false},
306308 ];
307309 }
308310
@@ -313,6 +315,12 @@ Item {
313315 ApplicationManager.focusApplication(data.focusedApp)
314316 waitUntilApplicationWindowIsFullyVisible();
315317
318+ var greeter = findChild(shell, "greeter");
319+ if (data.greeterShown) {
320+ LightDM.Greeter.showGreeter();
321+ tryCompare(greeter, "fullyShown", true);
322+ }
323+
316324 if (data.revealLauncher) {
317325 dragLauncherIntoView();
318326 }
@@ -320,8 +328,10 @@ Item {
320328 swipeFromLeftEdge(data.swipeLength);
321329 if (data.appHides) {
322330 waitUntilDashIsFocused();
331+ tryCompare(greeter, "shown", false);
323332 } else {
324333 waitUntilApplicationWindowIsFullyVisible();
334+ compare(greeter.fullyShown, data.greeterShown);
325335 }
326336
327337 var launcher = findChild(shell, "launcherPanel");
@@ -715,29 +725,6 @@ Item {
715725 tryCompare(unlockAllModemsSpy, "count", 1)
716726 }
717727
718− function test_leftEdgeDragOnGreeter_data() {
719− return [
720− {tag: "short swipe", targetX: shell.width / 3, unlocked: false},
721− {tag: "long swipe", targetX: shell.width / 3 * 2, unlocked: true}
722− ]
723− }
724−
725− function test_leftEdgeDragOnGreeter(data) {
726− var greeter = findChild(shell, "greeter");
727− LightDM.Greeter.showGreeter();
728− tryCompare(greeter, "fullyShown", true);
729−
730− var touchStartX = 2;
731− var touchStartY = shell.height / 2;
732− touchFlick(shell, touchStartX, touchStartY, data.targetX, touchStartY);
733−
734− if (data.unlocked) {
735− tryCompare(greeter, "shown", false);
736− } else {
737− tryCompare(greeter, "fullyShown", true);
738− }
739− }
740−
741728 function test_tapOnRightEdgeReachesApplicationSurface() {
742729 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
743730 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
tests/qmltests/tst_ShellWithPin.qml+25
@@ -599,5 +599,30 @@ Item {
599599 compare(launcherPanel.x, 0);
600600 }
601601 }
602+
603+ function test_longLeftEdgeDrags() {
604+ var coverPage = findChild(shell, "coverPage");
605+ var lockscreen = findChild(shell, "lockscreen");
606+ var launcher = findChild(shell, "launcherPanel");
607+ ApplicationManager.startApplication("gallery-app");
608+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
609+
610+ // Show greeter
611+ LightDM.Greeter.showGreeter();
612+ tryCompare(coverPage, "showProgress", 1);
613+
614+ // Swipe cover page away
615+ touchFlick(shell, 2, shell.height / 2, units.gu(27), shell.height / 2);
616+ tryCompare(launcher, "x", -launcher.width);
617+ tryCompare(coverPage, "showProgress", 0);
618+ compare(lockscreen.shown, true);
619+ compare(ApplicationManager.focusedApplicationId, "gallery-app");
620+
621+ // Now attempt a swipe on lockscreen
622+ touchFlick(shell, 2, shell.height / 2, units.gu(27), shell.height / 2);
623+ tryCompare(launcher, "x", 0);
624+ compare(lockscreen.shown, true);
625+ compare(ApplicationManager.focusedApplicationId, "gallery-app");
626+ }
602627 }
603628}