Client tests: Add simple test for mouse click
Change-Id: I2eb9bf8aa03e8df61a26d26da061f4030d8de0be Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
98b7643fdd
commit
ed34fa051d
@ -62,6 +62,7 @@ private slots:
|
|||||||
void createsPointer();
|
void createsPointer();
|
||||||
void setsCursorOnEnter();
|
void setsCursorOnEnter();
|
||||||
void usesEnterSerial();
|
void usesEnterSerial();
|
||||||
|
void mousePress();
|
||||||
void simpleAxis_data();
|
void simpleAxis_data();
|
||||||
void simpleAxis();
|
void simpleAxis();
|
||||||
void invalidPointerEvents();
|
void invalidPointerEvents();
|
||||||
@ -114,6 +115,28 @@ void tst_seatv4::usesEnterSerial()
|
|||||||
QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial);
|
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()
|
void tst_seatv4::simpleAxis_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<uint>("axis");
|
QTest::addColumn<uint>("axis");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user