From 270a9633507f349d5b1a630e0f2de21c4723fe55 Mon Sep 17 00:00:00 2001 From: Julius Zint Date: Thu, 10 Mar 2022 11:27:35 +0100 Subject: [PATCH] Migrate all autotest input simulation functions [5/6] Make autotests create fake input devices Migrate all input simulation functions from kwinApp()->platform()->... to the their counter part in the Test namespace. --- .../integration/decoration_input_test.cpp | 91 ++++++----- .../dont_crash_aurorae_destroy_deco.cpp | 6 +- .../dont_crash_useractions_menu.cpp | 4 +- .../popup_open_close_animation_test.cpp | 4 +- .../integration/globalshortcuts_test.cpp | 92 +++++------ .../integration/input_stacking_order.cpp | 2 +- autotests/integration/inputmethod_test.cpp | 10 +- autotests/integration/internal_window.cpp | 79 +++++----- .../integration/keyboard_layout_test.cpp | 32 ++-- .../keymap_creation_failure_test.cpp | 4 +- autotests/integration/kwin_wayland_test.h | 12 +- autotests/integration/lockscreen.cpp | 73 +++++---- .../modifier_only_shortcut_test.cpp | 112 +++++++------- .../integration/move_resize_window_test.cpp | 14 +- .../integration/no_global_shortcuts_test.cpp | 38 ++--- .../integration/pointer_constraints_test.cpp | 12 +- autotests/integration/pointer_input.cpp | 102 ++++++------- autotests/integration/quick_tiling_test.cpp | 44 +++--- .../screenedge_client_show_test.cpp | 6 +- autotests/integration/screenedges_test.cpp | 26 ++-- .../scripting/minimizeall_test.cpp | 24 +-- .../integration/scripting/screenedge_test.cpp | 12 +- autotests/integration/tabbox_test.cpp | 36 ++--- autotests/integration/test_helpers.cpp | 42 +++-- autotests/integration/touch_input_test.cpp | 48 +++--- .../integration/window_selection_test.cpp | 70 ++++----- .../integration/xdgshellclient_rules_test.cpp | 144 +++++++++--------- autotests/integration/xdgshellclient_test.cpp | 6 +- 28 files changed, 566 insertions(+), 579 deletions(-) diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp index a82f313f54..8ff1a269f0 100644 --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -74,14 +74,11 @@ private: AbstractClient *showWindow(); }; -#define MOTION(target) \ - kwinApp()->platform()->pointerMotion(target, timestamp++) +#define MOTION(target) Test::pointerMotion(target, timestamp++) -#define PRESS \ - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++) +#define PRESS Test::pointerButtonPressed(BTN_LEFT, timestamp++) -#define RELEASE \ - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) +#define RELEASE Test::pointerButtonReleased(BTN_LEFT, timestamp++) AbstractClient *DecorationInputTest::showWindow() { @@ -191,13 +188,13 @@ void DecorationInputTest::testAxis() // TODO: mouse wheel direction looks wrong to me // simulate wheel - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); QVERIFY(c->keepBelow()); QVERIFY(!c->keepAbove()); - kwinApp()->platform()->pointerAxisVertical(-5.0, timestamp++); + Test::pointerAxisVertical(-5.0, timestamp++); QVERIFY(!c->keepBelow()); QVERIFY(!c->keepAbove()); - kwinApp()->platform()->pointerAxisVertical(-5.0, timestamp++); + Test::pointerAxisVertical(-5.0, timestamp++); QVERIFY(!c->keepBelow()); QVERIFY(c->keepAbove()); @@ -208,7 +205,7 @@ void DecorationInputTest::testAxis() QVERIFY(input()->pointer()->decoration()); QCOMPARE(input()->pointer()->decoration()->client(), c); QTEST(input()->pointer()->decoration()->decoration()->sectionUnderMouse(), "expectedSection"); - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); QVERIFY(!c->keepBelow()); QVERIFY(!c->keepAbove()); } @@ -284,17 +281,17 @@ void KWin::DecorationInputTest::testDoubleTap() const QPoint tapPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2); // double tap - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); + Test::touchUp(0, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(c->isOnAllDesktops()); // double tap again - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(c->isOnAllDesktops()); - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(!c->isOnAllDesktops()); // test top most deco pixel, BUG: 362860 @@ -304,14 +301,14 @@ void KWin::DecorationInputTest::testDoubleTap() c->move(QPoint(10, 10)); QFETCH(QPoint, decoPoint); // double click - kwinApp()->platform()->touchDown(0, decoPoint, timestamp++); + Test::touchDown(0, decoPoint, timestamp++); QVERIFY(input()->touch()->decoration()); QCOMPARE(input()->touch()->decoration()->client(), c); QTEST(input()->touch()->decoration()->decoration()->sectionUnderMouse(), "expectedSection"); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(!c->isOnAllDesktops()); - kwinApp()->platform()->touchDown(0, decoPoint, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, decoPoint, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(c->isOnAllDesktops()); } @@ -448,33 +445,33 @@ void DecorationInputTest::testTapToMove() quint32 timestamp = 1; QPoint p = QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2); - kwinApp()->platform()->touchDown(0, p, timestamp++); + Test::touchDown(0, p, timestamp++); QVERIFY(!c->isInteractiveMove()); QFETCH(QPoint, offset); QCOMPARE(input()->touch()->decorationPressId(), 0); - kwinApp()->platform()->touchMotion(0, p + offset, timestamp++); + Test::touchMotion(0, p + offset, timestamp++); const QPoint oldPos = c->pos(); QVERIFY(c->isInteractiveMove()); QCOMPARE(startMoveResizedSpy.count(), 1); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QTRY_VERIFY(!c->isInteractiveMove()); QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); QEXPECT_FAIL("", "Just trigger move doesn't move the window", Continue); QCOMPARE(c->pos(), oldPos + offset); // again - kwinApp()->platform()->touchDown(1, p + offset, timestamp++); + Test::touchDown(1, p + offset, timestamp++); QCOMPARE(input()->touch()->decorationPressId(), 1); QVERIFY(!c->isInteractiveMove()); QFETCH(QPoint, offset2); - kwinApp()->platform()->touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2, timestamp++); + Test::touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset2, timestamp++); QVERIFY(c->isInteractiveMove()); QCOMPARE(startMoveResizedSpy.count(), 2); QFETCH(QPoint, offset3); - kwinApp()->platform()->touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3, timestamp++); + Test::touchMotion(1, QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2) + offset3, timestamp++); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QTRY_VERIFY(!c->isInteractiveMove()); QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); // TODO: the offset should also be included @@ -610,22 +607,22 @@ void DecorationInputTest::testModifierClickUnrestrictedMove() quint32 timestamp = 1; QFETCH(bool, capsLock); if (capsLock) { - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); } QFETCH(int, modifierKey); QFETCH(int, mouseButton); - kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++); + Test::keyboardKeyPressed(modifierKey, timestamp++); QVERIFY(!c->isInteractiveMove()); - kwinApp()->platform()->pointerButtonPressed(mouseButton, timestamp++); + Test::pointerButtonPressed(mouseButton, timestamp++); QVERIFY(c->isInteractiveMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); + Test::keyboardKeyReleased(modifierKey, timestamp++); QVERIFY(c->isInteractiveMove()); // but releasing the key should end move/resize - kwinApp()->platform()->pointerButtonReleased(mouseButton, timestamp++); + Test::pointerButtonReleased(mouseButton, timestamp++); QVERIFY(!c->isInteractiveMove()); if (capsLock) { - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); } } @@ -675,17 +672,17 @@ void DecorationInputTest::testModifierScrollOpacity() quint32 timestamp = 1; QFETCH(bool, capsLock); if (capsLock) { - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); } QFETCH(int, modifierKey); - kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++); - kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); + Test::keyboardKeyPressed(modifierKey, timestamp++); + Test::pointerAxisVertical(-5, timestamp++); QCOMPARE(c->opacity(), 0.6); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QCOMPARE(c->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); + Test::keyboardKeyReleased(modifierKey, timestamp++); if (capsLock) { - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); } } @@ -732,12 +729,12 @@ void DecorationInputTest::testTouchEvents() const QPoint tapPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2); QVERIFY(!input()->touch()->decoration()); - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); QVERIFY(input()->touch()->decoration()); QCOMPARE(input()->touch()->decoration()->decoration(), c->decoration()); QCOMPARE(hoverMoveSpy.count(), 1); QCOMPARE(hoverLeaveSpy.count(), 0); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(hoverMoveSpy.count(), 1); QCOMPARE(hoverLeaveSpy.count(), 1); @@ -746,10 +743,10 @@ void DecorationInputTest::testTouchEvents() // let's check that a hover motion is sent if the pointer is on deco, when touch release Cursors::self()->mouse()->setPos(tapPoint); QCOMPARE(hoverMoveSpy.count(), 2); - kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); + Test::touchDown(0, tapPoint, timestamp++); QCOMPARE(hoverMoveSpy.count(), 3); QCOMPARE(hoverLeaveSpy.count(), 1); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(hoverMoveSpy.count(), 3); QCOMPARE(hoverLeaveSpy.count(), 2); } @@ -785,9 +782,9 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents() // now send a key quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QVERIFY(keyEvent.wait()); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QVERIFY(keyEvent.wait()); c->decoratedClient()->requestHideToolTip(); diff --git a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp index 927dff7ff4..e45d951cd3 100644 --- a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp +++ b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp @@ -120,9 +120,9 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows() QSignalSpy maximizedStateChangedSpy(client, static_cast(&AbstractClient::clientMaximizedStateChanged)); QVERIFY(maximizedStateChangedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion(client->frameGeometry().topLeft() + scenePoint.toPoint(), timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerMotion(client->frameGeometry().topLeft() + scenePoint.toPoint(), timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(maximizedStateChangedSpy.wait()); QCOMPARE(client->maximizeMode(), MaximizeFull); QCOMPARE(client->noBorder(), true); diff --git a/autotests/integration/dont_crash_useractions_menu.cpp b/autotests/integration/dont_crash_useractions_menu.cpp index df9037c61f..5c3f5c061e 100644 --- a/autotests/integration/dont_crash_useractions_menu.cpp +++ b/autotests/integration/dont_crash_useractions_menu.cpp @@ -90,8 +90,8 @@ void TestDontCrashUseractionsMenu::testShowHideShowUseractionsMenu() QTRY_VERIFY(userActionsMenu->isShown()); QVERIFY(userActionsMenu->hasClient()); - kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, 1); + Test::keyboardKeyPressed(KEY_ESC, 0); + Test::keyboardKeyReleased(KEY_ESC, 1); QTRY_VERIFY(!userActionsMenu->isShown()); QVERIFY(!userActionsMenu->hasClient()); diff --git a/autotests/integration/effects/popup_open_close_animation_test.cpp b/autotests/integration/effects/popup_open_close_animation_test.cpp index cbb41b92a2..eb6d60aafb 100644 --- a/autotests/integration/effects/popup_open_close_animation_test.cpp +++ b/autotests/integration/effects/popup_open_close_animation_test.cpp @@ -186,8 +186,8 @@ void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup() QTRY_VERIFY(!effect->isActive()); // Close the user actions popup. - kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, 1); + Test::keyboardKeyPressed(KEY_ESC, 0); + Test::keyboardKeyReleased(KEY_ESC, 1); QTRY_VERIFY(!userActionsMenu->isShown()); QVERIFY(!userActionsMenu->hasClient()); QVERIFY(effect->isActive()); diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 00e9ab8aa8..50c7da10ce 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -154,12 +154,12 @@ void GlobalShortcutsTest::testNonLatinLayout() input()->registerShortcut(seq, action.data()); quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++); + Test::keyboardKeyPressed(modifierKey, timestamp++); QCOMPARE(input()->keyboardModifiers(), qtModifier); - kwinApp()->platform()->keyboardKeyPressed(key, timestamp++); + Test::keyboardKeyPressed(key, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(key, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); + Test::keyboardKeyReleased(key, timestamp++); + Test::keyboardKeyReleased(modifierKey, timestamp++); QTRY_COMPARE_WITH_TIMEOUT(triggeredSpy.count(), 1, 100); } @@ -178,14 +178,14 @@ void GlobalShortcutsTest::testConsumedShift() // press shift+5 quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_5, timestamp++); + Test::keyboardKeyPressed(KEY_5, timestamp++); QTRY_COMPARE(triggeredSpy.count(), 1); - kwinApp()->platform()->keyboardKeyReleased(KEY_5, timestamp++); + Test::keyboardKeyReleased(KEY_5, timestamp++); // release shift - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); } void GlobalShortcutsTest::testRepeatedTrigger() @@ -206,23 +206,23 @@ void GlobalShortcutsTest::testRepeatedTrigger() // press shift+5 quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_WAKEUP, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_WAKEUP, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_5, timestamp++); + Test::keyboardKeyPressed(KEY_5, timestamp++); QTRY_COMPARE(triggeredSpy.count(), 1); // and should repeat QVERIFY(triggeredSpy.wait()); QVERIFY(triggeredSpy.wait()); // now release the key - kwinApp()->platform()->keyboardKeyReleased(KEY_5, timestamp++); + Test::keyboardKeyReleased(KEY_5, timestamp++); QVERIFY(!triggeredSpy.wait(50)); - kwinApp()->platform()->keyboardKeyReleased(KEY_WAKEUP, timestamp++); + Test::keyboardKeyReleased(KEY_WAKEUP, timestamp++); QVERIFY(!triggeredSpy.wait(50)); // release shift - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); } void GlobalShortcutsTest::testUserActionsMenu() @@ -244,11 +244,11 @@ void GlobalShortcutsTest::testUserActionsMenu() quint32 timestamp = 0; QVERIFY(!workspace()->userActionsMenu()->isShown()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_F3, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_F3, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_F3, timestamp++); + Test::keyboardKeyReleased(KEY_F3, timestamp++); QTRY_VERIFY(workspace()->userActionsMenu()->isShown()); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); } void GlobalShortcutsTest::testMetaShiftW() @@ -264,17 +264,17 @@ void GlobalShortcutsTest::testMetaShiftW() // press meta+shift+w quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::MetaModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier | Qt::MetaModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_W, timestamp++); + Test::keyboardKeyPressed(KEY_W, timestamp++); QTRY_COMPARE(triggeredSpy.count(), 1); - kwinApp()->platform()->keyboardKeyReleased(KEY_W, timestamp++); + Test::keyboardKeyReleased(KEY_W, timestamp++); // release meta+shift - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); } void GlobalShortcutsTest::testComponseKey() @@ -290,8 +290,8 @@ void GlobalShortcutsTest::testComponseKey() // press & release ` quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_RESERVED, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RESERVED, timestamp++); + Test::keyboardKeyPressed(KEY_RESERVED, timestamp++); + Test::keyboardKeyReleased(KEY_RESERVED, timestamp++); QTRY_COMPARE(triggeredSpy.count(), 0); } @@ -359,13 +359,13 @@ void GlobalShortcutsTest::testX11ClientShortcut() // now let's trigger the shortcut quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_Y, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_Y, timestamp++); QTRY_COMPARE(workspace()->activeClient(), client); - kwinApp()->platform()->keyboardKeyReleased(KEY_Y, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_Y, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); // destroy window again QSignalSpy windowClosedSpy(client, &X11Client::windowClosed); @@ -398,13 +398,13 @@ void GlobalShortcutsTest::testWaylandClientShortcut() // now let's trigger the shortcut quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_Y, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_Y, timestamp++); QTRY_COMPARE(workspace()->activeClient(), client); - kwinApp()->platform()->keyboardKeyReleased(KEY_Y, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_Y, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); shellSurface.reset(); surface.reset(); @@ -441,18 +441,18 @@ void GlobalShortcutsTest::testSetupWindowShortcut() QTRY_VERIFY(sequenceEdit->hasFocus()); quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_Y, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_Y, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_Y, timestamp++); + Test::keyboardKeyReleased(KEY_Y, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); // the sequence gets accepted after one second, so wait a bit longer QTest::qWait(2000); // now send in enter - kwinApp()->platform()->keyboardKeyPressed(KEY_ENTER, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_ENTER, timestamp++); + Test::keyboardKeyPressed(KEY_ENTER, timestamp++); + Test::keyboardKeyReleased(KEY_ENTER, timestamp++); QTRY_COMPARE(client->shortcut(), QKeySequence(Qt::META | Qt::SHIFT | Qt::Key_Y)); } diff --git a/autotests/integration/input_stacking_order.cpp b/autotests/integration/input_stacking_order.cpp index 071455d845..5e88f30bd3 100644 --- a/autotests/integration/input_stacking_order.cpp +++ b/autotests/integration/input_stacking_order.cpp @@ -130,7 +130,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange() QCOMPARE(window1->frameGeometry(), window2->frameGeometry()); // enter - kwinApp()->platform()->pointerMotion(QPointF(25, 25), 1); + Test::pointerMotion(QPointF(25, 25), 1); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 1); // window 2 should have focus diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index 217b962cef..32c2567509 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -65,8 +65,8 @@ private Q_SLOTS: private: void touchNow() { static int time = 0; - kwinApp()->platform()->touchDown(0, {100, 100}, ++time); - kwinApp()->platform()->touchUp(0, ++time); + Test::touchDown(0, {100, 100}, ++time); + Test::touchUp(0, ++time); } }; @@ -508,13 +508,13 @@ void InputMethodTest::testModifierForwarding() QVERIFY(keyChanged); modifiersChanged = true; }); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); QVERIFY(keySpy.count() == 1 || keySpy.wait()); QVERIFY(modifierSpy.count() == 2 || modifierSpy.wait()); disconnect(keyChangedConnection); disconnect(modifiersChangedConnection); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QVERIFY(keySpy.count() == 2 || keySpy.wait()); QVERIFY(modifierSpy.count() == 2 || modifierSpy.wait()); @@ -529,7 +529,7 @@ void InputMethodTest::testModifierForwarding() QVERIFY(keyChanged); modifiersChanged = true; }); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(keySpy.count() == 3 || keySpy.wait()); QVERIFY(modifierSpy.count() == 3 || modifierSpy.wait()); disconnect(keyChangedConnection); diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index 76207a0668..dd40f91b78 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -234,24 +234,24 @@ void InternalWindowTest::testEnterLeave() QVERIFY(moveSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); + Test::pointerMotion(QPoint(50, 50), timestamp++); QTRY_COMPARE(moveSpy.count(), 1); - kwinApp()->platform()->pointerMotion(QPoint(60, 50), timestamp++); + Test::pointerMotion(QPoint(60, 50), timestamp++); QTRY_COMPARE(moveSpy.count(), 2); QCOMPARE(moveSpy[1].first().toPoint(), QPoint(60, 50)); - kwinApp()->platform()->pointerMotion(QPoint(101, 50), timestamp++); + Test::pointerMotion(QPoint(101, 50), timestamp++); QTRY_COMPARE(leaveSpy.count(), 1); // set a mask on the window win.setMask(QRegion(10, 20, 30, 40)); // outside the mask we should not get an enter - kwinApp()->platform()->pointerMotion(QPoint(5, 5), timestamp++); + Test::pointerMotion(QPoint(5, 5), timestamp++); QVERIFY(!enterSpy.wait(100)); QCOMPARE(enterSpy.count(), 1); // inside the mask we should still get an enter - kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++); + Test::pointerMotion(QPoint(25, 27), timestamp++); QTRY_COMPARE(enterSpy.count(), 2); } @@ -270,11 +270,11 @@ void InternalWindowTest::testPointerPressRelease() QTRY_COMPARE(clientAddedSpy.count(), 1); quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); + Test::pointerMotion(QPoint(50, 50), timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QTRY_COMPARE(pressSpy.count(), 1); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QTRY_COMPARE(releaseSpy.count(), 1); } @@ -290,11 +290,11 @@ void InternalWindowTest::testPointerAxis() QTRY_COMPARE(clientAddedSpy.count(), 1); quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++); + Test::pointerMotion(QPoint(50, 50), timestamp++); - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); QTRY_COMPARE(wheelSpy.count(), 1); - kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); + Test::pointerAxisHorizontal(5.0, timestamp++); QTRY_COMPARE(wheelSpy.count(), 2); } @@ -325,12 +325,12 @@ void InternalWindowTest::testKeyboard() quint32 timestamp = 1; QFETCH(QPoint, cursorPos); - kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); + Test::pointerMotion(cursorPos, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QTRY_COMPARE(pressSpy.count(), 1); QCOMPARE(releaseSpy.count(), 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QTRY_COMPARE(releaseSpy.count(), 1); QCOMPARE(pressSpy.count(), 1); } @@ -355,13 +355,13 @@ void InternalWindowTest::testKeyboardShowWithoutActivating() quint32 timestamp = 1; const QPoint cursorPos = QPoint(50, 50); - kwinApp()->platform()->pointerMotion(cursorPos, timestamp++); + Test::pointerMotion(cursorPos, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QCOMPARE(pressSpy.count(), 0); QVERIFY(!pressSpy.wait(100)); QCOMPARE(releaseSpy.count(), 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QCOMPARE(releaseSpy.count(), 0); QVERIFY(!releaseSpy.wait(100)); QCOMPARE(pressSpy.count(), 0); @@ -413,18 +413,18 @@ void InternalWindowTest::testKeyboardTriggersLeave() // now let's trigger a key, which should result in a leave quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QVERIFY(leftSpy.wait()); QCOMPARE(pressSpy.count(), 1); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QTRY_COMPARE(releaseSpy.count(), 1); // after hiding the internal window, next key press should trigger an enter win.hide(); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); QVERIFY(enteredSpy.wait()); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); // Destroy the test client. shellSurface.reset(); @@ -450,46 +450,46 @@ void InternalWindowTest::testTouch() quint32 timestamp = 1; QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); - kwinApp()->platform()->touchDown(0, QPointF(50, 50), timestamp++); + Test::touchDown(0, QPointF(50, 50), timestamp++); QCOMPARE(pressSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(50, 50)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons(Qt::LeftButton)); // further touch down should not trigger - kwinApp()->platform()->touchDown(1, QPointF(75, 75), timestamp++); + Test::touchDown(1, QPointF(75, 75), timestamp++); QCOMPARE(pressSpy.count(), 1); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QCOMPARE(releaseSpy.count(), 0); QCOMPARE(win.latestGlobalMousePos(), QPoint(50, 50)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons(Qt::LeftButton)); // another press - kwinApp()->platform()->touchDown(1, QPointF(10, 10), timestamp++); + Test::touchDown(1, QPointF(10, 10), timestamp++); QCOMPARE(pressSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(50, 50)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons(Qt::LeftButton)); // simulate the move QCOMPARE(moveSpy.count(), 0); - kwinApp()->platform()->touchMotion(0, QPointF(80, 90), timestamp++); + Test::touchMotion(0, QPointF(80, 90), timestamp++); QCOMPARE(moveSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons(Qt::LeftButton)); // move on other ID should not do anything - kwinApp()->platform()->touchMotion(1, QPointF(20, 30), timestamp++); + Test::touchMotion(1, QPointF(20, 30), timestamp++); QCOMPARE(moveSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons(Qt::LeftButton)); // now up our main point - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(releaseSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); QCOMPARE(win.pressedButtons(), Qt::MouseButtons()); // and up the additional point - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QCOMPARE(releaseSpy.count(), 1); QCOMPARE(moveSpy.count(), 1); QCOMPARE(win.latestGlobalMousePos(), QPoint(80, 90)); @@ -613,15 +613,15 @@ void InternalWindowTest::testModifierClickUnrestrictedMove() // simulate modifier+click quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QVERIFY(!internalClient->isInteractiveMove()); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(internalClient->isInteractiveMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QVERIFY(internalClient->isInteractiveMove()); // but releasing the key should end move/resize - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(!internalClient->isInteractiveMove()); } @@ -651,12 +651,12 @@ void InternalWindowTest::testModifierScroll() internalClient->setOpacity(0.5); QCOMPARE(internalClient->opacity(), 0.5); quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::pointerAxisVertical(-5, timestamp++); QCOMPARE(internalClient->opacity(), 0.6); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QCOMPARE(internalClient->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); } void InternalWindowTest::testPopup() @@ -849,9 +849,8 @@ void InternalWindowTest::testDismissPopup() // Click somewhere outside the popup window. QSignalSpy popupClosedSpy(serverPopup, &InternalClient::windowClosed); quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(serverOtherToplevel->frameGeometry().center(), - timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerMotion(serverOtherToplevel->frameGeometry().center(), timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QTRY_COMPARE(popupClosedSpy.count(), 1); } diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp index ae41c8a5c8..136a8a61bf 100644 --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -275,22 +275,22 @@ void KeyboardLayoutTest::testPerLayoutShortcut() // now switch to English through the global shortcut quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); QVERIFY(layoutChangedSpy.wait()); // now layout should be German QCOMPARE(xkb->layoutName(), QStringLiteral("German")); // release keys again - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); // switch back to English - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); QVERIFY(layoutChangedSpy.wait()); QCOMPARE(xkb->layoutName(), QStringLiteral("English (US)")); // release keys again - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); } void KeyboardLayoutTest::testDBusServiceExport() @@ -505,13 +505,13 @@ void KeyboardLayoutTest::testNumLock() // by default not set QVERIFY(!xkb->leds().testFlag(LED::NumLock)); quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_NUMLOCK, timestamp++); // now it should be on QVERIFY(xkb->leds().testFlag(LED::NumLock)); // and back to off - kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_NUMLOCK, timestamp++); QVERIFY(!xkb->leds().testFlag(LED::NumLock)); // let's reconfigure to enable through config @@ -522,13 +522,13 @@ void KeyboardLayoutTest::testNumLock() // now it should be on QVERIFY(xkb->leds().testFlag(LED::NumLock)); // pressing should result in it being off - kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_NUMLOCK, timestamp++); QVERIFY(!xkb->leds().testFlag(LED::NumLock)); // pressing again should enable it - kwinApp()->platform()->keyboardKeyPressed(KEY_NUMLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_NUMLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_NUMLOCK, timestamp++); QVERIFY(xkb->leds().testFlag(LED::NumLock)); // now reconfigure to disable on load diff --git a/autotests/integration/keymap_creation_failure_test.cpp b/autotests/integration/keymap_creation_failure_test.cpp index b781d909c0..7abe02eada 100644 --- a/autotests/integration/keymap_creation_failure_test.cpp +++ b/autotests/integration/keymap_creation_failure_test.cpp @@ -82,8 +82,8 @@ void KeymapCreationFailureTest::testPointerButton() // now create the crashing condition // which is sending in a pointer event - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, 0); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, 1); + Test::pointerButtonPressed(BTN_LEFT, 0); + Test::pointerButtonReleased(BTN_LEFT, 1); } WAYLANDTEST_MAIN(KeymapCreationFailureTest) diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index db3303003e..8f71e58fdc 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -518,10 +518,14 @@ private: void keyboardKeyPressed(quint32 key, quint32 time); void keyboardKeyReleased(quint32 key, quint32 time); -void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta = 0, - InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); -void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta = 0, - InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); +void pointerAxisHorizontal(qreal delta, + quint32 time, + qint32 discreteDelta = 0, + InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); +void pointerAxisVertical(qreal delta, + quint32 time, + qint32 discreteDelta = 0, + InputRedirection::PointerAxisSource source = InputRedirection::PointerAxisSourceUnknown); void pointerButtonPressed(quint32 button, quint32 time); void pointerButtonReleased(quint32 button, quint32 time); void pointerMotion(const QPointF &position, quint32 time); diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp index 91f00565df..4b2da369da 100644 --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -116,20 +116,15 @@ Q_SIGNALS: QCOMPARE(lockStateChangedSpy.count(), expectedLockCount + 1); \ QVERIFY(!waylandServer()->isScreenLocked()); -#define MOTION(target) \ - kwinApp()->platform()->pointerMotion(target, timestamp++) +#define MOTION(target) Test::pointerMotion(target, timestamp++) -#define PRESS \ - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++) +#define PRESS Test::pointerButtonPressed(BTN_LEFT, timestamp++) -#define RELEASE \ - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) +#define RELEASE Test::pointerButtonReleased(BTN_LEFT, timestamp++) -#define KEYPRESS( key ) \ - kwinApp()->platform()->keyboardKeyPressed(key, timestamp++) +#define KEYPRESS(key) Test::keyboardKeyPressed(key, timestamp++) -#define KEYRELEASE( key ) \ - kwinApp()->platform()->keyboardKeyReleased(key, timestamp++) +#define KEYRELEASE(key) Test::keyboardKeyReleased(key, timestamp++) void LockScreenTest::unlock() { @@ -337,15 +332,15 @@ void LockScreenTest::testPointerAxis() MOTION(c->frameGeometry().center()); QVERIFY(enteredSpy.wait()); // and simulate axis - kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); + Test::pointerAxisHorizontal(5.0, timestamp++); QVERIFY(axisChangedSpy.wait()); LOCK - // and simulate axis - kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); + // and simulate axis + Test::pointerAxisHorizontal(5.0, timestamp++); QVERIFY(!axisChangedSpy.wait(100)); - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); QVERIFY(!axisChangedSpy.wait(100)); // and unlock @@ -354,9 +349,9 @@ void LockScreenTest::testPointerAxis() QCOMPARE(enteredSpy.count(), 2); // and move axis again - kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); + Test::pointerAxisHorizontal(5.0, timestamp++); QVERIFY(axisChangedSpy.wait()); - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); QVERIFY(axisChangedSpy.wait()); } @@ -570,32 +565,32 @@ void LockScreenTest::testMoveWindow() workspace()->slotWindowMove(); QCOMPARE(workspace()->moveResizeClient(), c); QVERIFY(c->isInteractiveMove()); - kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_RIGHT, timestamp++); QEXPECT_FAIL("", "First event is ignored", Continue); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); // TODO adjust once the expected fail is fixed - kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_RIGHT, timestamp++); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); // while locking our window should continue to be in move resize LOCK QCOMPARE(workspace()->moveResizeClient(), c); QVERIFY(c->isInteractiveMove()); - kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_RIGHT, timestamp++); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); UNLOCK QCOMPARE(workspace()->moveResizeClient(), c); QVERIFY(c->isInteractiveMove()); - kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_RIGHT, timestamp++); QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); - kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); + Test::keyboardKeyPressed(KEY_ESC, timestamp++); + Test::keyboardKeyReleased(KEY_ESC, timestamp++); QVERIFY(!c->isInteractiveMove()); } @@ -610,12 +605,12 @@ void LockScreenTest::testPointerShortcut() // try to trigger the shortcut quint32 timestamp = 1; #define PERFORM(expectedCount) \ - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ PRESS; \ QCoreApplication::instance()->processEvents(); \ QCOMPARE(actionSpy.count(), expectedCount); \ RELEASE; \ - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ QCoreApplication::instance()->processEvents(); \ QCOMPARE(actionSpy.count(), expectedCount); @@ -662,14 +657,14 @@ void LockScreenTest::testAxisShortcut() // try to trigger the shortcut quint32 timestamp = 1; #define PERFORM(expectedCount) \ - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ if (direction == Qt::Vertical) \ - kwinApp()->platform()->pointerAxisVertical(sign * 5.0, timestamp++); \ + Test::pointerAxisVertical(sign * 5.0, timestamp++); \ else \ - kwinApp()->platform()->pointerAxisHorizontal(sign * 5.0, timestamp++); \ + Test::pointerAxisHorizontal(sign * 5.0, timestamp++); \ QCoreApplication::instance()->processEvents(); \ QCOMPARE(actionSpy.count(), expectedCount); \ - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ QCoreApplication::instance()->processEvents(); \ QCOMPARE(actionSpy.count(), expectedCount); @@ -745,24 +740,24 @@ void LockScreenTest::testTouch() QVERIFY(pointRemovedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++); + Test::touchDown(1, QPointF(25, 25), timestamp++); QVERIFY(sequenceStartedSpy.wait()); QCOMPARE(sequenceStartedSpy.count(), 1); LOCK QVERIFY(cancelSpy.wait()); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QVERIFY(!pointRemovedSpy.wait(100)); - kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++); - kwinApp()->platform()->touchMotion(1, QPointF(26, 26), timestamp++); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchDown(1, QPointF(25, 25), timestamp++); + Test::touchMotion(1, QPointF(26, 26), timestamp++); + Test::touchUp(1, timestamp++); UNLOCK - kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++); + Test::touchDown(1, QPointF(25, 25), timestamp++); QVERIFY(sequenceStartedSpy.wait()); QCOMPARE(sequenceStartedSpy.count(), 2); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QVERIFY(pointRemovedSpy.wait()); QCOMPARE(pointRemovedSpy.count(), 1); } diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index 73519a476d..82909bb689 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -147,93 +147,93 @@ void ModifierOnlyShortcutTest::testTrigger() // configured shortcut should trigger quint32 timestamp = 1; QFETCH(int, modifier); - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 1); // the other shortcuts should not trigger QFETCH(QList, nonTriggeringMods); for (auto it = nonTriggeringMods.constBegin(), end = nonTriggeringMods.constEnd(); it != end; it++) { - kwinApp()->platform()->keyboardKeyPressed(*it, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(*it, timestamp++); + Test::keyboardKeyPressed(*it, timestamp++); + Test::keyboardKeyReleased(*it, timestamp++); QCOMPARE(triggeredSpy.count(), 1); } // try configured again - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // click another key while modifier is held - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // release other key after modifier release - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // press key before pressing modifier - kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++); + Test::keyboardKeyPressed(KEY_A, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyReleased(KEY_A, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // mouse button pressed before clicking modifier - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::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++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QCOMPARE(input()->qtButtonStates(), Qt::NoButton); QCOMPARE(triggeredSpy.count(), 2); // mouse button press before mod press, release before mod release - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::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++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(input()->qtButtonStates(), Qt::NoButton); QCOMPARE(triggeredSpy.count(), 2); // mouse button click while mod is pressed - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QCOMPARE(input()->qtButtonStates(), Qt::LeftButton); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(input()->qtButtonStates(), Qt::NoButton); QCOMPARE(triggeredSpy.count(), 2); // scroll while mod is pressed - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::pointerAxisVertical(5.0, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // same for horizontal - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::pointerAxisHorizontal(5.0, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); #if KWIN_BUILD_SCREENLOCKER // now try to lock the screen while modifier key is pressed - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); QVERIFY(Test::lockScreen()); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); // now trigger while screen is locked, should also not work - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 2); QVERIFY(Test::unlockScreen()); @@ -259,20 +259,20 @@ void ModifierOnlyShortcutTest::testCapsLock() // first test that the normal shortcut triggers quint32 timestamp = 1; const int modifier = KEY_LEFTSHIFT; - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 1); // now capslock - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier); QCOMPARE(triggeredSpy.count(), 1); // currently caps lock is on // shift still triggers - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier); QCOMPARE(triggeredSpy.count(), 2); @@ -283,10 +283,10 @@ void ModifierOnlyShortcutTest::testCapsLock() group.writeEntry("Control", QStringList()); group.sync(); workspace()->slotReconfigure(); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier | Qt::MetaModifier); QCOMPARE(input()->keyboard()->xkb()->modifiersRelevantForGlobalShortcuts(), Qt::MetaModifier); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QCOMPARE(triggeredSpy.count(), 3); // set back to shift to ensure we don't trigger with capslock @@ -298,8 +298,8 @@ void ModifierOnlyShortcutTest::testCapsLock() workspace()->slotReconfigure(); // release caps lock - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::NoModifier); QCOMPARE(triggeredSpy.count(), 3); } @@ -350,8 +350,8 @@ void ModifierOnlyShortcutTest::testGlobalShortcutsDisabled() quint32 timestamp = 1; QFETCH(int, modifier); QVERIFY(!workspace()->globalShortcutsDisabled()); - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 1); triggeredSpy.clear(); @@ -359,8 +359,8 @@ void ModifierOnlyShortcutTest::testGlobalShortcutsDisabled() workspace()->disableGlobalShortcutsForClient(true); QVERIFY(workspace()->globalShortcutsDisabled()); // Should not get triggered - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 0); triggeredSpy.clear(); @@ -368,8 +368,8 @@ void ModifierOnlyShortcutTest::testGlobalShortcutsDisabled() workspace()->disableGlobalShortcutsForClient(false); QVERIFY(!workspace()->globalShortcutsDisabled()); // should get triggered again - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 1); } diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 12d5152430..66b428396f 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -512,22 +512,22 @@ void MoveResizeWindowTest::testPointerMoveEnd() // let's trigger the left button quint32 timestamp = 1; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(!c->isInteractiveMove()); workspace()->slotWindowMove(); QVERIFY(c->isInteractiveMove()); // let's press another button QFETCH(int, additionalButton); - kwinApp()->platform()->pointerButtonPressed(additionalButton, timestamp++); + Test::pointerButtonPressed(additionalButton, timestamp++); QVERIFY(c->isInteractiveMove()); // release the left button, should still have the window moving - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(c->isInteractiveMove()); // but releasing the other button should now end moving - kwinApp()->platform()->pointerButtonReleased(additionalButton, timestamp++); + Test::pointerButtonReleased(additionalButton, timestamp++); QVERIFY(!c->isInteractiveMove()); surface.reset(); QVERIFY(Test::waitForWindowDestroyed(c)); @@ -556,7 +556,7 @@ void MoveResizeWindowTest::testClientSideMove() QCOMPARE(pointerEnteredSpy.first().last().toPoint(), QPoint(49, 24)); // simulate press quint32 timestamp = 1; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(buttonSpy.wait()); QSignalSpy moveStartSpy(c, &AbstractClient::clientStartUserMovedResized); QVERIFY(moveStartSpy.isValid()); @@ -571,11 +571,11 @@ void MoveResizeWindowTest::testClientSideMove() const QPoint startPoint = startGeometry.center(); const int dragDistance = QApplication::startDragDistance(); // Why? - kwinApp()->platform()->pointerMotion(startPoint + QPoint(dragDistance, dragDistance) + QPoint(6, 6), timestamp++); + Test::pointerMotion(startPoint + QPoint(dragDistance, dragDistance) + QPoint(6, 6), timestamp++); QCOMPARE(clientMoveStepSpy.count(), 1); // and release again - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(pointerEnteredSpy.wait()); QCOMPARE(c->isInteractiveMove(), false); QCOMPARE(c->frameGeometry(), startGeometry.translated(QPoint(dragDistance, dragDistance) + QPoint(6, 6))); diff --git a/autotests/integration/no_global_shortcuts_test.cpp b/autotests/integration/no_global_shortcuts_test.cpp index bcb4b17923..4f037623bf 100644 --- a/autotests/integration/no_global_shortcuts_test.cpp +++ b/autotests/integration/no_global_shortcuts_test.cpp @@ -156,15 +156,15 @@ void NoGlobalShortcutsTest::testTrigger() // configured shortcut should trigger quint32 timestamp = 1; QFETCH(int, modifier); - kwinApp()->platform()->keyboardKeyPressed(modifier, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(modifier, timestamp++); + Test::keyboardKeyPressed(modifier, timestamp++); + Test::keyboardKeyReleased(modifier, timestamp++); QCOMPARE(triggeredSpy.count(), 0); // the other shortcuts should not trigger QFETCH(QList, nonTriggeringMods); for (auto it = nonTriggeringMods.constBegin(), end = nonTriggeringMods.constEnd(); it != end; it++) { - kwinApp()->platform()->keyboardKeyPressed(*it, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(*it, timestamp++); + Test::keyboardKeyPressed(*it, timestamp++); + Test::keyboardKeyReleased(*it, timestamp++); QCOMPARE(triggeredSpy.count(), 0); } } @@ -181,16 +181,16 @@ void NoGlobalShortcutsTest::testKGlobalAccel() // press meta+shift+w quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::MetaModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier | Qt::MetaModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_W, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_W, timestamp++); + Test::keyboardKeyPressed(KEY_W, timestamp++); + Test::keyboardKeyReleased(KEY_W, timestamp++); // release meta+shift - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QVERIFY(!triggeredSpy.wait()); QCOMPARE(triggeredSpy.count(), 0); @@ -206,12 +206,12 @@ void NoGlobalShortcutsTest::testPointerShortcut() // try to trigger the shortcut quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QCoreApplication::instance()->processEvents(); QCOMPARE(actionSpy.count(), 0); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QCoreApplication::instance()->processEvents(); QCOMPARE(actionSpy.count(), 0); } @@ -245,14 +245,14 @@ void NoGlobalShortcutsTest::testAxisShortcut() // try to trigger the shortcut quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); if (direction == Qt::Vertical) - kwinApp()->platform()->pointerAxisVertical(sign * 5.0, timestamp++); + Test::pointerAxisVertical(sign * 5.0, timestamp++); else - kwinApp()->platform()->pointerAxisHorizontal(sign * 5.0, timestamp++); + Test::pointerAxisHorizontal(sign * 5.0, timestamp++); QCoreApplication::instance()->processEvents(); QCOMPARE(actionSpy.count(), 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QCoreApplication::instance()->processEvents(); QCOMPARE(actionSpy.count(), 0); } @@ -265,7 +265,7 @@ void NoGlobalShortcutsTest::testScreenEdge() QCOMPARE(screenEdgeSpy.count(), 0); quint32 timestamp = 1; - kwinApp()->platform()->pointerMotion({5, 5}, timestamp++); + Test::pointerMotion({5, 5}, timestamp++); QCOMPARE(screenEdgeSpy.count(), 0); } diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp index 8e6215add8..92af1ce2f6 100644 --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -178,22 +178,22 @@ void TestPointerConstraints::testConfinedPointer() QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(!c->isInteractiveMove()); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); // set the opacity to 0.5 c->setOpacity(0.5); QCOMPARE(c->opacity(), 0.5); // pointer is confined so shortcut should not work - kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); + Test::pointerAxisVertical(-5, timestamp++); QCOMPARE(c->opacity(), 0.5); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QCOMPARE(c->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); // deactivate the client, this should unconfine workspace()->activateClient(nullptr); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index 4fd4f5ce6c..fe2db628c0 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -258,7 +258,7 @@ void PointerInputTest::testWarpingGeneratesPointerMotion() QVERIFY(window); // enter - kwinApp()->platform()->pointerMotion(QPointF(25, 25), 1); + Test::pointerMotion(QPointF(25, 25), 1); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25)); @@ -304,7 +304,7 @@ void PointerInputTest::testWarpingDuringFilter() QVERIFY(static_cast(effects)->isEffectLoaded("presentwindows")); QVERIFY(movedSpy.isEmpty()); quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(QPoint(0, 0), timestamp++); + Test::pointerMotion(QPoint(0, 0), timestamp++); // screen edges push back QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(1, 1)); QVERIFY(movedSpy.wait()); @@ -338,7 +338,7 @@ void PointerInputTest::testWarpingBetweenWindows() quint32 timestamp = 0; // put the pointer at the center of the first window - kwinApp()->platform()->pointerMotion(client1->frameGeometry().center(), timestamp++); + Test::pointerMotion(client1->frameGeometry().center(), timestamp++); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 1); QCOMPARE(enteredSpy.last().at(1).toPointF(), QPointF(49, 24)); @@ -347,7 +347,7 @@ void PointerInputTest::testWarpingBetweenWindows() QCOMPARE(pointer->enteredSurface(), surface1.data()); // put the pointer at the center of the second window - kwinApp()->platform()->pointerMotion(client2->frameGeometry().center(), timestamp++); + Test::pointerMotion(client2->frameGeometry().center(), timestamp++); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 2); QCOMPARE(enteredSpy.last().at(1).toPointF(), QPointF(99, 49)); @@ -467,7 +467,7 @@ void PointerInputTest::testUpdateFocusOnDecorationDestroy() // Simulate decoration hover quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(client->frameGeometry().topLeft(), timestamp++); + Test::pointerMotion(client->frameGeometry().topLeft(), timestamp++); QVERIFY(input()->pointer()->decoration()); // Maximize when on decoration @@ -491,8 +491,8 @@ void PointerInputTest::testUpdateFocusOnDecorationDestroy() // Window should have focus, BUG 411884 QVERIFY(!input()->pointer()->decoration()); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(buttonStateChangedSpy.wait()); QCOMPARE(pointer->enteredSurface(), surface.data()); @@ -585,22 +585,22 @@ void PointerInputTest::testModifierClickUnrestrictedMove() quint32 timestamp = 1; QFETCH(bool, capsLock); if (capsLock) { - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); } QFETCH(int, modifierKey); QFETCH(int, mouseButton); - kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++); + Test::keyboardKeyPressed(modifierKey, timestamp++); QVERIFY(!window->isInteractiveMove()); - kwinApp()->platform()->pointerButtonPressed(mouseButton, timestamp++); + Test::pointerButtonPressed(mouseButton, timestamp++); QVERIFY(window->isInteractiveMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); + Test::keyboardKeyReleased(modifierKey, timestamp++); QVERIFY(window->isInteractiveMove()); // but releasing the key should end move/resize - kwinApp()->platform()->pointerButtonReleased(mouseButton, timestamp++); + Test::pointerButtonReleased(mouseButton, timestamp++); QVERIFY(!window->isInteractiveMove()); if (capsLock) { - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); } // all of that should not have triggered button events on the surface @@ -655,14 +655,14 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled( // simulate modifier+click quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); QVERIFY(!window->isInteractiveMove()); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(!window->isInteractiveMove()); // release modifier should not change it - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QVERIFY(!window->isInteractiveMove()); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); workspace()->disableGlobalShortcutsForClient(false); } @@ -728,17 +728,17 @@ void PointerInputTest::testModifierScrollOpacity() quint32 timestamp = 1; QFETCH(bool, capsLock); if (capsLock) { - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); } QFETCH(int, modifierKey); - kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++); - kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); + Test::keyboardKeyPressed(modifierKey, timestamp++); + Test::pointerAxisVertical(-5, timestamp++); QCOMPARE(window->opacity(), 0.6); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QCOMPARE(window->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); + Test::keyboardKeyReleased(modifierKey, timestamp++); if (capsLock) { - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); } // axis should have been filtered out @@ -790,12 +790,12 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled() // simulate modifier+wheel quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerAxisVertical(-5, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::pointerAxisVertical(-5, timestamp++); QCOMPARE(window->opacity(), 0.5); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QCOMPARE(window->opacity(), 0.5); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); workspace()->disableGlobalShortcutsForClient(false); } @@ -841,7 +841,7 @@ void PointerInputTest::testScrollAction() quint32 timestamp = 1; QVERIFY(!window1->isActive()); - kwinApp()->platform()->pointerAxisVertical(5, timestamp++); + Test::pointerAxisVertical(5, timestamp++); QVERIFY(window1->isActive()); // but also the wheel event should be passed to the window @@ -1006,7 +1006,7 @@ void PointerInputTest::testMouseActionInactiveWindow() // and click quint32 timestamp = 1; QFETCH(quint32, button); - kwinApp()->platform()->pointerButtonPressed(button, timestamp++); + Test::pointerButtonPressed(button, timestamp++); // should raise window1 and activate it QCOMPARE(stackingOrderChangedSpy.count(), 1); QVERIFY(!activeWindowChangedSpy.isEmpty()); @@ -1015,7 +1015,7 @@ void PointerInputTest::testMouseActionInactiveWindow() QVERIFY(!window2->isActive()); // release again - kwinApp()->platform()->pointerButtonReleased(button, timestamp++); + Test::pointerButtonReleased(button, timestamp++); } void PointerInputTest::testMouseActionActiveWindow_data() @@ -1094,7 +1094,7 @@ void PointerInputTest::testMouseActionActiveWindow() // and click quint32 timestamp = 1; QFETCH(quint32, button); - kwinApp()->platform()->pointerButtonPressed(button, timestamp++); + Test::pointerButtonPressed(button, timestamp++); QVERIFY(buttonSpy.wait()); if (clickRaise) { QCOMPARE(stackingOrderChangedSpy.count(), 1); @@ -1106,7 +1106,7 @@ void PointerInputTest::testMouseActionActiveWindow() } // release again - kwinApp()->platform()->pointerButtonReleased(button, timestamp++); + Test::pointerButtonReleased(button, timestamp++); delete surface1; QVERIFY(window1DestroyedSpy.wait()); @@ -1328,8 +1328,8 @@ void PointerInputTest::testPopup() QVERIFY(enteredSpy.wait()); // click inside window to create serial quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(buttonStateChangedSpy.wait()); // now create the popup surface @@ -1369,9 +1369,9 @@ void PointerInputTest::testPopup() QCOMPARE(leftSpy.count(), 2); QVERIFY(doneReceivedSpy.isEmpty()); // now click, should trigger popupDone - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(doneReceivedSpy.wait()); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); } void PointerInputTest::testDecoCancelsPopup() @@ -1415,8 +1415,8 @@ void PointerInputTest::testDecoCancelsPopup() QVERIFY(enteredSpy.wait()); // click inside window to create serial quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(buttonStateChangedSpy.wait()); // now create the popup surface @@ -1443,9 +1443,9 @@ void PointerInputTest::testDecoCancelsPopup() // let's move the pointer into the center of the deco Cursors::self()->mouse()->setPos(window->frameGeometry().center().x(), window->y() + (window->height() - window->clientSize().height()) / 2); - kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); + Test::pointerButtonPressed(BTN_RIGHT, timestamp++); QVERIFY(doneReceivedSpy.wait()); - kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); + Test::pointerButtonReleased(BTN_RIGHT, timestamp++); } void PointerInputTest::testWindowUnderCursorWhileButtonPressed() @@ -1482,7 +1482,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed() QVERIFY(enteredSpy.wait()); // click inside window quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); // now create a second window as transient QScopedPointer positioner(Test::createXdgPositioner()); @@ -1503,7 +1503,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed() QVERIFY(popupClient->frameGeometry().contains(Cursors::self()->mouse()->pos())); QVERIFY(!leftSpy.wait()); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); // now that the button is no longer pressed we should get the leave event QVERIFY(leftSpy.wait()); QCOMPARE(leftSpy.count(), 1); @@ -1595,7 +1595,7 @@ void PointerInputTest::testConfineToScreenGeometry() // perform movement QFETCH(QPoint, targetPos); - kwinApp()->platform()->pointerMotion(targetPos, 1); + Test::pointerMotion(targetPos, 1); QFETCH(QPoint, expectedPos); QCOMPARE(Cursors::self()->mouse()->pos(), expectedPos); @@ -1687,8 +1687,8 @@ void PointerInputTest::testResizeCursor() // start resizing the client int timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::pointerButtonPressed(BTN_RIGHT, timestamp++); QVERIFY(c->isInteractiveResize()); QFETCH(KWin::CursorShape, cursorShape); @@ -1698,8 +1698,8 @@ void PointerInputTest::testResizeCursor() QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), resizeCursor.hotSpot()); // finish resizing the client - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::pointerButtonReleased(BTN_RIGHT, timestamp++); QVERIFY(!c->isInteractiveResize()); QCOMPARE(kwinApp()->platform()->cursorImage().image(), arrowCursor.image()); @@ -1758,8 +1758,8 @@ void PointerInputTest::testMoveCursor() // start moving the client int timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); QVERIFY(c->isInteractiveMove()); const PlatformCursorImage sizeAllCursor = loadReferenceThemeCursor(Qt::SizeAllCursor); @@ -1768,8 +1768,8 @@ void PointerInputTest::testMoveCursor() QCOMPARE(kwinApp()->platform()->cursorImage().hotSpot(), sizeAllCursor.hotSpot()); // finish moving the client - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QVERIFY(!c->isInteractiveMove()); QCOMPARE(kwinApp()->platform()->cursorImage().image(), arrowCursor.image()); diff --git a/autotests/integration/quick_tiling_test.cpp b/autotests/integration/quick_tiling_test.cpp index c15a239d80..4ca435a3f6 100644 --- a/autotests/integration/quick_tiling_test.cpp +++ b/autotests/integration/quick_tiling_test.cpp @@ -357,26 +357,26 @@ void QuickTilingTest::testQuickTilingKeyboardMove() QFETCH(QPoint, targetPos); quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); while (Cursors::self()->mouse()->pos().x() > targetPos.x()) { - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFT, timestamp++); } while (Cursors::self()->mouse()->pos().x() < targetPos.x()) { - kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++); + Test::keyboardKeyPressed(KEY_RIGHT, timestamp++); + Test::keyboardKeyReleased(KEY_RIGHT, timestamp++); } while (Cursors::self()->mouse()->pos().y() < targetPos.y()) { - kwinApp()->platform()->keyboardKeyPressed(KEY_DOWN, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_DOWN, timestamp++); + Test::keyboardKeyPressed(KEY_DOWN, timestamp++); + Test::keyboardKeyReleased(KEY_DOWN, timestamp++); } while (Cursors::self()->mouse()->pos().y() > targetPos.y()) { - kwinApp()->platform()->keyboardKeyPressed(KEY_UP, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_UP, timestamp++); + Test::keyboardKeyPressed(KEY_UP, timestamp++); + Test::keyboardKeyReleased(KEY_UP, timestamp++); } - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_ENTER, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_ENTER, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_ENTER, timestamp++); + Test::keyboardKeyReleased(KEY_ENTER, timestamp++); QCOMPARE(Cursors::self()->mouse()->pos(), targetPos); QVERIFY(!workspace()->moveResizeClient()); @@ -429,9 +429,9 @@ void QuickTilingTest::testQuickTilingPointerMove() QFETCH(QPoint, pointerPos); QFETCH(QSize, tileSize); quint32 timestamp = 1; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); - kwinApp()->platform()->pointerMotion(pointerPos, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerMotion(pointerPos, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QCOMPARE(quickTileChangedSpy.count(), 1); QTEST(c->quickTileMode(), "expectedMode"); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); @@ -444,16 +444,16 @@ void QuickTilingTest::testQuickTilingPointerMove() workspace()->performWindowOperation(c, Options::UnrestrictedMoveOp); QCOMPARE(c, workspace()->moveResizeClient()); - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); // untile the window - kwinApp()->platform()->pointerMotion(QPoint(1280, 1024) / 2, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); // untile the window + Test::pointerMotion(QPoint(1280, 1024) / 2, timestamp++); QCOMPARE(quickTileChangedSpy.count(), 2); QCOMPARE(c->quickTileMode(), QuickTileMode(QuickTileFlag::None)); QVERIFY(surfaceConfigureRequestedSpy.wait()); QCOMPARE(surfaceConfigureRequestedSpy.count(), 3); QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(100, 50)); - kwinApp()->platform()->pointerMotion(pointerPos, timestamp++); // tile the window again - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerMotion(pointerPos, timestamp++); // tile the window again + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QCOMPARE(quickTileChangedSpy.count(), 3); QTEST(c->quickTileMode(), "expectedMode"); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); @@ -521,13 +521,13 @@ void QuickTilingTest::testQuickTilingTouchMove() // Note that interactive move will be started with a delay. quint32 timestamp = 1; QSignalSpy clientStartUserMovedResizedSpy(c, &AbstractClient::clientStartUserMovedResized); - kwinApp()->platform()->touchDown(0, QPointF(c->frameGeometry().center().x(), c->frameGeometry().y() + decoration->borderTop() / 2), timestamp++); + Test::touchDown(0, QPointF(c->frameGeometry().center().x(), c->frameGeometry().y() + decoration->borderTop() / 2), timestamp++); QVERIFY(clientStartUserMovedResizedSpy.wait()); QCOMPARE(c, workspace()->moveResizeClient()); QFETCH(QPoint, targetPos); - kwinApp()->platform()->touchMotion(0, targetPos, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchMotion(0, targetPos, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(!workspace()->moveResizeClient()); diff --git a/autotests/integration/screenedge_client_show_test.cpp b/autotests/integration/screenedge_client_show_test.cpp index e8ef1dc517..9495d85c83 100644 --- a/autotests/integration/screenedge_client_show_test.cpp +++ b/autotests/integration/screenedge_client_show_test.cpp @@ -262,9 +262,9 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowX11Touch() quint32 timestamp = 0; QFETCH(QPoint, touchDownPos); QFETCH(QPoint, targetPos); - kwinApp()->platform()->touchDown(0, touchDownPos, timestamp++); - kwinApp()->platform()->touchMotion(0, targetPos, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, touchDownPos, timestamp++); + Test::touchMotion(0, targetPos, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(effectsWindowShownSpy.wait()); QVERIFY(!client->isHiddenInternal()); QCOMPARE(effectsWindowShownSpy.count(), 1); diff --git a/autotests/integration/screenedges_test.cpp b/autotests/integration/screenedges_test.cpp index 7152e19615..906eb13f00 100644 --- a/autotests/integration/screenedges_test.cpp +++ b/autotests/integration/screenedges_test.cpp @@ -156,16 +156,16 @@ void ScreenEdgesTest::testTouchCallback() // press the finger QFETCH(QPointF, startPos); - kwinApp()->platform()->touchDown(1, startPos, timestamp++); + Test::touchDown(1, startPos, timestamp++); QVERIFY(actionTriggeredSpy.isEmpty()); // move the finger QFETCH(QPointF, delta); - kwinApp()->platform()->touchMotion(1, startPos + delta, timestamp++); + Test::touchMotion(1, startPos + delta, timestamp++); QVERIFY(actionTriggeredSpy.isEmpty()); // release the finger - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QVERIFY(actionTriggeredSpy.wait()); QCOMPARE(actionTriggeredSpy.count(), 1); @@ -233,7 +233,7 @@ void ScreenEdgesTest::testPushBack() s->reserve(border, &callback, "callback"); QFETCH(QPoint, trigger); - kwinApp()->platform()->pointerMotion(trigger, 0); + Test::pointerMotion(trigger, 0); QVERIFY(spy.isEmpty()); QTEST(Cursors::self()->mouse()->pos(), "expected"); } @@ -273,11 +273,11 @@ void ScreenEdgesTest::testClientEdge() // Trigger the screen edge. QFETCH(QPointF, triggerPoint); quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QVERIFY(client->isHiddenInternal()); timestamp += 150 + 1; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QTRY_VERIFY(!client->isHiddenInternal()); } @@ -309,37 +309,37 @@ void ScreenEdgesTest::testObjectEdge() // doesn't trigger as the edge was not triggered yet qint64 timestamp = 0; - kwinApp()->platform()->pointerMotion(triggerPoint + delta, timestamp); + Test::pointerMotion(triggerPoint + delta, timestamp); QVERIFY(spy.isEmpty()); // test doesn't trigger due to too much offset timestamp += 160; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QVERIFY(spy.isEmpty()); // doesn't activate as we are waiting too short timestamp += 50; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QVERIFY(spy.isEmpty()); // and this one triggers timestamp += 110; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QVERIFY(!spy.isEmpty()); // now let's try to trigger again timestamp += 351; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QCOMPARE(spy.count(), 1); // it's still under the reactivation timestamp += 50; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QCOMPARE(spy.count(), 1); // now it should trigger again timestamp += 250; - kwinApp()->platform()->pointerMotion(triggerPoint, timestamp); + Test::pointerMotion(triggerPoint, timestamp); QCOMPARE(spy.count(), 2); } diff --git a/autotests/integration/scripting/minimizeall_test.cpp b/autotests/integration/scripting/minimizeall_test.cpp index 3eda913abc..db9418234e 100644 --- a/autotests/integration/scripting/minimizeall_test.cpp +++ b/autotests/integration/scripting/minimizeall_test.cpp @@ -125,23 +125,23 @@ void MinimizeAllScriptTest::testMinimizeUnminimize() // Minimize the windows. quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_D, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_D, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_D, timestamp++); + Test::keyboardKeyReleased(KEY_D, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QTRY_VERIFY(client1->isMinimized()); QTRY_VERIFY(client2->isMinimized()); // Unminimize the windows. - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_D, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_D, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_D, timestamp++); + Test::keyboardKeyReleased(KEY_D, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); QTRY_VERIFY(!client1->isMinimized()); QTRY_VERIFY(!client2->isMinimized()); diff --git a/autotests/integration/scripting/screenedge_test.cpp b/autotests/integration/scripting/screenedge_test.cpp index b56db8a985..a73b76ea4f 100644 --- a/autotests/integration/scripting/screenedge_test.cpp +++ b/autotests/integration/scripting/screenedge_test.cpp @@ -197,10 +197,10 @@ void ScreenEdgeTest::testTouchEdge() // trigger the edge QFETCH(QPoint, triggerPos); quint32 timestamp = 0; - kwinApp()->platform()->touchDown(0, triggerPos, timestamp++); + Test::touchDown(0, triggerPos, timestamp++); QFETCH(QPoint, motionPos); - kwinApp()->platform()->touchMotion(0, motionPos, timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchMotion(0, motionPos, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(showDesktopSpy.wait()); QCOMPARE(showDesktopSpy.count(), 1); QVERIFY(workspace()->showingDesktop()); @@ -274,9 +274,9 @@ void ScreenEdgeTest::testDeclarativeTouchEdge() // Trigger the edge through touch quint32 timestamp = 0; - kwinApp()->platform()->touchDown(0, QPointF(0, 50), timestamp++); - kwinApp()->platform()->touchMotion(0, QPointF(500, 50), timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, QPointF(0, 50), timestamp++); + Test::touchMotion(0, QPointF(500, 50), timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(showDesktopSpy.wait()); } diff --git a/autotests/integration/tabbox_test.cpp b/autotests/integration/tabbox_test.cpp index bb7cdada6f..ab4abe08c0 100644 --- a/autotests/integration/tabbox_test.cpp +++ b/autotests/integration/tabbox_test.cpp @@ -99,27 +99,27 @@ void TabBoxTest::testCapsLock() // enable capslock quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier); // press alt+tab - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::ShiftModifier | Qt::AltModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_TAB, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_TAB, timestamp++); + Test::keyboardKeyPressed(KEY_TAB, timestamp++); + Test::keyboardKeyReleased(KEY_TAB, timestamp++); QVERIFY(tabboxAddedSpy.wait()); QVERIFY(TabBox::TabBox::self()->isGrabbed()); // release alt - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); QCOMPARE(tabboxClosedSpy.count(), 1); QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false); // release caps lock - kwinApp()->platform()->keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++); + Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::NoModifier); QCOMPARE(tabboxClosedSpy.count(), 1); QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false); @@ -162,16 +162,16 @@ void TabBoxTest::testMoveForward() // press alt+tab quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::AltModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_TAB, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_TAB, timestamp++); + Test::keyboardKeyPressed(KEY_TAB, timestamp++); + Test::keyboardKeyReleased(KEY_TAB, timestamp++); QVERIFY(tabboxAddedSpy.wait()); QVERIFY(TabBox::TabBox::self()->isGrabbed()); // release alt - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); QCOMPARE(tabboxClosedSpy.count(), 1); QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false); QCOMPARE(workspace()->activeClient(), c2); @@ -213,20 +213,20 @@ void TabBoxTest::testMoveBackward() // press alt+shift+tab quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::AltModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTSHIFT, timestamp++); QCOMPARE(input()->keyboardModifiers(), Qt::AltModifier | Qt::ShiftModifier); - kwinApp()->platform()->keyboardKeyPressed(KEY_TAB, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_TAB, timestamp++); + Test::keyboardKeyPressed(KEY_TAB, timestamp++); + Test::keyboardKeyReleased(KEY_TAB, timestamp++); QVERIFY(tabboxAddedSpy.wait()); QVERIFY(TabBox::TabBox::self()->isGrabbed()); // release alt - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++); QCOMPARE(tabboxClosedSpy.count(), 0); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); QCOMPARE(tabboxClosedSpy.count(), 1); QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false); QCOMPARE(workspace()->activeClient(), c1); diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index fdc5e2f0ba..6e022d5dd8 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -1374,75 +1374,67 @@ bool VirtualInputDevice::isLidSwitch() const void keyboardKeyPressed(quint32 key, quint32 time) { - auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); + auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyPressed, time, virtualKeyboard); } void keyboardKeyReleased(quint32 key, quint32 time) { - auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); + auto virtualKeyboard = static_cast(kwinApp())->virtualKeyboard(); Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyReleased, time, virtualKeyboard); } -void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta, - InputRedirection::PointerAxisSource source) +void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta, InputRedirection::PointerAxisSource source) { - auto virtualPointer = static_cast(kwinApp())->virtualPointer(); - Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisHorizontal, - delta, discreteDelta, source, time, virtualPointer); + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisHorizontal, delta, discreteDelta, source, time, virtualPointer); } -void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta, - InputRedirection::PointerAxisSource source) +void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta, InputRedirection::PointerAxisSource source) { - auto virtualPointer = static_cast(kwinApp())->virtualPointer(); - Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisVertical, - delta, discreteDelta, source, time, virtualPointer); + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisVertical, delta, discreteDelta, source, time, virtualPointer); } void pointerButtonPressed(quint32 button, quint32 time) { - auto virtualPointer = static_cast(kwinApp())->virtualPointer(); - Q_EMIT virtualPointer->pointerButtonChanged(button, - InputRedirection::PointerButtonState::PointerButtonPressed, - time, virtualPointer); + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerButtonChanged(button, InputRedirection::PointerButtonState::PointerButtonPressed, time, virtualPointer); } void pointerButtonReleased(quint32 button, quint32 time) { - auto virtualPointer = static_cast(kwinApp())->virtualPointer(); - Q_EMIT virtualPointer->pointerButtonChanged(button, - InputRedirection::PointerButtonState::PointerButtonReleased, - time, virtualPointer); + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + Q_EMIT virtualPointer->pointerButtonChanged(button, InputRedirection::PointerButtonState::PointerButtonReleased, time, virtualPointer); } void pointerMotion(const QPointF &position, quint32 time) { - auto virtualPointer = static_cast(kwinApp())->virtualPointer(); + auto virtualPointer = static_cast(kwinApp())->virtualPointer(); Q_EMIT virtualPointer->pointerMotionAbsolute(position, time, virtualPointer); } void touchCancel() { - auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); Q_EMIT virtualTouch->touchCanceled(virtualTouch); } void touchDown(qint32 id, const QPointF &pos, quint32 time) { - auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); Q_EMIT virtualTouch->touchDown(id, pos, time, virtualTouch); } void touchMotion(qint32 id, const QPointF &pos, quint32 time) { - auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); Q_EMIT virtualTouch->touchMotion(id, pos, time, virtualTouch); } void touchUp(qint32 id, quint32 time) { - auto virtualTouch = static_cast(kwinApp())->virtualTouch(); + auto virtualTouch = static_cast(kwinApp())->virtualTouch(); Q_EMIT virtualTouch->touchUp(id, time, virtualTouch); } } diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp index 29ec0951e1..47c74e11e2 100644 --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -123,23 +123,23 @@ void TouchInputTest::testTouchHidesCursor() { QCOMPARE(Cursors::self()->isCursorHidden(), false); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++); + Test::touchDown(1, QPointF(125, 125), timestamp++); QCOMPARE(Cursors::self()->isCursorHidden(), true); - kwinApp()->platform()->touchDown(2, QPointF(130, 125), timestamp++); - kwinApp()->platform()->touchUp(2, timestamp++); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchDown(2, QPointF(130, 125), timestamp++); + Test::touchUp(2, timestamp++); + Test::touchUp(1, timestamp++); // now a mouse event should show the cursor again - kwinApp()->platform()->pointerMotion(QPointF(0, 0), timestamp++); + Test::pointerMotion(QPointF(0, 0), timestamp++); QCOMPARE(Cursors::self()->isCursorHidden(), false); // touch should hide again - kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchDown(1, QPointF(125, 125), timestamp++); + Test::touchUp(1, timestamp++); QCOMPARE(Cursors::self()->isCursorHidden(), true); // wheel should also show - kwinApp()->platform()->pointerAxisVertical(1.0, timestamp++); + Test::pointerAxisVertical(1.0, timestamp++); QCOMPARE(Cursors::self()->isCursorHidden(), false); } @@ -171,7 +171,7 @@ void TouchInputTest::testMultipleTouchPoints() QVERIFY(endedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(1, QPointF(125, 125) + c->clientPos(), timestamp++); + Test::touchDown(1, QPointF(125, 125) + c->clientPos(), timestamp++); QVERIFY(sequenceStartedSpy.wait()); QCOMPARE(sequenceStartedSpy.count(), 1); QCOMPARE(m_touch->sequence().count(), 1); @@ -181,7 +181,7 @@ void TouchInputTest::testMultipleTouchPoints() QCOMPARE(pointMovedSpy.count(), 0); // a point outside the window - kwinApp()->platform()->touchDown(2, QPointF(0, 0) + c->clientPos(), timestamp++); + Test::touchDown(2, QPointF(0, 0) + c->clientPos(), timestamp++); QVERIFY(pointAddedSpy.wait()); QCOMPARE(pointAddedSpy.count(), 1); QCOMPARE(m_touch->sequence().count(), 2); @@ -190,21 +190,21 @@ void TouchInputTest::testMultipleTouchPoints() QCOMPARE(pointMovedSpy.count(), 0); // let's move that one - kwinApp()->platform()->touchMotion(2, QPointF(100, 100) + c->clientPos(), timestamp++); + Test::touchMotion(2, QPointF(100, 100) + c->clientPos(), timestamp++); QVERIFY(pointMovedSpy.wait()); QCOMPARE(pointMovedSpy.count(), 1); QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().at(1)->isDown(), true); QCOMPARE(m_touch->sequence().at(1)->position(), QPointF(0, 0)); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QVERIFY(pointRemovedSpy.wait()); QCOMPARE(pointRemovedSpy.count(), 1); QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().first()->isDown(), false); QCOMPARE(endedSpy.count(), 0); - kwinApp()->platform()->touchUp(2, timestamp++); + Test::touchUp(2, timestamp++); QVERIFY(pointRemovedSpy.wait()); QCOMPARE(pointRemovedSpy.count(), 2); QCOMPARE(m_touch->sequence().count(), 2); @@ -227,12 +227,12 @@ void TouchInputTest::testCancel() QVERIFY(pointRemovedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++); + Test::touchDown(1, QPointF(125, 125), timestamp++); QVERIFY(sequenceStartedSpy.wait()); QCOMPARE(sequenceStartedSpy.count(), 1); // cancel - kwinApp()->platform()->touchCancel(); + Test::touchCancel(); QVERIFY(cancelSpy.wait()); QCOMPARE(cancelSpy.count(), 1); } @@ -255,7 +255,7 @@ void TouchInputTest::testTouchMouseAction() QVERIFY(sequenceStartedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(1, c1->frameGeometry().center(), timestamp++); + Test::touchDown(1, c1->frameGeometry().center(), timestamp++); QVERIFY(c1->isActive()); QVERIFY(sequenceStartedSpy.wait()); @@ -269,12 +269,12 @@ void TouchInputTest::testTouchPointCount() { QCOMPARE(input()->touch()->touchPointCount(), 0); quint32 timestamp = 1; - kwinApp()->platform()->touchDown(0, QPointF(125, 125), timestamp++); - kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++); - kwinApp()->platform()->touchDown(2, QPointF(125, 125), timestamp++); + Test::touchDown(0, QPointF(125, 125), timestamp++); + Test::touchDown(1, QPointF(125, 125), timestamp++); + Test::touchDown(2, QPointF(125, 125), timestamp++); QCOMPARE(input()->touch()->touchPointCount(), 3); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QCOMPARE(input()->touch()->touchPointCount(), 2); kwinApp()->platform()->cancelTouchSequence(); @@ -334,7 +334,7 @@ void TouchInputTest::testUpdateFocusOnDecorationDestroy() // Simulate decoration hover quint32 timestamp = 0; - kwinApp()->platform()->touchDown(1, client->frameGeometry().topLeft(), timestamp++); + Test::touchDown(1, client->frameGeometry().topLeft(), timestamp++); QVERIFY(input()->touch()->decoration()); // Maximize when on decoration @@ -358,10 +358,10 @@ void TouchInputTest::testUpdateFocusOnDecorationDestroy() // Window should have focus QVERIFY(!input()->touch()->decoration()); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QVERIFY(!sequenceEndedSpy.wait(100)); - kwinApp()->platform()->touchDown(2, client->frameGeometry().center(), timestamp++); - kwinApp()->platform()->touchUp(2, timestamp++); + Test::touchDown(2, client->frameGeometry().center(), timestamp++); + Test::touchUp(2, timestamp++); QVERIFY(sequenceEndedSpy.wait()); // Destroy the client. diff --git a/autotests/integration/window_selection_test.cpp b/autotests/integration/window_selection_test.cpp index 006745dfd3..4c8ed1ea79 100644 --- a/autotests/integration/window_selection_test.cpp +++ b/autotests/integration/window_selection_test.cpp @@ -126,7 +126,7 @@ void TestWindowSelection::testSelectOnWindowPointer() // simulate left button press quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); // should not have ended the mode QCOMPARE(input()->isSelectingWindow(), true); QVERIFY(!selectedWindow); @@ -139,13 +139,13 @@ void TestWindowSelection::testSelectOnWindowPointer() input()->keyboard()->update(); // perform a right button click - kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); + Test::pointerButtonPressed(BTN_RIGHT, timestamp++); + Test::pointerButtonReleased(BTN_RIGHT, timestamp++); // should not have ended the mode QCOMPARE(input()->isSelectingWindow(), true); QVERIFY(!selectedWindow); // now release - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QCOMPARE(selectedWindow, client); QCOMPARE(input()->pointer()->focus(), client); @@ -208,9 +208,9 @@ void TestWindowSelection::testSelectOnWindowKeyboard() // simulate key press quint32 timestamp = 0; // move cursor through keys - auto keyPress = [×tamp] (qint32 key) { - kwinApp()->platform()->keyboardKeyPressed(key, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(key, timestamp++); + auto keyPress = [×tamp](qint32 key) { + Test::keyboardKeyPressed(key, timestamp++); + Test::keyboardKeyReleased(key, timestamp++); }; while (KWin::Cursors::self()->mouse()->pos().x() >= client->frameGeometry().x() + client->frameGeometry().width()) { keyPress(KEY_LEFT); @@ -225,7 +225,7 @@ void TestWindowSelection::testSelectOnWindowKeyboard() keyPress(KEY_UP); } QFETCH(qint32, key); - kwinApp()->platform()->keyboardKeyPressed(key, timestamp++); + Test::keyboardKeyPressed(key, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QCOMPARE(selectedWindow, client); QCOMPARE(input()->pointer()->focus(), client); @@ -238,7 +238,7 @@ void TestWindowSelection::testSelectOnWindowKeyboard() QCOMPARE(keyboardLeftSpy.count(), 1); QCOMPARE(pointerEnteredSpy.count(), 1); QCOMPARE(keyboardEnteredSpy.count(), 2); - kwinApp()->platform()->keyboardKeyReleased(key, timestamp++); + Test::keyboardKeyReleased(key, timestamp++); } void TestWindowSelection::testSelectOnWindowTouch() @@ -267,25 +267,25 @@ void TestWindowSelection::testSelectOnWindowTouch() // simulate touch down quint32 timestamp = 0; - kwinApp()->platform()->touchDown(0, client->frameGeometry().center(), timestamp++); + Test::touchDown(0, client->frameGeometry().center(), timestamp++); QVERIFY(!selectedWindow); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QCOMPARE(selectedWindow, client); // with movement selectedWindow = nullptr; kwinApp()->platform()->startInteractiveWindowSelection(callback); - kwinApp()->platform()->touchDown(0, client->frameGeometry().bottomRight() + QPoint(20, 20), timestamp++); + Test::touchDown(0, client->frameGeometry().bottomRight() + QPoint(20, 20), timestamp++); QVERIFY(!selectedWindow); - kwinApp()->platform()->touchMotion(0, client->frameGeometry().bottomRight() - QPoint(1, 1), timestamp++); + Test::touchMotion(0, client->frameGeometry().bottomRight() - QPoint(1, 1), timestamp++); QVERIFY(!selectedWindow); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(selectedWindow, client); QCOMPARE(input()->isSelectingWindow(), false); // it cancels active touch sequence on the window - kwinApp()->platform()->touchDown(0, client->frameGeometry().center(), timestamp++); + Test::touchDown(0, client->frameGeometry().center(), timestamp++); QVERIFY(touchStartedSpy.wait()); selectedWindow = nullptr; kwinApp()->platform()->startInteractiveWindowSelection(callback); @@ -293,10 +293,10 @@ void TestWindowSelection::testSelectOnWindowTouch() QVERIFY(touchCanceledSpy.wait()); QVERIFY(!selectedWindow); // this touch up does not yet select the window, it was started prior to the selection - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QVERIFY(!selectedWindow); - kwinApp()->platform()->touchDown(0, client->frameGeometry().center(), timestamp++); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchDown(0, client->frameGeometry().center(), timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(selectedWindow, client); QCOMPARE(input()->isSelectingWindow(), false); @@ -347,8 +347,8 @@ void TestWindowSelection::testCancelOnWindowPointer() // simulate left button press quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); + Test::pointerButtonPressed(BTN_RIGHT, timestamp++); + Test::pointerButtonReleased(BTN_RIGHT, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QVERIFY(!selectedWindow); QCOMPARE(input()->pointer()->focus(), client); @@ -406,7 +406,7 @@ void TestWindowSelection::testCancelOnWindowKeyboard() // simulate left button press quint32 timestamp = 0; - kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); + Test::keyboardKeyPressed(KEY_ESC, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QVERIFY(!selectedWindow); QCOMPARE(input()->pointer()->focus(), client); @@ -419,7 +419,7 @@ void TestWindowSelection::testCancelOnWindowKeyboard() QCOMPARE(keyboardLeftSpy.count(), 1); QCOMPARE(pointerEnteredSpy.count(), 2); QCOMPARE(keyboardEnteredSpy.count(), 2); - kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); + Test::keyboardKeyReleased(KEY_ESC, timestamp++); } void TestWindowSelection::testSelectPointPointer() @@ -472,7 +472,7 @@ void TestWindowSelection::testSelectPointPointer() // simulate left button press quint32 timestamp = 0; - kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); + Test::pointerButtonPressed(BTN_LEFT, timestamp++); // should not have ended the mode QCOMPARE(input()->isSelectingWindow(), true); QCOMPARE(point, QPoint()); @@ -485,13 +485,13 @@ void TestWindowSelection::testSelectPointPointer() input()->keyboard()->update(); // perform a right button click - kwinApp()->platform()->pointerButtonPressed(BTN_RIGHT, timestamp++); - kwinApp()->platform()->pointerButtonReleased(BTN_RIGHT, timestamp++); + Test::pointerButtonPressed(BTN_RIGHT, timestamp++); + Test::pointerButtonReleased(BTN_RIGHT, timestamp++); // should not have ended the mode QCOMPARE(input()->isSelectingWindow(), true); QCOMPARE(point, QPoint()); // now release - kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++); + Test::pointerButtonReleased(BTN_LEFT, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QCOMPARE(point, input()->globalPointer().toPoint()); QCOMPARE(input()->pointer()->focus(), client); @@ -522,23 +522,23 @@ void TestWindowSelection::testSelectPointTouch() // let's create multiple touch points quint32 timestamp = 0; - kwinApp()->platform()->touchDown(0, QPointF(0, 1), timestamp++); + Test::touchDown(0, QPointF(0, 1), timestamp++); QCOMPARE(input()->isSelectingWindow(), true); - kwinApp()->platform()->touchDown(1, QPointF(10, 20), timestamp++); + Test::touchDown(1, QPointF(10, 20), timestamp++); QCOMPARE(input()->isSelectingWindow(), true); - kwinApp()->platform()->touchDown(2, QPointF(30, 40), timestamp++); + Test::touchDown(2, QPointF(30, 40), timestamp++); QCOMPARE(input()->isSelectingWindow(), true); // let's move our points - kwinApp()->platform()->touchMotion(0, QPointF(5, 10), timestamp++); - kwinApp()->platform()->touchMotion(2, QPointF(20, 25), timestamp++); - kwinApp()->platform()->touchMotion(1, QPointF(25, 35), timestamp++); + Test::touchMotion(0, QPointF(5, 10), timestamp++); + Test::touchMotion(2, QPointF(20, 25), timestamp++); + Test::touchMotion(1, QPointF(25, 35), timestamp++); QCOMPARE(input()->isSelectingWindow(), true); - kwinApp()->platform()->touchUp(0, timestamp++); + Test::touchUp(0, timestamp++); QCOMPARE(input()->isSelectingWindow(), true); - kwinApp()->platform()->touchUp(2, timestamp++); + Test::touchUp(2, timestamp++); QCOMPARE(input()->isSelectingWindow(), true); - kwinApp()->platform()->touchUp(1, timestamp++); + Test::touchUp(1, timestamp++); QCOMPARE(input()->isSelectingWindow(), false); QCOMPARE(point, QPoint(25, 35)); } diff --git a/autotests/integration/xdgshellclient_rules_test.cpp b/autotests/integration/xdgshellclient_rules_test.cpp index ad11b3e0a1..4036342880 100644 --- a/autotests/integration/xdgshellclient_rules_test.cpp +++ b/autotests/integration/xdgshellclient_rules_test.cpp @@ -2989,12 +2989,12 @@ void TestXdgShellClientRules::testShortcutDontAffect() QSignalSpy clientUnminimizedSpy(client, &AbstractClient::clientUnminimized); QVERIFY(clientUnminimizedSpy.isValid()); quint32 timestamp = 1; - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(!clientUnminimizedSpy.wait(100)); QVERIFY(client->isMinimized()); @@ -3022,12 +3022,12 @@ void TestXdgShellClientRules::testShortcutApply() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3036,24 +3036,24 @@ void TestXdgShellClientRules::testShortcutApply() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_2})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); // The old shortcut should do nothing. client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(!clientUnminimizedSpy.wait(100)); QVERIFY(client->isMinimized()); @@ -3093,12 +3093,12 @@ void TestXdgShellClientRules::testShortcutRemember() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3107,12 +3107,12 @@ void TestXdgShellClientRules::testShortcutRemember() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_2})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3152,12 +3152,12 @@ void TestXdgShellClientRules::testShortcutForce() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3166,12 +3166,12 @@ void TestXdgShellClientRules::testShortcutForce() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(!clientUnminimizedSpy.wait(100)); QVERIFY(client->isMinimized()); @@ -3210,12 +3210,12 @@ void TestXdgShellClientRules::testShortcutApplyNow() quint32 timestamp = 1; client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3224,12 +3224,12 @@ void TestXdgShellClientRules::testShortcutApplyNow() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_2})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3263,12 +3263,12 @@ void TestXdgShellClientRules::testShortcutForceTemporarily() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_1, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_1, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(clientUnminimizedSpy.wait()); QVERIFY(!client->isMinimized()); @@ -3277,12 +3277,12 @@ void TestXdgShellClientRules::testShortcutForceTemporarily() QCOMPARE(client->shortcut(), (QKeySequence{Qt::CTRL | Qt::ALT | Qt::Key_1})); client->minimize(); QVERIFY(client->isMinimized()); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyPressed(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_2, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTALT, timestamp++); - kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); + Test::keyboardKeyPressed(KEY_LEFTALT, timestamp++); + Test::keyboardKeyPressed(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_2, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++); + Test::keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); QVERIFY(!clientUnminimizedSpy.wait(100)); QVERIFY(client->isMinimized()); diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index 5ff45e8c1a..eb4637aaa9 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -1439,12 +1439,12 @@ void TestXdgShellClient::testPointerInputTransform() // Enter the surface. quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(client->pos(), timestamp++); + Test::pointerMotion(client->pos(), timestamp++); QVERIFY(pointerEnteredSpy.wait()); // Move the pointer to (10, 5) relative to the upper left frame corner, which is located // at (0, 0) in the surface-local coordinates. - kwinApp()->platform()->pointerMotion(client->pos() + QPoint(10, 5), timestamp++); + Test::pointerMotion(client->pos() + QPoint(10, 5), timestamp++); QVERIFY(pointerMotionSpy.wait()); QCOMPARE(pointerMotionSpy.last().first(), QPoint(10, 5)); @@ -1463,7 +1463,7 @@ void TestXdgShellClient::testPointerInputTransform() // Move the pointer to (20, 50) relative to the upper left frame corner, which is located // at (10, 20) in the surface-local coordinates. - kwinApp()->platform()->pointerMotion(client->pos() + QPoint(20, 50), timestamp++); + Test::pointerMotion(client->pos() + QPoint(20, 50), timestamp++); QVERIFY(pointerMotionSpy.wait()); QCOMPARE(pointerMotionSpy.last().first(), QPoint(10, 20) + QPoint(20, 50));