Improve TestWaylandConnectionThread::testConnectionThread
The test started to fail on my system without changing anything. I assume my system got an update to latest wayland version and it looks like the registry doesn't announce anything if nothing is registered. So now our display at least creates the Shm interface. In addition the test case is slightly improved with a few smaller changes added during the debug session.
This commit is contained in:
parent
809519f058
commit
ecec800357
1 changed files with 11 additions and 5 deletions
|
@ -57,10 +57,10 @@ void TestWaylandConnectionThread::init()
|
|||
using namespace KWayland::Server;
|
||||
delete m_display;
|
||||
m_display = new Display(this);
|
||||
QSignalSpy displayRunning(m_display, SIGNAL(runningChanged(bool)));
|
||||
m_display->setSocketName(s_socketName);
|
||||
m_display->start();
|
||||
QVERIFY(m_display->isRunning());
|
||||
m_display->createShm();
|
||||
}
|
||||
|
||||
void TestWaylandConnectionThread::cleanup()
|
||||
|
@ -123,15 +123,17 @@ static const struct wl_registry_listener s_registryListener = {
|
|||
|
||||
void TestWaylandConnectionThread::testConnectionThread()
|
||||
{
|
||||
QScopedPointer<KWayland::Client::ConnectionThread> connection(new KWayland::Client::ConnectionThread);
|
||||
KWayland::Client::ConnectionThread *connection = new KWayland::Client::ConnectionThread;
|
||||
connection->setSocketName(s_socketName);
|
||||
|
||||
QThread *connectionThread = new QThread(this);
|
||||
connection->moveToThread(connectionThread);
|
||||
connectionThread->start();
|
||||
|
||||
QSignalSpy connectedSpy(connection.data(), SIGNAL(connected()));
|
||||
QSignalSpy failedSpy(connection.data(), SIGNAL(failed()));
|
||||
QSignalSpy connectedSpy(connection, SIGNAL(connected()));
|
||||
QVERIFY(connectedSpy.isValid());
|
||||
QSignalSpy failedSpy(connection, SIGNAL(failed()));
|
||||
QVERIFY(failedSpy.isValid());
|
||||
connection->initConnection();
|
||||
QVERIFY(connectedSpy.wait());
|
||||
QCOMPARE(connectedSpy.count(), 1);
|
||||
|
@ -139,10 +141,13 @@ void TestWaylandConnectionThread::testConnectionThread()
|
|||
QVERIFY(connection->display());
|
||||
|
||||
// now we have the connection ready, let's get some events
|
||||
QSignalSpy eventsSpy(connection.data(), SIGNAL(eventsRead()));
|
||||
QSignalSpy eventsSpy(connection, SIGNAL(eventsRead()));
|
||||
QVERIFY(eventsSpy.isValid());
|
||||
wl_display *display = connection->display();
|
||||
QScopedPointer<KWayland::Client::EventQueue> queue(new KWayland::Client::EventQueue);
|
||||
queue->setup(display);
|
||||
QVERIFY(queue->isValid());
|
||||
connect(connection, &KWayland::Client::ConnectionThread::eventsRead, queue.data(), &KWayland::Client::EventQueue::dispatch, Qt::QueuedConnection);
|
||||
|
||||
wl_registry *registry = wl_display_get_registry(display);
|
||||
wl_proxy_set_queue((wl_proxy*)registry, *(queue.data()));
|
||||
|
@ -158,6 +163,7 @@ void TestWaylandConnectionThread::testConnectionThread()
|
|||
wl_registry_destroy(registry);
|
||||
queue.reset();
|
||||
|
||||
connection->deleteLater();
|
||||
connectionThread->quit();
|
||||
connectionThread->wait();
|
||||
delete connectionThread;
|
||||
|
|
Loading…
Reference in a new issue