Commit 5903c5be authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Fix testScreenEdges for good

Don't call kwinApp, because we are not on one.
The correct way to mock the geometries is by using the MockScreens,
which is already used in this test.
parent 6d59c0b4
......@@ -123,6 +123,8 @@ void TestScreenEdges::init()
new MockWorkspace(this);
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
Screens::create();
QSignalSpy sp(screens(), &MockScreens::changed);
QVERIFY(sp.wait());
auto vd = VirtualDesktopManager::create();
vd->setConfig(config);
......@@ -591,15 +593,12 @@ void TestScreenEdges::testOverlappingEdges()
QFETCH(QRect, geo1);
QFETCH(QRect, geo2);
QVector<QRect> geometries{{geo1, geo2}};
QMetaObject::invokeMethod(kwinApp()->platform(),
"setVirtualOutputs",
Qt::DirectConnection,
Q_ARG(int, geometries.count()),
Q_ARG(QVector<QRect>, geometries),
Q_ARG(QVector<int>, QVector<int>(geometries.count(), 1))
);
MockScreens* mockScreens = static_cast<MockScreens*>(screens());
QSignalSpy sp(mockScreens, &MockScreens::changed);
mockScreens->setGeometries({geo1, geo2});
QVERIFY(sp.wait());
QCOMPARE(screens()->count(), 2);
auto screenEdges = ScreenEdges::self();
screenEdges->init();
}
......@@ -630,16 +629,6 @@ void TestScreenEdges::testPushBack()
config->group("Windows").writeEntry("ElectricBorderPushbackPixels", pushback);
config->sync();
QVector<QRect> geometries{{QRect{0, 0, 1024, 768}, QRect{200, 768, 1024, 768}}};
QMetaObject::invokeMethod(kwinApp()->platform(),
"setVirtualOutputs",
Qt::DirectConnection,
Q_ARG(int, geometries.count()),
Q_ARG(QVector<QRect>, geometries),
Q_ARG(QVector<int>, QVector<int>(geometries.count(), 1))
);
auto s = ScreenEdges::self();
s->setConfig(config);
s->init();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment