Commit 6ea3abc5 authored by Martin Flöser's avatar Martin Flöser
Browse files

Add test case for Seat::destroy

parent ff9c6ea2
......@@ -53,6 +53,7 @@ private Q_SLOTS:
void testPointer();
void testKeyboard();
void testCast();
void testDestroy();
// TODO: add test for keymap
private:
......@@ -518,5 +519,28 @@ void TestWaylandSeat::testCast()
QCOMPARE((wl_seat*)s2, wlSeat);
}
void TestWaylandSeat::testDestroy()
{
using namespace KWayland::Client;
delete m_compositor;
m_compositor = nullptr;
connect(m_connection, &ConnectionThread::connectionDied, m_seat, &Seat::destroy);
QVERIFY(m_seat->isValid());
QSignalSpy connectionDiedSpy(m_connection, SIGNAL(connectionDied()));
QVERIFY(connectionDiedSpy.isValid());
delete m_display;
m_display = nullptr;
m_compositorInterface = nullptr;
m_seatInterface = nullptr;
QVERIFY(connectionDiedSpy.wait());
// now the seat should be destroyed;
QVERIFY(!m_seat->isValid());
// calling destroy again should not fail
m_seat->destroy();
}
QTEST_MAIN(TestWaylandSeat)
#include "test_wayland_seat.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