Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/maximize_test.cpp
Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Line(s) | 216 | { | |||
---|---|---|---|---|---|
304 | QVERIFY(Test::waitForWindowDestroyed(client)); | 304 | QVERIFY(Test::waitForWindowDestroyed(client)); | ||
305 | } | 305 | } | ||
306 | 306 | | |||
307 | void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() | 307 | void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() | ||
308 | { | 308 | { | ||
309 | // test case verifies that borderless maximized windows doesn't cause | 309 | // test case verifies that borderless maximized windows doesn't cause | ||
310 | // clients to render client-side decorations instead (BUG 405385) | 310 | // clients to render client-side decorations instead (BUG 405385) | ||
311 | 311 | | |||
312 | XdgShellSurface::States states; | ||||
313 | | ||||
312 | // adjust config | 314 | // adjust config | ||
313 | auto group = kwinApp()->config()->group("Windows"); | 315 | auto group = kwinApp()->config()->group("Windows"); | ||
314 | group.writeEntry("BorderlessMaximizedWindows", true); | 316 | group.writeEntry("BorderlessMaximizedWindows", true); | ||
315 | group.sync(); | 317 | group.sync(); | ||
316 | Workspace::self()->slotReconfigure(); | 318 | Workspace::self()->slotReconfigure(); | ||
317 | QCOMPARE(options->borderlessMaximizedWindows(), true); | 319 | QCOMPARE(options->borderlessMaximizedWindows(), true); | ||
318 | 320 | | |||
319 | QScopedPointer<Surface> surface(Test::createSurface()); | 321 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
320 | QScopedPointer<XdgShellSurface> xdgShellSurface(Test::createXdgShellStableSurface(surface.data())); | 322 | QScopedPointer<XdgShellSurface> xdgShellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
321 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(xdgShellSurface.data())); | 323 | QScopedPointer<XdgDecoration> deco(Test::xdgDecorationManager()->getToplevelDecoration(xdgShellSurface.data())); | ||
322 | 324 | | |||
323 | QSignalSpy decorationConfiguredSpy(deco.data(), &XdgDecoration::modeChanged); | 325 | QSignalSpy decorationConfiguredSpy(deco.data(), &XdgDecoration::modeChanged); | ||
324 | QVERIFY(decorationConfiguredSpy.isValid()); | 326 | QVERIFY(decorationConfiguredSpy.isValid()); | ||
325 | 327 | | |||
326 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 328 | auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
329 | QVERIFY(client->isDecorated()); | ||||
330 | QVERIFY(!client->noBorder()); | ||||
327 | 331 | | |||
328 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | 332 | QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); | ||
329 | QVERIFY(frameGeometryChangedSpy.isValid()); | 333 | QVERIFY(frameGeometryChangedSpy.isValid()); | ||
330 | QSignalSpy sizeChangeRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::sizeChanged); | | |||
331 | QVERIFY(sizeChangeRequestedSpy.isValid()); | | |||
332 | QSignalSpy configureRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::configureRequested); | 334 | QSignalSpy configureRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::configureRequested); | ||
333 | QVERIFY(configureRequestedSpy.isValid()); | 335 | QVERIFY(configureRequestedSpy.isValid()); | ||
334 | 336 | | |||
335 | QVERIFY(client->isDecorated()); | 337 | // Wait for the compositor to send a configure event with the Activated state. | ||
336 | QVERIFY(!client->noBorder()); | 338 | QVERIFY(configureRequestedSpy.wait()); | ||
337 | configureRequestedSpy.wait(); | 339 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
340 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
341 | QVERIFY(states & XdgShellSurface::State::Activated); | ||||
342 | | ||||
338 | QCOMPARE(decorationConfiguredSpy.count(), 1); | 343 | QCOMPARE(decorationConfiguredSpy.count(), 1); | ||
339 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | 344 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | ||
340 | 345 | | |||
341 | // go to maximized | 346 | // go to maximized | ||
342 | xdgShellSurface->setMaximized(true); | 347 | xdgShellSurface->setMaximized(true); | ||
343 | QVERIFY(sizeChangeRequestedSpy.wait()); | 348 | QVERIFY(configureRequestedSpy.wait()); | ||
344 | QCOMPARE(sizeChangeRequestedSpy.count(), 1); | 349 | QCOMPARE(configureRequestedSpy.count(), 2); | ||
350 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
351 | QVERIFY(states & XdgShellSurface::State::Maximized); | ||||
345 | 352 | | |||
346 | for (const auto &it: configureRequestedSpy) { | 353 | xdgShellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
347 | xdgShellSurface->ackConfigure(it[2].toInt()); | 354 | Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::red); | ||
348 | } | | |||
349 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | | |||
350 | QVERIFY(frameGeometryChangedSpy.wait()); | 355 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
351 | 356 | | |||
352 | // no deco | 357 | // no deco | ||
353 | QVERIFY(!client->isDecorated()); | 358 | QVERIFY(!client->isDecorated()); | ||
354 | QVERIFY(client->noBorder()); | 359 | QVERIFY(client->noBorder()); | ||
355 | // but still server-side | 360 | // but still server-side | ||
356 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | 361 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | ||
357 | 362 | | |||
358 | // go back to normal | 363 | // go back to normal | ||
359 | xdgShellSurface->setMaximized(false); | 364 | xdgShellSurface->setMaximized(false); | ||
360 | QVERIFY(sizeChangeRequestedSpy.wait()); | 365 | QVERIFY(configureRequestedSpy.wait()); | ||
361 | QCOMPARE(sizeChangeRequestedSpy.count(), 2); | 366 | QCOMPARE(configureRequestedSpy.count(), 3); | ||
367 | states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>(); | ||||
368 | QVERIFY(!(states & XdgShellSurface::State::Maximized)); | ||||
362 | 369 | | |||
363 | for (const auto &it: configureRequestedSpy) { | 370 | xdgShellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>()); | ||
364 | xdgShellSurface->ackConfigure(it[2].toInt()); | 371 | Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::red); | ||
365 | } | | |||
366 | Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); | | |||
367 | QVERIFY(frameGeometryChangedSpy.wait()); | 372 | QVERIFY(frameGeometryChangedSpy.wait()); | ||
368 | 373 | | |||
369 | QVERIFY(client->isDecorated()); | 374 | QVERIFY(client->isDecorated()); | ||
370 | QVERIFY(!client->noBorder()); | 375 | QVERIFY(!client->noBorder()); | ||
371 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | 376 | QCOMPARE(deco->mode(), XdgDecoration::Mode::ServerSide); | ||
372 | } | 377 | } | ||
373 | 378 | | |||
374 | WAYLANDTEST_MAIN(TestMaximized) | 379 | WAYLANDTEST_MAIN(TestMaximized) | ||
375 | #include "maximize_test.moc" | 380 | #include "maximize_test.moc" |