Add convenient create methods to Registry
These methods allow to create the Interface objects and set them up directly.
This commit is contained in:
parent
4d70ace4df
commit
4d77c197a9
5 changed files with 30 additions and 11 deletions
|
@ -36,6 +36,7 @@ private Q_SLOTS:
|
|||
void cleanup();
|
||||
|
||||
void testRegistry();
|
||||
void testRegistryCreate();
|
||||
|
||||
// TODO: add tests for removal - requires more control over the compositor
|
||||
|
||||
|
@ -119,5 +120,27 @@ void TestWaylandFullscreenShell::testRegistry()
|
|||
QVERIFY(fullscreenShell.isValid());
|
||||
}
|
||||
|
||||
void TestWaylandFullscreenShell::testRegistryCreate()
|
||||
{ if (m_westonProcess->state() != QProcess::Running) {
|
||||
QSKIP("This test requires a running wayland server");
|
||||
}
|
||||
KWayland::Client::ConnectionThread connection;
|
||||
QSignalSpy connectedSpy(&connection, SIGNAL(connected()));
|
||||
connection.setSocketName(s_socketName);
|
||||
connection.initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
KWayland::Client::Registry registry;
|
||||
QSignalSpy announced(®istry, SIGNAL(fullscreenShellAnnounced(quint32,quint32)));
|
||||
registry.create(connection.display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
wl_display_flush(connection.display());
|
||||
QVERIFY(announced.wait());
|
||||
|
||||
KWayland::Client::FullscreenShell *fullscreenShell = registry.createFullscreenShell(announced.first().first().value<quint32>(), 1, ®istry);
|
||||
QVERIFY(fullscreenShell->isValid());
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestWaylandFullscreenShell)
|
||||
#include "test_wayland_fullscreen_shell.moc"
|
||||
|
|
|
@ -302,16 +302,15 @@ void TestWaylandOutput::testTransform()
|
|||
wl_display_flush(m_connection->display());
|
||||
QVERIFY(announced.wait());
|
||||
|
||||
KWayland::Client::Output output;
|
||||
QSignalSpy outputChanged(&output, SIGNAL(changed()));
|
||||
KWayland::Client::Output *output = registry.createOutput(announced.first().first().value<quint32>(), announced.first().last().value<quint32>(), ®istry);
|
||||
QSignalSpy outputChanged(output, SIGNAL(changed()));
|
||||
QVERIFY(outputChanged.isValid());
|
||||
output.setup(registry.bindOutput(announced.first().first().value<quint32>(), announced.first().last().value<quint32>()));
|
||||
wl_display_flush(m_connection->display());
|
||||
if (outputChanged.isEmpty()) {
|
||||
QVERIFY(outputChanged.wait());
|
||||
}
|
||||
|
||||
QTEST(output.transform(), "expected");
|
||||
QTEST(output->transform(), "expected");
|
||||
|
||||
// change back to normal
|
||||
outputChanged.clear();
|
||||
|
@ -319,7 +318,7 @@ void TestWaylandOutput::testTransform()
|
|||
if (outputChanged.isEmpty()) {
|
||||
QVERIFY(outputChanged.wait());
|
||||
}
|
||||
QCOMPARE(output.transform(), Output::Transform::Normal);
|
||||
QCOMPARE(output->transform(), Output::Transform::Normal);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestWaylandOutput)
|
||||
|
|
|
@ -140,9 +140,8 @@ void TestWaylandSeat::init()
|
|||
m_compositor->setup(registry.bindCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>()));
|
||||
QVERIFY(m_compositor->isValid());
|
||||
|
||||
m_seat = new KWayland::Client::Seat(this);
|
||||
m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this);
|
||||
QSignalSpy nameSpy(m_seat, SIGNAL(nameChanged(QString)));
|
||||
m_seat->setup(registry.bindSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>()));
|
||||
QVERIFY(nameSpy.wait());
|
||||
}
|
||||
|
||||
|
|
|
@ -134,8 +134,7 @@ void TestWaylandShell::init()
|
|||
if (shellSpy.isEmpty()) {
|
||||
QVERIFY(shellSpy.wait());
|
||||
}
|
||||
m_shell = new KWayland::Client::Shell(this);
|
||||
m_shell->setup(registry.bindShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>()));
|
||||
m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_shell->isValid());
|
||||
}
|
||||
|
||||
|
|
|
@ -108,8 +108,7 @@ void TestWaylandSurface::init()
|
|||
registry.setup();
|
||||
QVERIFY(compositorSpy.wait());
|
||||
|
||||
m_compositor = new KWayland::Client::Compositor(this);
|
||||
m_compositor->setup(registry.bindCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>()));
|
||||
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
|
||||
QVERIFY(m_compositor->isValid());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue