Drop unused Screens::intersecting()

This commit is contained in:
Vlad Zahorodnii 2022-01-16 19:59:27 +02:00
parent 7120348932
commit 09fa095039
3 changed files with 0 additions and 44 deletions

View file

@ -34,8 +34,6 @@ private Q_SLOTS:
void testSize_data();
void testSize();
void testCount();
void testIntersecting_data();
void testIntersecting();
void testCurrent_data();
void testCurrent();
void testCurrentWithFollowsMouse_data();
@ -142,35 +140,6 @@ void ScreensTest::testCount()
QCOMPARE(countChangedSpy.count(), 1);
}
void ScreensTest::testIntersecting_data()
{
QTest::addColumn<QVector<QRect>>("geometries");
QTest::addColumn<QRect>("testGeometry");
QTest::addColumn<int>("expectedCount");
QTest::newRow("null-rect") << QVector<QRect>{{QRect{0, 0, 100, 100}}} << QRect() << 0;
QTest::newRow("non-overlapping") << QVector<QRect>{{QRect{0, 0, 100, 100}}} << QRect(100, 0, 100, 100) << 0;
QTest::newRow("in-between") << QVector<QRect>{{QRect{0, 0, 10, 20}, QRect{20, 40, 10, 20}}} << QRect(15, 0, 2, 2) << 0;
QTest::newRow("gap-overlapping") << QVector<QRect>{{QRect{0, 0, 10, 20}, QRect{20, 40, 10, 20}}} << QRect(9, 10, 200, 200) << 2;
QTest::newRow("larger") << QVector<QRect>{{QRect{0, 0, 100, 100}}} << QRect(-10, -10, 200, 200) << 1;
QTest::newRow("several") << QVector<QRect>{{QRect{0, 0, 100, 100}, QRect{100, 0, 100, 100}, QRect{200, 100, 100, 100}, QRect{300, 100, 100, 100}}} << QRect(0, 0, 300, 300) << 3;
}
void ScreensTest::testIntersecting()
{
QSignalSpy changedSpy(screens(), &Screens::changed);
QVERIFY(changedSpy.isValid());
QFETCH(QVector<QRect>, geometries);
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::QueuedConnection,
Q_ARG(int, geometries.count()), Q_ARG(QVector<QRect>, geometries));
QVERIFY(changedSpy.wait());
QFETCH(QRect, testGeometry);
QCOMPARE(screens()->count(), geometries.count());
QTEST(screens()->intersecting(testGeometry), "expectedCount");
}
void ScreensTest::testCurrent_data()
{
QTest::addColumn<int>("currentId");

View file

@ -107,17 +107,6 @@ void Screens::setCount(int count)
Q_EMIT countChanged(previous, count);
}
int Screens::intersecting(const QRect &r) const
{
int cnt = 0;
for (int i = 0; i < count(); ++i) {
if (geometry(i).intersects(r)) {
++cnt;
}
}
return cnt;
}
int Screens::number(const QPoint &pos) const
{
return kwinApp()->platform()->enabledOutputs().indexOf(kwinApp()->platform()->outputAt(pos));

View file

@ -64,8 +64,6 @@ public:
QSize size() const;
int number(const QPoint &pos) const;
int intersecting(const QRect &r) const;
Q_SIGNALS:
void countChanged(int previousCount, int newCount);
/**