13#include <wayland-client.h>
21#include <KWayland/Client/compositor.h>
22#include <KWayland/Client/connection_thread.h>
23#include <KWayland/Client/event_queue.h>
24#include <KWayland/Client/registry.h>
25#include <KWayland/Client/seat.h>
27#include "qwayland-zkde-screencast-unstable-v1.h"
36 , zkde_screencast_stream_unstable_v1(obj)
49class ScreencastV1 :
public QObject,
public QtWayland::zkde_screencast_unstable_v1
81 KWayland::Client::ConnectionThread *m_connection;
82 KWayland::Client::EventQueue *m_queue =
nullptr;
87 QPointer<KWin::ScreencastStreamV1Interface> m_triggered =
nullptr;
92static const QString s_socketName = QStringLiteral(
"kwin-wayland-server-screencast-test-0");
94void TestScreencastV1Interface::initTestCase()
103 m_connection =
new KWayland::Client::ConnectionThread;
104 QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);
105 m_connection->setSocketName(s_socketName);
107 m_thread =
new QThread(
this);
108 m_connection->moveToThread(m_thread);
111 m_connection->initConnection();
112 QVERIFY(connectedSpy.wait());
114 m_queue =
new KWayland::Client::EventQueue(
this);
115 QVERIFY(!m_queue->isValid());
116 m_queue->setup(m_connection);
117 QVERIFY(m_queue->isValid());
119 KWayland::Client::Registry
registry;
121 QSignalSpy screencastSpy(®istry, &KWayland::Client::Registry::interfacesAnnounced);
123 connect(m_screencastInterface,
128 m_triggered = stream;
132 &KWayland::Client::Registry::interfaceAnnounced,
134 [
this, ®istry](
const QByteArray &interfaceName, quint32 name, quint32
version) {
135 if (interfaceName !=
"zkde_screencast_unstable_v1")
138 m_screencast->init(&*registry, name,
version);
141 registry.create(m_connection->display());
144 wl_display_flush(m_connection->display());
146 QVERIFY(m_screencastInterface);
147 QVERIFY(m_screencast || screencastSpy.wait());
148 QVERIFY(m_screencast);
162 m_connection->deleteLater();
163 m_connection =
nullptr;
168void TestScreencastV1Interface::testCreate()
174 QVERIFY(spyWorking.count() || spyWorking.wait());
175 QVERIFY(m_triggered);
179 QVERIFY(spyStop.count() || spyStop.wait());
184#include "test_screencast.moc"
Class holding the Wayland server display loop.
bool addSocketName(const QString &name=QString())
void sendCreated(quint32 nodeid)
void windowScreencastRequested(ScreencastStreamV1Interface *stream, const QString &winid, CursorMode mode)
void created(quint32 node)
void zkde_screencast_stream_unstable_v1_created(uint32_t node) override
ScreencastStreamV1(::zkde_screencast_stream_unstable_v1 *obj, QObject *parent)
ScreencastStreamV1 * createWindowStream(const QString &uuid)
ScreencastV1(QObject *parent)
~TestScreencastV1Interface() override
TestScreencastV1Interface()
KWayland::Client::Registry * registry