From 252ba9e005f8fcb8e5bae9e989270c5cd9f34ecd Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 22 Oct 2021 11:41:18 +0300 Subject: [PATCH] autotests: Use less Screens::size(int) The same info can be retrieved from AbstractOutput::geometry().size(). --- autotests/integration/xdgshellclient_test.cpp | 16 +++++++++------- src/screens.cpp | 8 -------- src/screens.h | 7 ------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index 7e72f83fc4..37771b243f 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -425,7 +425,7 @@ void TestXdgShellClient::testFullscreen() QCOMPARE(surfaceConfigureRequestedSpy.count(), 2); states = toplevelConfigureRequestedSpy.last().at(1).value(); QVERIFY(states & Test::XdgToplevel::State::Fullscreen); - QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), screens()->size(0)); + QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), client->output()->geometry().size()); shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value()); Test::render(surface.data(), toplevelConfigureRequestedSpy.last().at(0).value(), Qt::red); @@ -435,7 +435,7 @@ void TestXdgShellClient::testFullscreen() QVERIFY(client->isFullScreen()); QVERIFY(!client->isDecorated()); QCOMPARE(client->layer(), ActiveLayer); - QCOMPARE(client->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0))); + QCOMPARE(client->frameGeometry(), QRect(QPoint(0, 0), client->output()->geometry().size())); // Ask the compositor to show the window in normal mode. shellSurface->unset_fullscreen(); @@ -538,7 +538,7 @@ void TestXdgShellClient::testMaximizedToFullscreen() shellSurface->set_fullscreen(nullptr); QVERIFY(surfaceConfigureRequestedSpy.wait()); QCOMPARE(surfaceConfigureRequestedSpy.count(), 3); - QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), screens()->size(0)); + QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), client->output()->geometry().size()); states = toplevelConfigureRequestedSpy.last().at(1).value(); QVERIFY(states & Test::XdgToplevel::State::Maximized); QVERIFY(states & Test::XdgToplevel::State::Fullscreen); @@ -579,7 +579,8 @@ void TestXdgShellClient::testFullscreenMultipleOutputs() { // this test verifies that kwin will place fullscreen windows in the outputs its instructed to - for (int i = 0; i < screens()->count(); ++i) { + const auto outputs = kwinApp()->platform()->enabledOutputs(); + for (int i = 0; i < outputs.count(); ++i) { Test::XdgToplevel::States states; QSharedPointer surface(Test::createSurface()); @@ -611,7 +612,7 @@ void TestXdgShellClient::testFullscreenMultipleOutputs() shellSurface->set_fullscreen(*Test::waylandOutputs()[i]); QVERIFY(surfaceConfigureRequestedSpy.wait()); QCOMPARE(surfaceConfigureRequestedSpy.count(), 2); - QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), screens()->size(i)); + QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), outputs[i]->geometry().size()); shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value()); Test::render(surface.data(), toplevelConfigureRequestedSpy.last().at(0).value(), Qt::red); @@ -643,12 +644,13 @@ void TestXdgShellClient::testWindowOpensLargerThanScreen() QVERIFY(decoSpy.wait()); QCOMPARE(deco->mode(), ServerSideDecoration::Mode::Server); - auto c = Test::renderAndWaitForShown(surface.data(), screens()->size(0), Qt::blue); + AbstractOutput *output = workspace()->activeOutput(); + auto c = Test::renderAndWaitForShown(surface.data(), output->geometry().size(), Qt::blue); QVERIFY(c); QVERIFY(c->isActive()); QVERIFY(c->isDecorated()); QEXPECT_FAIL("", "BUG 366632", Continue); - QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), screens()->size(0))); + QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), output->geometry().size())); } void TestXdgShellClient::testHidden() diff --git a/src/screens.cpp b/src/screens.cpp index b850ddaba4..c62f97df0e 100644 --- a/src/screens.cpp +++ b/src/screens.cpp @@ -65,14 +65,6 @@ QRect Screens::geometry(int screen) const return QRect(); } -QSize Screens::size(int screen) const -{ - if (AbstractOutput *output = findOutput(screen)) { - return output->geometry().size(); - } - return QSize(); -} - qreal Screens::scale(int screen) const { if (AbstractOutput *output = findOutput(screen)) { diff --git a/src/screens.h b/src/screens.h index ec0dd64c72..2c1836f2f9 100644 --- a/src/screens.h +++ b/src/screens.h @@ -41,13 +41,6 @@ public: * @see geometryChanged() */ QRect geometry() const; - /** - * @returns size of the @p screen. - * - * To get the size of all screens combined use size(). - * @see size() - */ - QSize size(int screen) const; /** * The highest scale() of all connected screens