diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-09-04 10:57:42 +0200 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-09-10 14:22:53 +0200 |
commit | 813365f472cf3b955d0985f83d0169016806cc36 (patch) | |
tree | aee72494c5c5524b207b377987b1f0775b68822d | |
parent | b1a534a536892035fdf1e826a066bda6ab34b93a (diff) | |
download | qtwayland-813365f472cf3b955d0985f83d0169016806cc36.tar.gz |
Add client test for floating point mouse press
Change-Id: Ia7cfb1bc86945e08a2ff2c794afb405110e819f9
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | tests/auto/client/seatv4/tst_seatv4.cpp | 25 |
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 7dc2e727..1d6fb6b9 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"); |