Commit 270a9633 authored by Julius Zint's avatar Julius Zint Committed by Vlad Zahorodnii
Browse files

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.
parent 93305f60
......@@ -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();
......
......@@ -120,9 +120,9 @@ void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
QSignalSpy maximizedStateChangedSpy(client, static_cast<void (AbstractClient::*)(KWin::AbstractClient*, MaximizeMode)>(&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);
......
......@@ -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());
......
......@@ -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());
......
......@@ -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));
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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