diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 41b8d27251..2b8bc4c6c7 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -23,9 +23,12 @@ along with this program. If not, see . #include "platform.h" #include "screens.h" #include "shell_client.h" +#include "useractions.h" #include "wayland_server.h" #include "workspace.h" +#include +#include #include #include @@ -46,6 +49,7 @@ private Q_SLOTS: void testConsumedShift(); void testRepeatedTrigger(); + void testUserActionsMenu(); }; void GlobalShortcutsTest::initTestCase() @@ -67,12 +71,14 @@ void GlobalShortcutsTest::initTestCase() void GlobalShortcutsTest::init() { + QVERIFY(Test::setupWaylandConnection(s_socketName)); screens()->setCurrent(0); KWin::Cursor::setPos(QPoint(640, 512)); } void GlobalShortcutsTest::cleanup() { + Test::destroyWaylandConnection(); } void GlobalShortcutsTest::testConsumedShift() @@ -137,5 +143,32 @@ void GlobalShortcutsTest::testRepeatedTrigger() kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); } +void GlobalShortcutsTest::testUserActionsMenu() +{ + // this test tries to trigger the user actions menu with Alt+F3 + // the problem here is that pressing F3 consumes modifiers as it's part of the + // Ctrl+alt+F3 keysym for vt switching. xkbcommon considers all modifiers as consumed + // which a transformation to any keysym would cause + // for more information see: + // https://bugs.freedesktop.org/show_bug.cgi?id=92818 + // https://github.com/xkbcommon/libxkbcommon/issues/17 + + // first create a window + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + QVERIFY(c); + QVERIFY(c->isActive()); + + quint32 timestamp = 0; + QVERIFY(!workspace()->userActionsMenu()->isShown()); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + kwinApp()->platform()->keyboardKeyPressed(KEY_F3, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_F3, timestamp++); + QEXPECT_FAIL("", "BUG 368989", Continue); + QTRY_VERIFY(workspace()->userActionsMenu()->isShown()); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); +} + WAYLANDTEST_MAIN(GlobalShortcutsTest) #include "globalshortcuts_test.moc" diff --git a/useractions.h b/useractions.h index 2a7927e9da..9f489346e7 100644 --- a/useractions.h +++ b/useractions.h @@ -21,6 +21,8 @@ along with this program. If not, see . #define KWIN_USERACTIONS_H #include "ui_shortcutdialog.h" +#include + // Qt #include #include @@ -52,7 +54,7 @@ class Client; * * @author Martin Gräßlin **/ -class UserActionsMenu : public QObject +class KWIN_EXPORT UserActionsMenu : public QObject { Q_OBJECT public: