Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/activation_test.cpp
Show All 17 Lines | |||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | 20 | | |||
21 | #include "kwin_wayland_test.h" | 21 | #include "kwin_wayland_test.h" | ||
22 | 22 | | |||
23 | #include "cursor.h" | 23 | #include "cursor.h" | ||
24 | #include "platform.h" | 24 | #include "platform.h" | ||
25 | #include "screens.h" | 25 | #include "screens.h" | ||
26 | #include "shell_client.h" | | |||
27 | #include "wayland_server.h" | 26 | #include "wayland_server.h" | ||
28 | #include "workspace.h" | 27 | #include "workspace.h" | ||
28 | #include "xdgshellclient.h" | ||||
29 | 29 | | |||
30 | #include <KWayland/Client/surface.h> | 30 | #include <KWayland/Client/surface.h> | ||
31 | 31 | | |||
32 | namespace KWin | 32 | namespace KWin | ||
33 | { | 33 | { | ||
34 | 34 | | |||
35 | static const QString s_socketName = QStringLiteral("wayland_test_activation-0"); | 35 | static const QString s_socketName = QStringLiteral("wayland_test_activation-0"); | ||
36 | 36 | | |||
Show All 16 Lines | |||||
53 | private: | 53 | private: | ||
54 | void stackScreensHorizontally(); | 54 | void stackScreensHorizontally(); | ||
55 | void stackScreensVertically(); | 55 | void stackScreensVertically(); | ||
56 | }; | 56 | }; | ||
57 | 57 | | |||
58 | void ActivationTest::initTestCase() | 58 | void ActivationTest::initTestCase() | ||
59 | { | 59 | { | ||
60 | qRegisterMetaType<AbstractClient *>(); | 60 | qRegisterMetaType<AbstractClient *>(); | ||
61 | qRegisterMetaType<ShellClient *>(); | 61 | qRegisterMetaType<XdgShellClient *>(); | ||
62 | 62 | | |||
63 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 63 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
64 | QVERIFY(workspaceCreatedSpy.isValid()); | 64 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
65 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 65 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
66 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 66 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
67 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | 67 | QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2)); | ||
68 | 68 | | |||
69 | kwinApp()->start(); | 69 | kwinApp()->start(); | ||
Show All 26 Lines | 93 | { | |||
96 | using namespace KWayland::Client; | 96 | using namespace KWayland::Client; | ||
97 | 97 | | |||
98 | // Prepare the test environment. | 98 | // Prepare the test environment. | ||
99 | stackScreensHorizontally(); | 99 | stackScreensHorizontally(); | ||
100 | 100 | | |||
101 | // Create several clients on the left screen. | 101 | // Create several clients on the left screen. | ||
102 | QScopedPointer<Surface> surface1(Test::createSurface()); | 102 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
103 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 103 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
104 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 104 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
105 | QVERIFY(client1); | 105 | QVERIFY(client1); | ||
106 | QVERIFY(client1->isActive()); | 106 | QVERIFY(client1->isActive()); | ||
107 | 107 | | |||
108 | QScopedPointer<Surface> surface2(Test::createSurface()); | 108 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
109 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 109 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
110 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 110 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
111 | QVERIFY(client2); | 111 | QVERIFY(client2); | ||
112 | QVERIFY(client2->isActive()); | 112 | QVERIFY(client2->isActive()); | ||
113 | 113 | | |||
114 | client1->move(QPoint(300, 200)); | 114 | client1->move(QPoint(300, 200)); | ||
115 | client2->move(QPoint(500, 200)); | 115 | client2->move(QPoint(500, 200)); | ||
116 | 116 | | |||
117 | // Create several clients on the right screen. | 117 | // Create several clients on the right screen. | ||
118 | QScopedPointer<Surface> surface3(Test::createSurface()); | 118 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
119 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 119 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
120 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 120 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
121 | QVERIFY(client3); | 121 | QVERIFY(client3); | ||
122 | QVERIFY(client3->isActive()); | 122 | QVERIFY(client3->isActive()); | ||
123 | 123 | | |||
124 | QScopedPointer<Surface> surface4(Test::createSurface()); | 124 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
125 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 125 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
126 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 126 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
127 | QVERIFY(client4); | 127 | QVERIFY(client4); | ||
128 | QVERIFY(client4->isActive()); | 128 | QVERIFY(client4->isActive()); | ||
129 | 129 | | |||
130 | client3->move(QPoint(1380, 200)); | 130 | client3->move(QPoint(1380, 200)); | ||
131 | client4->move(QPoint(1580, 200)); | 131 | client4->move(QPoint(1580, 200)); | ||
132 | 132 | | |||
133 | // Switch to window to the left. | 133 | // Switch to window to the left. | ||
134 | workspace()->switchWindow(Workspace::DirectionWest); | 134 | workspace()->switchWindow(Workspace::DirectionWest); | ||
Show All 29 Lines | 161 | { | |||
164 | using namespace KWayland::Client; | 164 | using namespace KWayland::Client; | ||
165 | 165 | | |||
166 | // Prepare the test environment. | 166 | // Prepare the test environment. | ||
167 | stackScreensHorizontally(); | 167 | stackScreensHorizontally(); | ||
168 | 168 | | |||
169 | // Create several clients on the left screen. | 169 | // Create several clients on the left screen. | ||
170 | QScopedPointer<Surface> surface1(Test::createSurface()); | 170 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
171 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 171 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
172 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 172 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
173 | QVERIFY(client1); | 173 | QVERIFY(client1); | ||
174 | QVERIFY(client1->isActive()); | 174 | QVERIFY(client1->isActive()); | ||
175 | 175 | | |||
176 | QScopedPointer<Surface> surface2(Test::createSurface()); | 176 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
177 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 177 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
178 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 178 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
179 | QVERIFY(client2); | 179 | QVERIFY(client2); | ||
180 | QVERIFY(client2->isActive()); | 180 | QVERIFY(client2->isActive()); | ||
181 | 181 | | |||
182 | client1->move(QPoint(300, 200)); | 182 | client1->move(QPoint(300, 200)); | ||
183 | client2->move(QPoint(500, 200)); | 183 | client2->move(QPoint(500, 200)); | ||
184 | 184 | | |||
185 | // Create several clients on the right screen. | 185 | // Create several clients on the right screen. | ||
186 | QScopedPointer<Surface> surface3(Test::createSurface()); | 186 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
187 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 187 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
188 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 188 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
189 | QVERIFY(client3); | 189 | QVERIFY(client3); | ||
190 | QVERIFY(client3->isActive()); | 190 | QVERIFY(client3->isActive()); | ||
191 | 191 | | |||
192 | QScopedPointer<Surface> surface4(Test::createSurface()); | 192 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
193 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 193 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
194 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 194 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
195 | QVERIFY(client4); | 195 | QVERIFY(client4); | ||
196 | QVERIFY(client4->isActive()); | 196 | QVERIFY(client4->isActive()); | ||
197 | 197 | | |||
198 | client3->move(QPoint(1380, 200)); | 198 | client3->move(QPoint(1380, 200)); | ||
199 | client4->move(QPoint(1580, 200)); | 199 | client4->move(QPoint(1580, 200)); | ||
200 | 200 | | |||
201 | // Switch to window to the right. | 201 | // Switch to window to the right. | ||
202 | workspace()->switchWindow(Workspace::DirectionEast); | 202 | workspace()->switchWindow(Workspace::DirectionEast); | ||
Show All 29 Lines | 229 | { | |||
232 | using namespace KWayland::Client; | 232 | using namespace KWayland::Client; | ||
233 | 233 | | |||
234 | // Prepare the test environment. | 234 | // Prepare the test environment. | ||
235 | stackScreensVertically(); | 235 | stackScreensVertically(); | ||
236 | 236 | | |||
237 | // Create several clients on the top screen. | 237 | // Create several clients on the top screen. | ||
238 | QScopedPointer<Surface> surface1(Test::createSurface()); | 238 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
239 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 239 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
240 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 240 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
241 | QVERIFY(client1); | 241 | QVERIFY(client1); | ||
242 | QVERIFY(client1->isActive()); | 242 | QVERIFY(client1->isActive()); | ||
243 | 243 | | |||
244 | QScopedPointer<Surface> surface2(Test::createSurface()); | 244 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
245 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 245 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
246 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 246 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
247 | QVERIFY(client2); | 247 | QVERIFY(client2); | ||
248 | QVERIFY(client2->isActive()); | 248 | QVERIFY(client2->isActive()); | ||
249 | 249 | | |||
250 | client1->move(QPoint(200, 300)); | 250 | client1->move(QPoint(200, 300)); | ||
251 | client2->move(QPoint(200, 500)); | 251 | client2->move(QPoint(200, 500)); | ||
252 | 252 | | |||
253 | // Create several clients on the bottom screen. | 253 | // Create several clients on the bottom screen. | ||
254 | QScopedPointer<Surface> surface3(Test::createSurface()); | 254 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
255 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 255 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
256 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 256 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
257 | QVERIFY(client3); | 257 | QVERIFY(client3); | ||
258 | QVERIFY(client3->isActive()); | 258 | QVERIFY(client3->isActive()); | ||
259 | 259 | | |||
260 | QScopedPointer<Surface> surface4(Test::createSurface()); | 260 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
261 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 261 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
262 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 262 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
263 | QVERIFY(client4); | 263 | QVERIFY(client4); | ||
264 | QVERIFY(client4->isActive()); | 264 | QVERIFY(client4->isActive()); | ||
265 | 265 | | |||
266 | client3->move(QPoint(200, 1224)); | 266 | client3->move(QPoint(200, 1224)); | ||
267 | client4->move(QPoint(200, 1424)); | 267 | client4->move(QPoint(200, 1424)); | ||
268 | 268 | | |||
269 | // Switch to window above. | 269 | // Switch to window above. | ||
270 | workspace()->switchWindow(Workspace::DirectionNorth); | 270 | workspace()->switchWindow(Workspace::DirectionNorth); | ||
Show All 29 Lines | 297 | { | |||
300 | using namespace KWayland::Client; | 300 | using namespace KWayland::Client; | ||
301 | 301 | | |||
302 | // Prepare the test environment. | 302 | // Prepare the test environment. | ||
303 | stackScreensVertically(); | 303 | stackScreensVertically(); | ||
304 | 304 | | |||
305 | // Create several clients on the top screen. | 305 | // Create several clients on the top screen. | ||
306 | QScopedPointer<Surface> surface1(Test::createSurface()); | 306 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
307 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 307 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
308 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 308 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
309 | QVERIFY(client1); | 309 | QVERIFY(client1); | ||
310 | QVERIFY(client1->isActive()); | 310 | QVERIFY(client1->isActive()); | ||
311 | 311 | | |||
312 | QScopedPointer<Surface> surface2(Test::createSurface()); | 312 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
313 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 313 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
314 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 314 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
315 | QVERIFY(client2); | 315 | QVERIFY(client2); | ||
316 | QVERIFY(client2->isActive()); | 316 | QVERIFY(client2->isActive()); | ||
317 | 317 | | |||
318 | client1->move(QPoint(200, 300)); | 318 | client1->move(QPoint(200, 300)); | ||
319 | client2->move(QPoint(200, 500)); | 319 | client2->move(QPoint(200, 500)); | ||
320 | 320 | | |||
321 | // Create several clients on the bottom screen. | 321 | // Create several clients on the bottom screen. | ||
322 | QScopedPointer<Surface> surface3(Test::createSurface()); | 322 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
323 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 323 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
324 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 324 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
325 | QVERIFY(client3); | 325 | QVERIFY(client3); | ||
326 | QVERIFY(client3->isActive()); | 326 | QVERIFY(client3->isActive()); | ||
327 | 327 | | |||
328 | QScopedPointer<Surface> surface4(Test::createSurface()); | 328 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
329 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 329 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
330 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 330 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
331 | QVERIFY(client4); | 331 | QVERIFY(client4); | ||
332 | QVERIFY(client4->isActive()); | 332 | QVERIFY(client4->isActive()); | ||
333 | 333 | | |||
334 | client3->move(QPoint(200, 1224)); | 334 | client3->move(QPoint(200, 1224)); | ||
335 | client4->move(QPoint(200, 1424)); | 335 | client4->move(QPoint(200, 1424)); | ||
336 | 336 | | |||
337 | // Switch to window below. | 337 | // Switch to window below. | ||
338 | workspace()->switchWindow(Workspace::DirectionSouth); | 338 | workspace()->switchWindow(Workspace::DirectionSouth); | ||
Show All 30 Lines | 365 | { | |||
369 | using namespace KWayland::Client; | 369 | using namespace KWayland::Client; | ||
370 | 370 | | |||
371 | // Prepare the test environment. | 371 | // Prepare the test environment. | ||
372 | stackScreensHorizontally(); | 372 | stackScreensHorizontally(); | ||
373 | 373 | | |||
374 | // Create several maximized clients on the left screen. | 374 | // Create several maximized clients on the left screen. | ||
375 | QScopedPointer<Surface> surface1(Test::createSurface()); | 375 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
376 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 376 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
377 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 377 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
378 | QVERIFY(client1); | 378 | QVERIFY(client1); | ||
379 | QVERIFY(client1->isActive()); | 379 | QVERIFY(client1->isActive()); | ||
380 | QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested); | 380 | QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested); | ||
381 | QVERIFY(configureRequestedSpy1.wait()); | 381 | QVERIFY(configureRequestedSpy1.wait()); | ||
382 | workspace()->slotWindowMaximize(); | 382 | workspace()->slotWindowMaximize(); | ||
383 | QVERIFY(configureRequestedSpy1.wait()); | 383 | QVERIFY(configureRequestedSpy1.wait()); | ||
384 | QSignalSpy geometryChangedSpy1(client1, &ShellClient::geometryChanged); | 384 | QSignalSpy geometryChangedSpy1(client1, &XdgShellClient::geometryChanged); | ||
385 | QVERIFY(geometryChangedSpy1.isValid()); | 385 | QVERIFY(geometryChangedSpy1.isValid()); | ||
386 | shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>()); | 386 | shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>()); | ||
387 | Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); | 387 | Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); | ||
388 | QVERIFY(geometryChangedSpy1.wait()); | 388 | QVERIFY(geometryChangedSpy1.wait()); | ||
389 | 389 | | |||
390 | QScopedPointer<Surface> surface2(Test::createSurface()); | 390 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
391 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 391 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
392 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 392 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
393 | QVERIFY(client2); | 393 | QVERIFY(client2); | ||
394 | QVERIFY(client2->isActive()); | 394 | QVERIFY(client2->isActive()); | ||
395 | QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested); | 395 | QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested); | ||
396 | QVERIFY(configureRequestedSpy2.wait()); | 396 | QVERIFY(configureRequestedSpy2.wait()); | ||
397 | workspace()->slotWindowMaximize(); | 397 | workspace()->slotWindowMaximize(); | ||
398 | QVERIFY(configureRequestedSpy2.wait()); | 398 | QVERIFY(configureRequestedSpy2.wait()); | ||
399 | QSignalSpy geometryChangedSpy2(client2, &ShellClient::geometryChanged); | 399 | QSignalSpy geometryChangedSpy2(client2, &XdgShellClient::geometryChanged); | ||
400 | QVERIFY(geometryChangedSpy2.isValid()); | 400 | QVERIFY(geometryChangedSpy2.isValid()); | ||
401 | shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>()); | 401 | shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>()); | ||
402 | Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); | 402 | Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); | ||
403 | QVERIFY(geometryChangedSpy2.wait()); | 403 | QVERIFY(geometryChangedSpy2.wait()); | ||
404 | 404 | | |||
405 | const ToplevelList stackingOrder = workspace()->stackingOrder(); | 405 | const ToplevelList stackingOrder = workspace()->stackingOrder(); | ||
406 | QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); | 406 | QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); | ||
407 | QCOMPARE(client1->maximizeMode(), MaximizeFull); | 407 | QCOMPARE(client1->maximizeMode(), MaximizeFull); | ||
408 | QCOMPARE(client2->maximizeMode(), MaximizeFull); | 408 | QCOMPARE(client2->maximizeMode(), MaximizeFull); | ||
409 | 409 | | |||
410 | // Create several clients on the right screen. | 410 | // Create several clients on the right screen. | ||
411 | QScopedPointer<Surface> surface3(Test::createSurface()); | 411 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
412 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 412 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
413 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 413 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
414 | QVERIFY(client3); | 414 | QVERIFY(client3); | ||
415 | QVERIFY(client3->isActive()); | 415 | QVERIFY(client3->isActive()); | ||
416 | 416 | | |||
417 | QScopedPointer<Surface> surface4(Test::createSurface()); | 417 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
418 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 418 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
419 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 419 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
420 | QVERIFY(client4); | 420 | QVERIFY(client4); | ||
421 | QVERIFY(client4->isActive()); | 421 | QVERIFY(client4->isActive()); | ||
422 | 422 | | |||
423 | client3->move(QPoint(1380, 200)); | 423 | client3->move(QPoint(1380, 200)); | ||
424 | client4->move(QPoint(1580, 200)); | 424 | client4->move(QPoint(1580, 200)); | ||
425 | 425 | | |||
426 | // Switch to window to the left. | 426 | // Switch to window to the left. | ||
427 | workspace()->switchWindow(Workspace::DirectionWest); | 427 | workspace()->switchWindow(Workspace::DirectionWest); | ||
Show All 26 Lines | 450 | { | |||
454 | using namespace KWayland::Client; | 454 | using namespace KWayland::Client; | ||
455 | 455 | | |||
456 | // Prepare the test environment. | 456 | // Prepare the test environment. | ||
457 | stackScreensVertically(); | 457 | stackScreensVertically(); | ||
458 | 458 | | |||
459 | // Create several maximized clients on the top screen. | 459 | // Create several maximized clients on the top screen. | ||
460 | QScopedPointer<Surface> surface1(Test::createSurface()); | 460 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
461 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | 461 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
462 | ShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 462 | XdgShellClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
463 | QVERIFY(client1); | 463 | QVERIFY(client1); | ||
464 | QVERIFY(client1->isActive()); | 464 | QVERIFY(client1->isActive()); | ||
465 | QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested); | 465 | QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested); | ||
466 | QVERIFY(configureRequestedSpy1.wait()); | 466 | QVERIFY(configureRequestedSpy1.wait()); | ||
467 | workspace()->slotWindowFullScreen(); | 467 | workspace()->slotWindowFullScreen(); | ||
468 | QVERIFY(configureRequestedSpy1.wait()); | 468 | QVERIFY(configureRequestedSpy1.wait()); | ||
469 | QSignalSpy geometryChangedSpy1(client1, &ShellClient::geometryChanged); | 469 | QSignalSpy geometryChangedSpy1(client1, &XdgShellClient::geometryChanged); | ||
470 | QVERIFY(geometryChangedSpy1.isValid()); | 470 | QVERIFY(geometryChangedSpy1.isValid()); | ||
471 | shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>()); | 471 | shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>()); | ||
472 | Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); | 472 | Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); | ||
473 | QVERIFY(geometryChangedSpy1.wait()); | 473 | QVERIFY(geometryChangedSpy1.wait()); | ||
474 | 474 | | |||
475 | QScopedPointer<Surface> surface2(Test::createSurface()); | 475 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
476 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | 476 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
477 | ShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 477 | XdgShellClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
478 | QVERIFY(client2); | 478 | QVERIFY(client2); | ||
479 | QVERIFY(client2->isActive()); | 479 | QVERIFY(client2->isActive()); | ||
480 | QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested); | 480 | QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested); | ||
481 | QVERIFY(configureRequestedSpy2.wait()); | 481 | QVERIFY(configureRequestedSpy2.wait()); | ||
482 | workspace()->slotWindowFullScreen(); | 482 | workspace()->slotWindowFullScreen(); | ||
483 | QVERIFY(configureRequestedSpy2.wait()); | 483 | QVERIFY(configureRequestedSpy2.wait()); | ||
484 | QSignalSpy geometryChangedSpy2(client2, &ShellClient::geometryChanged); | 484 | QSignalSpy geometryChangedSpy2(client2, &XdgShellClient::geometryChanged); | ||
485 | QVERIFY(geometryChangedSpy2.isValid()); | 485 | QVERIFY(geometryChangedSpy2.isValid()); | ||
486 | shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>()); | 486 | shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>()); | ||
487 | Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); | 487 | Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); | ||
488 | QVERIFY(geometryChangedSpy2.wait()); | 488 | QVERIFY(geometryChangedSpy2.wait()); | ||
489 | 489 | | |||
490 | const ToplevelList stackingOrder = workspace()->stackingOrder(); | 490 | const ToplevelList stackingOrder = workspace()->stackingOrder(); | ||
491 | QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); | 491 | QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); | ||
492 | QVERIFY(client1->isFullScreen()); | 492 | QVERIFY(client1->isFullScreen()); | ||
493 | QVERIFY(client2->isFullScreen()); | 493 | QVERIFY(client2->isFullScreen()); | ||
494 | 494 | | |||
495 | // Create several clients on the bottom screen. | 495 | // Create several clients on the bottom screen. | ||
496 | QScopedPointer<Surface> surface3(Test::createSurface()); | 496 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
497 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | 497 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
498 | ShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 498 | XdgShellClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
499 | QVERIFY(client3); | 499 | QVERIFY(client3); | ||
500 | QVERIFY(client3->isActive()); | 500 | QVERIFY(client3->isActive()); | ||
501 | 501 | | |||
502 | QScopedPointer<Surface> surface4(Test::createSurface()); | 502 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
503 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | 503 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
504 | ShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 504 | XdgShellClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
505 | QVERIFY(client4); | 505 | QVERIFY(client4); | ||
506 | QVERIFY(client4->isActive()); | 506 | QVERIFY(client4->isActive()); | ||
507 | 507 | | |||
508 | client3->move(QPoint(200, 1224)); | 508 | client3->move(QPoint(200, 1224)); | ||
509 | client4->move(QPoint(200, 1424)); | 509 | client4->move(QPoint(200, 1424)); | ||
510 | 510 | | |||
511 | // Switch to window above. | 511 | // Switch to window above. | ||
512 | workspace()->switchWindow(Workspace::DirectionNorth); | 512 | workspace()->switchWindow(Workspace::DirectionNorth); | ||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |