From 280663fede3d7bb7756f774a9b9159600051ce10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 13 Aug 2016 15:09:21 +0200 Subject: [PATCH] [autotest/integration] Add pointer button events to ModifiersOnlyShortcutTest If a pointer button is pressed or gets pressed while a modifier is hold, the modifier only shortcuts should not trigger. The user wanted to use the modifier for the pointer button. This is not implemented yet, thus all is QEXPECT_FAIL. --- .../modifier_only_shortcut_test.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index a6b94962ad..f077c851cc 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -19,6 +19,7 @@ along with this program. If not, see . *********************************************************************/ #include "kwin_wayland_test.h" #include "cursor.h" +#include "input.h" #include "platform.h" #include "screens.h" #include "wayland_server.h" @@ -188,6 +189,36 @@ void ModifierOnlyShortcutTest::testTrigger() kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); QCOMPARE(triggeredSpy.count(), 2); + + // mouse button pressed before clicking modifier + kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::LeftButton); + kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::NoButton); + QEXPECT_FAIL("", "Button not yet handled", Continue); + QCOMPARE(triggeredSpy.count(), 2); + + // mouse button press before mod press, release before mod release + kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::LeftButton); + kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); + kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::NoButton); + QEXPECT_FAIL("", "Button not yet handled", Continue); + QCOMPARE(triggeredSpy.count(), 2); + + // mouse button click while mod is pressed + kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); + kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::LeftButton); + kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + QCOMPARE(input()->qtButtonStates(), Qt::NoButton); + QEXPECT_FAIL("", "Button not yet handled", Continue); + QCOMPARE(triggeredSpy.count(), 2); } WAYLANDTEST_MAIN(ModifierOnlyShortcutTest)