[autotest] Add test case for global shortcuts while screen is locked
They shouldn't be triggered if the screen is locked.
This commit is contained in:
parent
75261ab9f6
commit
500bc9c18c
1 changed files with 41 additions and 0 deletions
|
@ -65,6 +65,7 @@ private Q_SLOTS:
|
|||
void testPointerShortcut();
|
||||
void testAxisShortcut_data();
|
||||
void testAxisShortcut();
|
||||
void testKeyboardShortcut();
|
||||
|
||||
private:
|
||||
void unlock();
|
||||
|
@ -630,6 +631,46 @@ void LockScreenTest::testAxisShortcut()
|
|||
#undef PERFORM
|
||||
}
|
||||
|
||||
void LockScreenTest::testKeyboardShortcut()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
QScopedPointer<QAction> action(new QAction(nullptr));
|
||||
QSignalSpy actionSpy(action.data(), &QAction::triggered);
|
||||
QVERIFY(actionSpy.isValid());
|
||||
input()->registerShortcut(Qt::CTRL + Qt::META + Qt::ALT + Qt::Key_Space, action.data());
|
||||
|
||||
// try to trigger the shortcut
|
||||
quint32 timestamp = 1;
|
||||
KEYPRESS(KEY_LEFTCTRL);
|
||||
KEYPRESS(KEY_LEFTMETA);
|
||||
KEYPRESS(KEY_LEFTALT);
|
||||
KEYPRESS(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 1);
|
||||
KEYRELEASE(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 1);
|
||||
|
||||
LOCK
|
||||
KEYPRESS(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 1);
|
||||
KEYRELEASE(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 1);
|
||||
|
||||
UNLOCK
|
||||
KEYPRESS(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 2);
|
||||
KEYRELEASE(KEY_SPACE);
|
||||
QCoreApplication::instance()->processEvents();
|
||||
QCOMPARE(actionSpy.count(), 2);
|
||||
KEYRELEASE(KEY_LEFTCTRL);
|
||||
KEYRELEASE(KEY_LEFTMETA);
|
||||
KEYRELEASE(KEY_LEFTALT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANTEST_MAIN(KWin::LockScreenTest)
|
||||
|
|
Loading…
Reference in a new issue