Add client test for floating point touch

Task-number: QTBUG-77457
Change-Id: I49df80f3e00d349fed273363cd2625b841c085c5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-09-04 11:13:46 +02:00
parent 582bdeb65c
commit 527a890cd3

View File

@ -68,6 +68,7 @@ private slots:
// Touch tests
void createsTouch();
void singleTap();
void singleTapFloat();
};
void tst_seatv5::bindsToSeat()
@ -431,5 +432,36 @@ void tst_seatv5::singleTap()
}
}
void tst_seatv5::singleTapFloat()
{
TouchWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
exec([=] {
auto *t = touch();
auto *c = client();
t->sendDown(xdgToplevel()->surface(), {32.75, 32.25}, 1);
t->sendFrame(c);
t->sendUp(c, 1);
t->sendFrame(c);
});
QTRY_VERIFY(!window.m_events.empty());
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchBegin);
QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed);
QCOMPARE(e.touchPoints.length(), 1);
QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchEnd);
QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased);
QCOMPARE(e.touchPoints.length(), 1);
QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
}
}
QCOMPOSITOR_TEST_MAIN(tst_seatv5)
#include "tst_seatv5.moc"