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