autotests: Port more tests from obsolete Screens
This commit is contained in:
parent
8d08c31de0
commit
79e0051b04
11 changed files with 36 additions and 43 deletions
|
@ -13,7 +13,6 @@
|
|||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "pointer_input.h"
|
||||
#include "screens.h"
|
||||
#include "touch_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
|
@ -378,7 +377,7 @@ void DecorationInputTest::testPressToMove()
|
|||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(screens()->geometry(0).center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QSignalSpy startMoveResizedSpy(window, &Window::clientStartUserMovedResized);
|
||||
QVERIFY(startMoveResizedSpy.isValid());
|
||||
QSignalSpy clientFinishUserMovedResizedSpy(window, &Window::clientFinishUserMovedResized);
|
||||
|
@ -437,7 +436,7 @@ void DecorationInputTest::testTapToMove()
|
|||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(screens()->geometry(0).center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QSignalSpy startMoveResizedSpy(window, &Window::clientStartUserMovedResized);
|
||||
QVERIFY(startMoveResizedSpy.isValid());
|
||||
QSignalSpy clientFinishUserMovedResizedSpy(window, &Window::clientFinishUserMovedResized);
|
||||
|
@ -503,7 +502,7 @@ void DecorationInputTest::testResizeOutsideWindow()
|
|||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(screens()->geometry(0).center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QVERIFY(window->frameGeometry() != window->inputGeometry());
|
||||
QVERIFY(window->inputGeometry().contains(window->frameGeometry()));
|
||||
QSignalSpy startMoveResizedSpy(window, &Window::clientStartUserMovedResized);
|
||||
|
@ -600,7 +599,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove()
|
|||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(screens()->geometry(0).center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
// move cursor on window
|
||||
Cursors::self()->mouse()->setPos(QPoint(window->frameGeometry().center().x(), window->y() + window->clientPos().y() / 2));
|
||||
|
||||
|
@ -662,7 +661,7 @@ void DecorationInputTest::testModifierScrollOpacity()
|
|||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(screens()->geometry(0).center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
// move cursor on window
|
||||
Cursors::self()->mouse()->setPos(QPoint(window->frameGeometry().center().x(), window->y() + window->clientPos().y() / 2));
|
||||
// set the opacity to 0.5
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "effects.h"
|
||||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
@ -660,7 +659,7 @@ void MoveResizeWindowTest::testNetMove()
|
|||
const QRect origGeo = window->frameGeometry();
|
||||
|
||||
// let's move the cursor outside the window
|
||||
Cursors::self()->mouse()->setPos(screens()->geometry(0).center());
|
||||
Cursors::self()->mouse()->setPos(workspace()->activeOutput()->geometry().center());
|
||||
QVERIFY(!origGeo.contains(Cursors::self()->mouse()->pos()));
|
||||
|
||||
QSignalSpy moveStartSpy(window, &X11Window::clientStartUserMovedResized);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "cursor.h"
|
||||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
@ -371,11 +370,11 @@ void TestPlacement::testFullscreen()
|
|||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
Test::render(surface.data(), toplevelConfigureRequestedSpy.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(geometryChangedSpy.wait());
|
||||
QCOMPARE(window->frameGeometry(), screens()->geometry(0));
|
||||
QCOMPARE(window->frameGeometry(), outputs[0]->geometry());
|
||||
|
||||
// this doesn't require a round trip, so should be immediate
|
||||
window->sendToOutput(outputs[1]);
|
||||
QCOMPARE(window->frameGeometry(), screens()->geometry(1));
|
||||
QCOMPARE(window->frameGeometry(), outputs[1]->geometry());
|
||||
QCOMPARE(geometryChangedSpy.count(), 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
|
|||
Q_ARG(int, 1),
|
||||
Q_ARG(QVector<QRect>, QVector<QRect>{QRect(0, 0, 1280, 1024)}));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
QCOMPARE(kwinApp()->platform()->enabledOutputs().count(), 1);
|
||||
|
||||
// this should have warped the cursor
|
||||
QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(639, 511));
|
||||
|
@ -1584,11 +1584,13 @@ void PointerInputTest::testConfineToScreenGeometry()
|
|||
Qt::DirectConnection,
|
||||
Q_ARG(int, geometries.count()),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->count(), geometries.count());
|
||||
QCOMPARE(screens()->geometry(0), geometries.at(0));
|
||||
QCOMPARE(screens()->geometry(1), geometries.at(1));
|
||||
QCOMPARE(screens()->geometry(2), geometries.at(2));
|
||||
QCOMPARE(screens()->geometry(3), geometries.at(3));
|
||||
|
||||
const auto outputs = kwinApp()->platform()->enabledOutputs();
|
||||
QCOMPARE(outputs.count(), geometries.count());
|
||||
QCOMPARE(outputs[0]->geometry(), geometries.at(0));
|
||||
QCOMPARE(outputs[1]->geometry(), geometries.at(1));
|
||||
QCOMPARE(outputs[2]->geometry(), geometries.at(2));
|
||||
QCOMPARE(outputs[3]->geometry(), geometries.at(3));
|
||||
|
||||
// move pointer to initial position
|
||||
QFETCH(QPoint, startPos);
|
||||
|
|
|
@ -81,7 +81,7 @@ void ScreenChangesTest::testScreenAddRemove()
|
|||
auto xdgOutputManager = registry.createXdgOutputManager(xdgOMData.name, xdgOMData.version);
|
||||
|
||||
// should be one output
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
QCOMPARE(kwinApp()->platform()->enabledOutputs().count(), 1);
|
||||
QCOMPARE(outputAnnouncedSpy.count(), 1);
|
||||
const quint32 firstOutputId = outputAnnouncedSpy.first().first().value<quint32>();
|
||||
QVERIFY(firstOutputId != 0u);
|
||||
|
@ -97,7 +97,7 @@ void ScreenChangesTest::testScreenAddRemove()
|
|||
Q_ARG(QVector<QRect>, geometries));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screensChangedSpy.count(), 2);
|
||||
const auto outputs = kwinApp()->platform()->enabledOutputs();
|
||||
auto outputs = kwinApp()->platform()->enabledOutputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), geometries[0]);
|
||||
QCOMPARE(outputs[1]->geometry(), geometries[1]);
|
||||
|
@ -169,8 +169,9 @@ void ScreenChangesTest::testScreenAddRemove()
|
|||
Q_ARG(QVector<QRect>, geometries2));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screensChangedSpy.count(), 2);
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
QCOMPARE(screens()->geometry(0), geometries2.at(0));
|
||||
outputs = kwinApp()->platform()->enabledOutputs();
|
||||
QCOMPARE(outputs.count(), 1);
|
||||
QCOMPARE(outputs[0]->geometry(), geometries2.at(0));
|
||||
|
||||
QVERIFY(outputAnnouncedSpy.wait());
|
||||
QCOMPARE(outputAnnouncedSpy.count(), 1);
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "screenedge.h"
|
||||
#include "screens.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
@ -694,7 +693,7 @@ void StrutsTest::test363804()
|
|||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(), QRect(0, 0, 1920, 1848));
|
||||
QCOMPARE(workspace()->geometry(), QRect(0, 0, 1920, 1848));
|
||||
|
||||
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
|
||||
const QVector<Output *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||
|
@ -778,7 +777,7 @@ void StrutsTest::testLeftScreenSmallerBottomAligned()
|
|||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(), QRect(0, 0, 3046, 1050));
|
||||
QCOMPARE(workspace()->geometry(), QRect(0, 0, 3046, 1050));
|
||||
|
||||
const QVector<Output *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||
QCOMPARE(outputs[0]->geometry(), geometries.at(0));
|
||||
|
@ -895,7 +894,7 @@ void StrutsTest::testWindowMoveWithPanelBetweenScreens()
|
|||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(), QRect(0, 0, 3046, 1050));
|
||||
QCOMPARE(workspace()->geometry(), QRect(0, 0, 3046, 1050));
|
||||
|
||||
const QVector<Output *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||
QCOMPARE(outputs[0]->geometry(), geometries.at(0));
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "cursor.h"
|
||||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland/seat_interface.h"
|
||||
#include "wayland/surface_interface.h"
|
||||
#include "wayland_server.h"
|
||||
|
@ -467,6 +466,8 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
{
|
||||
using namespace KWayland::Client;
|
||||
|
||||
const Output *output = workspace()->activeOutput();
|
||||
|
||||
QScopedPointer<KWayland::Client::Surface> surface{Test::createSurface()};
|
||||
QVERIFY(!surface.isNull());
|
||||
QScopedPointer<Test::XdgToplevel> dockShellSurface{Test::createXdgToplevelSurface(surface.data())};
|
||||
|
@ -474,7 +475,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QScopedPointer<PlasmaShellSurface> plasmaSurface(Test::waylandPlasmaShell()->createSurface(surface.data()));
|
||||
QVERIFY(!plasmaSurface.isNull());
|
||||
plasmaSurface->setRole(PlasmaShellSurface::Role::Panel);
|
||||
plasmaSurface->setPosition(QPoint(0, screens()->geometry(0).height() - 50));
|
||||
plasmaSurface->setPosition(QPoint(0, output->geometry().height() - 50));
|
||||
plasmaSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible);
|
||||
|
||||
// now render and map the window
|
||||
|
@ -482,7 +483,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(dock);
|
||||
QCOMPARE(dock->windowType(), NET::Dock);
|
||||
QVERIFY(dock->isDock());
|
||||
QCOMPARE(dock->frameGeometry(), QRect(0, screens()->geometry(0).height() - 50, 1280, 50));
|
||||
QCOMPARE(dock->frameGeometry(), QRect(0, output->geometry().height() - 50, 1280, 50));
|
||||
QCOMPARE(dock->hasStrut(), true);
|
||||
QCOMPARE(workspace()->clientArea(PlacementArea, dock), QRect(0, 0, 1280, 1024 - 50));
|
||||
QCOMPARE(workspace()->clientArea(FullScreenArea, dock), QRect(0, 0, 1280, 1024));
|
||||
|
@ -496,9 +497,9 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(parent);
|
||||
|
||||
QVERIFY(!parent->isDecorated());
|
||||
parent->move({0, screens()->geometry(0).height() - 600});
|
||||
parent->move({0, output->geometry().height() - 600});
|
||||
parent->keepInArea(workspace()->clientArea(PlacementArea, parent));
|
||||
QCOMPARE(parent->frameGeometry(), QRect(0, screens()->geometry(0).height() - 600 - 50, 800, 600));
|
||||
QCOMPARE(parent->frameGeometry(), QRect(0, output->geometry().height() - 600 - 50, 800, 600));
|
||||
|
||||
QScopedPointer<KWayland::Client::Surface> transientSurface(Test::createSurface());
|
||||
QVERIFY(transientSurface);
|
||||
|
@ -514,7 +515,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(!transient->isDecorated());
|
||||
QVERIFY(transient->hasTransientPlacementHint());
|
||||
|
||||
QCOMPARE(transient->frameGeometry(), QRect(50, screens()->geometry(0).height() - 200 - 50, 200, 200));
|
||||
QCOMPARE(transient->frameGeometry(), QRect(50, output->geometry().height() - 200 - 50, 200, 200));
|
||||
|
||||
transientShellSurface.reset();
|
||||
transientSurface.reset();
|
||||
|
@ -530,14 +531,14 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(frameGeometryChangedSpy.isValid());
|
||||
Test::render(parentSurface.data(), toplevelConfigureRequestedSpy.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy.wait());
|
||||
QCOMPARE(parent->frameGeometry(), screens()->geometry(0));
|
||||
QCOMPARE(parent->frameGeometry(), output->geometry());
|
||||
QVERIFY(parent->isFullScreen());
|
||||
|
||||
// another transient, with same hints as before from bottom of window
|
||||
transientSurface.reset(Test::createSurface());
|
||||
QVERIFY(transientSurface);
|
||||
|
||||
const QRect anchorRect2(50, screens()->geometry(0).height() - 100, 200, 200);
|
||||
const QRect anchorRect2(50, output->geometry().height() - 100, 200, 200);
|
||||
QScopedPointer<Test::XdgPositioner> positioner2(Test::createXdgPositioner());
|
||||
positioner2->set_size(200, 200);
|
||||
positioner2->set_anchor_rect(anchorRect2.x(), anchorRect2.y(), anchorRect2.width(), anchorRect2.height());
|
||||
|
@ -548,7 +549,7 @@ void TransientPlacementTest::testXdgPopupWithPanel()
|
|||
QVERIFY(!transient->isDecorated());
|
||||
QVERIFY(transient->hasTransientPlacementHint());
|
||||
|
||||
QCOMPARE(transient->frameGeometry(), QRect(50, screens()->geometry(0).height() - 200, 200, 200));
|
||||
QCOMPARE(transient->frameGeometry(), QRect(50, output->geometry().height() - 200, 200, 200));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "effectloader.h"
|
||||
#include "effects.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
@ -517,7 +516,7 @@ void X11WindowTest::testFullscreenLayerWithActiveWaylandWindow()
|
|||
{
|
||||
// this test verifies that an X11 fullscreen window does not stay in the active layer
|
||||
// when a Wayland window is active, see BUG: 375759
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
QCOMPARE(kwinApp()->platform()->enabledOutputs().count(), 1);
|
||||
|
||||
// first create an X11 window
|
||||
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "effects.h"
|
||||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "screens.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland/clientconnection.h"
|
||||
#include "wayland/display.h"
|
||||
|
@ -611,7 +610,7 @@ void TestXdgShellWindow::testFullscreenMultipleOutputs()
|
|||
|
||||
QVERIFY(window->isFullScreen());
|
||||
|
||||
QCOMPARE(window->frameGeometry(), screens()->geometry(i));
|
||||
QCOMPARE(window->frameGeometry(), outputs[i]->geometry());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "output.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "screens.h"
|
||||
#include "unmanaged.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "main.h"
|
||||
#include "platform.h"
|
||||
#include "scene.h"
|
||||
#include "screens.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
@ -57,9 +56,6 @@ void XwaylandServerRestartTest::initTestCase()
|
|||
|
||||
kwinApp()->start();
|
||||
QVERIFY(applicationStartedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 2);
|
||||
QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
|
||||
Test::initWaylandWorkspace();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue