Commit 44a51fef authored by Martin Flöser's avatar Martin Flöser
Browse files

Add test case for Surface::destroy

parent 610e8ce4
......@@ -46,6 +46,7 @@ private Q_SLOTS:
void testDamage();
void testFrameCallback();
void testAttachBuffer();
void testDestroy();
private:
KWayland::Server::Display *m_display;
......@@ -343,5 +344,28 @@ void TestWaylandSurface::testAttachBuffer()
buffer->unref();
}
void TestWaylandSurface::testDestroy()
{
using namespace KWayland::Client;
Surface *s = m_compositor->createSurface();
connect(m_connection, &ConnectionThread::connectionDied, s, &Surface::destroy);
connect(m_connection, &ConnectionThread::connectionDied, m_compositor, &Compositor::destroy);
QVERIFY(s->isValid());
QSignalSpy connectionDiedSpy(m_connection, SIGNAL(connectionDied()));
QVERIFY(connectionDiedSpy.isValid());
delete m_display;
m_display = nullptr;
m_compositorInterface = nullptr;
QVERIFY(connectionDiedSpy.wait());
// now the Surface should be destroyed;
QVERIFY(!s->isValid());
// calling destroy again should not fail
s->destroy();
}
QTEST_MAIN(TestWaylandSurface)
#include "test_wayland_surface.moc"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment