diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index 7e11a2ce5b..65b602001b 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -571,6 +571,7 @@ KWayland::Client::AppMenuManager *waylandAppMenuManager(); WaylandOutputManagementV2 *waylandOutputManagementV2(); KWayland::Client::TextInputManager *waylandTextInputManager(); QVector waylandOutputs(); +KWayland::Client::Output *waylandOutput(const QString &name); QVector waylandOutputDevicesV2(); bool waitForWaylandSurface(Window *window); diff --git a/autotests/integration/screen_changes_test.cpp b/autotests/integration/screen_changes_test.cpp index f8233d8e00..7e6d62e4ed 100644 --- a/autotests/integration/screen_changes_test.cpp +++ b/autotests/integration/screen_changes_test.cpp @@ -120,27 +120,31 @@ void ScreenChangesTest::testScreenAddRemove() QSignalSpy o1ChangedSpy(o1.get(), &KWayland::Client::Output::changed); QVERIFY(o1ChangedSpy.isValid()); QVERIFY(o1ChangedSpy.wait()); - QCOMPARE(o1->geometry(), geometries.at(0)); + KWin::Output *serverOutput1 = kwinApp()->platform()->findOutput(o1->name()); // use wl_output.name to find the compositor side output + QCOMPARE(o1->globalPosition(), serverOutput1->geometry().topLeft()); + QCOMPARE(o1->pixelSize(), serverOutput1->modeSize()); std::unique_ptr o2(registry.createOutput(outputAnnouncedSpy.last().first().value(), outputAnnouncedSpy.last().last().value())); QVERIFY(o2->isValid()); QSignalSpy o2ChangedSpy(o2.get(), &KWayland::Client::Output::changed); QVERIFY(o2ChangedSpy.isValid()); QVERIFY(o2ChangedSpy.wait()); - QCOMPARE(o2->geometry(), geometries.at(1)); + KWin::Output *serverOutput2 = kwinApp()->platform()->findOutput(o2->name()); // use wl_output.name to find the compositor side output + QCOMPARE(o2->globalPosition(), serverOutput2->geometry().topLeft()); + QCOMPARE(o2->pixelSize(), serverOutput2->modeSize()); // and check XDGOutput is synced std::unique_ptr xdgO1(xdgOutputManager->getXdgOutput(o1.get())); QSignalSpy xdgO1ChangedSpy(xdgO1.get(), &XdgOutput::changed); QVERIFY(xdgO1ChangedSpy.isValid()); QVERIFY(xdgO1ChangedSpy.wait()); - QCOMPARE(xdgO1->logicalPosition(), geometries.at(0).topLeft()); - QCOMPARE(xdgO1->logicalSize(), geometries.at(0).size()); + QCOMPARE(xdgO1->logicalPosition(), serverOutput1->geometry().topLeft()); + QCOMPARE(xdgO1->logicalSize(), serverOutput1->geometry().size()); std::unique_ptr xdgO2(xdgOutputManager->getXdgOutput(o2.get())); QSignalSpy xdgO2ChangedSpy(xdgO2.get(), &XdgOutput::changed); QVERIFY(xdgO2ChangedSpy.isValid()); QVERIFY(xdgO2ChangedSpy.wait()); - QCOMPARE(xdgO2->logicalPosition(), geometries.at(1).topLeft()); - QCOMPARE(xdgO2->logicalSize(), geometries.at(1).size()); + QCOMPARE(xdgO2->logicalPosition(), serverOutput2->geometry().topLeft()); + QCOMPARE(xdgO2->logicalSize(), serverOutput2->geometry().size()); QVERIFY(xdgO1->name().startsWith("Virtual-")); QVERIFY(xdgO1->name() != xdgO2->name()); diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index 3a98f16096..2788412734 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -640,6 +640,16 @@ QVector waylandOutputs() return s_waylandConnection.outputs; } +KWayland::Client::Output *waylandOutput(const QString &name) +{ + for (KWayland::Client::Output *output : std::as_const(s_waylandConnection.outputs)) { + if (output->name() == name) { + return output; + } + } + return nullptr; +} + QVector waylandOutputDevicesV2() { return s_waylandConnection.outputDevicesV2; diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp index 476a7363f8..f210f320fe 100644 --- a/autotests/integration/xdgshellwindow_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -561,7 +561,7 @@ void TestXdgShellWindow::testFullscreenMultipleOutputs() // this test verifies that kwin will place fullscreen windows in the outputs its instructed to const auto outputs = workspace()->outputs(); - for (int i = 0; i < outputs.count(); ++i) { + for (KWin::Output *output : outputs) { Test::XdgToplevel::States states; std::unique_ptr surface = Test::createSurface(); @@ -590,10 +590,10 @@ void TestXdgShellWindow::testFullscreenMultipleOutputs() QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated)); // Ask the compositor to show the window in full screen mode. - shellSurface->set_fullscreen(*Test::waylandOutputs()[i]); + shellSurface->set_fullscreen(*Test::waylandOutput(output->name())); QVERIFY(surfaceConfigureRequestedSpy.wait()); QCOMPARE(surfaceConfigureRequestedSpy.count(), 2); - QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), outputs[i]->geometry().size()); + QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value(), output->geometry().size()); shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value()); Test::render(surface.get(), toplevelConfigureRequestedSpy.last().at(0).value(), Qt::red); @@ -605,7 +605,7 @@ void TestXdgShellWindow::testFullscreenMultipleOutputs() QVERIFY(window->isFullScreen()); - QCOMPARE(window->frameGeometry(), outputs[i]->geometry()); + QCOMPARE(window->frameGeometry(), output->geometry()); } }