Merge lp:~mzanetti/unity8/quit-from-switcher into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2841
Merged at revision: 2875
Proposed branch: lp:~mzanetti/unity8/quit-from-switcher
Merge into: lp:unity8
Diff against target: 143 lines (+97/-0)
3 files modified
qml/Stage/Spread/Spread.qml (+11/-0)
qml/Stage/Stage.qml (+6/-0)
tests/qmltests/tst_Shell.qml (+80/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/quit-from-switcher
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+319405@code.launchpad.net

Commit message

Add support for closing apps from the spread with "Q"

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
np
 * Did you perform an exploratory manual test run of your code change and any related functionality?
yes
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
 * If you changed the UI, has there been a design review?
n/a

To post a comment you must log in.
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.
Waiting

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2841
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3318/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4368
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2614
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2614
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4396
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4229/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4229/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4229/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4229/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4229/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4229
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4229/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3318/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Stage/Spread/Spread.qml'
2--- qml/Stage/Spread/Spread.qml 2016-11-07 12:37:56 +0000
3+++ qml/Stage/Spread/Spread.qml 2017-03-09 09:44:27 +0000
4@@ -40,6 +40,7 @@
5 property real rightEdgeBreakPoint: Math.min(units.gu(40) / root.width, .35)
6
7 signal leaveSpread()
8+ signal closeCurrentApp();
9
10 // Calculated stuff
11 readonly property int totalItemCount: model.count
12@@ -118,6 +119,13 @@
13 Behavior on opacity { UbuntuNumberAnimation { } }
14 }
15
16+ readonly property int itemCount: root.model.count
17+ onItemCountChanged: {
18+ if (highlightedIndex >= itemCount) {
19+ highlightedIndex = itemCount - 1
20+ }
21+ }
22+
23 Keys.onPressed: {
24 switch (event.key) {
25 case Qt.Key_Left:
26@@ -130,6 +138,9 @@
27 selectNext(event.isAutoRepeat)
28 event.accepted = true;
29 break;
30+ case Qt.Key_Q:
31+ closeCurrentApp();
32+ break;
33 case Qt.Key_Escape:
34 highlightedIndex = -1
35 // Falling through intentionally
36
37=== modified file 'qml/Stage/Stage.qml'
38--- qml/Stage/Stage.qml 2017-02-16 13:44:45 +0000
39+++ qml/Stage/Stage.qml 2017-03-09 09:44:27 +0000
40@@ -575,6 +575,12 @@
41 onLeaveSpread: {
42 priv.goneToSpread = false;
43 }
44+
45+ onCloseCurrentApp: {
46+ if (!appRepeater.itemAt(highlightedIndex).isDash) {
47+ appRepeater.itemAt(highlightedIndex).close();
48+ }
49+ }
50 }
51
52 Connections {
53
54=== modified file 'tests/qmltests/tst_Shell.qml'
55--- tests/qmltests/tst_Shell.qml 2017-02-16 13:46:11 +0000
56+++ tests/qmltests/tst_Shell.qml 2017-03-09 09:44:27 +0000
57@@ -2883,6 +2883,86 @@
58 tryCompare(appDelegate, "state", "maximizedRight");
59 }
60
61+
62+ function test_closeAppsInSpreadWithQ() {
63+ loadShell("desktop");
64+ shell.usageScenario = "desktop";
65+ waitForRendering(shell);
66+ swipeAwayGreeter();
67+
68+ var appSurfaceId = topLevelSurfaceList.nextId;
69+ var app = ApplicationManager.startApplication("dialer-app")
70+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
71+
72+ appSurfaceId = topLevelSurfaceList.nextId;
73+ app = ApplicationManager.startApplication("calendar-app")
74+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
75+
76+ keyPress(Qt.Key_Alt);
77+ keyClick(Qt.Key_Tab);
78+
79+ var stage = findChild(shell, "stage");
80+ var spread = findChild(stage, "spreadItem");
81+ var appRepeater = findChild(stage, "appRepeater");
82+
83+ tryCompare(stage, "state", "spread");
84+
85+ tryCompare(ApplicationManager, "count", 3);
86+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "dialer-app"}, true);
87+
88+ // Close one app with Q while in spread
89+ keyClick(Qt.Key_Q);
90+
91+ tryCompare(ApplicationManager, "count", 2);
92+
93+ // Now the dash should be highlighted
94+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
95+
96+ keyClick(Qt.Key_Q);
97+
98+ // Dash is not closeable, should still be 2
99+ tryCompare(ApplicationManager, "count", 2);
100+
101+ // Move to the next one, should be closable again
102+ keyClick(Qt.Key_Tab);
103+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
104+
105+ // close it
106+ keyClick(Qt.Key_Q);
107+ tryCompare(ApplicationManager, "count", 1);
108+
109+ keyRelease(Qt.Key_Alt);
110+
111+ // Now start the apps again
112+ appSurfaceId = topLevelSurfaceList.nextId;
113+ app = ApplicationManager.startApplication("dialer-app");
114+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
115+
116+ appSurfaceId = topLevelSurfaceList.nextId;
117+ app = ApplicationManager.startApplication("calendar-app");
118+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
119+
120+ // First focus the dash so it'll be the leftmost in the spread
121+ ApplicationManager.requestFocusApplication("unity8-dash");
122+
123+ keyPress(Qt.Key_Alt);
124+ keyClick(Qt.Key_Tab);
125+ tryCompare(stage, "state", "spread");
126+
127+ // Move to the last one
128+ keyClick(Qt.Key_Tab);
129+
130+ // Close the last one, make sure the highlight fixes itself to stick within the list
131+ tryCompare(spread, "highlightedIndex", ApplicationManager.count - 1);
132+ var oldHighlighted = spread.highlightedIndex;
133+
134+ keyClick(Qt.Key_Q);
135+ tryCompare(spread, "highlightedIndex", oldHighlighted - 1);
136+
137+ keyRelease(Qt.Key_Alt);
138+
139+ }
140+
141 function test_altTabToMinimizedApp() {
142 loadShell("desktop");
143 shell.usageScenario = "desktop";

Subscribers

People subscribed via source and target branches