Add test for TouchInputRedirection::m_touches
parent
3c23194037
commit
93ee2f6815
|
@ -38,6 +38,7 @@ private Q_SLOTS:
|
||||||
void testMultipleTouchPoints();
|
void testMultipleTouchPoints();
|
||||||
void testCancel();
|
void testCancel();
|
||||||
void testTouchMouseAction();
|
void testTouchMouseAction();
|
||||||
|
void testTouchPointCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AbstractClient *showWindow(bool decorated = false);
|
AbstractClient *showWindow(bool decorated = false);
|
||||||
|
@ -263,7 +264,25 @@ void TouchInputTest::testTouchMouseAction()
|
||||||
QCOMPARE(sequenceStartedSpy.count(), 1);
|
QCOMPARE(sequenceStartedSpy.count(), 1);
|
||||||
|
|
||||||
// cleanup
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
10
input.cpp
10
input.cpp
|
@ -2517,6 +2517,11 @@ void InputRedirection::processTouchMotion(qint32 id, const QPointF &pos, quint32
|
||||||
m_touch->processMotion(id, pos, time);
|
m_touch->processMotion(id, pos, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputRedirection::cancelTouchSequence()
|
||||||
|
{
|
||||||
|
m_touch->processCancel();
|
||||||
|
}
|
||||||
|
|
||||||
void InputRedirection::cancelTouch()
|
void InputRedirection::cancelTouch()
|
||||||
{
|
{
|
||||||
m_touch->cancel();
|
m_touch->cancel();
|
||||||
|
@ -2527,6 +2532,11 @@ void InputRedirection::touchFrame()
|
||||||
m_touch->frame();
|
m_touch->frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InputRedirection::touchPointCount()
|
||||||
|
{
|
||||||
|
return m_touch->touchPointCount();
|
||||||
|
}
|
||||||
|
|
||||||
Qt::MouseButtons InputRedirection::qtButtonStates() const
|
Qt::MouseButtons InputRedirection::qtButtonStates() const
|
||||||
{
|
{
|
||||||
return m_pointer->buttons();
|
return m_pointer->buttons();
|
||||||
|
|
6
input.h
6
input.h
|
@ -168,8 +168,14 @@ public:
|
||||||
void processTouchDown(qint32 id, const QPointF &pos, quint32 time);
|
void processTouchDown(qint32 id, const QPointF &pos, quint32 time);
|
||||||
void processTouchUp(qint32 id, quint32 time);
|
void processTouchUp(qint32 id, quint32 time);
|
||||||
void processTouchMotion(qint32 id, const QPointF &pos, 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 cancelTouch();
|
||||||
void touchFrame();
|
void touchFrame();
|
||||||
|
int touchPointCount();
|
||||||
|
|
||||||
bool supportsPointerWarping() const;
|
bool supportsPointerWarping() const;
|
||||||
void warpPointer(const QPointF &pos);
|
void warpPointer(const QPointF &pos);
|
||||||
|
|
16
platform.cpp
16
platform.cpp
|
@ -311,6 +311,14 @@ void Platform::pointerButtonReleased(quint32 button, quint32 time)
|
||||||
input()->processPointerButton(button, InputRedirection::PointerButtonReleased, 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)
|
void Platform::pointerMotion(const QPointF &position, quint32 time)
|
||||||
{
|
{
|
||||||
if (!input()) {
|
if (!input()) {
|
||||||
|
@ -319,6 +327,14 @@ void Platform::pointerMotion(const QPointF &position, quint32 time)
|
||||||
input()->processPointerMotion(position, time);
|
input()->processPointerMotion(position, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Platform::cancelTouchSequence()
|
||||||
|
{
|
||||||
|
if (!input()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
input()->cancelTouchSequence();
|
||||||
|
}
|
||||||
|
|
||||||
void Platform::touchCancel()
|
void Platform::touchCancel()
|
||||||
{
|
{
|
||||||
if (!input()) {
|
if (!input()) {
|
||||||
|
|
|
@ -483,8 +483,10 @@ public Q_SLOTS:
|
||||||
void touchDown(qint32 id, const QPointF &pos, quint32 time);
|
void touchDown(qint32 id, const QPointF &pos, quint32 time);
|
||||||
void touchUp(qint32 id, quint32 time);
|
void touchUp(qint32 id, quint32 time);
|
||||||
void touchMotion(qint32 id, const QPointF &pos, quint32 time);
|
void touchMotion(qint32 id, const QPointF &pos, quint32 time);
|
||||||
|
void cancelTouchSequence();
|
||||||
void touchCancel();
|
void touchCancel();
|
||||||
void touchFrame();
|
void touchFrame();
|
||||||
|
int touchPointCount();
|
||||||
|
|
||||||
void processSwipeGestureBegin(int fingerCount, quint32 time);
|
void processSwipeGestureBegin(int fingerCount, quint32 time);
|
||||||
void processSwipeGestureUpdate(const QSizeF &delta, quint32 time);
|
void processSwipeGestureUpdate(const QSizeF &delta, quint32 time);
|
||||||
|
|
|
@ -71,6 +71,10 @@ public:
|
||||||
return m_lastPosition;
|
return m_lastPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int touchPointCount() const {
|
||||||
|
return m_touches;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void cleanupInternalWindow(QWindow *old, QWindow *now) override;
|
void cleanupInternalWindow(QWindow *old, QWindow *now) override;
|
||||||
void cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) override;
|
void cleanupDecoration(Decoration::DecoratedClientImpl *old, Decoration::DecoratedClientImpl *now) override;
|
||||||
|
|
Loading…
Reference in New Issue