Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
09fa0950
Commit
09fa0950
authored
Jan 16, 2022
by
Vlad Zahorodnii
Browse files
Drop unused Screens::intersecting()
parent
71203489
Pipeline
#128691
passed with stage
in 14 minutes and 49 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
autotests/integration/screens_test.cpp
View file @
09fa0950
...
...
@@ -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"
);
...
...
src/screens.cpp
View file @
09fa0950
...
...
@@ -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
));
...
...
src/screens.h
View file @
09fa0950
...
...
@@ -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
);
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment