Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/struts_test.cpp
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 133 | { | |||
---|---|---|---|---|---|
150 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 150 | QCOMPARE(workspace()->clientArea(FullScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
151 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 151 | QCOMPARE(workspace()->clientArea(ScreenArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
152 | // combined | 152 | // combined | ||
153 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | 153 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
154 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | 154 | QCOMPARE(workspace()->clientArea(FullArea, 0, 1), QRect(0, 0, 2560, 1024)); | ||
155 | 155 | | |||
156 | QFETCH(QVector<QRect>, windowGeometries); | 156 | QFETCH(QVector<QRect>, windowGeometries); | ||
157 | // create the panels | 157 | // create the panels | ||
158 | QSignalSpy windowCreatedSpy(waylandServer(), &WaylandServer::shellClientAdded); | | |||
159 | QVERIFY(windowCreatedSpy.isValid()); | | |||
160 | QHash<Surface*, ShellClient*> clients; | 158 | QHash<Surface*, ShellClient*> clients; | ||
161 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | 159 | for (auto it = windowGeometries.constBegin(), end = windowGeometries.constEnd(); it != end; it++) { | ||
162 | const QRect windowGeometry = *it; | 160 | const QRect windowGeometry = *it; | ||
163 | Surface *surface = Test::createSurface(m_compositor); | 161 | Surface *surface = Test::createSurface(m_compositor); | ||
164 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | 162 | ShellSurface *shellSurface = Test::createShellSurface(surface, surface); | ||
165 | Q_UNUSED(shellSurface) | 163 | Q_UNUSED(shellSurface) | ||
166 | PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface); | 164 | PlasmaShellSurface *plasmaSurface = m_plasmaShell->createSurface(surface, surface); | ||
167 | plasmaSurface->setPosition(windowGeometry.topLeft()); | 165 | plasmaSurface->setPosition(windowGeometry.topLeft()); | ||
168 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 166 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
169 | 167 | | |||
170 | // map the window | 168 | // map the window | ||
171 | Test::render(surface, windowGeometry.size(), Qt::red, QImage::Format_RGB32); | 169 | auto c = Test::renderAndWaitForShown(surface, windowGeometry.size(), Qt::red, QImage::Format_RGB32); | ||
172 | 170 | | |||
173 | QVERIFY(windowCreatedSpy.wait()); | | |||
174 | QCOMPARE(windowCreatedSpy.count(), 1); | | |||
175 | auto c = windowCreatedSpy.first().first().value<ShellClient*>(); | | |||
176 | QVERIFY(c); | 171 | QVERIFY(c); | ||
177 | QVERIFY(!c->isActive()); | 172 | QVERIFY(!c->isActive()); | ||
178 | QCOMPARE(c->geometry(), windowGeometry); | 173 | QCOMPARE(c->geometry(), windowGeometry); | ||
179 | QVERIFY(c->isDock()); | 174 | QVERIFY(c->isDock()); | ||
180 | QVERIFY(c->hasStrut()); | 175 | QVERIFY(c->hasStrut()); | ||
181 | windowCreatedSpy.clear(); | | |||
182 | clients.insert(surface, c); | 176 | clients.insert(surface, c); | ||
183 | } | 177 | } | ||
184 | 178 | | |||
185 | // some props are independent of struts - those first | 179 | // some props are independent of struts - those first | ||
186 | // screen 0 | 180 | // screen 0 | ||
187 | QCOMPARE(workspace()->clientArea(MovementArea, 0, 1), QRect(0, 0, 1280, 1024)); | 181 | QCOMPARE(workspace()->clientArea(MovementArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
188 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 0, 1), QRect(0, 0, 1280, 1024)); | 182 | QCOMPARE(workspace()->clientArea(MaximizeFullArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
189 | QCOMPARE(workspace()->clientArea(FullScreenArea, 0, 1), QRect(0, 0, 1280, 1024)); | 183 | QCOMPARE(workspace()->clientArea(FullScreenArea, 0, 1), QRect(0, 0, 1280, 1024)); | ||
Show All 29 Lines | 210 | { | |||
219 | const QRect windowGeometry(0, 1000, 1280, 24); | 213 | const QRect windowGeometry(0, 1000, 1280, 24); | ||
220 | QScopedPointer<Surface> surface(Test::createSurface()); | 214 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
221 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 215 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
222 | Q_UNUSED(shellSurface) | 216 | Q_UNUSED(shellSurface) | ||
223 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 217 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
224 | plasmaSurface->setPosition(windowGeometry.topLeft()); | 218 | plasmaSurface->setPosition(windowGeometry.topLeft()); | ||
225 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 219 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
226 | 220 | | |||
227 | QSignalSpy windowCreatedSpy(waylandServer(), &WaylandServer::shellClientAdded); | | |||
228 | QVERIFY(windowCreatedSpy.isValid()); | | |||
229 | | ||||
230 | // map the window | 221 | // map the window | ||
231 | Test::render(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); | 222 | auto c = Test::renderAndWaitForShown(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); | ||
232 | | ||||
233 | QVERIFY(windowCreatedSpy.wait()); | | |||
234 | QCOMPARE(windowCreatedSpy.count(), 1); | | |||
235 | auto c = windowCreatedSpy.first().first().value<ShellClient*>(); | | |||
236 | QVERIFY(c); | 223 | QVERIFY(c); | ||
237 | QVERIFY(!c->isActive()); | 224 | QVERIFY(!c->isActive()); | ||
238 | QCOMPARE(c->geometry(), windowGeometry); | 225 | QCOMPARE(c->geometry(), windowGeometry); | ||
239 | QVERIFY(c->isDock()); | 226 | QVERIFY(c->isDock()); | ||
240 | QVERIFY(c->hasStrut()); | 227 | QVERIFY(c->hasStrut()); | ||
241 | windowCreatedSpy.clear(); | | |||
242 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1000)); | 228 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1000)); | ||
243 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1000)); | 229 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1000)); | ||
244 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 230 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
245 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 231 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
246 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000)); | 232 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000)); | ||
247 | 233 | | |||
248 | QSignalSpy geometryChangedSpy(c, &ShellClient::geometryShapeChanged); | 234 | QSignalSpy geometryChangedSpy(c, &ShellClient::geometryShapeChanged); | ||
249 | QVERIFY(geometryChangedSpy.isValid()); | 235 | QVERIFY(geometryChangedSpy.isValid()); | ||
Show All 21 Lines | 247 | { | |||
271 | const QRect windowGeometry(0, 0, 1280, 60); | 257 | const QRect windowGeometry(0, 0, 1280, 60); | ||
272 | QScopedPointer<Surface> surface(Test::createSurface()); | 258 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
273 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 259 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
274 | Q_UNUSED(shellSurface) | 260 | Q_UNUSED(shellSurface) | ||
275 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | 261 | QScopedPointer<PlasmaShellSurface> plasmaSurface(m_plasmaShell->createSurface(surface.data())); | ||
276 | plasmaSurface->setPosition(windowGeometry.topLeft()); | 262 | plasmaSurface->setPosition(windowGeometry.topLeft()); | ||
277 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | 263 | plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); | ||
278 | 264 | | |||
279 | QSignalSpy windowCreatedSpy(waylandServer(), &WaylandServer::shellClientAdded); | | |||
280 | QVERIFY(windowCreatedSpy.isValid()); | | |||
281 | | ||||
282 | // map the first panel | 265 | // map the first panel | ||
283 | Test::render(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); | 266 | auto c = Test::renderAndWaitForShown(surface.data(), windowGeometry.size(), Qt::red, QImage::Format_RGB32); | ||
284 | | ||||
285 | QVERIFY(windowCreatedSpy.wait()); | | |||
286 | QCOMPARE(windowCreatedSpy.count(), 1); | | |||
287 | | ||||
288 | auto c = windowCreatedSpy.first().first().value<ShellClient*>(); | | |||
289 | QVERIFY(c); | 267 | QVERIFY(c); | ||
290 | QVERIFY(!c->isActive()); | 268 | QVERIFY(!c->isActive()); | ||
291 | QCOMPARE(c->geometry(), windowGeometry); | 269 | QCOMPARE(c->geometry(), windowGeometry); | ||
292 | QVERIFY(c->isDock()); | 270 | QVERIFY(c->isDock()); | ||
293 | QVERIFY(c->hasStrut()); | 271 | QVERIFY(c->hasStrut()); | ||
294 | windowCreatedSpy.clear(); | | |||
295 | 272 | | |||
296 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 964)); | 273 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 964)); | ||
297 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 964)); | 274 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 964)); | ||
298 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 275 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
299 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 276 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
300 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 964)); | 277 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 964)); | ||
301 | 278 | | |||
302 | // create another bottom panel | 279 | // create another bottom panel | ||
303 | const QRect windowGeometry2(0, 874, 1280, 150); | 280 | const QRect windowGeometry2(0, 874, 1280, 150); | ||
304 | QScopedPointer<Surface> surface2(Test::createSurface()); | 281 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
305 | QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data())); | 282 | QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data())); | ||
306 | Q_UNUSED(shellSurface2) | 283 | Q_UNUSED(shellSurface2) | ||
307 | QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); | 284 | QScopedPointer<PlasmaShellSurface> plasmaSurface2(m_plasmaShell->createSurface(surface2.data())); | ||
308 | plasmaSurface2->setPosition(windowGeometry2.topLeft()); | 285 | plasmaSurface2->setPosition(windowGeometry2.topLeft()); | ||
309 | plasmaSurface2->setRole(PlasmaShellSurface::Role::Panel); | 286 | plasmaSurface2->setRole(PlasmaShellSurface::Role::Panel); | ||
310 | 287 | | |||
311 | Test::render(surface2.data(), windowGeometry2.size(), Qt::blue, QImage::Format_RGB32); | 288 | auto c1 = Test::renderAndWaitForShown(surface2.data(), windowGeometry2.size(), Qt::blue, QImage::Format_RGB32); | ||
312 | | ||||
313 | QVERIFY(windowCreatedSpy.wait()); | | |||
314 | QCOMPARE(windowCreatedSpy.count(), 1); | | |||
315 | 289 | | |||
316 | auto c1 = windowCreatedSpy.first().first().value<ShellClient*>(); | | |||
317 | QVERIFY(c1); | 290 | QVERIFY(c1); | ||
318 | QVERIFY(!c1->isActive()); | 291 | QVERIFY(!c1->isActive()); | ||
319 | QCOMPARE(c1->geometry(), windowGeometry2); | 292 | QCOMPARE(c1->geometry(), windowGeometry2); | ||
320 | QVERIFY(c1->isDock()); | 293 | QVERIFY(c1->isDock()); | ||
321 | QVERIFY(c1->hasStrut()); | 294 | QVERIFY(c1->hasStrut()); | ||
322 | windowCreatedSpy.clear(); | | |||
323 | 295 | | |||
324 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 814)); | 296 | QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 60, 1280, 814)); | ||
325 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 814)); | 297 | QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 60, 1280, 814)); | ||
326 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 298 | QCOMPARE(workspace()->clientArea(PlacementArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
327 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | 299 | QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); | ||
328 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 814)); | 300 | QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 60, 2560, 814)); | ||
329 | } | 301 | } | ||
330 | 302 | | |||
▲ Show 20 Lines • Show All 399 Lines • Show Last 20 Lines |