From e8d6008726e62c39b0ee75bb710a6671b02f3487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Oct 2016 09:26:37 +0200 Subject: [PATCH] Test case for global shortcut Meta+Shift+w The global shortcut meta+shift+w does not trigger as the test case shows. CCBUG: 370341 --- .../integration/globalshortcuts_test.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 3a6478772f..f3968369cb 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -50,6 +50,7 @@ private Q_SLOTS: void testConsumedShift(); void testRepeatedTrigger(); void testUserActionsMenu(); + void testMetaShiftW(); }; void GlobalShortcutsTest::initTestCase() @@ -168,5 +169,32 @@ void GlobalShortcutsTest::testUserActionsMenu() kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); } +void GlobalShortcutsTest::testMetaShiftW() +{ + // BUG 370341 + QScopedPointer action(new QAction(nullptr)); + action->setProperty("componentName", QStringLiteral(KWIN_NAME)); + action->setObjectName(QStringLiteral("globalshortcuts-test-consumed-shift")); + QSignalSpy triggeredSpy(action.data(), &QAction::triggered); + QVERIFY(triggeredSpy.isValid()); + KGlobalAccel::self()->setShortcut(action.data(), QList{Qt::META + Qt::SHIFT + Qt::Key_W}, KGlobalAccel::NoAutoloading); + input()->registerShortcut(Qt::META + Qt::SHIFT + Qt::Key_W, action.data()); + + // press meta+shift+w + quint32 timestamp = 0; + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + QCOMPARE(input()->keyboardModifiers(), Qt::MetaModifier); + kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier | Qt::MetaModifier); + kwinApp()->platform()->keyboardKeyPressed(KEY_W, timestamp++); + QEXPECT_FAIL("", "BUG 370341", Continue); + QTRY_COMPARE(triggeredSpy.count(), 1); + kwinApp()->platform()->keyboardKeyReleased(KEY_W, timestamp++); + + // release meta+shift + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); +} + WAYLANDTEST_MAIN(GlobalShortcutsTest) #include "globalshortcuts_test.moc"