autotests: current abstract output
This commit is contained in:
parent
813804d5a0
commit
b08807cc36
39 changed files with 65 additions and 58 deletions
|
@ -66,7 +66,7 @@ void ActivationTest::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void ActivitiesTest::cleanupTestCase()
|
|||
|
||||
void ActivitiesTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void DecorationInputTest::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::Decoration));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void X11DesktopWindowTest::initTestCase()
|
|||
|
||||
void X11DesktopWindowTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
|
|||
|
||||
void DontCrashAuroraeDestroyDecoTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void DontCrashCursorPhysicalSizeEmpty::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void DontCrashEmptyDecorationTest::initTestCase()
|
|||
|
||||
void DontCrashEmptyDecorationTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void DontCrashNoBorder::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ void TestDontCrashUseractionsMenu::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestDontCrashUseractionsMenu::cleanup()
|
||||
|
|
|
@ -74,7 +74,7 @@ void GlobalShortcutsTest::initTestCase()
|
|||
void GlobalShortcutsTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
|
||||
auto xkb = input()->keyboard()->xkb();
|
||||
|
|
|
@ -71,7 +71,7 @@ void InputStackingOrderTest::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ void InputMethodTest::init()
|
|||
Test::AdditionalWaylandInterface::TextInputManagerV3));
|
||||
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
|
||||
InputMethod::self()->setEnabled(true);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void KWinBindingsTest::initTestCase()
|
|||
void KWinBindingsTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void LayerShellV1ClientTest::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::LayerShellV1));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ void LockScreenTest::init()
|
|||
m_shm = Test::waylandShmPool();
|
||||
m_seat = Test::waylandSeat();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ void TestMaximized::init()
|
|||
Test::AdditionalWaylandInterface::XdgDecorationV1 |
|
||||
Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestMaximized::cleanup()
|
||||
|
|
|
@ -95,7 +95,7 @@ void ModifierOnlyShortcutTest::initTestCase()
|
|||
|
||||
void ModifierOnlyShortcutTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void MoveResizeWindowTest::init()
|
|||
m_connection = Test::waylandConnection();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void MoveResizeWindowTest::cleanup()
|
||||
|
|
|
@ -105,7 +105,7 @@ void NoGlobalShortcutsTest::initTestCase()
|
|||
|
||||
void NoGlobalShortcutsTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ void TestOutputManagement::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::OutputManagement |
|
||||
Test::AdditionalWaylandInterface::OutputDevice));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
//put mouse in the middle of screen one
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestOutputManagement::cleanup()
|
||||
|
|
|
@ -65,8 +65,8 @@ void TestPlacement::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestPlacement::cleanup()
|
||||
|
|
|
@ -79,7 +79,7 @@ void PlasmaWindowTest::init()
|
|||
m_windowManagement = Test::waylandWindowManagement();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ void TestPointerConstraints::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::PointerConstraints));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestPointerConstraints::cleanup()
|
||||
|
|
|
@ -165,7 +165,7 @@ void PointerInputTest::init()
|
|||
m_compositor = Test::waylandCompositor();
|
||||
m_seat = Test::waylandSeat();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void QuickTilingTest::init()
|
|||
m_connection = Test::waylandConnection();
|
||||
m_compositor = Test::waylandCompositor();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void ScreenChangesTest::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ void ScreenEdgeClientShowTest::initTestCase()
|
|||
|
||||
void ScreenEdgeClientShowTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void ScreensTest::initTestCase()
|
|||
|
||||
void ScreensTest::init()
|
||||
{
|
||||
Screens::self()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
@ -229,9 +229,11 @@ void ScreensTest::testCurrent()
|
|||
QVERIFY(currentChangedSpy.isValid());
|
||||
|
||||
QFETCH(int, current);
|
||||
AbstractOutput *output = kwinApp()->platform()->findOutput(current);
|
||||
|
||||
screens()->setCurrentFollowsMouse(false);
|
||||
screens()->setCurrent(current);
|
||||
QCOMPARE(screens()->current(), current);
|
||||
screens()->setCurrent(output);
|
||||
QCOMPARE(screens()->currentOutput(), output);
|
||||
QTEST(!currentChangedSpy.isEmpty(), "signal");
|
||||
}
|
||||
|
||||
|
@ -253,7 +255,7 @@ void ScreensTest::testCurrentClient()
|
|||
// if the window is sent to another screen, that screen will become current
|
||||
client->sendToOutput(outputs[1]);
|
||||
QCOMPARE(currentChangedSpy.count(), 1);
|
||||
QCOMPARE(screens()->current(), 1);
|
||||
QCOMPARE(screens()->currentOutput(), outputs[1]);
|
||||
|
||||
// setting current with the same client again should not change
|
||||
screens()->setCurrent(client);
|
||||
|
@ -262,20 +264,20 @@ void ScreensTest::testCurrentClient()
|
|||
// and it should even still be on screen 1 if we make the client non-current again
|
||||
workspace()->setActiveClient(nullptr);
|
||||
client->setActive(false);
|
||||
QCOMPARE(screens()->current(), 1);
|
||||
QCOMPARE(screens()->currentOutput(), outputs[1]);
|
||||
|
||||
// it's not the active client, so changing won't work
|
||||
screens()->setCurrent(client);
|
||||
client->sendToOutput(outputs[0]);
|
||||
QCOMPARE(currentChangedSpy.count(), 1);
|
||||
QCOMPARE(screens()->current(), 1);
|
||||
QCOMPARE(screens()->currentOutput(), outputs[1]);
|
||||
}
|
||||
|
||||
void ScreensTest::testCurrentWithFollowsMouse_data()
|
||||
{
|
||||
QTest::addColumn<QVector<QRect>>("geometries");
|
||||
QTest::addColumn<QPoint>("cursorPos");
|
||||
QTest::addColumn<int>("expected");
|
||||
QTest::addColumn<int>("expectedId");
|
||||
|
||||
QTest::newRow("empty") << QVector<QRect>{{QRect()}} << QPoint(100, 100) << 0;
|
||||
QTest::newRow("cloned") << QVector<QRect>{{QRect{0, 0, 200, 100}, QRect{0, 0, 200, 100}}} << QPoint(50, 50) << 0;
|
||||
|
@ -289,7 +291,6 @@ void ScreensTest::testCurrentWithFollowsMouse()
|
|||
QSignalSpy changedSpy(screens(), &Screens::changed);
|
||||
QVERIFY(changedSpy.isValid());
|
||||
screens()->setCurrentFollowsMouse(true);
|
||||
QCOMPARE(screens()->current(), 0);
|
||||
|
||||
QFETCH(QVector<QRect>, geometries);
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::QueuedConnection,
|
||||
|
@ -298,14 +299,17 @@ void ScreensTest::testCurrentWithFollowsMouse()
|
|||
|
||||
QFETCH(QPoint, cursorPos);
|
||||
KWin::Cursors::self()->mouse()->setPos(cursorPos);
|
||||
QTEST(screens()->current(), "expected");
|
||||
|
||||
QFETCH(int, expectedId);
|
||||
AbstractOutput *expected = kwinApp()->platform()->findOutput(expectedId);
|
||||
QCOMPARE(screens()->currentOutput(), expected);
|
||||
}
|
||||
|
||||
void ScreensTest::testCurrentPoint_data()
|
||||
{
|
||||
QTest::addColumn<QVector<QRect>>("geometries");
|
||||
QTest::addColumn<QPoint>("cursorPos");
|
||||
QTest::addColumn<int>("expected");
|
||||
QTest::addColumn<int>("expectedId");
|
||||
|
||||
QTest::newRow("empty") << QVector<QRect>{{QRect()}} << QPoint(100, 100) << 0;
|
||||
QTest::newRow("cloned") << QVector<QRect>{{QRect{0, 0, 200, 100}, QRect{0, 0, 200, 100}}} << QPoint(50, 50) << 0;
|
||||
|
@ -328,7 +332,10 @@ void ScreensTest::testCurrentPoint()
|
|||
|
||||
QFETCH(QPoint, cursorPos);
|
||||
screens()->setCurrent(cursorPos);
|
||||
QTEST(screens()->current(), "expected");
|
||||
|
||||
QFETCH(int, expectedId);
|
||||
AbstractOutput *expected = kwinApp()->platform()->findOutput(expectedId);
|
||||
QCOMPARE(screens()->currentOutput(), expected);
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -55,7 +55,7 @@ void ShadeTest::initTestCase()
|
|||
|
||||
void ShadeTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void StrutsTest::init()
|
|||
m_compositor = Test::waylandCompositor();
|
||||
m_plasmaShell = Test::waylandPlasmaShell();
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void TabBoxTest::initTestCase()
|
|||
void TabBoxTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ void TouchInputTest::init()
|
|||
QVERIFY(m_touch);
|
||||
QVERIFY(m_touch->isValid());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TouchInputTest::cleanup()
|
||||
|
|
|
@ -80,7 +80,7 @@ void TransientPlacementTest::init()
|
|||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration | Test::AdditionalWaylandInterface::PlasmaShell));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void VirtualDesktopTest::initTestCase()
|
|||
void VirtualDesktopTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
VirtualDesktopManager::self()->setCount(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void WindowRuleTest::initTestCase()
|
|||
|
||||
void WindowRuleTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
QVERIFY(waylandServer()->clients().isEmpty());
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ void TestWindowSelection::init()
|
|||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestWindowSelection::cleanup()
|
||||
|
|
|
@ -155,7 +155,7 @@ void TestXdgShellClientRules::init()
|
|||
VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first());
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestXdgShellClientRules::cleanup()
|
||||
|
|
|
@ -193,9 +193,9 @@ void TestXdgShellClient::init()
|
|||
Test::AdditionalWaylandInterface::AppMenu));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
//put mouse in the middle of screen one
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512));
|
||||
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestXdgShellClient::cleanup()
|
||||
|
|
|
@ -59,7 +59,7 @@ void XWaylandInputTest::initTestCase()
|
|||
|
||||
void XWaylandInputTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
screens()->setCurrent(QPoint(640, 512));
|
||||
Cursors::self()->mouse()->setPos(QPoint(640, 512));
|
||||
xcb_warp_pointer(connection(), XCB_WINDOW_NONE, kwinApp()->x11RootWindow(), 0, 0, 0, 0, 640, 512);
|
||||
xcb_flush(connection());
|
||||
|
|
Loading…
Reference in a new issue