Merge lp:~aacid/unity8/tab_focus_fence_dialogs into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2753
Merged at revision: 2772
Proposed branch: lp:~aacid/unity8/tab_focus_fence_dialogs
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/focus_dialog_buttons
Diff against target: 419 lines (+163/-8)
11 files modified
plugins/Utils/CMakeLists.txt (+1/-0)
plugins/Utils/plugin.cpp (+3/-1)
plugins/Utils/tabfocusfence.cpp (+46/-0)
plugins/Utils/tabfocusfence.h (+35/-0)
qml/Components/Dialogs.qml (+9/-1)
qml/Components/Lockscreen.qml (+3/-1)
qml/Components/ModeSwitchWarningDialog.qml (+8/-2)
qml/Components/ShellDialog.qml (+15/-1)
tests/mocks/Utils/CMakeLists.txt (+1/-0)
tests/mocks/Utils/plugin.cpp (+3/-1)
tests/qmltests/tst_OrientedShell.qml (+39/-1)
To merge this branch: bzr merge lp:~aacid/unity8/tab_focus_fence_dialogs
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Lukáš Tinkl (community) Approve
Review via email: mp+313681@code.launchpad.net

Commit message

Limit tab-focus travelling on dialogs with a fence

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
Prereq

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Only tests since unity8 is not runnable on zesty at the moment

 * 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
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2747. By Albert Astals Cid

Test the focus fence in the shutdown dialog

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Some minor comments inline, otherwise the code looks good (haven't tested yet)

review: Needs Fixing (code-review)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Generally works fine but I can no longer press Esc to dismiss the logout/lock/reboot dialog.

review: Needs Fixing
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

When in phone mode:

1. Press Ctrl+Alt+Delete to invoke the logout dialog
2. Press Tab
3. The task switcher gets activated instead
4. Subsequent Tab presses are correctly cycling thru the dialog's buttons

Point 3 needs fixing

review: Needs Fixing
2748. By Albert Astals Cid

New year

2749. By Albert Astals Cid

{}

2750. By Albert Astals Cid

oh no an empty line!

Revision history for this message
Albert Astals Cid (aacid) wrote :

> What is this purpose of this, can't see it being used anywhere

It's a default property, the purpose is to make children of the parent children of the default property.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2751. By Albert Astals Cid

Merge

2752. By Albert Astals Cid

Beware of the evil double space!

2753. By Albert Astals Cid

Restore Esc to close dialog + test

Revision history for this message
Albert Astals Cid (aacid) wrote :

> Generally works fine but I can no longer press Esc to dismiss the
> logout/lock/reboot dialog.

Fixed

Revision history for this message
Albert Astals Cid (aacid) wrote :

> When in phone mode:
>
> 1. Press Ctrl+Alt+Delete to invoke the logout dialog
> 2. Press Tab
> 3. The task switcher gets activated instead
> 4. Subsequent Tab presses are correctly cycling thru the dialog's buttons
>
>
> Point 3 needs fixing

This seems to be a side effect of switching VTs, if you don't all is fine.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

This branch alone works fine; the issue with the logout dialog breaking Alt+Tab will be dealt with in another branch.

Waiting with top approval for CI

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

FAILED: Continuous integration, rev:2752
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2795/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3659
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2095
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2095
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3687
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3532/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3532/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3532/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3532/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3532/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3532
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3532/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) 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.

Yes, with an exception of an unrelated failure

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

