16#include "KWayland/Client/compositor.h"
17#include "KWayland/Client/connection_thread.h"
18#include "KWayland/Client/event_queue.h"
19#include "KWayland/Client/plasmashell.h"
20#include "KWayland/Client/registry.h"
21#include "KWayland/Client/surface.h"
23#include <wayland-client-protocol.h>
36 void testMultiplePlasmaShellSurfacesForSurface();
42 KWayland::Client::ConnectionThread *m_connection =
nullptr;
43 QThread *m_thread =
nullptr;
44 KWayland::Client::EventQueue *m_queue =
nullptr;
45 KWayland::Client::Compositor *m_compositor =
nullptr;
46 KWayland::Client::PlasmaShell *m_plasmaShell =
nullptr;
49static const QString s_socketName = QStringLiteral(
"kwayland-test-error-0");
63 m_connection =
new KWayland::Client::ConnectionThread;
64 QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);
65 m_connection->setSocketName(s_socketName);
67 m_thread =
new QThread(
this);
68 m_connection->moveToThread(m_thread);
71 m_connection->initConnection();
72 QVERIFY(connectedSpy.wait());
74 m_queue =
new KWayland::Client::EventQueue(
this);
75 m_queue->setup(m_connection);
77 KWayland::Client::Registry registry;
78 QSignalSpy interfacesAnnouncedSpy(®istry, &KWayland::Client::Registry::interfacesAnnounced);
79 registry.setEventQueue(m_queue);
80 registry.create(m_connection);
81 QVERIFY(registry.isValid());
83 QVERIFY(interfacesAnnouncedSpy.wait());
86 registry.createCompositor(registry.interface(KWayland::Client::Registry::Interface::Compositor).name, registry.interface(KWayland::Client::Registry::Interface::Compositor).version,
this);
87 QVERIFY(m_compositor);
88 m_plasmaShell = registry.createPlasmaShell(registry.interface(KWayland::Client::Registry::Interface::PlasmaShell).name,
89 registry.interface(KWayland::Client::Registry::Interface::PlasmaShell).version,
91 QVERIFY(m_plasmaShell);
94void ErrorTest::cleanup()
96#define CLEANUP(variable) \
105 m_connection->deleteLater();
106 m_connection =
nullptr;
121void ErrorTest::testMultiplePlasmaShellSurfacesForSurface()
124 QSignalSpy errorSpy(m_connection, &KWayland::Client::ConnectionThread::errorOccurred);
127 auto surface = wl_compositor_create_surface(*m_compositor);
128 std::unique_ptr<KWayland::Client::PlasmaShellSurface> shellSurface1(m_plasmaShell->createSurface(surface));
129 std::unique_ptr<KWayland::Client::PlasmaShellSurface> shellSurface2(m_plasmaShell->createSurface(surface));
130 QVERIFY(!m_connection->hasError());
131 QVERIFY(errorSpy.wait());
132 QVERIFY(m_connection->hasError());
133 QCOMPARE(m_connection->errorCode(), EPROTO);
134 wl_surface_destroy(surface);
138#include "test_error.moc"
Class holding the Wayland server display loop.
bool addSocketName(const QString &name=QString())
Global for the org_kde_plasma_shell interface.
#define CLEANUP(variable)