Add test case for ShellSurface::destroy
This commit is contained in:
parent
44a51fef8b
commit
bf1168db23
1 changed files with 29 additions and 0 deletions
|
@ -46,6 +46,7 @@ private Q_SLOTS:
|
||||||
void testPing();
|
void testPing();
|
||||||
void testTitle();
|
void testTitle();
|
||||||
void testWindowClass();
|
void testWindowClass();
|
||||||
|
void testDestroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KWayland::Server::Display *m_display;
|
KWayland::Server::Display *m_display;
|
||||||
|
@ -299,5 +300,33 @@ void TestWaylandShell::testWindowClass()
|
||||||
QCOMPARE(windowClassSpy.first().first().toByteArray(), testClass);
|
QCOMPARE(windowClassSpy.first().first().toByteArray(), testClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestWaylandShell::testDestroy()
|
||||||
|
{
|
||||||
|
using namespace KWayland::Client;
|
||||||
|
QScopedPointer<Surface> s(m_compositor->createSurface());
|
||||||
|
QVERIFY(!s.isNull());
|
||||||
|
QVERIFY(s->isValid());
|
||||||
|
ShellSurface *surface = m_shell->createSurface(s.data(), m_shell);
|
||||||
|
QVERIFY(surface->isValid());
|
||||||
|
|
||||||
|
connect(m_connection, &ConnectionThread::connectionDied, m_shell, &Shell::destroy);
|
||||||
|
connect(m_connection, &ConnectionThread::connectionDied, m_compositor, &Compositor::destroy);
|
||||||
|
connect(m_connection, &ConnectionThread::connectionDied, s.data(), &Surface::destroy);
|
||||||
|
|
||||||
|
QSignalSpy connectionDiedSpy(m_connection, SIGNAL(connectionDied()));
|
||||||
|
QVERIFY(connectionDiedSpy.isValid());
|
||||||
|
delete m_display;
|
||||||
|
m_display = nullptr;
|
||||||
|
m_compositorInterface = nullptr;
|
||||||
|
m_shellInterface = nullptr;
|
||||||
|
QVERIFY(connectionDiedSpy.wait());
|
||||||
|
|
||||||
|
QVERIFY(!m_shell->isValid());
|
||||||
|
QVERIFY(!surface->isValid());
|
||||||
|
|
||||||
|
m_shell->destroy();
|
||||||
|
surface->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestWaylandShell)
|
QTEST_MAIN(TestWaylandShell)
|
||||||
#include "test_wayland_shell.moc"
|
#include "test_wayland_shell.moc"
|
||||||
|
|
Loading…
Reference in a new issue