summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-09-04 10:57:42 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-09-10 14:22:53 +0200
commit813365f472cf3b955d0985f83d0169016806cc36 (patch)
treeaee72494c5c5524b207b377987b1f0775b68822d /tests
parentb1a534a536892035fdf1e826a066bda6ab34b93a (diff)
Add client test for floating point mouse press
Change-Id: Ia7cfb1bc86945e08a2ff2c794afb405110e819f9 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/seatv4/tst_seatv4.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/client/seatv4/tst_seatv4.cpp b/tests/auto/client/seatv4/tst_seatv4.cpp
index 7dc2e727a..1d6fb6b9c 100644
--- a/tests/auto/client/seatv4/tst_seatv4.cpp
+++ b/tests/auto/client/seatv4/tst_seatv4.cpp
@@ -72,6 +72,7 @@ private slots:
void usesEnterSerial();
void focusDestruction();
void mousePress();
+ void mousePressFloat();
void simpleAxis_data();
void simpleAxis();
void invalidPointerEvents();
@@ -207,6 +208,30 @@ void tst_seatv4::mousePress()
QTRY_VERIFY(window.m_pressed);
}
+void tst_seatv4::mousePressFloat()
+{
+ class Window : public QRasterWindow {
+ public:
+ void mousePressEvent(QMouseEvent *e) override { m_position = e->localPos(); }
+ QPointF m_position;
+ };
+
+ Window window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ pointer()->sendEnter(surface, {32.75, 32.25});
+ pointer()->sendButton(client(), BTN_LEFT, 1);
+ pointer()->sendButton(client(), BTN_LEFT, 0);
+ });
+ QMargins m = window.frameMargins();
+ QPointF pressedPosition(32.75 -m.left(), 32.25 - m.top());
+ QTRY_COMPARE(window.m_position, pressedPosition);
+}
+
void tst_seatv4::simpleAxis_data()
{
QTest::addColumn<uint>("axis");