summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-12-13 09:05:51 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-12-13 14:39:34 +0000
commit95dc3fd02ea3d1bea74e92b6d21c54758c461cd5 (patch)
treec4ace41453bc6c4d8072fc2c245cf4ec06d5df2f
parente43b099499d31ac6a03199ee09e8fb243f181ceb (diff)
downloadqtwayland-95dc3fd02ea3d1bea74e92b6d21c54758c461cd5.tar.gz
Client tests: Add simple test for mouse click
Change-Id: I2eb9bf8aa03e8df61a26d26da061f4030d8de0be Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--tests/auto/client/seatv4/tst_seatv4.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/client/seatv4/tst_seatv4.cpp b/tests/auto/client/seatv4/tst_seatv4.cpp
index a95dbfcc..0e0ada5d 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<uint>("axis");