From 95dc3fd02ea3d1bea74e92b6d21c54758c461cd5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Dec 2018 09:05:51 +0100 Subject: Client tests: Add simple test for mouse click Change-Id: I2eb9bf8aa03e8df61a26d26da061f4030d8de0be Reviewed-by: Paul Olav Tvete --- tests/auto/client/seatv4/tst_seatv4.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/auto/client/seatv4/tst_seatv4.cpp b/tests/auto/client/seatv4/tst_seatv4.cpp index a95dbfcc2..0e0ada5d0 100644 --- a/tests/auto/client/seatv4/tst_seatv4.cpp +++ b/tests/auto/client/seatv4/tst_seatv4.cpp @@ -62,6 +62,7 @@ private slots: void createsPointer(); void setsCursorOnEnter(); void usesEnterSerial(); + void mousePress(); void simpleAxis_data(); void simpleAxis(); void invalidPointerEvents(); @@ -114,6 +115,28 @@ void tst_seatv4::usesEnterSerial() QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); } +void tst_seatv4::mousePress() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_pressed = true; } + bool m_pressed = false; + }; + + 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, 32}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + QTRY_VERIFY(window.m_pressed); +} + void tst_seatv4::simpleAxis_data() { QTest::addColumn("axis"); -- cgit v1.2.3