File indexing completed on 2024-11-10 04:56:08

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #include "kwin_wayland_test.h"
0010 
0011 #include "core/output.h"
0012 #include "pointer_input.h"
0013 #include "tiles/tilemanager.h"
0014 #include "wayland_server.h"
0015 #include "window.h"
0016 #include "workspace.h"
0017 
0018 #include <QAbstractItemModelTester>
0019 
0020 namespace KWin
0021 {
0022 
0023 static const QString s_socketName = QStringLiteral("wayland_test_kwin_transient_placement-0");
0024 
0025 class TilesTest : public QObject
0026 {
0027     Q_OBJECT
0028 private Q_SLOTS:
0029     void initTestCase();
0030     void init();
0031     void cleanup();
0032     void testWindowInteraction();
0033     void testAssignedTileDeletion();
0034     void resizeTileFromWindow();
0035 
0036 private:
0037     void createSampleLayout();
0038 
0039     Output *m_output;
0040     TileManager *m_tileManager;
0041     CustomTile *m_rootTile;
0042 };
0043 
0044 void TilesTest::initTestCase()
0045 {
0046     qRegisterMetaType<KWin::Window *>();
0047     QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
0048     QVERIFY(applicationStartedSpy.isValid());
0049     QVERIFY(waylandServer()->init(s_socketName));
0050     Test::setOutputConfig({
0051         QRect(0, 0, 1280, 1024),
0052         QRect(1280, 0, 1280, 1024),
0053     });
0054 
0055     kwinApp()->start();
0056     QVERIFY(applicationStartedSpy.wait());
0057     const auto outputs = workspace()->outputs();
0058     QCOMPARE(outputs.count(), 2);
0059     QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
0060     QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
0061     setenv("QT_QPA_PLATFORM", "wayland", true);
0062 }
0063 
0064 void TilesTest::init()
0065 {
0066     QVERIFY(Test::setupWaylandConnection());
0067 
0068     workspace()->setActiveOutput(QPoint(640, 512));
0069     input()->pointer()->warp(QPoint(640, 512));
0070     m_output = workspace()->activeOutput();
0071     m_tileManager = workspace()->tileManager(m_output);
0072     m_rootTile = m_tileManager->rootTile();
0073     QAbstractItemModelTester(m_tileManager->model(), QAbstractItemModelTester::FailureReportingMode::QtTest);
0074     while (m_rootTile->childCount() > 0) {
0075         static_cast<CustomTile *>(m_rootTile->childTile(0))->remove();
0076     }
0077     createSampleLayout();
0078 }
0079 
0080 void TilesTest::cleanup()
0081 {
0082     while (m_rootTile->childCount() > 0) {
0083         static_cast<CustomTile *>(m_rootTile->childTile(0))->remove();
0084     }
0085     Test::destroyWaylandConnection();
0086 }
0087 
0088 void TilesTest::createSampleLayout()
0089 {
0090     QCOMPARE(m_rootTile->childCount(), 0);
0091     m_rootTile->split(CustomTile::LayoutDirection::Horizontal);
0092     QCOMPARE(m_rootTile->childCount(), 2);
0093 
0094     auto leftTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().first());
0095     auto rightTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().last());
0096     QVERIFY(leftTile);
0097     QVERIFY(rightTile);
0098 
0099     QCOMPARE(leftTile->relativeGeometry(), QRectF(0, 0, 0.5, 1));
0100     QCOMPARE(rightTile->relativeGeometry(), QRectF(0.5, 0, 0.5, 1));
0101 
0102     // Splitting with the same layout direction creates a sibling, not 2 children
0103     rightTile->split(CustomTile::LayoutDirection::Horizontal);
0104     auto newRightTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().last());
0105 
0106     QCOMPARE(m_rootTile->childCount(), 3);
0107     QCOMPARE(m_rootTile->relativeGeometry(), QRectF(0, 0, 1, 1));
0108     QCOMPARE(leftTile->relativeGeometry(), QRectF(0, 0, 0.5, 1));
0109     QCOMPARE(rightTile->relativeGeometry(), QRectF(0.5, 0, 0.25, 1));
0110     QCOMPARE(newRightTile->relativeGeometry(), QRectF(0.75, 0, 0.25, 1));
0111 
0112     QCOMPARE(m_rootTile->windowGeometry(), QRectF(4, 4, 1272, 1016));
0113     QCOMPARE(leftTile->windowGeometry(), QRectF(4, 4, 634, 1016));
0114     QCOMPARE(rightTile->windowGeometry(), QRectF(642, 4, 316, 1016));
0115     QCOMPARE(newRightTile->windowGeometry(), QRectF(962, 4, 314, 1016));
0116 
0117     // Splitting with a different layout direction creates 2 children in the tile
0118     QVERIFY(!rightTile->isLayout());
0119     QCOMPARE(rightTile->childCount(), 0);
0120     rightTile->split(CustomTile::LayoutDirection::Vertical);
0121     QVERIFY(rightTile->isLayout());
0122     QCOMPARE(rightTile->childCount(), 2);
0123     auto verticalTopTile = qobject_cast<CustomTile *>(rightTile->childTiles().first());
0124     auto verticalBottomTile = qobject_cast<CustomTile *>(rightTile->childTiles().last());
0125 
0126     // geometry of rightTile should be the same
0127     QCOMPARE(m_rootTile->childCount(), 3);
0128     QCOMPARE(rightTile->relativeGeometry(), QRectF(0.5, 0, 0.25, 1));
0129     QCOMPARE(rightTile->windowGeometry(), QRectF(642, 4, 316, 1016));
0130 
0131     QCOMPARE(verticalTopTile->relativeGeometry(), QRectF(0.5, 0, 0.25, 0.5));
0132     QCOMPARE(verticalBottomTile->relativeGeometry(), QRectF(0.5, 0.5, 0.25, 0.5));
0133     QCOMPARE(verticalTopTile->windowGeometry(), QRectF(642, 4, 316, 506));
0134     QCOMPARE(verticalBottomTile->windowGeometry(), QRectF(642, 514, 316, 506));
0135 }
0136 
0137 void TilesTest::testWindowInteraction()
0138 {
0139     // Test that resizing a tile resizes the contained window and resizes the neighboring tiles as well
0140     std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
0141 
0142     std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
0143 
0144     QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
0145     QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
0146 
0147     auto rootWindow = Test::renderAndWaitForShown(surface.get(), QSize(100, 100), Qt::cyan);
0148     QVERIFY(rootWindow);
0149     QSignalSpy frameGeometryChangedSpy(rootWindow, &Window::frameGeometryChanged);
0150     QVERIFY(surfaceConfigureRequestedSpy.wait());
0151     QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
0152     QCOMPARE(toplevelConfigureRequestedSpy.count(), 1);
0153 
0154     auto leftTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().first());
0155     QVERIFY(leftTile);
0156 
0157     rootWindow->setTile(leftTile);
0158     QVERIFY(surfaceConfigureRequestedSpy.wait());
0159     QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
0160     QCOMPARE(toplevelConfigureRequestedSpy.count(), 2);
0161 
0162     shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0163     Test::render(surface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0164     QVERIFY(frameGeometryChangedSpy.wait());
0165     QCOMPARE(rootWindow->frameGeometry(), leftTile->windowGeometry().toRect());
0166 
0167     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), leftTile->windowGeometry().toRect().size());
0168 
0169     // Resize owning tile
0170     leftTile->setRelativeGeometry({0, 0, 0.4, 1});
0171 
0172     QVERIFY(surfaceConfigureRequestedSpy.wait());
0173     QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
0174     QCOMPARE(toplevelConfigureRequestedSpy.count(), 3);
0175 
0176     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), leftTile->windowGeometry().toRect().size());
0177 
0178     shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0179 
0180     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), leftTile->windowGeometry().toRect().size());
0181 
0182     Test::render(surface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0183     QVERIFY(frameGeometryChangedSpy.wait());
0184     QCOMPARE(rootWindow->frameGeometry(), leftTile->windowGeometry().toRect());
0185 
0186     auto middleTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[1]);
0187     QVERIFY(middleTile);
0188     auto rightTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[2]);
0189     QVERIFY(rightTile);
0190     auto verticalTopTile = qobject_cast<CustomTile *>(middleTile->childTiles().first());
0191     QVERIFY(verticalTopTile);
0192     auto verticalBottomTile = qobject_cast<CustomTile *>(middleTile->childTiles().last());
0193     QVERIFY(verticalBottomTile);
0194 
0195     QCOMPARE(leftTile->relativeGeometry(), QRectF(0, 0, 0.4, 1));
0196     QCOMPARE(middleTile->relativeGeometry(), QRectF(0.4, 0, 0.35, 1));
0197     QCOMPARE(rightTile->relativeGeometry(), QRectF(0.75, 0, 0.25, 1));
0198     QCOMPARE(verticalTopTile->relativeGeometry(), QRectF(0.4, 0, 0.35, 0.5));
0199     QCOMPARE(verticalBottomTile->relativeGeometry(), QRectF(0.4, 0.5, 0.35, 0.5));
0200 }
0201 
0202 void TilesTest::testAssignedTileDeletion()
0203 {
0204     auto leftTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().first());
0205     QVERIFY(leftTile);
0206     leftTile->setRelativeGeometry({0, 0, 0.4, 1});
0207 
0208     std::unique_ptr<KWayland::Client::Surface> rootSurface(Test::createSurface());
0209 
0210     std::unique_ptr<Test::XdgToplevel> root(Test::createXdgToplevelSurface(rootSurface.get()));
0211 
0212     QSignalSpy surfaceConfigureRequestedSpy(root->xdgSurface(), &Test::XdgSurface::configureRequested);
0213     QSignalSpy toplevelConfigureRequestedSpy(root.get(), &Test::XdgToplevel::configureRequested);
0214 
0215     auto rootWindow = Test::renderAndWaitForShown(rootSurface.get(), QSize(100, 100), Qt::cyan);
0216     QVERIFY(rootWindow);
0217     QSignalSpy frameGeometryChangedSpy(rootWindow, &Window::frameGeometryChanged);
0218     QVERIFY(surfaceConfigureRequestedSpy.wait());
0219     QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
0220     QCOMPARE(toplevelConfigureRequestedSpy.count(), 1);
0221     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0222 
0223     auto middleTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[1]);
0224     QVERIFY(middleTile);
0225     auto middleBottomTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[1]->childTiles()[1]);
0226     QVERIFY(middleBottomTile);
0227 
0228     rootWindow->setTile(middleBottomTile);
0229     QVERIFY(surfaceConfigureRequestedSpy.wait());
0230     QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
0231     QCOMPARE(toplevelConfigureRequestedSpy.count(), 2);
0232 
0233     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0234 
0235     Test::render(rootSurface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0236     QVERIFY(frameGeometryChangedSpy.wait());
0237     QCOMPARE(rootWindow->frameGeometry(), middleBottomTile->windowGeometry().toRect());
0238 
0239     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), middleBottomTile->windowGeometry().toRect().size());
0240 
0241     QCOMPARE(middleBottomTile->windowGeometry().toRect(), QRect(514, 514, 444, 506));
0242 
0243     middleBottomTile->remove();
0244 
0245     QVERIFY(surfaceConfigureRequestedSpy.wait());
0246     QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
0247     QCOMPARE(toplevelConfigureRequestedSpy.count(), 3);
0248 
0249     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0250 
0251     // The window has been reassigned to middleTile after deletion of the children
0252     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), middleTile->windowGeometry().toRect().size());
0253 
0254     Test::render(rootSurface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0255     QVERIFY(frameGeometryChangedSpy.wait());
0256     QCOMPARE(rootWindow->frameGeometry(), middleTile->windowGeometry().toRect());
0257 
0258     // Both children have been deleted as the system avoids tiles with ha single child
0259     QCOMPARE(middleTile->isLayout(), false);
0260     QCOMPARE(middleTile->childCount(), 0);
0261     QCOMPARE(rootWindow->tile(), middleTile);
0262 }
0263 
0264 void TilesTest::resizeTileFromWindow()
0265 {
0266     auto middleBottomTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[1]->childTiles()[1]);
0267     QVERIFY(middleBottomTile);
0268     middleBottomTile->remove();
0269 
0270     std::unique_ptr<KWayland::Client::Surface> rootSurface(Test::createSurface());
0271 
0272     std::unique_ptr<Test::XdgToplevel> root(Test::createXdgToplevelSurface(rootSurface.get()));
0273 
0274     QSignalSpy surfaceConfigureRequestedSpy(root->xdgSurface(), &Test::XdgSurface::configureRequested);
0275     QSignalSpy toplevelConfigureRequestedSpy(root.get(), &Test::XdgToplevel::configureRequested);
0276 
0277     Test::XdgToplevel::States states;
0278     auto window = Test::renderAndWaitForShown(rootSurface.get(), QSize(100, 100), Qt::cyan);
0279     QVERIFY(window);
0280     QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
0281     QVERIFY(frameGeometryChangedSpy.isValid());
0282     QVERIFY(surfaceConfigureRequestedSpy.wait());
0283     QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
0284     QCOMPARE(toplevelConfigureRequestedSpy.count(), 1);
0285     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0286 
0287     auto leftTile = qobject_cast<CustomTile *>(m_rootTile->childTiles().first());
0288     QVERIFY(leftTile);
0289     leftTile->setRelativeGeometry({0, 0, 0.4, 1});
0290     QCOMPARE(leftTile->windowGeometry(), QRectF(4, 4, 506, 1016));
0291 
0292     auto middleTile = qobject_cast<CustomTile *>(m_rootTile->childTiles()[1]);
0293     QVERIFY(middleTile);
0294     QCOMPARE(middleTile->windowGeometry(), QRectF(514, 4, 444, 1016));
0295 
0296     leftTile->split(CustomTile::LayoutDirection::Vertical);
0297     auto topLeftTile = qobject_cast<CustomTile *>(leftTile->childTiles().first());
0298     QVERIFY(topLeftTile);
0299     QCOMPARE(topLeftTile->windowGeometry(), QRectF(4, 4, 506, 506));
0300     QSignalSpy tileGeometryChangedSpy(topLeftTile, &Tile::windowGeometryChanged);
0301     auto bottomLeftTile = qobject_cast<CustomTile *>(leftTile->childTiles().last());
0302     QVERIFY(bottomLeftTile);
0303     QCOMPARE(bottomLeftTile->windowGeometry(), QRectF(4, 514, 506, 506));
0304 
0305     window->setTile(topLeftTile);
0306     QVERIFY(surfaceConfigureRequestedSpy.wait());
0307     QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
0308     QCOMPARE(toplevelConfigureRequestedSpy.count(), 2);
0309 
0310     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0311 
0312     QCOMPARE(toplevelConfigureRequestedSpy.last().first().value<QSize>(), topLeftTile->windowGeometry().toRect().size());
0313     Test::render(rootSurface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0314     QVERIFY(frameGeometryChangedSpy.wait());
0315     QCOMPARE(window->frameGeometry(), QRect(4, 4, 506, 506));
0316 
0317     QCOMPARE(workspace()->activeWindow(), window);
0318     QSignalSpy interactiveMoveResizeStartedSpy(window, &Window::interactiveMoveResizeStarted);
0319     QVERIFY(interactiveMoveResizeStartedSpy.isValid());
0320     QSignalSpy moveResizedChangedSpy(window, &Window::moveResizedChanged);
0321     QVERIFY(moveResizedChangedSpy.isValid());
0322     QSignalSpy interactiveMoveResizeFinishedSpy(window, &Window::interactiveMoveResizeFinished);
0323     QVERIFY(interactiveMoveResizeFinishedSpy.isValid());
0324 
0325     // begin resize
0326     QCOMPARE(workspace()->moveResizeWindow(), nullptr);
0327     QCOMPARE(window->isInteractiveMove(), false);
0328     QCOMPARE(window->isInteractiveResize(), false);
0329     workspace()->slotWindowResize();
0330     QCOMPARE(workspace()->moveResizeWindow(), window);
0331     QCOMPARE(interactiveMoveResizeStartedSpy.count(), 1);
0332     QCOMPARE(moveResizedChangedSpy.count(), 1);
0333     QCOMPARE(window->isInteractiveResize(), true);
0334     QCOMPARE(window->geometryRestore(), QRect());
0335     QVERIFY(surfaceConfigureRequestedSpy.wait());
0336     QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
0337     QCOMPARE(toplevelConfigureRequestedSpy.count(), 3);
0338     states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
0339     QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
0340     QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
0341     // Trigger a change.
0342     QPoint cursorPos = window->frameGeometry().bottomRight().toPoint();
0343     input()->pointer()->warp(cursorPos + QPoint(8, 0));
0344     window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
0345     QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
0346 
0347     // The client should receive a configure event with the new size.
0348     QVERIFY(surfaceConfigureRequestedSpy.wait());
0349     QCOMPARE(surfaceConfigureRequestedSpy.count(), 4);
0350     QCOMPARE(toplevelConfigureRequestedSpy.count(), 4);
0351     states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
0352     QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
0353     QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
0354     QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(516, 508));
0355 
0356     // Now render new size.
0357     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0358     Test::render(rootSurface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0359     QVERIFY(frameGeometryChangedSpy.wait());
0360     QCOMPARE(window->frameGeometry(), QRect(4, 4, 516, 508));
0361 
0362     QTRY_COMPARE(tileGeometryChangedSpy.count(), 2);
0363     QCOMPARE(window->tile(), topLeftTile);
0364     QCOMPARE(topLeftTile->windowGeometry(), QRect(4, 4, 516, 508));
0365     QCOMPARE(bottomLeftTile->windowGeometry(), QRect(4, 516, 516, 504));
0366     QCOMPARE(leftTile->windowGeometry(), QRect(4, 4, 516, 1016));
0367     QCOMPARE(middleTile->windowGeometry(), QRect(524, 4, 434, 1016));
0368 
0369     // Resize vertically
0370     workspace()->slotWindowResize();
0371     QCOMPARE(workspace()->moveResizeWindow(), window);
0372     QCOMPARE(interactiveMoveResizeStartedSpy.count(), 2);
0373     QCOMPARE(moveResizedChangedSpy.count(), 3);
0374     QCOMPARE(window->isInteractiveResize(), true);
0375     QCOMPARE(window->geometryRestore(), QRect());
0376     QVERIFY(surfaceConfigureRequestedSpy.wait());
0377     QCOMPARE(surfaceConfigureRequestedSpy.count(), 5);
0378     QCOMPARE(toplevelConfigureRequestedSpy.count(), 5);
0379     states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
0380     QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
0381     QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
0382 
0383     // Trigger a change.
0384     cursorPos = window->frameGeometry().bottomRight().toPoint();
0385     input()->pointer()->warp(cursorPos + QPoint(0, 8));
0386     window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos());
0387     QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(0, 8));
0388 
0389     // The client should receive a configure event with the new size.
0390     QVERIFY(surfaceConfigureRequestedSpy.wait());
0391     QCOMPARE(surfaceConfigureRequestedSpy.count(), 6);
0392     QCOMPARE(toplevelConfigureRequestedSpy.count(), 6);
0393     states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
0394     QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
0395     QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing));
0396     QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(518, 518));
0397 
0398     // Now render new size.
0399     root->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
0400     Test::render(rootSurface.get(), toplevelConfigureRequestedSpy.last().first().value<QSize>(), Qt::blue);
0401     QVERIFY(frameGeometryChangedSpy.wait());
0402     QCOMPARE(window->frameGeometry(), QRect(4, 4, 518, 518));
0403 
0404     QTRY_COMPARE(tileGeometryChangedSpy.count(), 5);
0405     QCOMPARE(window->tile(), topLeftTile);
0406     QCOMPARE(topLeftTile->windowGeometry(), QRect(4, 4, 518, 518));
0407     QCOMPARE(bottomLeftTile->windowGeometry(), QRect(4, 526, 518, 494));
0408     QCOMPARE(leftTile->windowGeometry(), QRect(4, 4, 518, 1016));
0409     QCOMPARE(middleTile->windowGeometry(), QRect(526, 4, 432, 1016));
0410 }
0411 }
0412 
0413 WAYLANDTEST_MAIN(KWin::TilesTest)
0414 #include "tiles_test.moc"