ButtonRebindsFilter: Add test for disabled bindings
This was missed when it was first implemented, but now there's tests for checking if bindings can be disabled in the buttons rebind plugin.
This commit is contained in:
parent
47a538e61c
commit
0ea1bcfe89
1 changed files with 31 additions and 0 deletions
|
@ -36,6 +36,8 @@ private Q_SLOTS:
|
|||
void testMouse_data();
|
||||
void testMouse();
|
||||
|
||||
void testDisabled();
|
||||
|
||||
private:
|
||||
quint32 timestamp = 1;
|
||||
};
|
||||
|
@ -148,5 +150,34 @@ void TestButtonRebind::testMouse()
|
|||
Test::pointerButtonReleased(0x119, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testDisabled()
|
||||
{
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("Mouse"));
|
||||
buttonGroup.writeEntry("ExtraButton7", QStringList{"Disabled"}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy buttonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
input()->pointer()->warp(startGeometry.center());
|
||||
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// 0x119 is Qt::ExtraButton7
|
||||
Test::pointerButtonPressed(0x119, timestamp++);
|
||||
|
||||
// Qt::ExtraButton7 should not have been emitted if this button is disabled
|
||||
QVERIFY(!buttonChangedSpy.wait(std::chrono::milliseconds(100)));
|
||||
QCOMPARE(buttonChangedSpy.count(), 0);
|
||||
|
||||
Test::pointerButtonReleased(0x119, timestamp++);
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestButtonRebind)
|
||||
#include "buttonrebind_test.moc"
|
||||
|
|
Loading…
Reference in a new issue