Commit 974abbfa authored by Martin Flöser's avatar Martin Flöser

[autotests/integration] Add test case for global shortcuts with Fx

New test which tries to trigger Alt+F3 which does not work due to the
behavior how xkbcommon calculates consumed modifers. The combination
Ctrl+Alt+F3 generates a keysym (vt switching) so just pressing F3
already consumes ctrl and alt modifier.

For more information see:
 * https://github.com/xkbcommon/libxkbcommon/issues/17
 * https://bugs.freedesktop.org/show_bug.cgi?id=92818

CCBUG: 368989
parent 03b8477f
......@@ -23,9 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "platform.h"
#include "screens.h"
#include "shell_client.h"
#include "useractions.h"
#include "wayland_server.h"
#include "workspace.h"
#include <KWayland/Client/shell.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Server/seat_interface.h>
#include <KGlobalAccel>
......@@ -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> surface(Test::createSurface());
QScopedPointer<ShellSurface> 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"
......@@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_USERACTIONS_H
#include "ui_shortcutdialog.h"
#include <kwinglobals.h>
// Qt
#include <QDialog>
#include <QObject>
......@@ -52,7 +54,7 @@ class Client;
*
* @author Martin Gräßlin <mgraesslin@kde.org>
**/
class UserActionsMenu : public QObject
class KWIN_EXPORT UserActionsMenu : public QObject
{
Q_OBJECT
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment