test: add test for edges on mostly overlapping outputs
Inspired in commit b2a44fb08aa140646c879226ee82509aa201ec11 by Roman Gilg <subdiff@gmail.com> in kwinft.
This commit is contained in:
parent
001761cea2
commit
9750a38069
1 changed files with 51 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "../virtualdesktops.h"
|
#include "../virtualdesktops.h"
|
||||||
#include "../xcbutils.h"
|
#include "../xcbutils.h"
|
||||||
|
#include "../platform.h"
|
||||||
#include "mock_screens.h"
|
#include "mock_screens.h"
|
||||||
#include "mock_workspace.h"
|
#include "mock_workspace.h"
|
||||||
#include "mock_x11client.h"
|
#include "mock_x11client.h"
|
||||||
|
@ -90,6 +91,8 @@ private Q_SLOTS:
|
||||||
void testCreatingInitialEdges();
|
void testCreatingInitialEdges();
|
||||||
void testCallback();
|
void testCallback();
|
||||||
void testCallbackWithCheck();
|
void testCallbackWithCheck();
|
||||||
|
void testOverlappingEdges_data();
|
||||||
|
void testOverlappingEdges();
|
||||||
void testPushBack_data();
|
void testPushBack_data();
|
||||||
void testPushBack();
|
void testPushBack();
|
||||||
void testFullScreenBlocking();
|
void testFullScreenBlocking();
|
||||||
|
@ -567,6 +570,45 @@ void TestScreenEdges::testCallbackWithCheck()
|
||||||
QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(98, 50));
|
QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(98, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestScreenEdges::testOverlappingEdges_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QRect>("geo1");
|
||||||
|
QTest::addColumn<QRect>("geo2");
|
||||||
|
|
||||||
|
QTest::newRow("topleft-1x1") << QRect{0, 1, 1024, 768} << QRect{1, 0, 1024, 768};
|
||||||
|
QTest::newRow("left-1x1-same") << QRect{0, 1, 1024, 766} << QRect{1, 0, 1024, 768};
|
||||||
|
QTest::newRow("left-1x1-exchanged") << QRect{0, 1, 1024, 768} << QRect{1, 0, 1024, 766};
|
||||||
|
QTest::newRow("bottomleft-1x1") << QRect{0, 0, 1024, 768} << QRect{1, 0, 1024, 769};
|
||||||
|
QTest::newRow("bottomright-1x1") << QRect{0, 0, 1024, 768} << QRect{0, 0, 1023, 769};
|
||||||
|
QTest::newRow("right-1x1-same") << QRect{0, 0, 1024, 768} << QRect{0, 1, 1025, 766};
|
||||||
|
QTest::newRow("right-1x1-exchanged") << QRect{0, 0, 1024, 768} << QRect{1, 1, 1024, 768};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TestScreenEdges::testOverlappingEdges()
|
||||||
|
{
|
||||||
|
using namespace KWin;
|
||||||
|
QSignalSpy changedSpy(screens(), &Screens::changed);
|
||||||
|
QVERIFY(changedSpy.isValid());
|
||||||
|
|
||||||
|
QFETCH(QRect, geo1);
|
||||||
|
QFETCH(QRect, geo2);
|
||||||
|
|
||||||
|
QList<QRect> geometries{{geo1, geo2}};
|
||||||
|
QMetaObject::invokeMethod(kwinApp()->platform(),
|
||||||
|
"setVirtualOutputs",
|
||||||
|
Qt::DirectConnection,
|
||||||
|
Q_ARG(int, geometries.count()),
|
||||||
|
Q_ARG(QVector<QRect>, QVector<QRect>::fromList(geometries)),
|
||||||
|
Q_ARG(QVector<int>, QVector<int>(geometries.count(), 1))
|
||||||
|
);
|
||||||
|
|
||||||
|
QCOMPARE(changedSpy.count(), 1);
|
||||||
|
|
||||||
|
auto screenEdges = ScreenEdges::self();
|
||||||
|
screenEdges->init();
|
||||||
|
}
|
||||||
|
|
||||||
void TestScreenEdges::testPushBack_data()
|
void TestScreenEdges::testPushBack_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<KWin::ElectricBorder>("border");
|
QTest::addColumn<KWin::ElectricBorder>("border");
|
||||||
|
@ -593,7 +635,15 @@ void TestScreenEdges::testPushBack()
|
||||||
config->group("Windows").writeEntry("ElectricBorderPushbackPixels", pushback);
|
config->group("Windows").writeEntry("ElectricBorderPushbackPixels", pushback);
|
||||||
config->sync();
|
config->sync();
|
||||||
|
|
||||||
// TODO: add screens
|
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();
|
auto s = ScreenEdges::self();
|
||||||
s->setConfig(config);
|
s->setConfig(config);
|
||||||
|
|
Loading…
Reference in a new issue