From ecec800357d87cddec0705e8d952f5dff5953980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 13 Oct 2014 10:10:50 +0200 Subject: [PATCH] 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. --- .../client/test_wayland_connection_thread.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/wayland/autotests/client/test_wayland_connection_thread.cpp b/src/wayland/autotests/client/test_wayland_connection_thread.cpp index a1ef989b05..8eaa525bb7 100644 --- a/src/wayland/autotests/client/test_wayland_connection_thread.cpp +++ b/src/wayland/autotests/client/test_wayland_connection_thread.cpp @@ -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 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 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;