PASSED: Continuous integration, rev:2753
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2806/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3673
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2106
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2106
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3701
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3545/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3545/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3545/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3545/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3545/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3545
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3545/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2806/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 'plugins/Utils/CMakeLists.txt'
2--- plugins/Utils/CMakeLists.txt 2016-12-07 13:43:25 +0000
3+++ plugins/Utils/CMakeLists.txt 2017-01-03 13:45:36 +0000
4@@ -34,6 +34,7 @@
5 deviceconfigparser.cpp
6 globalfunctions.cpp
7 URLDispatcher.cpp
8+ tabfocusfence.cpp
9 plugin.cpp
10 )
11
12
13=== modified file 'plugins/Utils/plugin.cpp'
14--- plugins/Utils/plugin.cpp 2016-11-01 18:18:56 +0000
15+++ plugins/Utils/plugin.cpp 2017-01-03 13:45:36 +0000
16@@ -1,5 +1,5 @@
17 /*
18- * Copyright (C) 2012-2015 Canonical, Ltd.
19+ * Copyright (C) 2012-2017 Canonical, Ltd.
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23@@ -40,6 +40,7 @@
24 #include "globalfunctions.h"
25 #include "URLDispatcher.h"
26 #include "appdrawerproxymodel.h"
27+#include "tabfocusfence.h"
28
29 static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
30 {
31@@ -84,4 +85,5 @@
32 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
33 qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
34 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
35+ qmlRegisterType<TabFocusFenceItem>(uri, 0, 1, "TabFocusFence");
36 }
37
38=== added file 'plugins/Utils/tabfocusfence.cpp'
39--- plugins/Utils/tabfocusfence.cpp 1970-01-01 00:00:00 +0000
40+++ plugins/Utils/tabfocusfence.cpp 2017-01-03 13:45:36 +0000
41@@ -0,0 +1,46 @@
42+/*
43+ * Copyright 2017 Canonical Ltd.
44+ *
45+ * This program is free software; you can redistribute it and/or modify
46+ * it under the terms of the GNU Lesser General Public License as published by
47+ * the Free Software Foundation; version 3.
48+ *
49+ * This program is distributed in the hope that it will be useful,
50+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
51+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+ * GNU Lesser General Public License for more details.
53+ *
54+ * You should have received a copy of the GNU Lesser General Public License
55+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
56+*/
57+
58+#include "tabfocusfence.h"
59+
60+#include <private/qquickitem_p.h>
61+
62+TabFocusFenceItem::TabFocusFenceItem(QQuickItem *parent) : QQuickItem(parent)
63+{
64+ QQuickItemPrivate *d = QQuickItemPrivate::get(this);
65+ d->isTabFence = true;
66+ setFlag(ItemIsFocusScope);
67+}
68+
69+void TabFocusFenceItem::keyPressEvent(QKeyEvent *event)
70+{
71+ // Needed so we eat Tab keys when there's only one item inside the fence
72+ if (event->key() == Qt::Key_Tab) {
73+ event->accept();
74+ } else {
75+ QQuickItem::keyPressEvent(event);
76+ }
77+}
78+
79+void TabFocusFenceItem::keyReleaseEvent(QKeyEvent *event)
80+{
81+ // Needed so we eat Tab keys when there's only one item inside the fence
82+ if (event->key() == Qt::Key_Tab) {
83+ event->accept();
84+ } else {
85+ QQuickItem::keyReleaseEvent(event);
86+ }
87+}
88
89=== added file 'plugins/Utils/tabfocusfence.h'
90--- plugins/Utils/tabfocusfence.h 1970-01-01 00:00:00 +0000
91+++ plugins/Utils/tabfocusfence.h 2017-01-03 13:45:36 +0000
92@@ -0,0 +1,35 @@
93+/*
94+ * Copyright 2017 Canonical Ltd.
95+ *
96+ * This program is free software; you can redistribute it and/or modify
97+ * it under the terms of the GNU Lesser General Public License as published by
98+ * the Free Software Foundation; version 3.
99+ *
100+ * This program is distributed in the hope that it will be useful,
101+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
102+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103+ * GNU Lesser General Public License for more details.
104+ *
105+ * You should have received a copy of the GNU Lesser General Public License
106+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
107+*/
108+
109+#ifndef TABFOCUSFENCE_H
110+#define TABFOCUSFENCE_H
111+
112+#include <QQuickItem>
113+
114+// An item that restricts focus Tab travelling
115+// to its children
116+class TabFocusFenceItem : public QQuickItem
117+{
118+Q_OBJECT
119+
120+public:
121+ TabFocusFenceItem(QQuickItem *parent = nullptr);
122+
123+ void keyPressEvent(QKeyEvent *event) override;
124+ void keyReleaseEvent(QKeyEvent *event) override;
125+};
126+
127+#endif
128
129=== modified file 'qml/Components/Dialogs.qml'
130--- qml/Components/Dialogs.qml 2017-01-03 13:45:36 +0000
131+++ qml/Components/Dialogs.qml 2017-01-03 13:45:36 +0000
132@@ -1,5 +1,5 @@
133 /*
134- * Copyright (C) 2014-2016 Canonical, Ltd.
135+ * Copyright (C) 2014-2017 Canonical, Ltd.
136 *
137 * This program is free software; you can redistribute it and/or modify
138 * it under the terms of the GNU General Public License as published by
139@@ -149,6 +149,7 @@
140 title: i18n.ctr("Title: Lock/Log out dialog", "Log out")
141 text: i18n.tr("Are you sure you want to log out?")
142 Button {
143+ width: parent.width
144 text: i18n.ctr("Button: Lock the system", "Lock")
145 onClicked: {
146 LightDMService.greeter.showGreeter()
147@@ -156,6 +157,7 @@
148 }
149 }
150 Button {
151+ width: parent.width
152 focus: true
153 text: i18n.ctr("Button: Log out from the system", "Log Out")
154 onClicked: {
155@@ -164,6 +166,7 @@
156 }
157 }
158 Button {
159+ width: parent.width
160 text: i18n.tr("Cancel")
161 onClicked: {
162 logoutDialog.hide();
163@@ -179,12 +182,14 @@
164 title: i18n.ctr("Title: Reboot dialog", "Reboot")
165 text: i18n.tr("Are you sure you want to reboot?")
166 Button {
167+ width: parent.width
168 text: i18n.tr("No")
169 onClicked: {
170 rebootDialog.hide();
171 }
172 }
173 Button {
174+ width: parent.width
175 focus: true
176 text: i18n.tr("Yes")
177 onClicked: {
178@@ -204,6 +209,7 @@
179 title: i18n.ctr("Title: Power off/Restart dialog", "Power")
180 text: i18n.tr("Are you sure you would like\nto power off?")
181 Button {
182+ width: parent.width
183 focus: true
184 text: i18n.ctr("Button: Power off the system", "Power off")
185 onClicked: {
186@@ -214,6 +220,7 @@
187 color: theme.palette.normal.negative
188 }
189 Button {
190+ width: parent.width
191 text: i18n.ctr("Button: Restart the system", "Restart")
192 onClicked: {
193 root.closeAllApps();
194@@ -222,6 +229,7 @@
195 }
196 }
197 Button {
198+ width: parent.width
199 text: i18n.tr("Cancel")
200 onClicked: {
201 powerDialog.hide();
202
203=== modified file 'qml/Components/Lockscreen.qml'
204--- qml/Components/Lockscreen.qml 2016-08-30 14:06:47 +0000
205+++ qml/Components/Lockscreen.qml 2017-01-03 13:45:36 +0000
206@@ -1,5 +1,5 @@
207 /*
208- * Copyright (C) 2013 Canonical, Ltd.
209+ * Copyright (C) 2013-2017 Canonical, Ltd.
210 *
211 * This program is free software; you can redistribute it and/or modify
212 * it under the terms of the GNU General Public License as published by
213@@ -240,8 +240,10 @@
214 property var dialogLoader // dummy to satisfy ShellDialog's context dependent prop
215
216 Button {
217+ width: parent.width
218 objectName: "infoPopupOkButton"
219 text: i18n.tr("OK")
220+ focus: true
221 onClicked: {
222 PopupUtils.close(dialog)
223 root.infoPopupConfirmed();
224
225=== modified file 'qml/Components/ModeSwitchWarningDialog.qml'
226--- qml/Components/ModeSwitchWarningDialog.qml 2016-05-17 20:46:51 +0000
227+++ qml/Components/ModeSwitchWarningDialog.qml 2017-01-03 13:45:36 +0000
228@@ -1,5 +1,5 @@
229 /*
230- * Copyright (C) 2015 Canonical, Ltd.
231+ * Copyright (C) 2015-2017 Canonical, Ltd.
232 *
233 * This program is free software; you can redistribute it and/or modify
234 * it under the terms of the GNU General Public License as published by
235@@ -29,6 +29,7 @@
236 signal forceClose();
237
238 Label {
239+ width: parent.width
240 text: i18n.tr("Apps may have unsaved data:")
241 fontSize: "large"
242 color: "#5D5D5D"
243@@ -37,6 +38,7 @@
244 Repeater {
245 id: appRepeater
246 RowLayout {
247+ width: parent.width
248 spacing: units.gu(2)
249 Image {
250 Layout.preferredHeight: units.gu(2)
251@@ -54,20 +56,23 @@
252 }
253
254 Label {
255+ width: parent.width
256 text: i18n.ctr("Re-dock means connect the device again to an external screen/mouse/keyboard", "Re-dock, save your work and close these apps to continue.")
257 wrapMode: Text.WordWrap
258 color: "#888888"
259 }
260
261 Label {
262+ width: parent.width
263 text: i18n.tr("Or force close now (unsaved data will be lost).")
264 wrapMode: Text.WordWrap
265 color: "#888888"
266 }
267
268- ThinDivider {}
269+ ThinDivider { width: parent.width }
270
271 RowLayout {
272+ width: parent.width
273 Label {
274 objectName: "reconnectLabel"
275 Layout.fillWidth: true
276@@ -84,6 +89,7 @@
277 }
278
279 Button {
280+ focus: true
281 objectName: "forceCloseButton"
282 text: i18n.tr("Close all")
283 color: theme.palette.normal.negative
284
285=== modified file 'qml/Components/ShellDialog.qml'
286--- qml/Components/ShellDialog.qml 2016-03-29 03:47:39 +0000
287+++ qml/Components/ShellDialog.qml 2017-01-03 13:45:36 +0000
288@@ -1,5 +1,5 @@
289 /*
290- * Copyright (C) 2014 Canonical, Ltd.
291+ * Copyright (C) 2014-2017 Canonical, Ltd.
292 *
293 * This program is free software; you can redistribute it and/or modify
294 * it under the terms of the GNU General Public License as published by
295@@ -19,6 +19,7 @@
296 import Ubuntu.Components 1.3
297 import Ubuntu.Components.Themes 1.3
298 import Ubuntu.Components.Popups 1.3
299+import Utils 0.1
300
301 /*
302 A Dialog configured for use as a proper in-scene Dialog
303@@ -32,6 +33,8 @@
304 // NB: PopupBase, Dialog's superclass, will check for the existence of this property
305 property bool reparentToRootItem: false
306
307+ default property alias columnContents: column.data
308+
309 onVisibleChanged: { if (!visible && dialogLoader) { dialogLoader.active = false; } }
310
311 Keys.onEscapePressed: hide()
312@@ -50,4 +53,15 @@
313 __foreground.theme = themeHack
314 show();
315 }
316+
317+ TabFocusFence {
318+ width: parent.width
319+ height: column.height
320+ focus: true
321+ Column {
322+ id: column
323+ width: parent.width
324+ spacing: units.gu(2)
325+ }
326+ }
327 }
328
329=== modified file 'tests/mocks/Utils/CMakeLists.txt'
330--- tests/mocks/Utils/CMakeLists.txt 2016-12-07 13:43:25 +0000
331+++ tests/mocks/Utils/CMakeLists.txt 2017-01-03 13:45:36 +0000
332@@ -25,6 +25,7 @@
333 ${CMAKE_SOURCE_DIR}/plugins/Utils/deviceconfigparser.cpp
334 ${CMAKE_SOURCE_DIR}/plugins/Utils/globalfunctions.cpp
335 ${CMAKE_SOURCE_DIR}/plugins/Utils/appdrawerproxymodel.cpp
336+ ${CMAKE_SOURCE_DIR}/plugins/Utils/tabfocusfence.cpp
337 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
338 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
339 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
340
341=== modified file 'tests/mocks/Utils/plugin.cpp'
342--- tests/mocks/Utils/plugin.cpp 2016-11-01 18:18:56 +0000
343+++ tests/mocks/Utils/plugin.cpp 2017-01-03 13:45:36 +0000
344@@ -1,5 +1,5 @@
345 /*
346- * Copyright (C) 2015-2016 Canonical, Ltd.
347+ * Copyright (C) 2015-2017 Canonical, Ltd.
348 *
349 * This program is free software; you can redistribute it and/or modify
350 * it under the terms of the GNU General Public License as published by
351@@ -41,6 +41,7 @@
352 #include <deviceconfigparser.h>
353 #include <globalfunctions.h>
354 #include <appdrawerproxymodel.h>
355+#include <tabfocusfence.h>
356
357 static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
358 {
359@@ -84,4 +85,5 @@
360 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
361 qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
362 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
363+ qmlRegisterType<TabFocusFenceItem>(uri, 0, 1, "TabFocusFence");
364 }
365
366=== modified file 'tests/qmltests/tst_OrientedShell.qml'
367--- tests/qmltests/tst_OrientedShell.qml 2016-12-12 16:45:09 +0000
368+++ tests/qmltests/tst_OrientedShell.qml 2017-01-03 13:45:36 +0000
369@@ -1,5 +1,5 @@
370 /*
371- * Copyright (C) 2015-2016 Canonical, Ltd.
372+ * Copyright (C) 2015-2017 Canonical, Ltd.
373 *
374 * This program is free software; you can redistribute it and/or modify
375 * it under the terms of the GNU General Public License as published by
376@@ -1558,5 +1558,43 @@
377 verify(surface);
378 return surface.activeFocus;
379 }
380+
381+ function test_tabCyclyingInShutdownDialog() {
382+ loadShell("mako");
383+
384+ testCase.showPowerDialog();
385+
386+ var dialogs = findChild(orientedShell, "dialogs");
387+ var buttons = findChildsByType(dialogs, "Button");
388+
389+ tryCompare(buttons[0], "activeFocus", true);
390+
391+ keyClick(Qt.Key_Tab);
392+ tryCompare(buttons[1], "activeFocus", true);
393+
394+ keyClick(Qt.Key_Tab);
395+ tryCompare(buttons[2], "activeFocus", true);
396+
397+ keyClick(Qt.Key_Tab);
398+ tryCompare(buttons[0], "activeFocus", true);
399+
400+ keyClick(Qt.Key_Escape);
401+
402+ var dialogLoader = findChild(orientedShell, "dialogLoader");
403+ tryCompare(dialogLoader, "item", null);
404+ }
405+
406+ function test_escColosesShutdownDialog() {
407+ loadShell("mako");
408+
409+ testCase.showPowerDialog();
410+
411+ var dialogLoader = findChild(orientedShell, "dialogLoader");
412+ tryCompareFunction(function() { return dialogLoader.item !== null }, true);
413+
414+ keyClick(Qt.Key_Escape);
415+
416+ tryCompare(dialogLoader, "item", null);
417+ }
418 }
419 }

Subscribers

People subscribed via source and target branches