Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/quick_tiling_test.cpp
Show All 22 Lines | |||||
23 | #include "cursor.h" | 23 | #include "cursor.h" | ||
24 | #include "screens.h" | 24 | #include "screens.h" | ||
25 | #include "wayland_server.h" | 25 | #include "wayland_server.h" | ||
26 | #include "workspace.h" | 26 | #include "workspace.h" | ||
27 | #include "shell_client.h" | 27 | #include "shell_client.h" | ||
28 | 28 | | |||
29 | #include <KWayland/Client/connection_thread.h> | 29 | #include <KWayland/Client/connection_thread.h> | ||
30 | #include <KWayland/Client/compositor.h> | 30 | #include <KWayland/Client/compositor.h> | ||
31 | #include <KWayland/Client/event_queue.h> | | |||
32 | #include <KWayland/Client/registry.h> | | |||
33 | #include <KWayland/Client/shell.h> | 31 | #include <KWayland/Client/shell.h> | ||
34 | #include <KWayland/Client/shm_pool.h> | | |||
35 | #include <KWayland/Client/surface.h> | 32 | #include <KWayland/Client/surface.h> | ||
36 | 33 | | |||
37 | #include <linux/input.h> | 34 | #include <linux/input.h> | ||
38 | 35 | | |||
39 | Q_DECLARE_METATYPE(KWin::AbstractClient::QuickTileMode) | 36 | Q_DECLARE_METATYPE(KWin::AbstractClient::QuickTileMode) | ||
40 | Q_DECLARE_METATYPE(KWin::MaximizeMode) | 37 | Q_DECLARE_METATYPE(KWin::MaximizeMode) | ||
41 | 38 | | |||
42 | namespace KWin | 39 | namespace KWin | ||
Show All 15 Lines | 47 | private Q_SLOTS: | |||
58 | void testQuickTilingKeyboardMove_data(); | 55 | void testQuickTilingKeyboardMove_data(); | ||
59 | void testQuickTilingKeyboardMove(); | 56 | void testQuickTilingKeyboardMove(); | ||
60 | void testQuickTilingPointerMove_data(); | 57 | void testQuickTilingPointerMove_data(); | ||
61 | void testQuickTilingPointerMove(); | 58 | void testQuickTilingPointerMove(); | ||
62 | 59 | | |||
63 | private: | 60 | private: | ||
64 | KWayland::Client::ConnectionThread *m_connection = nullptr; | 61 | KWayland::Client::ConnectionThread *m_connection = nullptr; | ||
65 | KWayland::Client::Compositor *m_compositor = nullptr; | 62 | KWayland::Client::Compositor *m_compositor = nullptr; | ||
66 | KWayland::Client::ShmPool *m_shm = nullptr; | | |||
67 | KWayland::Client::Shell *m_shell = nullptr; | 63 | KWayland::Client::Shell *m_shell = nullptr; | ||
68 | KWayland::Client::EventQueue *m_queue = nullptr; | | |||
69 | QThread *m_thread = nullptr; | | |||
70 | }; | 64 | }; | ||
71 | 65 | | |||
72 | void QuickTilingTest::initTestCase() | 66 | void QuickTilingTest::initTestCase() | ||
73 | { | 67 | { | ||
74 | qRegisterMetaType<KWin::ShellClient*>(); | 68 | qRegisterMetaType<KWin::ShellClient*>(); | ||
75 | qRegisterMetaType<KWin::AbstractClient*>(); | 69 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
76 | qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode"); | 70 | qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode"); | ||
77 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 71 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
Show All 14 Lines | |||||
92 | QVERIFY(workspaceCreatedSpy.wait()); | 86 | QVERIFY(workspaceCreatedSpy.wait()); | ||
93 | QCOMPARE(screens()->count(), 2); | 87 | QCOMPARE(screens()->count(), 2); | ||
94 | QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024)); | 88 | QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024)); | ||
95 | QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024)); | 89 | QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024)); | ||
96 | } | 90 | } | ||
97 | 91 | | |||
98 | void QuickTilingTest::init() | 92 | void QuickTilingTest::init() | ||
99 | { | 93 | { | ||
100 | using namespace KWayland::Client; | 94 | QVERIFY(Test::setupWaylandConnection(s_socketName)); | ||
101 | // setup connection | 95 | m_connection = Test::waylandConnection(); | ||
102 | m_connection = new ConnectionThread; | 96 | m_compositor = Test::waylandCompositor(); | ||
103 | QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected); | 97 | m_shell = Test::waylandShell(); | ||
104 | QVERIFY(connectedSpy.isValid()); | | |||
105 | m_connection->setSocketName(s_socketName); | | |||
106 | | ||||
107 | m_thread = new QThread(this); | | |||
108 | m_connection->moveToThread(m_thread); | | |||
109 | m_thread->start(); | | |||
110 | | ||||
111 | m_connection->initConnection(); | | |||
112 | QVERIFY(connectedSpy.wait()); | | |||
113 | | ||||
114 | m_queue = new EventQueue(this); | | |||
115 | QVERIFY(!m_queue->isValid()); | | |||
116 | m_queue->setup(m_connection); | | |||
117 | QVERIFY(m_queue->isValid()); | | |||
118 | | ||||
119 | Registry registry; | | |||
120 | registry.setEventQueue(m_queue); | | |||
121 | QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced); | | |||
122 | QSignalSpy shmSpy(®istry, &Registry::shmAnnounced); | | |||
123 | QSignalSpy shellSpy(®istry, &Registry::shellAnnounced); | | |||
124 | QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced); | | |||
125 | QVERIFY(allAnnounced.isValid()); | | |||
126 | QVERIFY(shmSpy.isValid()); | | |||
127 | QVERIFY(shellSpy.isValid()); | | |||
128 | QVERIFY(compositorSpy.isValid()); | | |||
129 | registry.create(m_connection->display()); | | |||
130 | QVERIFY(registry.isValid()); | | |||
131 | registry.setup(); | | |||
132 | QVERIFY(allAnnounced.wait()); | | |||
133 | QVERIFY(!compositorSpy.isEmpty()); | | |||
134 | QVERIFY(!shmSpy.isEmpty()); | | |||
135 | QVERIFY(!shellSpy.isEmpty()); | | |||
136 | | ||||
137 | m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this); | | |||
138 | QVERIFY(m_compositor->isValid()); | | |||
139 | m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this); | | |||
140 | QVERIFY(m_shm->isValid()); | | |||
141 | m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this); | | |||
142 | QVERIFY(m_shell->isValid()); | | |||
143 | 98 | | |||
144 | screens()->setCurrent(0); | 99 | screens()->setCurrent(0); | ||
145 | } | 100 | } | ||
146 | 101 | | |||
147 | void QuickTilingTest::cleanup() | 102 | void QuickTilingTest::cleanup() | ||
148 | { | 103 | { | ||
149 | delete m_compositor; | 104 | Test::destroyWaylandConnection(); | ||
150 | m_compositor = nullptr; | | |||
151 | delete m_shm; | | |||
152 | m_shm = nullptr; | | |||
153 | delete m_shell; | | |||
154 | m_shell = nullptr; | | |||
155 | delete m_queue; | | |||
156 | m_queue = nullptr; | | |||
157 | if (m_thread) { | | |||
158 | m_connection->deleteLater(); | | |||
159 | m_thread->quit(); | | |||
160 | m_thread->wait(); | | |||
161 | delete m_thread; | | |||
162 | m_thread = nullptr; | | |||
163 | m_connection = nullptr; | | |||
164 | } | | |||
165 | } | 105 | } | ||
166 | 106 | | |||
167 | void QuickTilingTest::testQuickTiling_data() | 107 | void QuickTilingTest::testQuickTiling_data() | ||
168 | { | 108 | { | ||
169 | QTest::addColumn<AbstractClient::QuickTileMode>("mode"); | 109 | QTest::addColumn<AbstractClient::QuickTileMode>("mode"); | ||
170 | QTest::addColumn<QRect>("expectedGeometry"); | 110 | QTest::addColumn<QRect>("expectedGeometry"); | ||
171 | QTest::addColumn<QRect>("secondScreen"); | 111 | QTest::addColumn<QRect>("secondScreen"); | ||
172 | 112 | | |||
Show All 16 Lines | |||||
189 | 129 | | |||
190 | void QuickTilingTest::testQuickTiling() | 130 | void QuickTilingTest::testQuickTiling() | ||
191 | { | 131 | { | ||
192 | using namespace KWayland::Client; | 132 | using namespace KWayland::Client; | ||
193 | 133 | | |||
194 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 134 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
195 | QVERIFY(clientAddedSpy.isValid()); | 135 | QVERIFY(clientAddedSpy.isValid()); | ||
196 | 136 | | |||
197 | QScopedPointer<Surface> surface(m_compositor->createSurface()); | 137 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
198 | QVERIFY(!surface.isNull()); | 138 | QVERIFY(!surface.isNull()); | ||
199 | 139 | | |||
200 | QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data())); | 140 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
201 | QVERIFY(!shellSurface.isNull()); | 141 | QVERIFY(!shellSurface.isNull()); | ||
202 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | 142 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | ||
203 | QVERIFY(sizeChangeSpy.isValid()); | 143 | QVERIFY(sizeChangeSpy.isValid()); | ||
204 | // let's render | 144 | // let's render | ||
205 | QImage img(QSize(100, 50), QImage::Format_ARGB32); | 145 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
206 | img.fill(Qt::blue); | | |||
207 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
208 | surface->damage(QRect(0, 0, 100, 50)); | | |||
209 | surface->commit(Surface::CommitFlag::None); | | |||
210 | 146 | | |||
211 | m_connection->flush(); | 147 | m_connection->flush(); | ||
212 | QVERIFY(clientAddedSpy.wait()); | 148 | QVERIFY(clientAddedSpy.wait()); | ||
213 | AbstractClient *c = workspace()->activeClient(); | 149 | AbstractClient *c = workspace()->activeClient(); | ||
214 | QVERIFY(c); | 150 | QVERIFY(c); | ||
215 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | 151 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | ||
216 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | 152 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | ||
217 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | 153 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | ||
Show All 12 Lines | |||||
230 | QCOMPARE(c->quickTileMode(), mode); | 166 | QCOMPARE(c->quickTileMode(), mode); | ||
231 | 167 | | |||
232 | // but we got requested a new geometry | 168 | // but we got requested a new geometry | ||
233 | QVERIFY(sizeChangeSpy.wait()); | 169 | QVERIFY(sizeChangeSpy.wait()); | ||
234 | QCOMPARE(sizeChangeSpy.count(), 1); | 170 | QCOMPARE(sizeChangeSpy.count(), 1); | ||
235 | QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size()); | 171 | QCOMPARE(sizeChangeSpy.first().first().toSize(), expectedGeometry.size()); | ||
236 | 172 | | |||
237 | // attach a new image | 173 | // attach a new image | ||
238 | img = QImage(expectedGeometry.size(), QImage::Format_ARGB32); | 174 | Test::render(surface.data(), expectedGeometry.size(), Qt::red); | ||
239 | img.fill(Qt::red); | | |||
240 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
241 | surface->damage(QRect(QPoint(0, 0), expectedGeometry.size())); | | |||
242 | surface->commit(Surface::CommitFlag::None); | | |||
243 | m_connection->flush(); | 175 | m_connection->flush(); | ||
244 | 176 | | |||
245 | QVERIFY(geometryChangedSpy.wait()); | 177 | QVERIFY(geometryChangedSpy.wait()); | ||
246 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | 178 | QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); | ||
247 | QCOMPARE(geometryChangedSpy.count(), 1); | 179 | QCOMPARE(geometryChangedSpy.count(), 1); | ||
248 | QCOMPARE(c->geometry(), expectedGeometry); | 180 | QCOMPARE(c->geometry(), expectedGeometry); | ||
249 | 181 | | |||
250 | // send window to other screen | 182 | // send window to other screen | ||
Show All 20 Lines | |||||
271 | 203 | | |||
272 | void QuickTilingTest::testQuickMaximizing() | 204 | void QuickTilingTest::testQuickMaximizing() | ||
273 | { | 205 | { | ||
274 | using namespace KWayland::Client; | 206 | using namespace KWayland::Client; | ||
275 | 207 | | |||
276 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 208 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
277 | QVERIFY(clientAddedSpy.isValid()); | 209 | QVERIFY(clientAddedSpy.isValid()); | ||
278 | 210 | | |||
279 | QScopedPointer<Surface> surface(m_compositor->createSurface()); | 211 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
280 | QVERIFY(!surface.isNull()); | 212 | QVERIFY(!surface.isNull()); | ||
281 | 213 | | |||
282 | QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data())); | 214 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
283 | QVERIFY(!shellSurface.isNull()); | 215 | QVERIFY(!shellSurface.isNull()); | ||
284 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | 216 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | ||
285 | QVERIFY(sizeChangeSpy.isValid()); | 217 | QVERIFY(sizeChangeSpy.isValid()); | ||
286 | // let's render | 218 | // let's render | ||
287 | QImage img(QSize(100, 50), QImage::Format_ARGB32); | 219 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
288 | img.fill(Qt::blue); | | |||
289 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
290 | surface->damage(QRect(0, 0, 100, 50)); | | |||
291 | surface->commit(Surface::CommitFlag::None); | | |||
292 | 220 | | |||
293 | m_connection->flush(); | 221 | m_connection->flush(); | ||
294 | QVERIFY(clientAddedSpy.wait()); | 222 | QVERIFY(clientAddedSpy.wait()); | ||
295 | AbstractClient *c = workspace()->activeClient(); | 223 | AbstractClient *c = workspace()->activeClient(); | ||
296 | QVERIFY(c); | 224 | QVERIFY(c); | ||
297 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | 225 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | ||
298 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | 226 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | ||
299 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | 227 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | ||
Show All 24 Lines | |||||
324 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 252 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
325 | 253 | | |||
326 | // but we got requested a new geometry | 254 | // but we got requested a new geometry | ||
327 | QVERIFY(sizeChangeSpy.wait()); | 255 | QVERIFY(sizeChangeSpy.wait()); | ||
328 | QCOMPARE(sizeChangeSpy.count(), 1); | 256 | QCOMPARE(sizeChangeSpy.count(), 1); | ||
329 | QCOMPARE(sizeChangeSpy.first().first().toSize(), QSize(1280, 1024)); | 257 | QCOMPARE(sizeChangeSpy.first().first().toSize(), QSize(1280, 1024)); | ||
330 | 258 | | |||
331 | // attach a new image | 259 | // attach a new image | ||
332 | img = QImage(QSize(1280, 1024), QImage::Format_ARGB32); | 260 | Test::render(surface.data(), QSize(1280, 1024), Qt::red); | ||
333 | img.fill(Qt::red); | | |||
334 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
335 | surface->damage(QRect(0, 0, 1280, 1024)); | | |||
336 | surface->commit(Surface::CommitFlag::None); | | |||
337 | m_connection->flush(); | 261 | m_connection->flush(); | ||
338 | 262 | | |||
339 | QVERIFY(geometryChangedSpy.wait()); | 263 | QVERIFY(geometryChangedSpy.wait()); | ||
340 | QCOMPARE(geometryChangedSpy.count(), 2); | 264 | QCOMPARE(geometryChangedSpy.count(), 2); | ||
341 | QCOMPARE(c->geometry(), QRect(0, 0, 1280, 1024)); | 265 | QCOMPARE(c->geometry(), QRect(0, 0, 1280, 1024)); | ||
342 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 266 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
343 | 267 | | |||
344 | // go back to quick tile none | 268 | // go back to quick tile none | ||
Show All 13 Lines | |||||
358 | QCOMPARE(c->geometry(), QRect(0, 0, 1280, 1024)); | 282 | QCOMPARE(c->geometry(), QRect(0, 0, 1280, 1024)); | ||
359 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 283 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
360 | // we got requested a new geometry | 284 | // we got requested a new geometry | ||
361 | QVERIFY(sizeChangeSpy.wait()); | 285 | QVERIFY(sizeChangeSpy.wait()); | ||
362 | QCOMPARE(sizeChangeSpy.count(), 2); | 286 | QCOMPARE(sizeChangeSpy.count(), 2); | ||
363 | QCOMPARE(sizeChangeSpy.last().first().toSize(), QSize(100, 50)); | 287 | QCOMPARE(sizeChangeSpy.last().first().toSize(), QSize(100, 50)); | ||
364 | 288 | | |||
365 | // render again | 289 | // render again | ||
366 | img = QImage(QSize(100, 50), QImage::Format_ARGB32); | 290 | Test::render(surface.data(), QSize(100, 50), Qt::yellow); | ||
367 | img.fill(Qt::yellow); | | |||
368 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
369 | surface->damage(QRect(0, 0, 100, 50)); | | |||
370 | surface->commit(Surface::CommitFlag::None); | | |||
371 | m_connection->flush(); | 291 | m_connection->flush(); | ||
372 | 292 | | |||
373 | QVERIFY(geometryChangedSpy.wait()); | 293 | QVERIFY(geometryChangedSpy.wait()); | ||
374 | QCOMPARE(geometryChangedSpy.count(), 4); | 294 | QCOMPARE(geometryChangedSpy.count(), 4); | ||
375 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | 295 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | ||
376 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | 296 | QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); | ||
377 | } | 297 | } | ||
378 | 298 | | |||
Show All 12 Lines | |||||
391 | 311 | | |||
392 | void QuickTilingTest::testQuickTilingKeyboardMove() | 312 | void QuickTilingTest::testQuickTilingKeyboardMove() | ||
393 | { | 313 | { | ||
394 | using namespace KWayland::Client; | 314 | using namespace KWayland::Client; | ||
395 | 315 | | |||
396 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 316 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
397 | QVERIFY(clientAddedSpy.isValid()); | 317 | QVERIFY(clientAddedSpy.isValid()); | ||
398 | 318 | | |||
399 | QScopedPointer<Surface> surface(m_compositor->createSurface()); | 319 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
400 | QVERIFY(!surface.isNull()); | 320 | QVERIFY(!surface.isNull()); | ||
401 | 321 | | |||
402 | QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data())); | 322 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
403 | QVERIFY(!shellSurface.isNull()); | 323 | QVERIFY(!shellSurface.isNull()); | ||
404 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | 324 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | ||
405 | QVERIFY(sizeChangeSpy.isValid()); | 325 | QVERIFY(sizeChangeSpy.isValid()); | ||
406 | // let's render | 326 | // let's render | ||
407 | QImage img(QSize(100, 50), QImage::Format_ARGB32); | 327 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
408 | img.fill(Qt::blue); | | |||
409 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
410 | surface->damage(QRect(0, 0, 100, 50)); | | |||
411 | surface->commit(Surface::CommitFlag::None); | | |||
412 | 328 | | |||
413 | m_connection->flush(); | 329 | m_connection->flush(); | ||
414 | QVERIFY(clientAddedSpy.wait()); | 330 | QVERIFY(clientAddedSpy.wait()); | ||
415 | AbstractClient *c = workspace()->activeClient(); | 331 | AbstractClient *c = workspace()->activeClient(); | ||
416 | QVERIFY(c); | 332 | QVERIFY(c); | ||
417 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | 333 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | ||
418 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | 334 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | ||
419 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | 335 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
472 | 388 | | |||
473 | void QuickTilingTest::testQuickTilingPointerMove() | 389 | void QuickTilingTest::testQuickTilingPointerMove() | ||
474 | { | 390 | { | ||
475 | using namespace KWayland::Client; | 391 | using namespace KWayland::Client; | ||
476 | 392 | | |||
477 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 393 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
478 | QVERIFY(clientAddedSpy.isValid()); | 394 | QVERIFY(clientAddedSpy.isValid()); | ||
479 | 395 | | |||
480 | QScopedPointer<Surface> surface(m_compositor->createSurface()); | 396 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
481 | QVERIFY(!surface.isNull()); | 397 | QVERIFY(!surface.isNull()); | ||
482 | 398 | | |||
483 | QScopedPointer<ShellSurface> shellSurface(m_shell->createSurface(surface.data())); | 399 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
484 | QVERIFY(!shellSurface.isNull()); | 400 | QVERIFY(!shellSurface.isNull()); | ||
485 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | 401 | QSignalSpy sizeChangeSpy(shellSurface.data(), &ShellSurface::sizeChanged); | ||
486 | QVERIFY(sizeChangeSpy.isValid()); | 402 | QVERIFY(sizeChangeSpy.isValid()); | ||
487 | // let's render | 403 | // let's render | ||
488 | QImage img(QSize(100, 50), QImage::Format_ARGB32); | 404 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
489 | img.fill(Qt::blue); | | |||
490 | surface->attachBuffer(m_shm->createBuffer(img)); | | |||
491 | surface->damage(QRect(0, 0, 100, 50)); | | |||
492 | surface->commit(Surface::CommitFlag::None); | | |||
493 | 405 | | |||
494 | m_connection->flush(); | 406 | m_connection->flush(); | ||
495 | QVERIFY(clientAddedSpy.wait()); | 407 | QVERIFY(clientAddedSpy.wait()); | ||
496 | AbstractClient *c = workspace()->activeClient(); | 408 | AbstractClient *c = workspace()->activeClient(); | ||
497 | QVERIFY(c); | 409 | QVERIFY(c); | ||
498 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | 410 | QCOMPARE(clientAddedSpy.first().first().value<ShellClient*>(), c); | ||
499 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | 411 | QCOMPARE(c->geometry(), QRect(0, 0, 100, 50)); | ||
500 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | 412 | QCOMPARE(c->quickTileMode(), AbstractClient::QuickTileNone); | ||
Show All 25 Lines |