Test case for global shortcut Meta+Shift+w

The global shortcut meta+shift+w does not trigger as the test case
shows.

CCBUG: 370341
This commit is contained in:
Martin Gräßlin 2016-10-11 09:26:37 +02:00
parent 66d1a0cc7a
commit e8d6008726

View file

@ -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<QAction> 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<QKeySequence>{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"