KWin
Loading...
Searching...
No Matches
test_plasmashell.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6// Qt
7#include <QSignalSpy>
8#include <QTest>
9// KWayland
10#include "wayland/compositor.h"
11#include "wayland/display.h"
12#include "wayland/plasmashell.h"
13
14#include "KWayland/Client/compositor.h"
15#include "KWayland/Client/connection_thread.h"
16#include "KWayland/Client/event_queue.h"
17#include "KWayland/Client/plasmashell.h"
18#include "KWayland/Client/registry.h"
19#include "KWayland/Client/surface.h"
20
21using namespace KWin;
22
23class TestPlasmaShell : public QObject
24{
25 Q_OBJECT
26private Q_SLOTS:
27 void init();
28 void cleanup();
29
30 void testRole_data();
31 void testRole();
32 void testPosition();
33 void testSkipTaskbar();
34 void testSkipSwitcher();
35 void testPanelBehavior_data();
36 void testPanelBehavior();
37 void testAutoHidePanel();
38 void testPanelTakesFocus();
39 void testDisconnect();
40 void testWhileDestroying();
41
42private:
43 KWin::Display *m_display = nullptr;
44 CompositorInterface *m_compositorInterface = nullptr;
45 PlasmaShellInterface *m_plasmaShellInterface = nullptr;
46
47 KWayland::Client::ConnectionThread *m_connection = nullptr;
48 KWayland::Client::Compositor *m_compositor = nullptr;
49 KWayland::Client::EventQueue *m_queue = nullptr;
50 QThread *m_thread = nullptr;
51 KWayland::Client::Registry *m_registry = nullptr;
52 KWayland::Client::PlasmaShell *m_plasmaShell = nullptr;
53};
54
55static const QString s_socketName = QStringLiteral("kwayland-test-wayland-plasma-shell-0");
56
57void TestPlasmaShell::init()
58{
59 delete m_display;
60 m_display = new KWin::Display(this);
61 m_display->addSocketName(s_socketName);
62 m_display->start();
63 QVERIFY(m_display->isRunning());
64
65 m_compositorInterface = new CompositorInterface(m_display, m_display);
66 m_display->createShm();
67
68 m_plasmaShellInterface = new PlasmaShellInterface(m_display, m_display);
69
70 // setup connection
71 m_connection = new KWayland::Client::ConnectionThread;
72 QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);
73 m_connection->setSocketName(s_socketName);
74
75 m_thread = new QThread(this);
76 m_connection->moveToThread(m_thread);
77 m_thread->start();
78
79 m_connection->initConnection();
80 QVERIFY(connectedSpy.wait());
81
82 m_queue = new KWayland::Client::EventQueue(this);
83 QVERIFY(!m_queue->isValid());
84 m_queue->setup(m_connection);
85 QVERIFY(m_queue->isValid());
86
87 m_registry = new KWayland::Client::Registry();
88 QSignalSpy interfacesAnnouncedSpy(m_registry, &KWayland::Client::Registry::interfaceAnnounced);
89
90 QVERIFY(!m_registry->eventQueue());
91 m_registry->setEventQueue(m_queue);
92 QCOMPARE(m_registry->eventQueue(), m_queue);
93 m_registry->create(m_connection);
94 QVERIFY(m_registry->isValid());
95 m_registry->setup();
96
97 QVERIFY(interfacesAnnouncedSpy.wait());
98#define CREATE(variable, factory, iface) \
99 variable = \
100 m_registry->create##factory(m_registry->interface(KWayland::Client::Registry::Interface::iface).name, m_registry->interface(KWayland::Client::Registry::Interface::iface).version, this); \
101 QVERIFY(variable);
102
103 CREATE(m_compositor, Compositor, Compositor)
104 CREATE(m_plasmaShell, PlasmaShell, PlasmaShell)
105
106#undef CREATE
107}
108
109void TestPlasmaShell::cleanup()
110{
111#define DELETE(name) \
112 if (name) { \
113 delete name; \
114 name = nullptr; \
115 }
116 DELETE(m_plasmaShell)
117 DELETE(m_compositor)
118 DELETE(m_queue)
119 DELETE(m_registry)
120#undef DELETE
121 if (m_thread) {
122 m_thread->quit();
123 m_thread->wait();
124 delete m_thread;
125 m_thread = nullptr;
126 }
127 delete m_connection;
128 m_connection = nullptr;
129
130 delete m_display;
131 m_display = nullptr;
132}
133
134void TestPlasmaShell::testRole_data()
135{
136 QTest::addColumn<KWayland::Client::PlasmaShellSurface::Role>("clientRole");
137 QTest::addColumn<KWin::PlasmaShellSurfaceInterface::Role>("serverRole");
138
139 QTest::newRow("desktop") << KWayland::Client::PlasmaShellSurface::Role::Desktop << PlasmaShellSurfaceInterface::Role::Desktop;
140 QTest::newRow("osd") << KWayland::Client::PlasmaShellSurface::Role::OnScreenDisplay << PlasmaShellSurfaceInterface::Role::OnScreenDisplay;
141 QTest::newRow("panel") << KWayland::Client::PlasmaShellSurface::Role::Panel << PlasmaShellSurfaceInterface::Role::Panel;
142 QTest::newRow("notification") << KWayland::Client::PlasmaShellSurface::Role::Notification << PlasmaShellSurfaceInterface::Role::Notification;
143 QTest::newRow("tooltip") << KWayland::Client::PlasmaShellSurface::Role::ToolTip << PlasmaShellSurfaceInterface::Role::ToolTip;
144 QTest::newRow("criticalnotification") << KWayland::Client::PlasmaShellSurface::Role::CriticalNotification << PlasmaShellSurfaceInterface::Role::CriticalNotification;
145 QTest::newRow("appletPopup") << KWayland::Client::PlasmaShellSurface::Role::AppletPopup << PlasmaShellSurfaceInterface::Role::AppletPopup;
146}
147
148void TestPlasmaShell::testRole()
149{
150 // this test verifies that setting the role on a plasma shell surface works
151
152 // first create signal spies
153 QSignalSpy surfaceCreatedSpy(m_compositorInterface, &CompositorInterface::surfaceCreated);
154 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
155
156 // create the surface
157 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
158 // no PlasmaShellSurface for the Surface yet yet
159 QVERIFY(!KWayland::Client::PlasmaShellSurface::get(s.get()));
160 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
161 QCOMPARE(ps->role(), KWayland::Client::PlasmaShellSurface::Role::Normal);
162 // now we should have a PlasmaShellSurface for
163 QCOMPARE(KWayland::Client::PlasmaShellSurface::get(s.get()), ps.get());
164
165 // try to create another PlasmaShellSurface for the same Surface, should return from cache
166 QCOMPARE(m_plasmaShell->createSurface(s.get()), ps.get());
167
168 // and get them on the server
169 QVERIFY(plasmaSurfaceCreatedSpy.wait());
170 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
171 QCOMPARE(surfaceCreatedSpy.count(), 1);
172
173 // verify that we got a plasma shell surface
174 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
175 QVERIFY(sps);
176 QVERIFY(sps->surface());
177 QCOMPARE(sps->surface(), surfaceCreatedSpy.first().first().value<SurfaceInterface *>());
178
179 // default role should be normal
180 QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Normal);
181
182 // now change it
183 QSignalSpy roleChangedSpy(sps, &PlasmaShellSurfaceInterface::roleChanged);
184 QFETCH(KWayland::Client::PlasmaShellSurface::Role, clientRole);
185 ps->setRole(clientRole);
186 QCOMPARE(ps->role(), clientRole);
187 QVERIFY(roleChangedSpy.wait());
188 QCOMPARE(roleChangedSpy.count(), 1);
189 QTEST(sps->role(), "serverRole");
190
191 // try changing again should not emit the signal
192 ps->setRole(clientRole);
193 QVERIFY(!roleChangedSpy.wait(100));
194
195 // set role back to normal
196 ps->setRole(KWayland::Client::PlasmaShellSurface::Role::Normal);
197 QCOMPARE(ps->role(), KWayland::Client::PlasmaShellSurface::Role::Normal);
198 QVERIFY(roleChangedSpy.wait());
199 QCOMPARE(roleChangedSpy.count(), 2);
200 QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Normal);
201}
202
203void TestPlasmaShell::testPosition()
204{
205 // this test verifies that updating the position of a PlasmaShellSurface is properly passed to the server
206 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
207
208 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
209 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
210 QVERIFY(plasmaSurfaceCreatedSpy.wait());
211 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
212
213 // verify that we got a plasma shell surface
214 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
215 QVERIFY(sps);
216 QVERIFY(sps->surface());
217
218 // default position should not be set
219 QVERIFY(!sps->isPositionSet());
220 QCOMPARE(sps->position(), QPoint());
221
222 // now let's try to change the position
223 QSignalSpy positionChangedSpy(sps, &PlasmaShellSurfaceInterface::positionChanged);
224 ps->setPosition(QPoint(1, 2));
225 QVERIFY(positionChangedSpy.wait());
226 QCOMPARE(positionChangedSpy.count(), 1);
227 QVERIFY(sps->isPositionSet());
228 QCOMPARE(sps->position(), QPoint(1, 2));
229
230 // let's try to set same position, should not trigger an update
231 ps->setPosition(QPoint(1, 2));
232 QVERIFY(!positionChangedSpy.wait(100));
233 // different point should work, though
234 ps->setPosition(QPoint(3, 4));
235 QVERIFY(positionChangedSpy.wait());
236 QCOMPARE(positionChangedSpy.count(), 2);
237 QCOMPARE(sps->position(), QPoint(3, 4));
238}
239
240void TestPlasmaShell::testSkipTaskbar()
241{
242 // this test verifies that sip taskbar is properly passed to server
243 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
244
245 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
246 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
247 QVERIFY(plasmaSurfaceCreatedSpy.wait());
248 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
249
250 // verify that we got a plasma shell surface
251 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
252 QVERIFY(sps);
253 QVERIFY(sps->surface());
254 QVERIFY(!sps->skipTaskbar());
255
256 // now change
257 QSignalSpy skipTaskbarChangedSpy(sps, &PlasmaShellSurfaceInterface::skipTaskbarChanged);
258 ps->setSkipTaskbar(true);
259 QVERIFY(skipTaskbarChangedSpy.wait());
260 QVERIFY(sps->skipTaskbar());
261 // setting to same again should not emit the signal
262 ps->setSkipTaskbar(true);
263 QEXPECT_FAIL("", "Should not be emitted if not changed", Continue);
264 QVERIFY(!skipTaskbarChangedSpy.wait(100));
265 QVERIFY(sps->skipTaskbar());
266
267 // setting to false should change again
268 ps->setSkipTaskbar(false);
269 QVERIFY(skipTaskbarChangedSpy.wait());
270 QVERIFY(!sps->skipTaskbar());
271}
272
273void TestPlasmaShell::testSkipSwitcher()
274{
275 // this test verifies that Skip Switcher is properly passed to server
276 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
277
278 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
279 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
280 QVERIFY(plasmaSurfaceCreatedSpy.wait());
281 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
282
283 // verify that we got a plasma shell surface
284 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
285 QVERIFY(sps);
286 QVERIFY(sps->surface());
287 QVERIFY(!sps->skipSwitcher());
288
289 // now change
290 QSignalSpy skipSwitcherChangedSpy(sps, &PlasmaShellSurfaceInterface::skipSwitcherChanged);
291 ps->setSkipSwitcher(true);
292 QVERIFY(skipSwitcherChangedSpy.wait());
293 QVERIFY(sps->skipSwitcher());
294 // setting to same again should not emit the signal
295 ps->setSkipSwitcher(true);
296 QEXPECT_FAIL("", "Should not be emitted if not changed", Continue);
297 QVERIFY(!skipSwitcherChangedSpy.wait(100));
298 QVERIFY(sps->skipSwitcher());
299
300 // setting to false should change again
301 ps->setSkipSwitcher(false);
302 QVERIFY(skipSwitcherChangedSpy.wait());
303 QVERIFY(!sps->skipSwitcher());
304}
305
306void TestPlasmaShell::testPanelBehavior_data()
307{
308 QTest::addColumn<KWayland::Client::PlasmaShellSurface::PanelBehavior>("client");
309 QTest::addColumn<PlasmaShellSurfaceInterface::PanelBehavior>("server");
310
311 QTest::newRow("autohide") << KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide << PlasmaShellSurfaceInterface::PanelBehavior::AutoHide;
312 QTest::newRow("can cover") << KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsCanCover << PlasmaShellSurfaceInterface::PanelBehavior::WindowsCanCover;
313 QTest::newRow("go below") << KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow << PlasmaShellSurfaceInterface::PanelBehavior::WindowsGoBelow;
314}
315
316void TestPlasmaShell::testPanelBehavior()
317{
318 // this test verifies that the panel behavior is properly passed to the server
319 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
320
321 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
322 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
323 ps->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
324 QVERIFY(plasmaSurfaceCreatedSpy.wait());
325 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
326
327 // verify that we got a plasma shell surface
328 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
329 QVERIFY(sps);
330 QVERIFY(sps->surface());
331 QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible);
332
333 // now change the behavior
334 QSignalSpy behaviorChangedSpy(sps, &PlasmaShellSurfaceInterface::panelBehaviorChanged);
335 QFETCH(KWayland::Client::PlasmaShellSurface::PanelBehavior, client);
336 ps->setPanelBehavior(client);
337 QVERIFY(behaviorChangedSpy.wait());
338 QTEST(sps->panelBehavior(), "server");
339
340 // changing to same should not trigger the signal
341 ps->setPanelBehavior(client);
342 QVERIFY(!behaviorChangedSpy.wait(100));
343
344 // but changing back to Always Visible should work
345 ps->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AlwaysVisible);
346 QVERIFY(behaviorChangedSpy.wait());
347 QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AlwaysVisible);
348}
349
350void TestPlasmaShell::testAutoHidePanel()
351{
352 // this test verifies that auto-hiding panels work correctly
353 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
354
355 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
356 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
357 ps->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
358 ps->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
359 QVERIFY(plasmaSurfaceCreatedSpy.wait());
360 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
361 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
362 QVERIFY(sps);
363 QCOMPARE(sps->panelBehavior(), PlasmaShellSurfaceInterface::PanelBehavior::AutoHide);
364
365 QSignalSpy autoHideRequestedSpy(sps, &PlasmaShellSurfaceInterface::panelAutoHideHideRequested);
366 QSignalSpy autoHideShowRequestedSpy(sps, &PlasmaShellSurfaceInterface::panelAutoHideShowRequested);
367 ps->requestHideAutoHidingPanel();
368 QVERIFY(autoHideRequestedSpy.wait());
369 QCOMPARE(autoHideRequestedSpy.count(), 1);
370 QCOMPARE(autoHideShowRequestedSpy.count(), 0);
371
372 QSignalSpy panelShownSpy(ps.get(), &KWayland::Client::PlasmaShellSurface::autoHidePanelShown);
373 QSignalSpy panelHiddenSpy(ps.get(), &KWayland::Client::PlasmaShellSurface::autoHidePanelHidden);
374
375 sps->hideAutoHidingPanel();
376 QVERIFY(panelHiddenSpy.wait());
377 QCOMPARE(panelHiddenSpy.count(), 1);
378 QCOMPARE(panelShownSpy.count(), 0);
379
380 ps->requestShowAutoHidingPanel();
381 QVERIFY(autoHideShowRequestedSpy.wait());
382 QCOMPARE(autoHideRequestedSpy.count(), 1);
383 QCOMPARE(autoHideShowRequestedSpy.count(), 1);
384
385 sps->showAutoHidingPanel();
386 QVERIFY(panelShownSpy.wait());
387 QCOMPARE(panelHiddenSpy.count(), 1);
388 QCOMPARE(panelShownSpy.count(), 1);
389
390 // change panel type
391 ps->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AlwaysVisible);
392 // requesting auto hide should raise error
393 QSignalSpy errorSpy(m_connection, &KWayland::Client::ConnectionThread::errorOccurred);
394 ps->requestHideAutoHidingPanel();
395 QVERIFY(errorSpy.wait());
396}
397
398void TestPlasmaShell::testPanelTakesFocus()
399{
400 // this test verifies that whether a panel wants to take focus is passed through correctly
401 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
402
403 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
404 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
405 ps->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
406 QVERIFY(plasmaSurfaceCreatedSpy.wait());
407 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
408 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
409 QSignalSpy plasmaSurfaceTakesFocusSpy(sps, &PlasmaShellSurfaceInterface::panelTakesFocusChanged);
410
411 QVERIFY(sps);
412 QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Panel);
413 QCOMPARE(sps->panelTakesFocus(), false);
414
415 ps->setPanelTakesFocus(true);
416 m_connection->flush();
417 QVERIFY(plasmaSurfaceTakesFocusSpy.wait());
418 QCOMPARE(plasmaSurfaceTakesFocusSpy.count(), 1);
419 QCOMPARE(sps->panelTakesFocus(), true);
420 ps->setPanelTakesFocus(false);
421 m_connection->flush();
422 QVERIFY(plasmaSurfaceTakesFocusSpy.wait());
423 QCOMPARE(plasmaSurfaceTakesFocusSpy.count(), 2);
424 QCOMPARE(sps->panelTakesFocus(), false);
425}
426
427void TestPlasmaShell::testDisconnect()
428{
429 // this test verifies that a disconnect cleans up
430 QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
431 // create the surface
432 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
433 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
434
435 // and get them on the server
436 QVERIFY(plasmaSurfaceCreatedSpy.wait());
437 QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
438 auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface *>();
439 QVERIFY(sps);
440
441 // disconnect
442 QSignalSpy surfaceDestroyedSpy(sps, &QObject::destroyed);
443 if (m_connection) {
444 m_connection->deleteLater();
445 m_connection = nullptr;
446 }
447 QCOMPARE(surfaceDestroyedSpy.count(), 0);
448 QVERIFY(surfaceDestroyedSpy.wait());
449 QCOMPARE(surfaceDestroyedSpy.count(), 1);
450
451 s->destroy();
452 ps->destroy();
453 m_plasmaShell->destroy();
454 m_compositor->destroy();
455 m_registry->destroy();
456 m_queue->destroy();
457}
458
459void TestPlasmaShell::testWhileDestroying()
460{
461 // this test tries to hit a condition that a Surface gets created with an ID which was already
462 // used for a previous Surface. For each Surface we try to create a PlasmaShellSurface.
463 // Even if there was a Surface in the past with the same ID, it should create the PlasmaShellSurface
464 QSignalSpy surfaceCreatedSpy(m_compositorInterface, &CompositorInterface::surfaceCreated);
465 std::unique_ptr<KWayland::Client::Surface> s(m_compositor->createSurface());
466 QVERIFY(surfaceCreatedSpy.wait());
467 auto serverSurface = surfaceCreatedSpy.first().first().value<SurfaceInterface *>();
468 QVERIFY(serverSurface);
469
470 // create ShellSurface
471 QSignalSpy shellSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
472 std::unique_ptr<KWayland::Client::PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.get()));
473 QVERIFY(shellSurfaceCreatedSpy.wait());
474
475 // now try to create more surfaces
476 QSignalSpy clientErrorSpy(m_connection, &KWayland::Client::ConnectionThread::errorOccurred);
477 for (int i = 0; i < 100; i++) {
478 s.reset();
479 s.reset(m_compositor->createSurface());
480 m_plasmaShell->createSurface(s.get(), this);
481 QVERIFY(surfaceCreatedSpy.wait());
482 }
483 QVERIFY(clientErrorSpy.isEmpty());
484 QVERIFY(!clientErrorSpy.wait(100));
485 QVERIFY(clientErrorSpy.isEmpty());
486}
487
488QTEST_GUILESS_MAIN(TestPlasmaShell)
489#include "test_plasmashell.moc"
void surfaceCreated(KWin::SurfaceInterface *surface)
Class holding the Wayland server display loop.
Definition display.h:34
void createShm()
Definition display.cpp:128
bool addSocketName(const QString &name=QString())
Definition display.cpp:68
bool isRunning() const
Definition display.cpp:144
bool start()
Definition display.cpp:92
Global for the org_kde_plasma_shell interface.
Definition plasmashell.h:37
void surfaceCreated(KWin::PlasmaShellSurfaceInterface *)
Resource for the org_kde_plasma_shell_surface interface.
Definition plasmashell.h:60
Resource representing a wl_surface.
Definition surface.h:80
#define DELETE(name)
#define CREATE(variable, factory, iface)