From ca3b8b0cec6f6d40b46d4bca11241288ff0459cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 22 Sep 2014 11:03:46 +0200 Subject: [PATCH] Add test case for operator cast in Compositor --- .../autotests/client/test_compositor.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wayland/autotests/client/test_compositor.cpp b/src/wayland/autotests/client/test_compositor.cpp index aaac11dab6..89da679411 100644 --- a/src/wayland/autotests/client/test_compositor.cpp +++ b/src/wayland/autotests/client/test_compositor.cpp @@ -40,6 +40,7 @@ private Q_SLOTS: void cleanup(); void testDestroy(); + void testCast(); private: KWayland::Server::Display *m_display; @@ -136,5 +137,25 @@ void TestCompositor::testDestroy() m_compositor->destroy(); } +void TestCompositor::testCast() +{ + using namespace KWayland::Client; + Registry registry; + QSignalSpy compositorSpy(®istry, SIGNAL(compositorAnnounced(quint32,quint32))); + registry.create(m_connection->display()); + QVERIFY(registry.isValid()); + registry.setup(); + + QVERIFY(compositorSpy.wait()); + + Compositor c; + auto wlComp = registry.bindCompositor(compositorSpy.first().first().value(), compositorSpy.first().last().value()); + c.setup(wlComp); + QCOMPARE((wl_compositor*)c, wlComp); + + const Compositor &c2(c); + QCOMPARE((wl_compositor*)c2, wlComp); +} + QTEST_MAIN(TestCompositor) #include "test_compositor.moc"