Add test case for operator cast in Client::Shell
One test also adjusted to get the operator cast in ShellSurface under coverage.
This commit is contained in:
parent
bf1168db23
commit
d267cdca02
1 changed files with 24 additions and 1 deletions
|
@ -47,6 +47,7 @@ private Q_SLOTS:
|
|||
void testTitle();
|
||||
void testWindowClass();
|
||||
void testDestroy();
|
||||
void testCast();
|
||||
|
||||
private:
|
||||
KWayland::Server::Display *m_display;
|
||||
|
@ -269,7 +270,7 @@ void TestWaylandShell::testTitle()
|
|||
QString testTitle = QStringLiteral("fooBar");
|
||||
QVERIFY(serverSurface->title().isNull());
|
||||
|
||||
wl_shell_surface_set_title(*surface, testTitle.toUtf8().constData());
|
||||
wl_shell_surface_set_title(*(const KWayland::Client::ShellSurface *)surface, testTitle.toUtf8().constData());
|
||||
QVERIFY(titleSpy.wait());
|
||||
QCOMPARE(serverSurface->title(), testTitle);
|
||||
QCOMPARE(titleSpy.first().first().toString(), testTitle);
|
||||
|
@ -328,5 +329,27 @@ void TestWaylandShell::testDestroy()
|
|||
surface->destroy();
|
||||
}
|
||||
|
||||
void TestWaylandShell::testCast()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
Registry registry;
|
||||
QSignalSpy shellSpy(®istry, SIGNAL(shellAnnounced(quint32,quint32)));
|
||||
registry.create(m_connection->display());
|
||||
QVERIFY(registry.isValid());
|
||||
registry.setup();
|
||||
QVERIFY(shellSpy.wait());
|
||||
|
||||
Shell s;
|
||||
auto wlShell = registry.bindShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>());
|
||||
QVERIFY(wlShell);
|
||||
QVERIFY(!s.isValid());
|
||||
s.setup(wlShell);
|
||||
QVERIFY(s.isValid());
|
||||
QCOMPARE((wl_shell*)s, wlShell);
|
||||
|
||||
const Shell &s2(s);
|
||||
QCOMPARE((wl_shell*)s2, wlShell);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestWaylandShell)
|
||||
#include "test_wayland_shell.moc"
|
||||
|
|
Loading…
Reference in a new issue