[wayland] Fix ShellClientTest

Summary:
When switching from maximised to full screen the geometry as kwin sees
it doesn't necessarily need to change, the test is wrong.

Also we can fix the XDGShell-deco tests.

wlshell-deco test still fails as before.

Test Plan: Tests pass \o/

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16922
This commit is contained in:
David Edmundson 2018-11-16 11:59:39 +00:00
parent 5f2e0b7299
commit 1a2c90ea12

View file

@ -701,7 +701,6 @@ void TestShellClient::testMaximizedToFullscreen()
QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(screens()->size(0))); QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(screens()->size(0)));
// TODO: should switch to fullscreen once it's updated // TODO: should switch to fullscreen once it's updated
QVERIFY(c->isFullScreen()); QVERIFY(c->isFullScreen());
QVERIFY(geometryChangedSpy.isEmpty());
if (xdgShellSurface) { if (xdgShellSurface) {
for (const auto &it: configureRequestedSpy) { for (const auto &it: configureRequestedSpy) {
@ -710,8 +709,7 @@ void TestShellClient::testMaximizedToFullscreen()
} }
// render at the new size // render at the new size
Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red);
QVERIFY(geometryChangedSpy.wait());
QCOMPARE(geometryChangedSpy.count(), 1);
QVERIFY(c->isFullScreen()); QVERIFY(c->isFullScreen());
QVERIFY(!c->isDecorated()); QVERIFY(!c->isDecorated());
QCOMPARE(c->geometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.last().first().toSize())); QCOMPARE(c->geometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.last().first().toSize()));
@ -726,18 +724,20 @@ void TestShellClient::testMaximizedToFullscreen()
case Test::ShellSurfaceType::XdgShellV6: case Test::ShellSurfaceType::XdgShellV6:
case Test::ShellSurfaceType::XdgShellStable: case Test::ShellSurfaceType::XdgShellStable:
qobject_cast<XdgShellSurface*>(shellSurface.data())->setFullscreen(false); qobject_cast<XdgShellSurface*>(shellSurface.data())->setFullscreen(false);
break; qobject_cast<XdgShellSurface*>(shellSurface.data())->setMaximized(false);
default:
Q_UNREACHABLE();
break; break;
} }
QVERIFY(fullscreenChangedSpy.wait()); QVERIFY(fullscreenChangedSpy.wait());
QVERIFY(sizeChangeRequestedSpy.wait()); if (decoMode == ServerSideDecoration::Mode::Server) {
QCOMPARE(sizeChangeRequestedSpy.count(), 1); QVERIFY(sizeChangeRequestedSpy.wait());
QEXPECT_FAIL("wlShell - deco", "With decoration incorrect geometry requested", Continue); // don't check count, XDG might legitimately get two updates
QEXPECT_FAIL("xdgShellV5 - deco", "With decoration incorrect geometry requested", Continue);
QEXPECT_FAIL("xdgShellV6 - deco", "With decoration incorrect geometry requested", Continue); // fails as we don't correctly call setMaximize(false)
QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50)); // but realistically the only toolkits that support the deco also use XDGShell
QEXPECT_FAIL("wlShell - deco", "With decoration incorrect geometry requested", Continue);
QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50));
}
// TODO: should switch to fullscreen once it's updated // TODO: should switch to fullscreen once it's updated
QVERIFY(!c->isFullScreen()); QVERIFY(!c->isFullScreen());
QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server);