Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/struts_test.cpp
Show All 20 Lines | |||||
21 | #include "platform.h" | 21 | #include "platform.h" | ||
22 | #include "x11client.h" | 22 | #include "x11client.h" | ||
23 | #include "cursor.h" | 23 | #include "cursor.h" | ||
24 | #include "deleted.h" | 24 | #include "deleted.h" | ||
25 | #include "screenedge.h" | 25 | #include "screenedge.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 28 | #include "workspace.h" | ||
29 | #include "xdgshellclient.h" | | |||
30 | #include <kwineffects.h> | 29 | #include <kwineffects.h> | ||
31 | 30 | | |||
32 | #include <KWayland/Client/compositor.h> | 31 | #include <KWayland/Client/compositor.h> | ||
33 | #include <KWayland/Client/plasmashell.h> | 32 | #include <KWayland/Client/plasmashell.h> | ||
34 | #include <KWayland/Client/surface.h> | 33 | #include <KWayland/Client/surface.h> | ||
35 | 34 | | |||
36 | #include <KDecoration2/Decoration> | 35 | #include <KDecoration2/Decoration> | ||
37 | 36 | | |||
Show All 24 Lines | |||||
62 | 61 | | |||
63 | private: | 62 | private: | ||
64 | KWayland::Client::Compositor *m_compositor = nullptr; | 63 | KWayland::Client::Compositor *m_compositor = nullptr; | ||
65 | KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; | 64 | KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; | ||
66 | }; | 65 | }; | ||
67 | 66 | | |||
68 | void StrutsTest::initTestCase() | 67 | void StrutsTest::initTestCase() | ||
69 | { | 68 | { | ||
70 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
71 | qRegisterMetaType<KWin::AbstractClient*>(); | 69 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
72 | qRegisterMetaType<KWin::Deleted*>(); | 70 | qRegisterMetaType<KWin::Deleted*>(); | ||
73 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 71 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
74 | QVERIFY(workspaceCreatedSpy.isValid()); | 72 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
75 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 73 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
76 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 74 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
77 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 75 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
78 | 76 | | |||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 143 | { | |||
163 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 161 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
164 | // combined | 162 | // combined | ||
165 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | 163 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
166 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 164 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
167 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | 165 | QCOMPARE(workspace()->restrictedMoveArea(-1), QRegion()); | ||
168 | 166 | | |||
169 | QFETCH(QVector<QRect>, windowGeometries); | 167 | QFETCH(QVector<QRect>, windowGeometries); | ||
170 | // create the panels | 168 | // create the panels | ||
171 | QHash<Surface*, XdgShellClient *> clients; | 169 | QHash<Surface*, AbstractClient *> clients; | ||
172 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | 170 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | ||
173 | const QRect windowGeometry = *it; | 171 | const QRect windowGeometry = *it; | ||
174 | Surface *surface = Test::createSurface(m_compositor); | 172 | Surface *surface = Test::createSurface(m_compositor); | ||
175 | XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface, Test::CreationSetup::CreateOnly); | 173 | XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface, Test::CreationSetup::CreateOnly); | ||
176 | PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface); | 174 | PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface); | ||
177 | plasmaSurface->setPosition(windowGeometry.topLeft()); | 175 | plasmaSurface->setPosition(windowGeometry.topLeft()); | ||
178 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 176 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
179 | Test::initXdgShellSurface(surface, shellSurface); | 177 | Test::initXdgShellSurface(surface, shellSurface); | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 223 | { | |||
241 | QVERIFY(c->isDock()); | 239 | QVERIFY(c->isDock()); | ||
242 | QVERIFY(c->hasStrut()); | 240 | QVERIFY(c->hasStrut()); | ||
243 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1000)); | 241 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1000)); | ||
244 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1000)); | 242 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1000)); | ||
245 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 243 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
246 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 244 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
247 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000)); | 245 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000)); | ||
248 | 246 | | |||
249 | QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); | 247 | QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); | ||
250 | QVERIFY(frameGeometryChangedSpy.isValid()); | 248 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
251 | plasmaSurface->setPosition(QPoint(1280, 1000)); | 249 | plasmaSurface->setPosition(QPoint(1280, 1000)); | ||
252 | QVERIFY(frameGeometryChangedSpy.wait()); | 250 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
253 | QCOMPARE(c->frameGeometry(), QRect(1280, 1000, 1280, 24)); | 251 | QCOMPARE(c->frameGeometry(), QRect(1280, 1000, 1280, 24)); | ||
254 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1024)); | 252 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
255 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1024)); | 253 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
256 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1000)); | 254 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1000)); | ||
257 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1000)); | 255 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1000)); | ||
▲ Show 20 Lines • Show All 710 Lines • Show Last 20 Lines |