on xenial help sign in
Restore Esc to close dialog + test
commitcec096a7ab9fafa043f9103452adc26a7b5bd3b7 authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 3 Jan 2017, 14:45 (10 years ago) parent503032b
2 files changed+22
plugins/Utils/tabfocusfence.cpp+4 tests/qmltests/tst_OrientedShell.qml+18
plugins/Utils/tabfocusfence.cpp+4
@@ -30,6 +30,8 @@ void TabFocusFenceItem::keyPressEvent(QKeyEvent *event)
3030 // Needed so we eat Tab keys when there's only one item inside the fence
3131 if (event->key() == Qt::Key_Tab) {
3232 event->accept();
33+ } else {
34+ QQuickItem::keyPressEvent(event);
3335 }
3436}
3537
@@ -38,5 +40,7 @@ void TabFocusFenceItem::keyReleaseEvent(QKeyEvent *event)
3840 // Needed so we eat Tab keys when there's only one item inside the fence
3941 if (event->key() == Qt::Key_Tab) {
4042 event->accept();
43+ } else {
44+ QQuickItem::keyReleaseEvent(event);
4145 }
4246}
tests/qmltests/tst_OrientedShell.qml+18
@@ -1577,6 +1577,24 @@ Rectangle {
15771577
15781578 keyClick(Qt.Key_Tab);
15791579 tryCompare(buttons[0], "activeFocus", true);
1580+
1581+ keyClick(Qt.Key_Escape);
1582+
1583+ var dialogLoader = findChild(orientedShell, "dialogLoader");
1584+ tryCompare(dialogLoader, "item", null);
1585+ }
1586+
1587+ function test_escColosesShutdownDialog() {
1588+ loadShell("mako");
1589+
1590+ testCase.showPowerDialog();
1591+
1592+ var dialogLoader = findChild(orientedShell, "dialogLoader");
1593+ tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1594+
1595+ keyClick(Qt.Key_Escape);
1596+
1597+ tryCompare(dialogLoader, "item", null);
15801598 }
15811599 }
15821600}