File indexing completed on 2024-05-05 17:36:02

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