Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/xdgshellclient_test.cpp
Show All 13 Lines | |||||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
17 | 17 | | |||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | #include "abstract_client.h" | ||||
22 | #include "cursor.h" | 23 | #include "cursor.h" | ||
23 | #include "decorations/decorationbridge.h" | 24 | #include "decorations/decorationbridge.h" | ||
24 | #include "decorations/settings.h" | 25 | #include "decorations/settings.h" | ||
25 | #include "effects.h" | 26 | #include "effects.h" | ||
26 | #include "deleted.h" | 27 | #include "deleted.h" | ||
27 | #include "platform.h" | 28 | #include "platform.h" | ||
28 | #include "xdgshellclient.h" | | |||
29 | #include "screens.h" | 29 | #include "screens.h" | ||
30 | #include "wayland_server.h" | 30 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 31 | #include "workspace.h" | ||
32 | 32 | | |||
33 | #include <KDecoration2/DecoratedClient> | 33 | #include <KDecoration2/DecoratedClient> | ||
34 | #include <KDecoration2/Decoration> | 34 | #include <KDecoration2/Decoration> | ||
35 | #include <KDecoration2/DecorationSettings> | 35 | #include <KDecoration2/DecorationSettings> | ||
36 | 36 | | |||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 68 | private Q_SLOTS: | |||
121 | void testXdgWindowGeometryInteractiveResize(); | 121 | void testXdgWindowGeometryInteractiveResize(); | ||
122 | void testXdgWindowGeometryFullScreen(); | 122 | void testXdgWindowGeometryFullScreen(); | ||
123 | void testXdgWindowGeometryMaximize(); | 123 | void testXdgWindowGeometryMaximize(); | ||
124 | }; | 124 | }; | ||
125 | 125 | | |||
126 | void TestXdgShellClient::initTestCase() | 126 | void TestXdgShellClient::initTestCase() | ||
127 | { | 127 | { | ||
128 | qRegisterMetaType<KWin::Deleted*>(); | 128 | qRegisterMetaType<KWin::Deleted*>(); | ||
129 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
130 | qRegisterMetaType<KWin::AbstractClient*>(); | 129 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
131 | qRegisterMetaType<KWayland::Client::Output*>(); | 130 | qRegisterMetaType<KWayland::Client::Output*>(); | ||
132 | 131 | | |||
133 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 132 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
134 | QVERIFY(workspaceCreatedSpy.isValid()); | 133 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
135 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 134 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
136 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 135 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
137 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 136 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 170 | { | |||
181 | QFETCH(Test::XdgShellSurfaceType, type); | 180 | QFETCH(Test::XdgShellSurfaceType, type); | ||
182 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 181 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
183 | 182 | | |||
184 | // now let's render | 183 | // now let's render | ||
185 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 184 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
186 | 185 | | |||
187 | QVERIFY(clientAddedSpy.isEmpty()); | 186 | QVERIFY(clientAddedSpy.isEmpty()); | ||
188 | QVERIFY(clientAddedSpy.wait()); | 187 | QVERIFY(clientAddedSpy.wait()); | ||
189 | auto client = clientAddedSpy.first().first().value<XdgShellClient *>(); | 188 | auto client = clientAddedSpy.first().first().value<AbstractClient *>(); | ||
190 | QVERIFY(client); | 189 | QVERIFY(client); | ||
191 | QVERIFY(client->isShown(true)); | 190 | QVERIFY(client->isShown(true)); | ||
192 | QCOMPARE(client->isHiddenInternal(), false); | 191 | QCOMPARE(client->isHiddenInternal(), false); | ||
193 | QCOMPARE(client->readyForPainting(), true); | 192 | QCOMPARE(client->readyForPainting(), true); | ||
194 | QCOMPARE(client->depth(), 32); | 193 | QCOMPARE(client->depth(), 32); | ||
195 | QVERIFY(client->hasAlpha()); | 194 | QVERIFY(client->hasAlpha()); | ||
196 | QCOMPARE(client->icon().name(), QStringLiteral("wayland")); | 195 | QCOMPARE(client->icon().name(), QStringLiteral("wayland")); | ||
197 | QCOMPARE(workspace()->activeClient(), client); | 196 | QCOMPARE(workspace()->activeClient(), client); | ||
Show All 9 Lines | |||||
207 | QCOMPARE(client->isInternal(), false); | 206 | QCOMPARE(client->isInternal(), false); | ||
208 | QVERIFY(client->effectWindow()); | 207 | QVERIFY(client->effectWindow()); | ||
209 | QVERIFY(!client->effectWindow()->internalWindow()); | 208 | QVERIFY(!client->effectWindow()->internalWindow()); | ||
210 | QCOMPARE(client->internalId().isNull(), false); | 209 | QCOMPARE(client->internalId().isNull(), false); | ||
211 | const auto uuid = client->internalId(); | 210 | const auto uuid = client->internalId(); | ||
212 | QUuid deletedUuid; | 211 | QUuid deletedUuid; | ||
213 | QCOMPARE(deletedUuid.isNull(), true); | 212 | QCOMPARE(deletedUuid.isNull(), true); | ||
214 | 213 | | |||
215 | connect(client, &XdgShellClient::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); }); | 214 | connect(client, &AbstractClient::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); }); | ||
216 | 215 | | |||
217 | // now unmap | 216 | // now unmap | ||
218 | QSignalSpy hiddenSpy(client, &XdgShellClient::windowHidden); | 217 | QSignalSpy hiddenSpy(client, &AbstractClient::windowHidden); | ||
219 | QVERIFY(hiddenSpy.isValid()); | 218 | QVERIFY(hiddenSpy.isValid()); | ||
220 | QSignalSpy windowClosedSpy(client, &XdgShellClient::windowClosed); | 219 | QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed); | ||
221 | QVERIFY(windowClosedSpy.isValid()); | 220 | QVERIFY(windowClosedSpy.isValid()); | ||
222 | surface->attachBuffer(Buffer::Ptr()); | 221 | surface->attachBuffer(Buffer::Ptr()); | ||
223 | surface->commit(Surface::CommitFlag::None); | 222 | surface->commit(Surface::CommitFlag::None); | ||
224 | QVERIFY(hiddenSpy.wait()); | 223 | QVERIFY(hiddenSpy.wait()); | ||
225 | QCOMPARE(client->readyForPainting(), true); | 224 | QCOMPARE(client->readyForPainting(), true); | ||
226 | QCOMPARE(client->isHiddenInternal(), true); | 225 | QCOMPARE(client->isHiddenInternal(), true); | ||
227 | QVERIFY(windowClosedSpy.isEmpty()); | 226 | QVERIFY(windowClosedSpy.isEmpty()); | ||
228 | QVERIFY(!workspace()->activeClient()); | 227 | QVERIFY(!workspace()->activeClient()); | ||
229 | QCOMPARE(effectsWindowHiddenSpy.count(), 1); | 228 | QCOMPARE(effectsWindowHiddenSpy.count(), 1); | ||
230 | QCOMPARE(effectsWindowHiddenSpy.first().first().value<EffectWindow*>(), client->effectWindow()); | 229 | QCOMPARE(effectsWindowHiddenSpy.first().first().value<EffectWindow*>(), client->effectWindow()); | ||
231 | 230 | | |||
232 | QSignalSpy windowShownSpy(client, &XdgShellClient::windowShown); | 231 | QSignalSpy windowShownSpy(client, &AbstractClient::windowShown); | ||
233 | QVERIFY(windowShownSpy.isValid()); | 232 | QVERIFY(windowShownSpy.isValid()); | ||
234 | Test::render(surface.data(), QSize(100, 50), Qt::blue, QImage::Format_RGB32); | 233 | Test::render(surface.data(), QSize(100, 50), Qt::blue, QImage::Format_RGB32); | ||
235 | QCOMPARE(clientAddedSpy.count(), 1); | 234 | QCOMPARE(clientAddedSpy.count(), 1); | ||
236 | QVERIFY(windowShownSpy.wait()); | 235 | QVERIFY(windowShownSpy.wait()); | ||
237 | QCOMPARE(windowShownSpy.count(), 1); | 236 | QCOMPARE(windowShownSpy.count(), 1); | ||
238 | QCOMPARE(clientAddedSpy.count(), 1); | 237 | QCOMPARE(clientAddedSpy.count(), 1); | ||
239 | QCOMPARE(client->readyForPainting(), true); | 238 | QCOMPARE(client->readyForPainting(), true); | ||
240 | QCOMPARE(client->isHiddenInternal(), false); | 239 | QCOMPARE(client->isHiddenInternal(), false); | ||
Show All 28 Lines | |||||
269 | { | 268 | { | ||
270 | // this test verifies that the desktop presence changed signals are properly emitted | 269 | // this test verifies that the desktop presence changed signals are properly emitted | ||
271 | QScopedPointer<Surface> surface(Test::createSurface()); | 270 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
272 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 271 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
273 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 272 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
274 | QVERIFY(c); | 273 | QVERIFY(c); | ||
275 | QCOMPARE(c->desktop(), 1); | 274 | QCOMPARE(c->desktop(), 1); | ||
276 | effects->setNumberOfDesktops(4); | 275 | effects->setNumberOfDesktops(4); | ||
277 | QSignalSpy desktopPresenceChangedClientSpy(c, &XdgShellClient::desktopPresenceChanged); | 276 | QSignalSpy desktopPresenceChangedClientSpy(c, &AbstractClient::desktopPresenceChanged); | ||
278 | QVERIFY(desktopPresenceChangedClientSpy.isValid()); | 277 | QVERIFY(desktopPresenceChangedClientSpy.isValid()); | ||
279 | QSignalSpy desktopPresenceChangedWorkspaceSpy(workspace(), &Workspace::desktopPresenceChanged); | 278 | QSignalSpy desktopPresenceChangedWorkspaceSpy(workspace(), &Workspace::desktopPresenceChanged); | ||
280 | QVERIFY(desktopPresenceChangedWorkspaceSpy.isValid()); | 279 | QVERIFY(desktopPresenceChangedWorkspaceSpy.isValid()); | ||
281 | QSignalSpy desktopPresenceChangedEffectsSpy(effects, &EffectsHandler::desktopPresenceChanged); | 280 | QSignalSpy desktopPresenceChangedEffectsSpy(effects, &EffectsHandler::desktopPresenceChanged); | ||
282 | QVERIFY(desktopPresenceChangedEffectsSpy.isValid()); | 281 | QVERIFY(desktopPresenceChangedEffectsSpy.isValid()); | ||
283 | 282 | | |||
284 | // let's change the desktop | 283 | // let's change the desktop | ||
285 | workspace()->sendClientToDesktop(c, 2, false); | 284 | workspace()->sendClientToDesktop(c, 2, false); | ||
Show All 27 Lines | 301 | { | |||
313 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | 312 | positioner.setGravity(Qt::BottomEdge | Qt::RightEdge); | ||
314 | QScopedPointer<Surface> transientSurface(Test::createSurface()); | 313 | QScopedPointer<Surface> transientSurface(Test::createSurface()); | ||
315 | QScopedPointer<XdgShellPopup> transientShellSurface(Test::createXdgShellStablePopup(transientSurface.data(), shellSurface.data(), positioner)); | 314 | QScopedPointer<XdgShellPopup> transientShellSurface(Test::createXdgShellStablePopup(transientSurface.data(), shellSurface.data(), positioner)); | ||
316 | auto transient = Test::renderAndWaitForShown(transientSurface.data(), positioner.initialSize(), Qt::blue); | 315 | auto transient = Test::renderAndWaitForShown(transientSurface.data(), positioner.initialSize(), Qt::blue); | ||
317 | QVERIFY(transient); | 316 | QVERIFY(transient); | ||
318 | QCOMPARE(transient->frameGeometry(), QRect(c->frameGeometry().topLeft() + QPoint(5, 10), QSize(50, 40))); | 317 | QCOMPARE(transient->frameGeometry(), QRect(c->frameGeometry().topLeft() + QPoint(5, 10), QSize(50, 40))); | ||
319 | 318 | | |||
320 | // unmap the transient | 319 | // unmap the transient | ||
321 | QSignalSpy windowHiddenSpy(transient, &XdgShellClient::windowHidden); | 320 | QSignalSpy windowHiddenSpy(transient, &AbstractClient::windowHidden); | ||
322 | QVERIFY(windowHiddenSpy.isValid()); | 321 | QVERIFY(windowHiddenSpy.isValid()); | ||
323 | transientSurface->attachBuffer(Buffer::Ptr()); | 322 | transientSurface->attachBuffer(Buffer::Ptr()); | ||
324 | transientSurface->commit(Surface::CommitFlag::None); | 323 | transientSurface->commit(Surface::CommitFlag::None); | ||
325 | QVERIFY(windowHiddenSpy.wait()); | 324 | QVERIFY(windowHiddenSpy.wait()); | ||
326 | 325 | | |||
327 | // now move the parent surface | 326 | // now move the parent surface | ||
328 | c->setFrameGeometry(c->frameGeometry().translated(5, 10)); | 327 | c->setFrameGeometry(c->frameGeometry().translated(5, 10)); | ||
329 | 328 | | |||
330 | // now map the transient again | 329 | // now map the transient again | ||
331 | QSignalSpy windowShownSpy(transient, &XdgShellClient::windowShown); | 330 | QSignalSpy windowShownSpy(transient, &AbstractClient::windowShown); | ||
332 | QVERIFY(windowShownSpy.isValid()); | 331 | QVERIFY(windowShownSpy.isValid()); | ||
333 | Test::render(transientSurface.data(), QSize(50, 40), Qt::blue); | 332 | Test::render(transientSurface.data(), QSize(50, 40), Qt::blue); | ||
334 | QVERIFY(windowShownSpy.wait()); | 333 | QVERIFY(windowShownSpy.wait()); | ||
335 | QCOMPARE(transient->frameGeometry(), QRect(c->frameGeometry().topLeft() + QPoint(5, 10), QSize(50, 40))); | 334 | QCOMPARE(transient->frameGeometry(), QRect(c->frameGeometry().topLeft() + QPoint(5, 10), QSize(50, 40))); | ||
336 | } | 335 | } | ||
337 | 336 | | |||
338 | void TestXdgShellClient::testWindowOutputs_data() | 337 | void TestXdgShellClient::testWindowOutputs_data() | ||
339 | { | 338 | { | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 436 | { | |||
454 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 453 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
455 | QVERIFY(c); | 454 | QVERIFY(c); | ||
456 | QVERIFY(c->isActive()); | 455 | QVERIFY(c->isActive()); | ||
457 | QCOMPARE(c->layer(), NormalLayer); | 456 | QCOMPARE(c->layer(), NormalLayer); | ||
458 | QVERIFY(!c->isFullScreen()); | 457 | QVERIFY(!c->isFullScreen()); | ||
459 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 458 | QCOMPARE(c->clientSize(), QSize(100, 50)); | ||
460 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 459 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
461 | QCOMPARE(c->clientSizeToFrameSize(c->clientSize()), c->frameGeometry().size()); | 460 | QCOMPARE(c->clientSizeToFrameSize(c->clientSize()), c->frameGeometry().size()); | ||
462 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 461 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | ||
463 | QVERIFY(fullscreenChangedSpy.isValid()); | 462 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
464 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | 463 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
465 | QVERIFY(frameGeometryChangedSpy.isValid()); | 464 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
466 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | 465 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||
467 | QVERIFY(sizeChangeRequestedSpy.isValid()); | 466 | QVERIFY(sizeChangeRequestedSpy.isValid()); | ||
468 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 467 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
469 | QVERIFY(configureRequestedSpy.isValid()); | 468 | QVERIFY(configureRequestedSpy.isValid()); | ||
470 | 469 | | |||
471 | shellSurface->setFullscreen(true); | 470 | shellSurface->setFullscreen(true); | ||
472 | QVERIFY(fullscreenChangedSpy.wait()); | 471 | QVERIFY(fullscreenChangedSpy.wait()); | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 510 | { | |||
530 | xdgShellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); | 529 | xdgShellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); | ||
531 | 530 | | |||
532 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | 531 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | ||
533 | QVERIFY(c); | 532 | QVERIFY(c); | ||
534 | QVERIFY(c->isFullScreen()); | 533 | QVERIFY(c->isFullScreen()); | ||
535 | 534 | | |||
536 | configureRequestedSpy.wait(100); | 535 | configureRequestedSpy.wait(100); | ||
537 | 536 | | |||
538 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 537 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | ||
539 | QVERIFY(fullscreenChangedSpy.isValid()); | 538 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
540 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | 539 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
541 | QVERIFY(frameGeometryChangedSpy.isValid()); | 540 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
542 | 541 | | |||
543 | // swap back to normal | 542 | // swap back to normal | ||
544 | configureRequestedSpy.clear(); | 543 | configureRequestedSpy.clear(); | ||
545 | xdgShellSurface->setFullscreen(false); | 544 | xdgShellSurface->setFullscreen(false); | ||
546 | 545 | | |||
547 | QVERIFY(fullscreenChangedSpy.wait()); | 546 | QVERIFY(fullscreenChangedSpy.wait()); | ||
548 | QVERIFY(configureRequestedSpy.wait()); | 547 | QVERIFY(configureRequestedSpy.wait()); | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 657 | { | |||
673 | QCOMPARE(deco->mode(), decoMode); | 672 | QCOMPARE(deco->mode(), decoMode); | ||
674 | 673 | | |||
675 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 674 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
676 | QVERIFY(c); | 675 | QVERIFY(c); | ||
677 | QVERIFY(c->isActive()); | 676 | QVERIFY(c->isActive()); | ||
678 | QVERIFY(!c->isFullScreen()); | 677 | QVERIFY(!c->isFullScreen()); | ||
679 | QCOMPARE(c->clientSize(), QSize(100, 50)); | 678 | QCOMPARE(c->clientSize(), QSize(100, 50)); | ||
680 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | 679 | QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); | ||
681 | QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); | 680 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | ||
682 | QVERIFY(fullscreenChangedSpy.isValid()); | 681 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
683 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | 682 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
684 | QVERIFY(frameGeometryChangedSpy.isValid()); | 683 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
685 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | 684 | QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); | ||
686 | QVERIFY(sizeChangeRequestedSpy.isValid()); | 685 | QVERIFY(sizeChangeRequestedSpy.isValid()); | ||
687 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 686 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
688 | QVERIFY(configureRequestedSpy.isValid()); | 687 | QVERIFY(configureRequestedSpy.isValid()); | ||
689 | shellSurface->setMaximized(true); | 688 | shellSurface->setMaximized(true); | ||
690 | QVERIFY(sizeChangeRequestedSpy.wait()); | 689 | QVERIFY(sizeChangeRequestedSpy.wait()); | ||
691 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 690 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | ||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 811 | { | |||
821 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); | 820 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.foo")); | ||
822 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.foo")); | 821 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.foo")); | ||
823 | QVERIFY(c->resourceName().startsWith("testXdgShellClient")); | 822 | QVERIFY(c->resourceName().startsWith("testXdgShellClient")); | ||
824 | // the desktop file does not exist, so icon should be generic Wayland | 823 | // the desktop file does not exist, so icon should be generic Wayland | ||
825 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | 824 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||
826 | 825 | | |||
827 | QSignalSpy desktopFileNameChangedSpy(c, &AbstractClient::desktopFileNameChanged); | 826 | QSignalSpy desktopFileNameChangedSpy(c, &AbstractClient::desktopFileNameChanged); | ||
828 | QVERIFY(desktopFileNameChangedSpy.isValid()); | 827 | QVERIFY(desktopFileNameChangedSpy.isValid()); | ||
829 | QSignalSpy iconChangedSpy(c, &XdgShellClient::iconChanged); | 828 | QSignalSpy iconChangedSpy(c, &AbstractClient::iconChanged); | ||
830 | QVERIFY(iconChangedSpy.isValid()); | 829 | QVERIFY(iconChangedSpy.isValid()); | ||
831 | shellSurface->setAppId(QByteArrayLiteral("org.kde.bar")); | 830 | shellSurface->setAppId(QByteArrayLiteral("org.kde.bar")); | ||
832 | QVERIFY(desktopFileNameChangedSpy.wait()); | 831 | QVERIFY(desktopFileNameChangedSpy.wait()); | ||
833 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); | 832 | QCOMPARE(c->desktopFileName(), QByteArrayLiteral("org.kde.bar")); | ||
834 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.bar")); | 833 | QCOMPARE(c->resourceClass(), QByteArrayLiteral("org.kde.bar")); | ||
835 | QVERIFY(c->resourceName().startsWith("testXdgShellClient")); | 834 | QVERIFY(c->resourceName().startsWith("testXdgShellClient")); | ||
836 | // icon should still be wayland | 835 | // icon should still be wayland | ||
837 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | 836 | QCOMPARE(c->icon().name(), QStringLiteral("wayland")); | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 863 | { | |||
892 | QScopedPointer<Surface> surface4(Test::createSurface()); | 891 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
893 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 892 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
894 | shellSurface4->setTitle(QStringLiteral("bar")); | 893 | shellSurface4->setTitle(QStringLiteral("bar")); | ||
895 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 894 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
896 | QVERIFY(c4); | 895 | QVERIFY(c4); | ||
897 | QCOMPARE(c4->caption(), QStringLiteral("bar")); | 896 | QCOMPARE(c4->caption(), QStringLiteral("bar")); | ||
898 | QCOMPARE(c4->captionNormal(), QStringLiteral("bar")); | 897 | QCOMPARE(c4->captionNormal(), QStringLiteral("bar")); | ||
899 | QCOMPARE(c4->captionSuffix(), QString()); | 898 | QCOMPARE(c4->captionSuffix(), QString()); | ||
900 | QSignalSpy captionChangedSpy(c4, &XdgShellClient::captionChanged); | 899 | QSignalSpy captionChangedSpy(c4, &AbstractClient::captionChanged); | ||
901 | QVERIFY(captionChangedSpy.isValid()); | 900 | QVERIFY(captionChangedSpy.isValid()); | ||
902 | shellSurface4->setTitle(QStringLiteral("foo")); | 901 | shellSurface4->setTitle(QStringLiteral("foo")); | ||
903 | QVERIFY(captionChangedSpy.wait()); | 902 | QVERIFY(captionChangedSpy.wait()); | ||
904 | QCOMPARE(captionChangedSpy.count(), 1); | 903 | QCOMPARE(captionChangedSpy.count(), 1); | ||
905 | QCOMPARE(c4->caption(), QStringLiteral("foo <4>")); | 904 | QCOMPARE(c4->caption(), QStringLiteral("foo <4>")); | ||
906 | QCOMPARE(c4->captionNormal(), QStringLiteral("foo")); | 905 | QCOMPARE(c4->captionNormal(), QStringLiteral("foo")); | ||
907 | QCOMPARE(c4->captionSuffix(), QStringLiteral(" <4>")); | 906 | QCOMPARE(c4->captionSuffix(), QStringLiteral(" <4>")); | ||
908 | } | 907 | } | ||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 1015 | { | |||
1017 | //register a faux appmenu client | 1016 | //register a faux appmenu client | ||
1018 | QVERIFY (QDBusConnection::sessionBus().registerService("org.kde.kappmenu")); | 1017 | QVERIFY (QDBusConnection::sessionBus().registerService("org.kde.kappmenu")); | ||
1019 | 1018 | | |||
1020 | QScopedPointer<Surface> surface(Test::createSurface()); | 1019 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1021 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1020 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1022 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 1021 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
1023 | QVERIFY(c); | 1022 | QVERIFY(c); | ||
1024 | QScopedPointer<AppMenu> menu(Test::waylandAppMenuManager()->create(surface.data())); | 1023 | QScopedPointer<AppMenu> menu(Test::waylandAppMenuManager()->create(surface.data())); | ||
1025 | QSignalSpy spy(c, &XdgShellClient::hasApplicationMenuChanged); | 1024 | QSignalSpy spy(c, &AbstractClient::hasApplicationMenuChanged); | ||
1026 | menu->setAddress("service.name", "object/path"); | 1025 | menu->setAddress("service.name", "object/path"); | ||
1027 | spy.wait(); | 1026 | spy.wait(); | ||
1028 | QCOMPARE(c->hasApplicationMenu(), true); | 1027 | QCOMPARE(c->hasApplicationMenu(), true); | ||
1029 | QCOMPARE(c->applicationMenuServiceName(), QString("service.name")); | 1028 | QCOMPARE(c->applicationMenuServiceName(), QString("service.name")); | ||
1030 | QCOMPARE(c->applicationMenuObjectPath(), QString("object/path")); | 1029 | QCOMPARE(c->applicationMenuObjectPath(), QString("object/path")); | ||
1031 | 1030 | | |||
1032 | QVERIFY (QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu")); | 1031 | QVERIFY (QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu")); | ||
1033 | } | 1032 | } | ||
▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Line(s) | |||||
1306 | void TestXdgShellClient::testXdgWindowGeometryIsntSet() | 1305 | void TestXdgShellClient::testXdgWindowGeometryIsntSet() | ||
1307 | { | 1306 | { | ||
1308 | // This test verifies that the effective window geometry corresponds to the | 1307 | // This test verifies that the effective window geometry corresponds to the | ||
1309 | // bounding rectangle of the main surface and its sub-surfaces if no window | 1308 | // bounding rectangle of the main surface and its sub-surfaces if no window | ||
1310 | // geometry is set by the client. | 1309 | // geometry is set by the client. | ||
1311 | 1310 | | |||
1312 | QScopedPointer<Surface> surface(Test::createSurface()); | 1311 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1313 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1312 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1314 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1313 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1315 | QVERIFY(client); | 1314 | QVERIFY(client); | ||
1316 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1315 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1317 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1316 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1318 | 1317 | | |||
1319 | const QPoint oldPosition = client->pos(); | 1318 | const QPoint oldPosition = client->pos(); | ||
1320 | 1319 | | |||
1321 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | 1320 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1322 | QVERIFY(frameGeometryChangedSpy.isValid()); | 1321 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
Show All 21 Lines | |||||
1344 | { | 1343 | { | ||
1345 | // This test verifies that the effective window geometry remains the same when | 1344 | // This test verifies that the effective window geometry remains the same when | ||
1346 | // a new buffer is attached and xdg_surface.set_window_geometry is not called | 1345 | // a new buffer is attached and xdg_surface.set_window_geometry is not called | ||
1347 | // again. Notice that the window geometry must remain the same even if the new | 1346 | // again. Notice that the window geometry must remain the same even if the new | ||
1348 | // buffer is smaller. | 1347 | // buffer is smaller. | ||
1349 | 1348 | | |||
1350 | QScopedPointer<Surface> surface(Test::createSurface()); | 1349 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1351 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1350 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1352 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1351 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1353 | QVERIFY(client); | 1352 | QVERIFY(client); | ||
1354 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1353 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1355 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1354 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1356 | 1355 | | |||
1357 | const QPoint oldPosition = client->pos(); | 1356 | const QPoint oldPosition = client->pos(); | ||
1358 | 1357 | | |||
1359 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | 1358 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1360 | QVERIFY(frameGeometryChangedSpy.isValid()); | 1359 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
Show All 30 Lines | |||||
1391 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | 1390 | void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() | ||
1392 | { | 1391 | { | ||
1393 | // This test verifies that the effective window geometry remains the same | 1392 | // This test verifies that the effective window geometry remains the same | ||
1394 | // when a new sub-surface is added and xdg_surface.set_window_geometry is | 1393 | // when a new sub-surface is added and xdg_surface.set_window_geometry is | ||
1395 | // not called again. | 1394 | // not called again. | ||
1396 | 1395 | | |||
1397 | QScopedPointer<Surface> surface(Test::createSurface()); | 1396 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1398 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1397 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1399 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1398 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1400 | QVERIFY(client); | 1399 | QVERIFY(client); | ||
1401 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1400 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1402 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1401 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1403 | 1402 | | |||
1404 | const QPoint oldPosition = client->pos(); | 1403 | const QPoint oldPosition = client->pos(); | ||
1405 | 1404 | | |||
1406 | QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); | 1405 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
1407 | QVERIFY(frameGeometryChangedSpy.isValid()); | 1406 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
1408 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | 1407 | shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); | ||
1409 | surface->commit(Surface::CommitFlag::None); | 1408 | surface->commit(Surface::CommitFlag::None); | ||
1410 | QVERIFY(frameGeometryChangedSpy.wait()); | 1409 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
1411 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | 1410 | QCOMPARE(client->frameGeometry().topLeft(), oldPosition); | ||
1412 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | 1411 | QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); | ||
1413 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | 1412 | QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); | ||
1414 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1413 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
Show All 20 Lines | |||||
1435 | 1434 | | |||
1436 | void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() | 1435 | void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() | ||
1437 | { | 1436 | { | ||
1438 | // This test verifies that correct window geometry is provided along each | 1437 | // This test verifies that correct window geometry is provided along each | ||
1439 | // configure event when an xdg-shell is being interactively resized. | 1438 | // configure event when an xdg-shell is being interactively resized. | ||
1440 | 1439 | | |||
1441 | QScopedPointer<Surface> surface(Test::createSurface()); | 1440 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1442 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1441 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1443 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1442 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1444 | QVERIFY(client); | 1443 | QVERIFY(client); | ||
1445 | QVERIFY(client->isActive()); | 1444 | QVERIFY(client->isActive()); | ||
1446 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1445 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1447 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1446 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1448 | 1447 | | |||
1449 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1448 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1450 | QVERIFY(configureRequestedSpy.isValid()); | 1449 | QVERIFY(configureRequestedSpy.isValid()); | ||
1451 | QVERIFY(configureRequestedSpy.wait()); | 1450 | QVERIFY(configureRequestedSpy.wait()); | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
1530 | 1529 | | |||
1531 | void TestXdgShellClient::testXdgWindowGeometryFullScreen() | 1530 | void TestXdgShellClient::testXdgWindowGeometryFullScreen() | ||
1532 | { | 1531 | { | ||
1533 | // This test verifies that an xdg-shell receives correct window geometry when | 1532 | // This test verifies that an xdg-shell receives correct window geometry when | ||
1534 | // its fullscreen state gets changed. | 1533 | // its fullscreen state gets changed. | ||
1535 | 1534 | | |||
1536 | QScopedPointer<Surface> surface(Test::createSurface()); | 1535 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1537 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1536 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1538 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1537 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1539 | QVERIFY(client); | 1538 | QVERIFY(client); | ||
1540 | QVERIFY(client->isActive()); | 1539 | QVERIFY(client->isActive()); | ||
1541 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1540 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1542 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1541 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1543 | 1542 | | |||
1544 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1543 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1545 | QVERIFY(configureRequestedSpy.isValid()); | 1544 | QVERIFY(configureRequestedSpy.isValid()); | ||
1546 | QVERIFY(configureRequestedSpy.wait()); | 1545 | QVERIFY(configureRequestedSpy.wait()); | ||
Show All 39 Lines | |||||
1586 | 1585 | | |||
1587 | void TestXdgShellClient::testXdgWindowGeometryMaximize() | 1586 | void TestXdgShellClient::testXdgWindowGeometryMaximize() | ||
1588 | { | 1587 | { | ||
1589 | // This test verifies that an xdg-shell receives correct window geometry when | 1588 | // This test verifies that an xdg-shell receives correct window geometry when | ||
1590 | // its maximized state gets changed. | 1589 | // its maximized state gets changed. | ||
1591 | 1590 | | |||
1592 | QScopedPointer<Surface> surface(Test::createSurface()); | 1591 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
1593 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | 1592 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
1594 | XdgShellClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | 1593 | AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(200, 100), Qt::red); | ||
1595 | QVERIFY(client); | 1594 | QVERIFY(client); | ||
1596 | QVERIFY(client->isActive()); | 1595 | QVERIFY(client->isActive()); | ||
1597 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | 1596 | QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); | ||
1598 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | 1597 | QCOMPARE(client->frameGeometry().size(), QSize(200, 100)); | ||
1599 | 1598 | | |||
1600 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 1599 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
1601 | QVERIFY(configureRequestedSpy.isValid()); | 1600 | QVERIFY(configureRequestedSpy.isValid()); | ||
1602 | QVERIFY(configureRequestedSpy.wait()); | 1601 | QVERIFY(configureRequestedSpy.wait()); | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |