Add all three VirtualInputDevices for autotests
[3/6] Make autotests create fake input devices This commit adds back all three VirtualInputDevices for simulating keyboard, touch and pointer input events from autotests.
This commit is contained in:
parent
97f49edb1c
commit
33487c06d6
2 changed files with 58 additions and 0 deletions
|
@ -87,12 +87,39 @@ WaylandTestApplication::~WaylandTestApplication()
|
||||||
}
|
}
|
||||||
delete m_xwayland;
|
delete m_xwayland;
|
||||||
m_xwayland = nullptr;
|
m_xwayland = nullptr;
|
||||||
|
destroyVirtualInputDevices();
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
destroyInputMethod();
|
destroyInputMethod();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
destroyInput();
|
destroyInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaylandTestApplication::createVirtualInputDevices()
|
||||||
|
{
|
||||||
|
m_virtualKeyboard.reset(new Test::VirtualInputDevice());
|
||||||
|
m_virtualKeyboard->setName(QStringLiteral("Virtual Keyboard 1"));
|
||||||
|
m_virtualKeyboard->setKeyboard(true);
|
||||||
|
|
||||||
|
m_virtualPointer.reset(new Test::VirtualInputDevice());
|
||||||
|
m_virtualPointer->setName(QStringLiteral("Virtual Pointer 1"));
|
||||||
|
m_virtualPointer->setPointer(true);
|
||||||
|
|
||||||
|
m_virtualTouch.reset(new Test::VirtualInputDevice());
|
||||||
|
m_virtualTouch->setName(QStringLiteral("Virtual Touch 1"));
|
||||||
|
m_virtualTouch->setTouch(true);
|
||||||
|
|
||||||
|
input()->addInputDevice(m_virtualPointer.get());
|
||||||
|
input()->addInputDevice(m_virtualTouch.get());
|
||||||
|
input()->addInputDevice(m_virtualKeyboard.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaylandTestApplication::destroyVirtualInputDevices()
|
||||||
|
{
|
||||||
|
input()->removeInputDevice(m_virtualPointer.get());
|
||||||
|
input()->removeInputDevice(m_virtualTouch.get());
|
||||||
|
input()->removeInputDevice(m_virtualKeyboard.get());
|
||||||
|
}
|
||||||
|
|
||||||
void WaylandTestApplication::performStartup()
|
void WaylandTestApplication::performStartup()
|
||||||
{
|
{
|
||||||
if (!m_inputMethodServerToStart.isEmpty()) {
|
if (!m_inputMethodServerToStart.isEmpty()) {
|
||||||
|
@ -114,6 +141,7 @@ void WaylandTestApplication::performStartup()
|
||||||
// try creating the Wayland Backend
|
// try creating the Wayland Backend
|
||||||
createInput();
|
createInput();
|
||||||
createPlugins();
|
createPlugins();
|
||||||
|
createVirtualInputDevices();
|
||||||
|
|
||||||
if (!platform()->enabledOutputs().isEmpty()) {
|
if (!platform()->enabledOutputs().isEmpty()) {
|
||||||
continueStartupWithScreens();
|
continueStartupWithScreens();
|
||||||
|
@ -160,4 +188,18 @@ void WaylandTestApplication::continueStartupWithScene()
|
||||||
m_xwayland->start();
|
m_xwayland->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test::VirtualInputDevice *WaylandTestApplication::virtualPointer() const
|
||||||
|
{
|
||||||
|
return m_virtualPointer.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
Test::VirtualInputDevice *WaylandTestApplication::virtualKeyboard() const
|
||||||
|
{
|
||||||
|
return m_virtualKeyboard.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
Test::VirtualInputDevice *WaylandTestApplication::virtualTouch() const
|
||||||
|
{
|
||||||
|
return m_virtualTouch.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,10 @@ class Xwayland;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
|
namespace Test
|
||||||
|
{
|
||||||
|
class VirtualInputDevice;
|
||||||
|
}
|
||||||
|
|
||||||
class WaylandTestApplication : public ApplicationWaylandAbstract
|
class WaylandTestApplication : public ApplicationWaylandAbstract
|
||||||
{
|
{
|
||||||
|
@ -75,6 +79,11 @@ public:
|
||||||
void setInputMethodServerToStart(const QString &inputMethodServer) {
|
void setInputMethodServerToStart(const QString &inputMethodServer) {
|
||||||
m_inputMethodServerToStart = inputMethodServer;
|
m_inputMethodServerToStart = inputMethodServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test::VirtualInputDevice *virtualPointer() const;
|
||||||
|
Test::VirtualInputDevice *virtualKeyboard() const;
|
||||||
|
Test::VirtualInputDevice *virtualTouch() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void performStartup() override;
|
void performStartup() override;
|
||||||
|
|
||||||
|
@ -83,8 +92,15 @@ private:
|
||||||
void continueStartupWithScene();
|
void continueStartupWithScene();
|
||||||
void finalizeStartup();
|
void finalizeStartup();
|
||||||
|
|
||||||
|
void createVirtualInputDevices();
|
||||||
|
void destroyVirtualInputDevices();
|
||||||
|
|
||||||
Xwl::Xwayland *m_xwayland = nullptr;
|
Xwl::Xwayland *m_xwayland = nullptr;
|
||||||
QString m_inputMethodServerToStart;
|
QString m_inputMethodServerToStart;
|
||||||
|
|
||||||
|
QScopedPointer<Test::VirtualInputDevice> m_virtualPointer;
|
||||||
|
QScopedPointer<Test::VirtualInputDevice> m_virtualKeyboard;
|
||||||
|
QScopedPointer<Test::VirtualInputDevice> m_virtualTouch;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Test
|
namespace Test
|
||||||
|
|
Loading…
Reference in a new issue