Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_wayland_registry.cpp
Show All 24 Lines | |||||
25 | #include "../../src/client/compositor.h" | 25 | #include "../../src/client/compositor.h" | ||
26 | #include "../../src/client/connection_thread.h" | 26 | #include "../../src/client/connection_thread.h" | ||
27 | #include "../../src/client/dpms.h" | 27 | #include "../../src/client/dpms.h" | ||
28 | #include "../../src/client/event_queue.h" | 28 | #include "../../src/client/event_queue.h" | ||
29 | #include "../../src/client/registry.h" | 29 | #include "../../src/client/registry.h" | ||
30 | #include "../../src/client/output.h" | 30 | #include "../../src/client/output.h" | ||
31 | #include "../../src/client/pointerconstraints.h" | 31 | #include "../../src/client/pointerconstraints.h" | ||
32 | #include "../../src/client/pointergestures.h" | 32 | #include "../../src/client/pointergestures.h" | ||
33 | #include "../../src/client/idleinhibit.h" | ||||
33 | #include "../../src/client/seat.h" | 34 | #include "../../src/client/seat.h" | ||
34 | #include "../../src/client/relativepointer.h" | 35 | #include "../../src/client/relativepointer.h" | ||
35 | #include "../../src/client/server_decoration.h" | 36 | #include "../../src/client/server_decoration.h" | ||
36 | #include "../../src/client/shell.h" | 37 | #include "../../src/client/shell.h" | ||
37 | #include "../../src/client/surface.h" | 38 | #include "../../src/client/surface.h" | ||
38 | #include "../../src/client/subcompositor.h" | 39 | #include "../../src/client/subcompositor.h" | ||
39 | #include "../../src/client/xdgshell.h" | 40 | #include "../../src/client/xdgshell.h" | ||
40 | #include "../../src/server/compositor_interface.h" | 41 | #include "../../src/server/compositor_interface.h" | ||
41 | #include "../../src/server/datadevicemanager_interface.h" | 42 | #include "../../src/server/datadevicemanager_interface.h" | ||
42 | #include "../../src/server/display.h" | 43 | #include "../../src/server/display.h" | ||
43 | #include "../../src/server/dpms_interface.h" | 44 | #include "../../src/server/dpms_interface.h" | ||
45 | #include "../../src/server/idleinhibit_interface.h" | ||||
44 | #include "../../src/server/output_interface.h" | 46 | #include "../../src/server/output_interface.h" | ||
45 | #include "../../src/server/seat_interface.h" | 47 | #include "../../src/server/seat_interface.h" | ||
46 | #include "../../src/server/shell_interface.h" | 48 | #include "../../src/server/shell_interface.h" | ||
47 | #include "../../src/server/blur_interface.h" | 49 | #include "../../src/server/blur_interface.h" | ||
48 | #include "../../src/server/contrast_interface.h" | 50 | #include "../../src/server/contrast_interface.h" | ||
49 | #include "../../src/server/server_decoration_interface.h" | 51 | #include "../../src/server/server_decoration_interface.h" | ||
50 | #include "../../src/server/slide_interface.h" | 52 | #include "../../src/server/slide_interface.h" | ||
51 | #include "../../src/server/subcompositor_interface.h" | 53 | #include "../../src/server/subcompositor_interface.h" | ||
52 | #include "../../src/server/outputmanagement_interface.h" | 54 | #include "../../src/server/outputmanagement_interface.h" | ||
53 | #include "../../src/server/outputdevice_interface.h" | 55 | #include "../../src/server/outputdevice_interface.h" | ||
54 | #include "../../src/server/pointerconstraints_interface.h" | 56 | #include "../../src/server/pointerconstraints_interface.h" | ||
55 | #include "../../src/server/pointergestures_interface.h" | 57 | #include "../../src/server/pointergestures_interface.h" | ||
56 | #include "../../src/server/textinput_interface.h" | 58 | #include "../../src/server/textinput_interface.h" | ||
57 | #include "../../src/server/xdgshell_interface.h" | 59 | #include "../../src/server/xdgshell_interface.h" | ||
58 | #include "../../src/server/relativepointer_interface.h" | 60 | #include "../../src/server/relativepointer_interface.h" | ||
59 | // Wayland | 61 | // Wayland | ||
60 | #include <wayland-client-protocol.h> | 62 | #include <wayland-client-protocol.h> | ||
61 | #include <wayland-dpms-client-protocol.h> | 63 | #include <wayland-dpms-client-protocol.h> | ||
64 | #include <wayland-idle-inhibit-unstable-v1-client-protocol.h> | ||||
62 | #include <wayland-server-decoration-client-protocol.h> | 65 | #include <wayland-server-decoration-client-protocol.h> | ||
63 | #include <wayland-text-input-v0-client-protocol.h> | 66 | #include <wayland-text-input-v0-client-protocol.h> | ||
64 | #include <wayland-text-input-v2-client-protocol.h> | 67 | #include <wayland-text-input-v2-client-protocol.h> | ||
65 | #include <wayland-xdg-shell-v5-client-protocol.h> | 68 | #include <wayland-xdg-shell-v5-client-protocol.h> | ||
66 | #include <wayland-relativepointer-unstable-v1-client-protocol.h> | 69 | #include <wayland-relativepointer-unstable-v1-client-protocol.h> | ||
67 | #include <wayland-pointer-gestures-unstable-v1-client-protocol.h> | 70 | #include <wayland-pointer-gestures-unstable-v1-client-protocol.h> | ||
68 | #include <wayland-pointer-constraints-unstable-v1-client-protocol.h> | 71 | #include <wayland-pointer-constraints-unstable-v1-client-protocol.h> | ||
69 | 72 | | |||
Show All 20 Lines | 78 | private Q_SLOTS: | |||
90 | void testBindDpmsManager(); | 93 | void testBindDpmsManager(); | ||
91 | void testBindServerSideDecorationManager(); | 94 | void testBindServerSideDecorationManager(); | ||
92 | void testBindTextInputManagerUnstableV0(); | 95 | void testBindTextInputManagerUnstableV0(); | ||
93 | void testBindTextInputManagerUnstableV2(); | 96 | void testBindTextInputManagerUnstableV2(); | ||
94 | void testBindXdgShellUnstableV5(); | 97 | void testBindXdgShellUnstableV5(); | ||
95 | void testBindRelativePointerManagerUnstableV1(); | 98 | void testBindRelativePointerManagerUnstableV1(); | ||
96 | void testBindPointerGesturesUnstableV1(); | 99 | void testBindPointerGesturesUnstableV1(); | ||
97 | void testBindPointerConstraintsUnstableV1(); | 100 | void testBindPointerConstraintsUnstableV1(); | ||
101 | void testBindIdleIhibitManagerUnstableV1(); | ||||
98 | void testGlobalSync(); | 102 | void testGlobalSync(); | ||
99 | void testGlobalSyncThreaded(); | 103 | void testGlobalSyncThreaded(); | ||
100 | void testRemoval(); | 104 | void testRemoval(); | ||
101 | void testOutOfSyncRemoval(); | 105 | void testOutOfSyncRemoval(); | ||
102 | void testDestroy(); | 106 | void testDestroy(); | ||
103 | void testAnnounceMultiple(); | 107 | void testAnnounceMultiple(); | ||
104 | void testAnnounceMultipleOutputDevices(); | 108 | void testAnnounceMultipleOutputDevices(); | ||
105 | 109 | | |||
Show All 11 Lines | 110 | private: | |||
117 | KWayland::Server::TextInputManagerInterface *m_textInputManagerV0; | 121 | KWayland::Server::TextInputManagerInterface *m_textInputManagerV0; | ||
118 | KWayland::Server::TextInputManagerInterface *m_textInputManagerV2; | 122 | KWayland::Server::TextInputManagerInterface *m_textInputManagerV2; | ||
119 | KWayland::Server::XdgShellInterface *m_xdgShellUnstableV5; | 123 | KWayland::Server::XdgShellInterface *m_xdgShellUnstableV5; | ||
120 | KWayland::Server::RelativePointerManagerInterface *m_relativePointerV1; | 124 | KWayland::Server::RelativePointerManagerInterface *m_relativePointerV1; | ||
121 | KWayland::Server::PointerGesturesInterface *m_pointerGesturesV1; | 125 | KWayland::Server::PointerGesturesInterface *m_pointerGesturesV1; | ||
122 | KWayland::Server::PointerConstraintsInterface *m_pointerConstraintsV1; | 126 | KWayland::Server::PointerConstraintsInterface *m_pointerConstraintsV1; | ||
123 | KWayland::Server::BlurManagerInterface *m_blur; | 127 | KWayland::Server::BlurManagerInterface *m_blur; | ||
124 | KWayland::Server::ContrastManagerInterface *m_contrast; | 128 | KWayland::Server::ContrastManagerInterface *m_contrast; | ||
129 | KWayland::Server::IdleInhibitManagerInterface *m_idleInhibit; | ||||
125 | 130 | | |||
126 | }; | 131 | }; | ||
127 | 132 | | |||
128 | static const QString s_socketName = QStringLiteral("kwin-test-wayland-registry-0"); | 133 | static const QString s_socketName = QStringLiteral("kwin-test-wayland-registry-0"); | ||
129 | 134 | | |||
130 | TestWaylandRegistry::TestWaylandRegistry(QObject *parent) | 135 | TestWaylandRegistry::TestWaylandRegistry(QObject *parent) | ||
131 | : QObject(parent) | 136 | : QObject(parent) | ||
132 | , m_display(nullptr) | 137 | , m_display(nullptr) | ||
Show All 9 Lines | |||||
142 | , m_textInputManagerV0(nullptr) | 147 | , m_textInputManagerV0(nullptr) | ||
143 | , m_textInputManagerV2(nullptr) | 148 | , m_textInputManagerV2(nullptr) | ||
144 | , m_xdgShellUnstableV5(nullptr) | 149 | , m_xdgShellUnstableV5(nullptr) | ||
145 | , m_relativePointerV1(nullptr) | 150 | , m_relativePointerV1(nullptr) | ||
146 | , m_pointerGesturesV1(nullptr) | 151 | , m_pointerGesturesV1(nullptr) | ||
147 | , m_pointerConstraintsV1(nullptr) | 152 | , m_pointerConstraintsV1(nullptr) | ||
148 | , m_blur(nullptr) | 153 | , m_blur(nullptr) | ||
149 | , m_contrast(nullptr) | 154 | , m_contrast(nullptr) | ||
155 | , m_idleInhibit(nullptr) | ||||
150 | { | 156 | { | ||
151 | } | 157 | } | ||
152 | 158 | | |||
153 | void TestWaylandRegistry::init() | 159 | void TestWaylandRegistry::init() | ||
154 | { | 160 | { | ||
155 | m_display = new KWayland::Server::Display(); | 161 | m_display = new KWayland::Server::Display(); | ||
156 | m_display->setSocketName(s_socketName); | 162 | m_display->setSocketName(s_socketName); | ||
157 | m_display->start(); | 163 | m_display->start(); | ||
Show All 36 Lines | |||||
194 | m_relativePointerV1->create(); | 200 | m_relativePointerV1->create(); | ||
195 | QCOMPARE(m_relativePointerV1->interfaceVersion(), KWayland::Server::RelativePointerInterfaceVersion::UnstableV1); | 201 | QCOMPARE(m_relativePointerV1->interfaceVersion(), KWayland::Server::RelativePointerInterfaceVersion::UnstableV1); | ||
196 | m_pointerGesturesV1 = m_display->createPointerGestures(KWayland::Server::PointerGesturesInterfaceVersion::UnstableV1); | 202 | m_pointerGesturesV1 = m_display->createPointerGestures(KWayland::Server::PointerGesturesInterfaceVersion::UnstableV1); | ||
197 | m_pointerGesturesV1->create(); | 203 | m_pointerGesturesV1->create(); | ||
198 | QCOMPARE(m_pointerGesturesV1->interfaceVersion(), KWayland::Server::PointerGesturesInterfaceVersion::UnstableV1); | 204 | QCOMPARE(m_pointerGesturesV1->interfaceVersion(), KWayland::Server::PointerGesturesInterfaceVersion::UnstableV1); | ||
199 | m_pointerConstraintsV1 = m_display->createPointerConstraints(KWayland::Server::PointerConstraintsInterfaceVersion::UnstableV1); | 205 | m_pointerConstraintsV1 = m_display->createPointerConstraints(KWayland::Server::PointerConstraintsInterfaceVersion::UnstableV1); | ||
200 | m_pointerConstraintsV1->create(); | 206 | m_pointerConstraintsV1->create(); | ||
201 | QCOMPARE(m_pointerConstraintsV1->interfaceVersion(), KWayland::Server::PointerConstraintsInterfaceVersion::UnstableV1); | 207 | QCOMPARE(m_pointerConstraintsV1->interfaceVersion(), KWayland::Server::PointerConstraintsInterfaceVersion::UnstableV1); | ||
208 | m_idleInhibit = m_display->createIdleInhibitManager(KWayland::Server::IdleInhibitManagerInterfaceVersion::UnstableV1); | ||||
209 | m_idleInhibit->create(); | ||||
210 | QCOMPARE(m_idleInhibit->interfaceVersion(), KWayland::Server::IdleInhibitManagerInterfaceVersion::UnstableV1); | ||||
202 | } | 211 | } | ||
203 | 212 | | |||
204 | void TestWaylandRegistry::cleanup() | 213 | void TestWaylandRegistry::cleanup() | ||
205 | { | 214 | { | ||
206 | delete m_display; | 215 | delete m_display; | ||
207 | m_display = nullptr; | 216 | m_display = nullptr; | ||
208 | } | 217 | } | ||
209 | 218 | | |||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | 359 | { | |||
351 | TEST_BIND(KWayland::Client::Registry::Interface::PointerGesturesUnstableV1, SIGNAL(pointerGesturesUnstableV1Announced(quint32,quint32)), bindPointerGesturesUnstableV1, zwp_pointer_gestures_v1_destroy) | 360 | TEST_BIND(KWayland::Client::Registry::Interface::PointerGesturesUnstableV1, SIGNAL(pointerGesturesUnstableV1Announced(quint32,quint32)), bindPointerGesturesUnstableV1, zwp_pointer_gestures_v1_destroy) | ||
352 | } | 361 | } | ||
353 | 362 | | |||
354 | void TestWaylandRegistry::testBindPointerConstraintsUnstableV1() | 363 | void TestWaylandRegistry::testBindPointerConstraintsUnstableV1() | ||
355 | { | 364 | { | ||
356 | TEST_BIND(KWayland::Client::Registry::Interface::PointerConstraintsUnstableV1, SIGNAL(pointerConstraintsUnstableV1Announced(quint32,quint32)), bindPointerConstraintsUnstableV1, zwp_pointer_constraints_v1_destroy) | 365 | TEST_BIND(KWayland::Client::Registry::Interface::PointerConstraintsUnstableV1, SIGNAL(pointerConstraintsUnstableV1Announced(quint32,quint32)), bindPointerConstraintsUnstableV1, zwp_pointer_constraints_v1_destroy) | ||
357 | } | 366 | } | ||
358 | 367 | | |||
368 | void TestWaylandRegistry::testBindIdleIhibitManagerUnstableV1() | ||||
369 | { | ||||
370 | TEST_BIND(KWayland::Client::Registry::Interface::IdleInhibitManagerUnstableV1, SIGNAL(idleInhibitManagerUnstableV1Announced(quint32,quint32)), bindIdleInhibitManagerUnstableV1, zwp_idle_inhibit_manager_v1_destroy) | ||||
371 | } | ||||
372 | | ||||
359 | #undef TEST_BIND | 373 | #undef TEST_BIND | ||
360 | 374 | | |||
361 | void TestWaylandRegistry::testRemoval() | 375 | void TestWaylandRegistry::testRemoval() | ||
362 | { | 376 | { | ||
363 | using namespace KWayland::Client; | 377 | using namespace KWayland::Client; | ||
364 | KWayland::Client::ConnectionThread connection; | 378 | KWayland::Client::ConnectionThread connection; | ||
365 | QSignalSpy connectedSpy(&connection, SIGNAL(connected())); | 379 | QSignalSpy connectedSpy(&connection, SIGNAL(connected())); | ||
366 | connection.setSocketName(s_socketName); | 380 | connection.setSocketName(s_socketName); | ||
Show All 21 Lines | |||||
388 | QSignalSpy subCompositorAnnouncedSpy(®istry, SIGNAL(subCompositorAnnounced(quint32,quint32))); | 402 | QSignalSpy subCompositorAnnouncedSpy(®istry, SIGNAL(subCompositorAnnounced(quint32,quint32))); | ||
389 | QVERIFY(subCompositorAnnouncedSpy.isValid()); | 403 | QVERIFY(subCompositorAnnouncedSpy.isValid()); | ||
390 | QSignalSpy outputManagementAnnouncedSpy(®istry, SIGNAL(outputManagementAnnounced(quint32,quint32))); | 404 | QSignalSpy outputManagementAnnouncedSpy(®istry, SIGNAL(outputManagementAnnounced(quint32,quint32))); | ||
391 | QVERIFY(outputManagementAnnouncedSpy.isValid()); | 405 | QVERIFY(outputManagementAnnouncedSpy.isValid()); | ||
392 | QSignalSpy serverSideDecorationManagerAnnouncedSpy(®istry, &Registry::serverSideDecorationManagerAnnounced); | 406 | QSignalSpy serverSideDecorationManagerAnnouncedSpy(®istry, &Registry::serverSideDecorationManagerAnnounced); | ||
393 | QVERIFY(serverSideDecorationManagerAnnouncedSpy.isValid()); | 407 | QVERIFY(serverSideDecorationManagerAnnouncedSpy.isValid()); | ||
394 | QSignalSpy blurAnnouncedSpy(®istry, &Registry::blurAnnounced); | 408 | QSignalSpy blurAnnouncedSpy(®istry, &Registry::blurAnnounced); | ||
395 | QVERIFY(blurAnnouncedSpy.isValid()); | 409 | QVERIFY(blurAnnouncedSpy.isValid()); | ||
410 | QSignalSpy idleInhibitManagerUnstableV1AnnouncedSpy(®istry, &Registry::idleInhibitManagerUnstableV1Announced); | ||||
411 | QVERIFY(idleInhibitManagerUnstableV1AnnouncedSpy.isValid()); | ||||
396 | 412 | | |||
397 | QVERIFY(!registry.isValid()); | 413 | QVERIFY(!registry.isValid()); | ||
398 | registry.create(connection.display()); | 414 | registry.create(connection.display()); | ||
399 | registry.setup(); | 415 | registry.setup(); | ||
400 | 416 | | |||
401 | QVERIFY(shmAnnouncedSpy.wait()); | 417 | QVERIFY(shmAnnouncedSpy.wait()); | ||
402 | QVERIFY(!compositorAnnouncedSpy.isEmpty()); | 418 | QVERIFY(!compositorAnnouncedSpy.isEmpty()); | ||
403 | QVERIFY(!outputAnnouncedSpy.isEmpty()); | 419 | QVERIFY(!outputAnnouncedSpy.isEmpty()); | ||
404 | QVERIFY(!outputDeviceAnnouncedSpy.isEmpty()); | 420 | QVERIFY(!outputDeviceAnnouncedSpy.isEmpty()); | ||
405 | QVERIFY(!shellAnnouncedSpy.isEmpty()); | 421 | QVERIFY(!shellAnnouncedSpy.isEmpty()); | ||
406 | QVERIFY(!seatAnnouncedSpy.isEmpty()); | 422 | QVERIFY(!seatAnnouncedSpy.isEmpty()); | ||
407 | QVERIFY(!subCompositorAnnouncedSpy.isEmpty()); | 423 | QVERIFY(!subCompositorAnnouncedSpy.isEmpty()); | ||
408 | QVERIFY(!outputManagementAnnouncedSpy.isEmpty()); | 424 | QVERIFY(!outputManagementAnnouncedSpy.isEmpty()); | ||
409 | QVERIFY(!serverSideDecorationManagerAnnouncedSpy.isEmpty()); | 425 | QVERIFY(!serverSideDecorationManagerAnnouncedSpy.isEmpty()); | ||
410 | QVERIFY(!blurAnnouncedSpy.isEmpty()); | 426 | QVERIFY(!blurAnnouncedSpy.isEmpty()); | ||
427 | QVERIFY(!idleInhibitManagerUnstableV1AnnouncedSpy.isEmpty()); | ||||
411 | 428 | | |||
412 | 429 | | |||
413 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Compositor)); | 430 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Compositor)); | ||
414 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Output)); | 431 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Output)); | ||
415 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::OutputDevice)); | 432 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::OutputDevice)); | ||
416 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Seat)); | 433 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Seat)); | ||
417 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Shell)); | 434 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Shell)); | ||
418 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Shm)); | 435 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Shm)); | ||
419 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::SubCompositor)); | 436 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::SubCompositor)); | ||
420 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::FullscreenShell)); | 437 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::FullscreenShell)); | ||
421 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::OutputManagement)); | 438 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::OutputManagement)); | ||
422 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::ServerSideDecorationManager)); | 439 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::ServerSideDecorationManager)); | ||
423 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Blur)); | 440 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Blur)); | ||
441 | QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::IdleInhibitManagerUnstableV1)); | ||||
424 | 442 | | |||
425 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Compositor).isEmpty()); | 443 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Compositor).isEmpty()); | ||
426 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Output).isEmpty()); | 444 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Output).isEmpty()); | ||
427 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::OutputDevice).isEmpty()); | 445 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::OutputDevice).isEmpty()); | ||
428 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Seat).isEmpty()); | 446 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Seat).isEmpty()); | ||
429 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Shell).isEmpty()); | 447 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Shell).isEmpty()); | ||
430 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Shm).isEmpty()); | 448 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Shm).isEmpty()); | ||
431 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::SubCompositor).isEmpty()); | 449 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::SubCompositor).isEmpty()); | ||
432 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::FullscreenShell).isEmpty()); | 450 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::FullscreenShell).isEmpty()); | ||
433 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::OutputManagement).isEmpty()); | 451 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::OutputManagement).isEmpty()); | ||
434 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::ServerSideDecorationManager).isEmpty()); | 452 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::ServerSideDecorationManager).isEmpty()); | ||
435 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Blur).isEmpty()); | 453 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::Blur).isEmpty()); | ||
454 | QVERIFY(!registry.interfaces(KWayland::Client::Registry::Interface::IdleInhibitManagerUnstableV1).isEmpty()); | ||||
436 | 455 | | |||
437 | QSignalSpy seatRemovedSpy(®istry, SIGNAL(seatRemoved(quint32))); | 456 | QSignalSpy seatRemovedSpy(®istry, SIGNAL(seatRemoved(quint32))); | ||
438 | QVERIFY(seatRemovedSpy.isValid()); | 457 | QVERIFY(seatRemovedSpy.isValid()); | ||
439 | 458 | | |||
440 | Seat *seat = registry.createSeat(registry.interface(Registry::Interface::Seat).name, registry.interface(Registry::Interface::Seat).version, ®istry); | 459 | Seat *seat = registry.createSeat(registry.interface(Registry::Interface::Seat).name, registry.interface(Registry::Interface::Seat).version, ®istry); | ||
441 | Shell *shell = registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version, ®istry); | 460 | Shell *shell = registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version, ®istry); | ||
442 | Output *output = registry.createOutput(registry.interface(Registry::Interface::Output).name, registry.interface(Registry::Interface::Output).version, ®istry); | 461 | Output *output = registry.createOutput(registry.interface(Registry::Interface::Output).name, registry.interface(Registry::Interface::Output).version, ®istry); | ||
443 | Compositor *compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name, registry.interface(Registry::Interface::Compositor).version, ®istry); | 462 | Compositor *compositor = registry.createCompositor(registry.interface(Registry::Interface::Compositor).name, registry.interface(Registry::Interface::Compositor).version, ®istry); | ||
444 | SubCompositor *subcompositor = registry.createSubCompositor(registry.interface(Registry::Interface::SubCompositor).name, registry.interface(Registry::Interface::SubCompositor).version, ®istry); | 463 | SubCompositor *subcompositor = registry.createSubCompositor(registry.interface(Registry::Interface::SubCompositor).name, registry.interface(Registry::Interface::SubCompositor).version, ®istry); | ||
445 | ServerSideDecorationManager *serverSideDeco = registry.createServerSideDecorationManager(registry.interface(Registry::Interface::ServerSideDecorationManager).name, registry.interface(Registry::Interface::ServerSideDecorationManager).version, ®istry); | 464 | ServerSideDecorationManager *serverSideDeco = registry.createServerSideDecorationManager(registry.interface(Registry::Interface::ServerSideDecorationManager).name, registry.interface(Registry::Interface::ServerSideDecorationManager).version, ®istry); | ||
446 | BlurManager *blurManager = registry.createBlurManager(registry.interface(Registry::Interface::Blur).name, registry.interface(Registry::Interface::Blur).version, ®istry); | 465 | BlurManager *blurManager = registry.createBlurManager(registry.interface(Registry::Interface::Blur).name, registry.interface(Registry::Interface::Blur).version, ®istry); | ||
466 | auto idleInhibitManager = registry.createIdleInhibitManager(registry.interface(Registry::Interface::IdleInhibitManagerUnstableV1).name, registry.interface(Registry::Interface::IdleInhibitManagerUnstableV1).version, ®istry); | ||||
447 | 467 | | |||
448 | connection.flush(); | 468 | connection.flush(); | ||
449 | m_display->dispatchEvents(); | 469 | m_display->dispatchEvents(); | ||
450 | QSignalSpy seatObjectRemovedSpy(seat, &Seat::removed); | 470 | QSignalSpy seatObjectRemovedSpy(seat, &Seat::removed); | ||
451 | QVERIFY(seatObjectRemovedSpy.isValid()); | 471 | QVERIFY(seatObjectRemovedSpy.isValid()); | ||
452 | QSignalSpy shellObjectRemovedSpy(shell, &Shell::removed); | 472 | QSignalSpy shellObjectRemovedSpy(shell, &Shell::removed); | ||
453 | QVERIFY(shellObjectRemovedSpy.isValid()); | 473 | QVERIFY(shellObjectRemovedSpy.isValid()); | ||
454 | QSignalSpy outputObjectRemovedSpy(output, &Output::removed); | 474 | QSignalSpy outputObjectRemovedSpy(output, &Output::removed); | ||
455 | QVERIFY(outputObjectRemovedSpy.isValid()); | 475 | QVERIFY(outputObjectRemovedSpy.isValid()); | ||
456 | QSignalSpy compositorObjectRemovedSpy(compositor, &Compositor::removed); | 476 | QSignalSpy compositorObjectRemovedSpy(compositor, &Compositor::removed); | ||
457 | QVERIFY(compositorObjectRemovedSpy.isValid()); | 477 | QVERIFY(compositorObjectRemovedSpy.isValid()); | ||
458 | QSignalSpy subcompositorObjectRemovedSpy(subcompositor, &SubCompositor::removed); | 478 | QSignalSpy subcompositorObjectRemovedSpy(subcompositor, &SubCompositor::removed); | ||
459 | QVERIFY(subcompositorObjectRemovedSpy.isValid()); | 479 | QVERIFY(subcompositorObjectRemovedSpy.isValid()); | ||
480 | QSignalSpy idleInhibitManagerObjectRemovedSpy(idleInhibitManager, &IdleInhibitManager::removed); | ||||
481 | QVERIFY(idleInhibitManagerObjectRemovedSpy.isValid()); | ||||
460 | 482 | | |||
461 | delete m_seat; | 483 | delete m_seat; | ||
462 | QVERIFY(seatRemovedSpy.wait()); | 484 | QVERIFY(seatRemovedSpy.wait()); | ||
463 | QCOMPARE(seatRemovedSpy.first().first(), seatAnnouncedSpy.first().first()); | 485 | QCOMPARE(seatRemovedSpy.first().first(), seatAnnouncedSpy.first().first()); | ||
464 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::Seat)); | 486 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::Seat)); | ||
465 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::Seat).isEmpty()); | 487 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::Seat).isEmpty()); | ||
466 | QCOMPARE(seatObjectRemovedSpy.count(), 1); | 488 | QCOMPARE(seatObjectRemovedSpy.count(), 1); | ||
467 | 489 | | |||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | |||||
542 | 564 | | |||
543 | delete m_blur; | 565 | delete m_blur; | ||
544 | QVERIFY(blurRemovedSpy.wait()); | 566 | QVERIFY(blurRemovedSpy.wait()); | ||
545 | QCOMPARE(blurRemovedSpy.first().first(), blurRemovedSpy.first().first()); | 567 | QCOMPARE(blurRemovedSpy.first().first(), blurRemovedSpy.first().first()); | ||
546 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::Blur)); | 568 | QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::Blur)); | ||
547 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::Blur).isEmpty()); | 569 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::Blur).isEmpty()); | ||
548 | QCOMPARE(blurObjectRemovedSpy.count(), 1); | 570 | QCOMPARE(blurObjectRemovedSpy.count(), 1); | ||
549 | 571 | | |||
572 | QSignalSpy idleInhibitManagerUnstableV1RemovedSpy(®istry, &Registry::idleInhibitManagerUnstableV1Removed); | ||||
573 | QVERIFY(idleInhibitManagerUnstableV1RemovedSpy.isValid()); | ||||
574 | delete m_idleInhibit; | ||||
575 | QVERIFY(idleInhibitManagerUnstableV1RemovedSpy.wait()); | ||||
576 | QCOMPARE(idleInhibitManagerUnstableV1RemovedSpy.first().first(), idleInhibitManagerUnstableV1AnnouncedSpy.first().first()); | ||||
577 | QVERIFY(registry.interfaces(KWayland::Client::Registry::Interface::IdleInhibitManagerUnstableV1).isEmpty()); | ||||
578 | QCOMPARE(idleInhibitManagerObjectRemovedSpy.count(), 1); | ||||
579 | | ||||
550 | // cannot test shmRemoved as there is no functionality for it | 580 | // cannot test shmRemoved as there is no functionality for it | ||
551 | 581 | | |||
552 | // verify everything has been removed only once | 582 | // verify everything has been removed only once | ||
553 | QCOMPARE(seatObjectRemovedSpy.count(), 1); | 583 | QCOMPARE(seatObjectRemovedSpy.count(), 1); | ||
554 | QCOMPARE(shellObjectRemovedSpy.count(), 1); | 584 | QCOMPARE(shellObjectRemovedSpy.count(), 1); | ||
555 | QCOMPARE(outputObjectRemovedSpy.count(), 1); | 585 | QCOMPARE(outputObjectRemovedSpy.count(), 1); | ||
556 | QCOMPARE(compositorObjectRemovedSpy.count(), 1); | 586 | QCOMPARE(compositorObjectRemovedSpy.count(), 1); | ||
557 | QCOMPARE(subcompositorObjectRemovedSpy.count(), 1); | 587 | QCOMPARE(subcompositorObjectRemovedSpy.count(), 1); | ||
558 | QCOMPARE(serverSideDecoManagerObjectRemovedSpy.count(), 1); | 588 | QCOMPARE(serverSideDecoManagerObjectRemovedSpy.count(), 1); | ||
559 | QCOMPARE(blurObjectRemovedSpy.count(), 1); | 589 | QCOMPARE(blurObjectRemovedSpy.count(), 1); | ||
590 | QCOMPARE(idleInhibitManagerObjectRemovedSpy.count(), 1); | ||||
560 | } | 591 | } | ||
561 | 592 | | |||
562 | void TestWaylandRegistry::testOutOfSyncRemoval() | 593 | void TestWaylandRegistry::testOutOfSyncRemoval() | ||
563 | { | 594 | { | ||
564 | //This tests the following sequence of events | 595 | //This tests the following sequence of events | ||
565 | //server announces global | 596 | //server announces global | ||
566 | //client binds to that global | 597 | //client binds to that global | ||
567 | 598 | | |||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |