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
93ee2f68
Commit
93ee2f68
authored
Jan 17, 2021
by
Xaver Hugl
Committed by
Aleix Pol Gonzalez
Jan 18, 2021
Browse files
Add test for TouchInputRedirection::m_touches
parent
3c231940
Changes
6
Hide whitespace changes
Inline
Side-by-side
autotests/integration/touch_input_test.cpp
View file @
93ee2f68
...
...
@@ -38,6 +38,7 @@ private Q_SLOTS:
void
testMultipleTouchPoints
();
void
testCancel
();
void
testTouchMouseAction
();
void
testTouchPointCount
();
private:
AbstractClient
*
showWindow
(
bool
decorated
=
false
);
...
...
@@ -263,7 +264,25 @@ void TouchInputTest::testTouchMouseAction()
QCOMPARE
(
sequenceStartedSpy
.
count
(),
1
);
// cleanup
kwinApp
()
->
platform
()
->
touchCancel
();
kwinApp
()
->
platform
()
->
cancelTouchSequence
();
}
void
TouchInputTest
::
testTouchPointCount
()
{
QCOMPARE
(
kwinApp
()
->
platform
()
->
touchPointCount
(),
0
);
quint32
timestamp
=
1
;
kwinApp
()
->
platform
()
->
touchDown
(
0
,
QPointF
(
125
,
125
),
timestamp
++
);
kwinApp
()
->
platform
()
->
touchDown
(
1
,
QPointF
(
125
,
125
),
timestamp
++
);
kwinApp
()
->
platform
()
->
touchDown
(
2
,
QPointF
(
125
,
125
),
timestamp
++
);
QCOMPARE
(
kwinApp
()
->
platform
()
->
touchPointCount
(),
3
);
kwinApp
()
->
platform
()
->
touchUp
(
1
,
timestamp
++
);
QCOMPARE
(
kwinApp
()
->
platform
()
->
touchPointCount
(),
2
);
kwinApp
()
->
platform
()
->
cancelTouchSequence
();
QCOMPARE
(
kwinApp
()
->
platform
()
->
touchPointCount
(),
1
);
kwinApp
()
->
platform
()
->
cancelTouchSequence
();
QCOMPARE
(
kwinApp
()
->
platform
()
->
touchPointCount
(),
0
);
}
}
...
...
input.cpp
View file @
93ee2f68
...
...
@@ -2517,6 +2517,11 @@ void InputRedirection::processTouchMotion(qint32 id, const QPointF &pos, quint32
m_touch
->
processMotion
(
id
,
pos
,
time
);
}
void
InputRedirection
::
cancelTouchSequence
()
{
m_touch
->
processCancel
();
}
void
InputRedirection
::
cancelTouch
()
{
m_touch
->
cancel
();
...
...
@@ -2527,6 +2532,11 @@ void InputRedirection::touchFrame()
m_touch
->
frame
();
}
int
InputRedirection
::
touchPointCount
()
{
return
m_touch
->
touchPointCount
();
}
Qt
::
MouseButtons
InputRedirection
::
qtButtonStates
()
const
{
return
m_pointer
->
buttons
();
...
...
input.h
View file @
93ee2f68
...
...
@@ -168,8 +168,14 @@ public:
void
processTouchDown
(
qint32
id
,
const
QPointF
&
pos
,
quint32
time
);
void
processTouchUp
(
qint32
id
,
quint32
time
);
void
processTouchMotion
(
qint32
id
,
const
QPointF
&
pos
,
quint32
time
);
/**
* triggers the same code path as LIBINPUT_TOUCH_CANCEL_EVENT.
* Only intended for autotests
*/
void
cancelTouchSequence
();
void
cancelTouch
();
void
touchFrame
();
int
touchPointCount
();
bool
supportsPointerWarping
()
const
;
void
warpPointer
(
const
QPointF
&
pos
);
...
...
platform.cpp
View file @
93ee2f68
...
...
@@ -311,6 +311,14 @@ void Platform::pointerButtonReleased(quint32 button, quint32 time)
input
()
->
processPointerButton
(
button
,
InputRedirection
::
PointerButtonReleased
,
time
);
}
int
Platform
::
touchPointCount
()
{
if
(
!
input
())
{
return
0
;
}
return
input
()
->
touchPointCount
();
}
void
Platform
::
pointerMotion
(
const
QPointF
&
position
,
quint32
time
)
{
if
(
!
input
())
{
...
...
@@ -319,6 +327,14 @@ void Platform::pointerMotion(const QPointF &position, quint32 time)
input
()
->
processPointerMotion
(
position
,
time
);
}
void
Platform
::
cancelTouchSequence
()
{
if
(
!
input
())
{
return
;
}
input
()
->
cancelTouchSequence
();
}
void
Platform
::
touchCancel
()
{
if
(
!
input
())
{
...
...
platform.h
View file @
93ee2f68
...
...
@@ -483,8 +483,10 @@ public Q_SLOTS:
void
touchDown
(
qint32
id
,
const
QPointF
&
pos
,
quint32
time
);
void
touchUp
(
qint32
id
,
quint32
time
);
void
touchMotion
(
qint32
id
,
const
QPointF
&
pos
,
quint32
time
);
void
cancelTouchSequence
();
void
touchCancel
();
void
touchFrame
();
int
touchPointCount
();
void
processSwipeGestureBegin
(
int
fingerCount
,
quint32
time
);
void
processSwipeGestureUpdate
(
const
QSizeF
&
delta
,
quint32
time
);
...
...
touch_input.h
View file @
93ee2f68
...
...
@@ -71,6 +71,10 @@ public:
return
m_lastPosition
;
}
int
touchPointCount
()
const
{
return
m_touches
;
}
private:
void
cleanupInternalWindow
(
QWindow
*
old
,
QWindow
*
now
)
override
;
void
cleanupDecoration
(
Decoration
::
DecoratedClientImpl
*
old
,
Decoration
::
DecoratedClientImpl
*
now
)
override
;
...
...
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