Add all required input simulation methods
[4/6] Make autotests create fake input devices This translates all required input simulating methods from kwinApp()->platform()->... to seperate functions in the Test namespace.
This commit is contained in:
parent
33487c06d6
commit
93305f6041
2 changed files with 88 additions and 0 deletions
|
@ -516,6 +516,20 @@ private:
|
||||||
bool m_touch = false;
|
bool m_touch = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 pointerButtonPressed(quint32 button, quint32 time);
|
||||||
|
void pointerButtonReleased(quint32 button, quint32 time);
|
||||||
|
void pointerMotion(const QPointF &position, quint32 time);
|
||||||
|
void touchCancel();
|
||||||
|
void touchDown(qint32 id, const QPointF &pos, quint32 time);
|
||||||
|
void touchMotion(qint32 id, const QPointF &pos, quint32 time);
|
||||||
|
void touchUp(qint32 id, quint32 time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Wayland Connection in a dedicated thread and creates various
|
* Creates a Wayland Connection in a dedicated thread and creates various
|
||||||
* client side objects which can be used to create windows.
|
* client side objects which can be used to create windows.
|
||||||
|
|
|
@ -1371,5 +1371,79 @@ bool VirtualInputDevice::isLidSwitch() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void keyboardKeyPressed(quint32 key, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualKeyboard = static_cast<WaylandTestApplication*>(kwinApp())->virtualKeyboard();
|
||||||
|
Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyPressed, time, virtualKeyboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboardKeyReleased(quint32 key, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualKeyboard = static_cast<WaylandTestApplication*>(kwinApp())->virtualKeyboard();
|
||||||
|
Q_EMIT virtualKeyboard->keyChanged(key, InputRedirection::KeyboardKeyState::KeyboardKeyReleased, time, virtualKeyboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta,
|
||||||
|
InputRedirection::PointerAxisSource source)
|
||||||
|
{
|
||||||
|
auto virtualPointer = static_cast<WaylandTestApplication*>(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)
|
||||||
|
{
|
||||||
|
auto virtualPointer = static_cast<WaylandTestApplication*>(kwinApp())->virtualPointer();
|
||||||
|
Q_EMIT virtualPointer->pointerAxisChanged(InputRedirection::PointerAxis::PointerAxisVertical,
|
||||||
|
delta, discreteDelta, source, time, virtualPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pointerButtonPressed(quint32 button, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualPointer = static_cast<WaylandTestApplication*>(kwinApp())->virtualPointer();
|
||||||
|
Q_EMIT virtualPointer->pointerButtonChanged(button,
|
||||||
|
InputRedirection::PointerButtonState::PointerButtonPressed,
|
||||||
|
time, virtualPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pointerButtonReleased(quint32 button, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualPointer = static_cast<WaylandTestApplication*>(kwinApp())->virtualPointer();
|
||||||
|
Q_EMIT virtualPointer->pointerButtonChanged(button,
|
||||||
|
InputRedirection::PointerButtonState::PointerButtonReleased,
|
||||||
|
time, virtualPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pointerMotion(const QPointF &position, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualPointer = static_cast<WaylandTestApplication*>(kwinApp())->virtualPointer();
|
||||||
|
Q_EMIT virtualPointer->pointerMotionAbsolute(position, time, virtualPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void touchCancel()
|
||||||
|
{
|
||||||
|
auto virtualTouch = static_cast<WaylandTestApplication*>(kwinApp())->virtualTouch();
|
||||||
|
Q_EMIT virtualTouch->touchCanceled(virtualTouch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void touchDown(qint32 id, const QPointF &pos, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualTouch = static_cast<WaylandTestApplication*>(kwinApp())->virtualTouch();
|
||||||
|
Q_EMIT virtualTouch->touchDown(id, pos, time, virtualTouch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void touchMotion(qint32 id, const QPointF &pos, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualTouch = static_cast<WaylandTestApplication*>(kwinApp())->virtualTouch();
|
||||||
|
Q_EMIT virtualTouch->touchMotion(id, pos, time, virtualTouch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void touchUp(qint32 id, quint32 time)
|
||||||
|
{
|
||||||
|
auto virtualTouch = static_cast<WaylandTestApplication*>(kwinApp())->virtualTouch();
|
||||||
|
Q_EMIT virtualTouch->touchUp(id, time, virtualTouch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue