Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/shell_client_test.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 60 | private Q_SLOTS: | |||
---|---|---|---|---|---|
96 | void testNoDecorationModeRequested_data(); | 96 | void testNoDecorationModeRequested_data(); | ||
97 | void testNoDecorationModeRequested(); | 97 | void testNoDecorationModeRequested(); | ||
98 | void testSendClientWithTransientToDesktop_data(); | 98 | void testSendClientWithTransientToDesktop_data(); | ||
99 | void testSendClientWithTransientToDesktop(); | 99 | void testSendClientWithTransientToDesktop(); | ||
100 | void testMinimizeWindowWithTransients_data(); | 100 | void testMinimizeWindowWithTransients_data(); | ||
101 | void testMinimizeWindowWithTransients(); | 101 | void testMinimizeWindowWithTransients(); | ||
102 | void testXdgDecoration_data(); | 102 | void testXdgDecoration_data(); | ||
103 | void testXdgDecoration(); | 103 | void testXdgDecoration(); | ||
104 | void testXdgNeverCommitted(); | ||||
105 | void testXdgInitialState(); | ||||
106 | void testXdgInitiallyMaximised(); | ||||
107 | void testXdgInitiallyFullscreen(); | ||||
104 | }; | 108 | }; | ||
105 | 109 | | |||
106 | void TestShellClient::initTestCase() | 110 | void TestShellClient::initTestCase() | ||
107 | { | 111 | { | ||
108 | qRegisterMetaType<KWin::Deleted*>(); | 112 | qRegisterMetaType<KWin::Deleted*>(); | ||
109 | qRegisterMetaType<KWin::ShellClient*>(); | 113 | qRegisterMetaType<KWin::ShellClient*>(); | ||
110 | qRegisterMetaType<KWin::AbstractClient*>(); | 114 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
111 | qRegisterMetaType<KWayland::Client::Output*>(); | 115 | qRegisterMetaType<KWayland::Client::Output*>(); | ||
▲ Show 20 Lines • Show All 469 Lines • ▼ Show 20 Line(s) | 581 | { | |||
581 | QVERIFY(!shellSurface.isNull()); | 585 | QVERIFY(!shellSurface.isNull()); | ||
582 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | 586 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||
583 | QVERIFY(configureRequestedSpy.isValid()); | 587 | QVERIFY(configureRequestedSpy.isValid()); | ||
584 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 588 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
585 | QVERIFY(c); | 589 | QVERIFY(c); | ||
586 | QVERIFY(c->isActive()); | 590 | QVERIFY(c->isActive()); | ||
587 | QVERIFY(!c->isFullScreen()); | 591 | QVERIFY(!c->isFullScreen()); | ||
588 | 592 | | |||
589 | // two, one for initial sync, second as it becomes active | 593 | QTRY_COMPARE(configureRequestedSpy.count(), 1); | ||
590 | QTRY_COMPARE(configureRequestedSpy.count(), 2); | | |||
591 | 594 | | |||
592 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | 595 | QSignalSpy fullscreenChangedSpy(c, &AbstractClient::fullScreenChanged); | ||
593 | QVERIFY(fullscreenChangedSpy.isValid()); | 596 | QVERIFY(fullscreenChangedSpy.isValid()); | ||
594 | c->setFullScreen(true); | 597 | c->setFullScreen(true); | ||
595 | QCOMPARE(c->isFullScreen(), true); | 598 | QCOMPARE(c->isFullScreen(), true); | ||
596 | configureRequestedSpy.clear(); | 599 | configureRequestedSpy.clear(); | ||
597 | QVERIFY(configureRequestedSpy.wait()); | 600 | QVERIFY(configureRequestedSpy.wait()); | ||
598 | QCOMPARE(configureRequestedSpy.count(), 1); | 601 | QCOMPARE(configureRequestedSpy.count(), 1); | ||
▲ Show 20 Lines • Show All 697 Lines • ▼ Show 20 Line(s) | 1278 | { | |||
1296 | 1299 | | |||
1297 | shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); | 1300 | shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); | ||
1298 | 1301 | | |||
1299 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 1302 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
1300 | QCOMPARE(c->userCanSetNoBorder(), expectedMode == XdgDecoration::Mode::ServerSide); | 1303 | QCOMPARE(c->userCanSetNoBorder(), expectedMode == XdgDecoration::Mode::ServerSide); | ||
1301 | QCOMPARE(c->isDecorated(), expectedMode == XdgDecoration::Mode::ServerSide); | 1304 | QCOMPARE(c->isDecorated(), expectedMode == XdgDecoration::Mode::ServerSide); | ||
1302 | } | 1305 | } | ||
1303 | 1306 | | |||
1307 | void TestShellClient::testXdgNeverCommitted() | ||||
1308 | { | ||||
1309 | //check we don't crash if we create a shell object but delete the ShellClient before committing it | ||||
1310 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
1311 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); | ||||
1312 | } | ||||
1313 | | ||||
1314 | void TestShellClient::testXdgInitialState() | ||||
1315 | { | ||||
1316 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
1317 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); | ||||
1318 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||||
1319 | surface->commit(Surface::CommitFlag::None); | ||||
1320 | | ||||
1321 | configureRequestedSpy.wait(); | ||||
1322 | | ||||
1323 | QCOMPARE(configureRequestedSpy.count(), 1); | ||||
1324 | | ||||
1325 | const auto size = configureRequestedSpy.first()[0].value<QSize>(); | ||||
1326 | | ||||
1327 | QCOMPARE(size, QSize(0, 0)); //client should chose it's preferred size | ||||
1328 | | ||||
1329 | shellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); | ||||
1330 | | ||||
1331 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(200,100), Qt::blue); | ||||
1332 | QCOMPARE(c->size(), QSize(200, 100)); | ||||
1333 | } | ||||
1334 | | ||||
1335 | void TestShellClient::testXdgInitiallyMaximised() | ||||
1336 | { | ||||
1337 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
1338 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); | ||||
1339 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||||
1340 | | ||||
1341 | shellSurface->setMaximized(true); | ||||
1342 | surface->commit(Surface::CommitFlag::None); | ||||
1343 | | ||||
1344 | configureRequestedSpy.wait(); | ||||
1345 | | ||||
1346 | QCOMPARE(configureRequestedSpy.count(), 1); | ||||
1347 | | ||||
1348 | const auto size = configureRequestedSpy.first()[0].value<QSize>(); | ||||
1349 | const auto state = configureRequestedSpy.first()[1].value<KWayland::Client::XdgShellSurface::States>(); | ||||
1350 | | ||||
1351 | QCOMPARE(size, QSize(1280, 1024)); | ||||
1352 | QVERIFY(state & KWayland::Client::XdgShellSurface::State::Maximized); | ||||
1353 | | ||||
1354 | shellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); | ||||
1355 | | ||||
1356 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | ||||
1357 | QCOMPARE(c->maximizeMode(), MaximizeFull); | ||||
1358 | QCOMPARE(c->size(), QSize(1280, 1024)); | ||||
1359 | } | ||||
1360 | | ||||
1361 | void TestShellClient::testXdgInitiallyFullscreen() | ||||
1362 | { | ||||
1363 | QScopedPointer<Surface> surface(Test::createSurface()); | ||||
1364 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); | ||||
1365 | QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); | ||||
1366 | | ||||
1367 | shellSurface->setFullscreen(true); | ||||
1368 | surface->commit(Surface::CommitFlag::None); | ||||
1369 | | ||||
1370 | configureRequestedSpy.wait(); | ||||
1371 | | ||||
1372 | QCOMPARE(configureRequestedSpy.count(), 1); | ||||
1373 | | ||||
1374 | const auto size = configureRequestedSpy.first()[0].value<QSize>(); | ||||
1375 | const auto state = configureRequestedSpy.first()[1].value<KWayland::Client::XdgShellSurface::States>(); | ||||
1376 | | ||||
1377 | QCOMPARE(size, QSize(1280, 1024)); | ||||
1378 | QVERIFY(state & KWayland::Client::XdgShellSurface::State::Fullscreen); | ||||
1379 | | ||||
1380 | shellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); | ||||
1381 | | ||||
1382 | auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); | ||||
1383 | QCOMPARE(c->isFullScreen(), true); | ||||
1384 | QCOMPARE(c->size(), QSize(1280, 1024)); | ||||
1385 | } | ||||
1386 | | ||||
1387 | | ||||
1304 | WAYLANDTEST_MAIN(TestShellClient) | 1388 | WAYLANDTEST_MAIN(TestShellClient) | ||
1305 | #include "shell_client_test.moc" | 1389 | #include "shell_client_test.moc" |