Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/plasma_surface_test.cpp
Show All 24 Lines | |||||
25 | #include "wayland_server.h" | 25 | #include "wayland_server.h" | ||
26 | #include "workspace.h" | 26 | #include "workspace.h" | ||
27 | #include <KWayland/Client/connection_thread.h> | 27 | #include <KWayland/Client/connection_thread.h> | ||
28 | #include <KWayland/Client/compositor.h> | 28 | #include <KWayland/Client/compositor.h> | ||
29 | #include <KWayland/Client/event_queue.h> | 29 | #include <KWayland/Client/event_queue.h> | ||
30 | #include <KWayland/Client/plasmashell.h> | 30 | #include <KWayland/Client/plasmashell.h> | ||
31 | #include <KWayland/Client/registry.h> | 31 | #include <KWayland/Client/registry.h> | ||
32 | #include <KWayland/Client/shm_pool.h> | 32 | #include <KWayland/Client/shm_pool.h> | ||
33 | #include <KWayland/Client/shell.h> | | |||
34 | #include <KWayland/Client/surface.h> | 33 | #include <KWayland/Client/surface.h> | ||
35 | 34 | | |||
36 | using namespace KWin; | 35 | using namespace KWin; | ||
37 | using namespace KWayland::Client; | 36 | using namespace KWayland::Client; | ||
38 | 37 | | |||
39 | Q_DECLARE_METATYPE(KWin::Layer) | 38 | Q_DECLARE_METATYPE(KWin::Layer) | ||
40 | 39 | | |||
41 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_plasma_surface-0"); | 40 | static const QString s_socketName = QStringLiteral("wayland_test_kwin_plasma_surface-0"); | ||
Show All 38 Lines | 73 | { | |||
80 | kwinApp()->start(); | 79 | kwinApp()->start(); | ||
81 | QVERIFY(workspaceCreatedSpy.wait()); | 80 | QVERIFY(workspaceCreatedSpy.wait()); | ||
82 | } | 81 | } | ||
83 | 82 | | |||
84 | void PlasmaSurfaceTest::init() | 83 | void PlasmaSurfaceTest::init() | ||
85 | { | 84 | { | ||
86 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::PlasmaShell)); | 85 | QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::PlasmaShell)); | ||
87 | m_compositor = Test::waylandCompositor(); | 86 | m_compositor = Test::waylandCompositor(); | ||
88 | m_shell = Test::waylandShell(); | | |||
89 | m_plasmaShell = Test::waylandPlasmaShell(); | 87 | m_plasmaShell = Test::waylandPlasmaShell(); | ||
90 | 88 | | |||
91 | KWin::Cursor::setPos(640, 512); | 89 | KWin::Cursor::setPos(640, 512); | ||
92 | } | 90 | } | ||
93 | 91 | | |||
94 | void PlasmaSurfaceTest::cleanup() | 92 | void PlasmaSurfaceTest::cleanup() | ||
95 | { | 93 | { | ||
96 | Test::destroyWaylandConnection(); | 94 | Test::destroyWaylandConnection(); | ||
Show All 13 Lines | 98 | { | |||
110 | QTest::newRow("CriticalNotification") << PlasmaShellSurface::Role::CriticalNotification << true; | 108 | QTest::newRow("CriticalNotification") << PlasmaShellSurface::Role::CriticalNotification << true; | ||
111 | } | 109 | } | ||
112 | 110 | | |||
113 | void PlasmaSurfaceTest::testRoleOnAllDesktops() | 111 | void PlasmaSurfaceTest::testRoleOnAllDesktops() | ||
114 | { | 112 | { | ||
115 | // this test verifies that a ShellClient is set on all desktops when the role changes | 113 | // this test verifies that a ShellClient is set on all desktops when the role changes | ||
116 | QScopedPointer<Surface> surface(Test::createSurface()); | 114 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
117 | QVERIFY(!surface.isNull()); | 115 | QVERIFY(!surface.isNull()); | ||
118 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 116 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
119 | QVERIFY(!shellSurface.isNull()); | 117 | QVERIFY(!shellSurface.isNull()); | ||
120 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 118 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
121 | QVERIFY(!plasmaSurface.isNull()); | 119 | QVERIFY(!plasmaSurface.isNull()); | ||
122 | 120 | | |||
123 | // now render to map the window | 121 | // now render to map the window | ||
124 | AbstractClient *c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 122 | AbstractClient *c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
125 | QVERIFY(c); | 123 | QVERIFY(c); | ||
126 | QCOMPARE(workspace()->activeClient(), c); | 124 | QCOMPARE(workspace()->activeClient(), c); | ||
Show All 12 Lines | |||||
139 | 137 | | |||
140 | // let's create a second window where we init a little bit different | 138 | // let's create a second window where we init a little bit different | ||
141 | // first creating the PlasmaSurface then the Shell Surface | 139 | // first creating the PlasmaSurface then the Shell Surface | ||
142 | QScopedPointer<Surface> surface2(Test::createSurface()); | 140 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
143 | QVERIFY(!surface2.isNull()); | 141 | QVERIFY(!surface2.isNull()); | ||
144 | QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); | 142 | QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); | ||
145 | QVERIFY(!plasmaSurface2.isNull()); | 143 | QVERIFY(!plasmaSurface2.isNull()); | ||
146 | plasmaSurface2->setRole(role); | 144 | plasmaSurface2->setRole(role); | ||
147 | QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data())); | 145 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
148 | QVERIFY(!shellSurface2.isNull()); | 146 | QVERIFY(!shellSurface2.isNull()); | ||
149 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 147 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
150 | QVERIFY(c2); | 148 | QVERIFY(c2); | ||
151 | QVERIFY(c != c2); | 149 | QVERIFY(c != c2); | ||
152 | 150 | | |||
153 | QCOMPARE(c2->isOnAllDesktops(), expectedOnAllDesktops); | 151 | QCOMPARE(c2->isOnAllDesktops(), expectedOnAllDesktops); | ||
154 | } | 152 | } | ||
155 | 153 | | |||
Show All 12 Lines | 155 | { | |||
168 | QTest::newRow("CriticalNotification") << PlasmaShellSurface::Role::CriticalNotification << false << false; | 166 | QTest::newRow("CriticalNotification") << PlasmaShellSurface::Role::CriticalNotification << false << false; | ||
169 | } | 167 | } | ||
170 | 168 | | |||
171 | void PlasmaSurfaceTest::testAcceptsFocus() | 169 | void PlasmaSurfaceTest::testAcceptsFocus() | ||
172 | { | 170 | { | ||
173 | // this test verifies that some surface roles don't get focus | 171 | // this test verifies that some surface roles don't get focus | ||
174 | QScopedPointer<Surface> surface(Test::createSurface()); | 172 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
175 | QVERIFY(!surface.isNull()); | 173 | QVERIFY(!surface.isNull()); | ||
176 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 174 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
177 | QVERIFY(!shellSurface.isNull()); | 175 | QVERIFY(!shellSurface.isNull()); | ||
178 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 176 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
179 | QVERIFY(!plasmaSurface.isNull()); | 177 | QVERIFY(!plasmaSurface.isNull()); | ||
180 | QFETCH(PlasmaShellSurface::Role, role); | 178 | QFETCH(PlasmaShellSurface::Role, role); | ||
181 | plasmaSurface->setRole(role); | 179 | plasmaSurface->setRole(role); | ||
182 | 180 | | |||
183 | // now render to map the window | 181 | // now render to map the window | ||
184 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 182 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
185 | 183 | | |||
186 | QVERIFY(c); | 184 | QVERIFY(c); | ||
187 | QTEST(c->wantsInput(), "wantsInput"); | 185 | QTEST(c->wantsInput(), "wantsInput"); | ||
188 | QTEST(c->isActive(), "active"); | 186 | QTEST(c->isActive(), "active"); | ||
189 | } | 187 | } | ||
190 | 188 | | |||
191 | void PlasmaSurfaceTest::testDesktopIsOpaque() | 189 | void PlasmaSurfaceTest::testDesktopIsOpaque() | ||
192 | { | 190 | { | ||
193 | QScopedPointer<Surface> surface(Test::createSurface()); | 191 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
194 | QVERIFY(!surface.isNull()); | 192 | QVERIFY(!surface.isNull()); | ||
195 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 193 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
196 | QVERIFY(!shellSurface.isNull()); | 194 | QVERIFY(!shellSurface.isNull()); | ||
197 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 195 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
198 | QVERIFY(!plasmaSurface.isNull()); | 196 | QVERIFY(!plasmaSurface.isNull()); | ||
199 | plasmaSurface->setRole(PlasmaShellSurface::Role::Desktop); | 197 | plasmaSurface->setRole(PlasmaShellSurface::Role::Desktop); | ||
200 | 198 | | |||
201 | // now render to map the window | 199 | // now render to map the window | ||
202 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 200 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
203 | 201 | | |||
204 | QVERIFY(c); | 202 | QVERIFY(c); | ||
205 | QCOMPARE(c->windowType(), NET::Desktop); | 203 | QCOMPARE(c->windowType(), NET::Desktop); | ||
206 | QVERIFY(c->isDesktop()); | 204 | QVERIFY(c->isDesktop()); | ||
207 | 205 | | |||
208 | QVERIFY(!c->hasAlpha()); | 206 | QVERIFY(!c->hasAlpha()); | ||
209 | QCOMPARE(c->depth(), 24); | 207 | QCOMPARE(c->depth(), 24); | ||
210 | } | 208 | } | ||
211 | 209 | | |||
212 | void PlasmaSurfaceTest::testOSDPlacement() | 210 | void PlasmaSurfaceTest::testOSDPlacement() | ||
213 | { | 211 | { | ||
214 | QScopedPointer<Surface> surface(Test::createSurface()); | 212 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
215 | QVERIFY(!surface.isNull()); | 213 | QVERIFY(!surface.isNull()); | ||
216 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 214 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
217 | QVERIFY(!shellSurface.isNull()); | 215 | QVERIFY(!shellSurface.isNull()); | ||
218 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 216 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
219 | QVERIFY(!plasmaSurface.isNull()); | 217 | QVERIFY(!plasmaSurface.isNull()); | ||
220 | plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay); | 218 | plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay); | ||
221 | 219 | | |||
222 | // now render and map the window | 220 | // now render and map the window | ||
223 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 221 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
224 | 222 | | |||
Show All 23 Lines | |||||
248 | QVERIFY(geometryChangedSpy.isValid()); | 246 | QVERIFY(geometryChangedSpy.isValid()); | ||
249 | Test::render(surface.data(), QSize(200, 100), Qt::red); | 247 | Test::render(surface.data(), QSize(200, 100), Qt::red); | ||
250 | QVERIFY(geometryChangedSpy.wait()); | 248 | QVERIFY(geometryChangedSpy.wait()); | ||
251 | QCOMPARE(c->geometry(), QRect(540, 616, 200, 100)); | 249 | QCOMPARE(c->geometry(), QRect(540, 616, 200, 100)); | ||
252 | } | 250 | } | ||
253 | 251 | | |||
254 | void PlasmaSurfaceTest::testOSDPlacementManualPosition_data() | 252 | void PlasmaSurfaceTest::testOSDPlacementManualPosition_data() | ||
255 | { | 253 | { | ||
256 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 254 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
257 | 255 | | |||
258 | QTest::newRow("wl-shell") << Test::ShellSurfaceType::WlShell; | 256 | QTest::newRow("xdgv5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
259 | QTest::newRow("xdgv5") << Test::ShellSurfaceType::XdgShellV5; | 257 | QTest::newRow("xdgv6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
260 | QTest::newRow("xdgv6") << Test::ShellSurfaceType::XdgShellV6; | 258 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
261 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
262 | } | 259 | } | ||
263 | 260 | | |||
264 | void PlasmaSurfaceTest::testOSDPlacementManualPosition() | 261 | void PlasmaSurfaceTest::testOSDPlacementManualPosition() | ||
265 | { | 262 | { | ||
266 | QScopedPointer<Surface> surface(Test::createSurface()); | 263 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
267 | QVERIFY(!surface.isNull()); | 264 | QVERIFY(!surface.isNull()); | ||
268 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 265 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
269 | QVERIFY(!plasmaSurface.isNull()); | 266 | QVERIFY(!plasmaSurface.isNull()); | ||
270 | plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay); | 267 | plasmaSurface->setRole(PlasmaShellSurface::Role::OnScreenDisplay); | ||
271 | 268 | | |||
272 | plasmaSurface->setPosition(QPoint(50, 70)); | 269 | plasmaSurface->setPosition(QPoint(50, 70)); | ||
273 | 270 | | |||
274 | QFETCH(Test::ShellSurfaceType, type); | 271 | QFETCH(Test::XdgShellSurfaceType, type); | ||
275 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 272 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
276 | QVERIFY(!shellSurface.isNull()); | 273 | QVERIFY(!shellSurface.isNull()); | ||
277 | 274 | | |||
278 | // now render and map the window | 275 | // now render and map the window | ||
279 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 276 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
280 | 277 | | |||
281 | QVERIFY(c); | 278 | QVERIFY(c); | ||
282 | QVERIFY(c->isInitialPositionSet()); | 279 | QVERIFY(c->isInitialPositionSet()); | ||
283 | QCOMPARE(c->windowType(), NET::OnScreenDisplay); | 280 | QCOMPARE(c->windowType(), NET::OnScreenDisplay); | ||
284 | QVERIFY(c->isOnScreenDisplay()); | 281 | QVERIFY(c->isOnScreenDisplay()); | ||
285 | QCOMPARE(c->geometry(), QRect(50, 70, 100, 50)); | 282 | QCOMPARE(c->geometry(), QRect(50, 70, 100, 50)); | ||
286 | } | 283 | } | ||
287 | 284 | | |||
288 | 285 | | |||
289 | void PlasmaSurfaceTest::testPanelTypeHasStrut_data() | 286 | void PlasmaSurfaceTest::testPanelTypeHasStrut_data() | ||
290 | { | 287 | { | ||
291 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 288 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
292 | QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior"); | 289 | QTest::addColumn<PlasmaShellSurface::PanelBehavior>("panelBehavior"); | ||
293 | QTest::addColumn<bool>("expectedStrut"); | 290 | QTest::addColumn<bool>("expectedStrut"); | ||
294 | QTest::addColumn<QRect>("expectedMaxArea"); | 291 | QTest::addColumn<QRect>("expectedMaxArea"); | ||
295 | QTest::addColumn<KWin::Layer>("expectedLayer"); | 292 | QTest::addColumn<KWin::Layer>("expectedLayer"); | ||
296 | 293 | | |||
297 | QTest::newRow("always visible - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | 294 | QTest::newRow("always visible - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | ||
298 | QTest::newRow("always visible - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | 295 | QTest::newRow("always visible - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | ||
299 | QTest::newRow("always visible - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | 296 | QTest::newRow("always visible - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | ||
300 | QTest::newRow("always visible - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AlwaysVisible << true << QRect(0, 50, 1280, 974) << KWin::DockLayer; | 297 | QTest::newRow("autohide - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | ||
301 | QTest::newRow("autohide - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | 298 | QTest::newRow("autohide - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | ||
302 | QTest::newRow("autohide - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | 299 | QTest::newRow("autohide - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | ||
303 | QTest::newRow("autohide - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | 300 | QTest::newRow("windows can cover - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | ||
304 | QTest::newRow("autohide - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::AutoHide << false << QRect(0, 0, 1280, 1024) << KWin::AboveLayer; | 301 | QTest::newRow("windows can cover - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | ||
305 | QTest::newRow("windows can cover - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | 302 | QTest::newRow("windows can cover - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | ||
306 | QTest::newRow("windows can cover - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | 303 | QTest::newRow("windows go below - xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | ||
307 | QTest::newRow("windows can cover - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | 304 | QTest::newRow("windows go below - xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | ||
308 | QTest::newRow("windows can cover - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsCanCover << false << QRect(0, 0, 1280, 1024) << KWin::NormalLayer; | 305 | QTest::newRow("windows go below - xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | ||
309 | QTest::newRow("windows go below - wlShell") << Test::ShellSurfaceType::WlShell << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | | |||
310 | QTest::newRow("windows go below - xdgShellV5") << Test::ShellSurfaceType::XdgShellV5 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | | |||
311 | QTest::newRow("windows go below - xdgShellV6") << Test::ShellSurfaceType::XdgShellV6 << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | | |||
312 | QTest::newRow("windows go below - xdgWmBase") << Test::ShellSurfaceType::XdgShellStable << PlasmaShellSurface::PanelBehavior::WindowsGoBelow << false << QRect(0, 0, 1280, 1024) << KWin::DockLayer; | | |||
313 | } | 306 | } | ||
314 | 307 | | |||
315 | void PlasmaSurfaceTest::testPanelTypeHasStrut() | 308 | void PlasmaSurfaceTest::testPanelTypeHasStrut() | ||
316 | { | 309 | { | ||
317 | QScopedPointer<Surface> surface(Test::createSurface()); | 310 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
318 | QVERIFY(!surface.isNull()); | 311 | QVERIFY(!surface.isNull()); | ||
319 | QFETCH(Test::ShellSurfaceType, type); | 312 | QFETCH(Test::XdgShellSurfaceType, type); | ||
320 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 313 | QScopedPointer<QObject> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
321 | QVERIFY(!shellSurface.isNull()); | 314 | QVERIFY(!shellSurface.isNull()); | ||
322 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 315 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
323 | QVERIFY(!plasmaSurface.isNull()); | 316 | QVERIFY(!plasmaSurface.isNull()); | ||
324 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 317 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
325 | plasmaSurface->setPosition(QPoint(0, 0)); | 318 | plasmaSurface->setPosition(QPoint(0, 0)); | ||
326 | QFETCH(PlasmaShellSurface::PanelBehavior, panelBehavior); | 319 | QFETCH(PlasmaShellSurface::PanelBehavior, panelBehavior); | ||
327 | plasmaSurface->setPanelBehavior(panelBehavior); | 320 | plasmaSurface->setPanelBehavior(panelBehavior); | ||
328 | 321 | | |||
Show All 30 Lines | |||||
359 | } | 352 | } | ||
360 | 353 | | |||
361 | void PlasmaSurfaceTest::testPanelWindowsCanCover() | 354 | void PlasmaSurfaceTest::testPanelWindowsCanCover() | ||
362 | { | 355 | { | ||
363 | // this test verifies the behavior of a panel with windows can cover | 356 | // this test verifies the behavior of a panel with windows can cover | ||
364 | // triggering the screen edge should raise the panel. | 357 | // triggering the screen edge should raise the panel. | ||
365 | QScopedPointer<Surface> surface(Test::createSurface()); | 358 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
366 | QVERIFY(!surface.isNull()); | 359 | QVERIFY(!surface.isNull()); | ||
367 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); | 360 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
368 | QVERIFY(!shellSurface.isNull()); | 361 | QVERIFY(!shellSurface.isNull()); | ||
369 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 362 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
370 | QVERIFY(!plasmaSurface.isNull()); | 363 | QVERIFY(!plasmaSurface.isNull()); | ||
371 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 364 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
372 | QFETCH(QRect, panelGeometry); | 365 | QFETCH(QRect, panelGeometry); | ||
373 | plasmaSurface->setPosition(panelGeometry.topLeft()); | 366 | plasmaSurface->setPosition(panelGeometry.topLeft()); | ||
374 | plasmaSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::WindowsCanCover); | 367 | plasmaSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::WindowsCanCover); | ||
375 | 368 | | |||
376 | | ||||
377 | // now render and map the window | 369 | // now render and map the window | ||
378 | auto panel = Test::renderAndWaitForShown(surface.data(), panelGeometry.size(), Qt::blue); | 370 | auto panel = Test::renderAndWaitForShown(surface.data(), panelGeometry.size(), Qt::blue); | ||
379 | 371 | | |||
380 | QVERIFY(panel); | 372 | QVERIFY(panel); | ||
381 | QCOMPARE(panel->windowType(), NET::Dock); | 373 | QCOMPARE(panel->windowType(), NET::Dock); | ||
382 | QVERIFY(panel->isDock()); | 374 | QVERIFY(panel->isDock()); | ||
383 | QCOMPARE(panel->geometry(), panelGeometry); | 375 | QCOMPARE(panel->geometry(), panelGeometry); | ||
384 | QCOMPARE(panel->hasStrut(), false); | 376 | QCOMPARE(panel->hasStrut(), false); | ||
385 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 0), QRect(0, 0, 1280, 1024)); | 377 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 0), QRect(0, 0, 1280, 1024)); | ||
386 | QCOMPARE(panel->layer(), KWin::NormalLayer); | 378 | QCOMPARE(panel->layer(), KWin::NormalLayer); | ||
387 | 379 | | |||
388 | // create a Window | 380 | // create a Window | ||
389 | QScopedPointer<Surface> surface2(Test::createSurface()); | 381 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
390 | QVERIFY(!surface2.isNull()); | 382 | QVERIFY(!surface2.isNull()); | ||
391 | QScopedPointer<QObject> shellSurface2(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface2.data())); | 383 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
392 | QVERIFY(!shellSurface2.isNull()); | 384 | QVERIFY(!shellSurface2.isNull()); | ||
393 | 385 | | |||
394 | QFETCH(QRect, windowGeometry); | 386 | QFETCH(QRect, windowGeometry); | ||
395 | auto c = Test::renderAndWaitForShown(surface2.data(), windowGeometry.size(), Qt::red); | 387 | auto c = Test::renderAndWaitForShown(surface2.data(), windowGeometry.size(), Qt::red); | ||
396 | 388 | | |||
397 | QVERIFY(c); | 389 | QVERIFY(c); | ||
398 | QCOMPARE(c->windowType(), NET::Normal); | 390 | QCOMPARE(c->windowType(), NET::Normal); | ||
399 | QVERIFY(c->isActive()); | 391 | QVERIFY(c->isActive()); | ||
Show All 26 Lines | 414 | { | |||
426 | QTest::newRow("no focus") << false << false; | 418 | QTest::newRow("no focus") << false << false; | ||
427 | QTest::newRow("focus") << true << true; | 419 | QTest::newRow("focus") << true << true; | ||
428 | } | 420 | } | ||
429 | 421 | | |||
430 | void PlasmaSurfaceTest::testPanelActivate() | 422 | void PlasmaSurfaceTest::testPanelActivate() | ||
431 | { | 423 | { | ||
432 | QScopedPointer<Surface> surface(Test::createSurface()); | 424 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
433 | QVERIFY(!surface.isNull()); | 425 | QVERIFY(!surface.isNull()); | ||
434 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); | 426 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
435 | QVERIFY(!shellSurface.isNull()); | 427 | QVERIFY(!shellSurface.isNull()); | ||
436 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 428 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
437 | QVERIFY(!plasmaSurface.isNull()); | 429 | QVERIFY(!plasmaSurface.isNull()); | ||
438 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 430 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
439 | QFETCH(bool, wantsFocus); | 431 | QFETCH(bool, wantsFocus); | ||
440 | plasmaSurface->setPanelTakesFocus(wantsFocus); | 432 | plasmaSurface->setPanelTakesFocus(wantsFocus); | ||
441 | 433 | | |||
442 | auto panel = Test::renderAndWaitForShown(surface.data(), QSize(100, 200), Qt::blue); | 434 | auto panel = Test::renderAndWaitForShown(surface.data(), QSize(100, 200), Qt::blue); | ||
Show All 11 Lines |