Add test case for operator cast in Client::Seat

This commit is contained in:
Martin Gräßlin 2014-09-22 11:56:48 +02:00
parent d267cdca02
commit ff9c6ea23d

View file

@ -52,6 +52,7 @@ private Q_SLOTS:
void testCapabilities();
void testPointer();
void testKeyboard();
void testCast();
// TODO: add test for keymap
private:
@ -495,5 +496,27 @@ void TestWaylandSeat::testKeyboard()
QVERIFY(!serverKeyboard->focusedSurface());
}
void TestWaylandSeat::testCast()
{
using namespace KWayland::Client;
Registry registry;
QSignalSpy seatSpy(&registry, SIGNAL(seatAnnounced(quint32,quint32)));
registry.create(m_connection->display());
QVERIFY(registry.isValid());
registry.setup();
QVERIFY(seatSpy.wait());
Seat s;
QVERIFY(!s.isValid());
auto wlSeat = registry.bindSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>());
QVERIFY(wlSeat);
s.setup(wlSeat);
QVERIFY(s.isValid());
QCOMPARE((wl_seat*)s, wlSeat);
const Seat &s2(s);
QCOMPARE((wl_seat*)s2, wlSeat);
}
QTEST_MAIN(TestWaylandSeat)
#include "test_wayland_seat.moc"