diff --git a/src/wayland/autotests/client/test_wayland_shell.cpp b/src/wayland/autotests/client/test_wayland_shell.cpp index b4f7d84df7..aff2777ba0 100644 --- a/src/wayland/autotests/client/test_wayland_shell.cpp +++ b/src/wayland/autotests/client/test_wayland_shell.cpp @@ -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(), shellSpy.first().last().value()); + 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"