From 66c77bcd31fc2a36d9cbdc65f1bba8f58f3db630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 4 Feb 2016 15:07:03 +0100 Subject: [PATCH] [autotest] Move window through decoration Interestingly just trigger the move and instant release doesn't move the window. --- autotests/wayland/decoration_input_test.cpp | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/autotests/wayland/decoration_input_test.cpp b/autotests/wayland/decoration_input_test.cpp index aa73a64e3d..c9fde23ff9 100644 --- a/autotests/wayland/decoration_input_test.cpp +++ b/autotests/wayland/decoration_input_test.cpp @@ -58,6 +58,7 @@ private Q_SLOTS: void testAxis(); void testDoubleClick(); void testHover(); + void testPressToMove(); private: AbstractClient *showWindow(); @@ -326,6 +327,48 @@ void DecorationInputTest::testHover() QCOMPARE(c->cursor(), Qt::ArrowCursor); } +void DecorationInputTest::testPressToMove() +{ + AbstractClient *c = showWindow(); + QVERIFY(c); + QVERIFY(c->isDecorated()); + QVERIFY(!c->noBorder()); + QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); + QVERIFY(startMoveResizedSpy.isValid()); + QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized); + QVERIFY(clientFinishUserMovedResizedSpy.isValid()); + + quint32 timestamp = 1; + MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2)); + QCOMPARE(c->cursor(), Qt::ArrowCursor); + + PRESS; + QVERIFY(!c->isMove()); + MOTION(QPoint(c->geometry().center().x() + 10, c->clientPos().y() / 2)); + const int oldX = c->x(); + QTRY_VERIFY(c->isMove()); + QCOMPARE(startMoveResizedSpy.count(), 1); + + RELEASE; + QTRY_VERIFY(!c->isMove()); + QCOMPARE(clientFinishUserMovedResizedSpy.count(), 1); + QEXPECT_FAIL("", "Just trigger move doesn't move the window", Continue); + QCOMPARE(c->x(), oldX + 10); + + // again + PRESS; + QVERIFY(!c->isMove()); + MOTION(QPoint(c->geometry().center().x() + 20, c->clientPos().y() / 2)); + QTRY_VERIFY(c->isMove()); + QCOMPARE(startMoveResizedSpy.count(), 2); + MOTION(QPoint(c->geometry().center().x() + 30, c->clientPos().y() / 2)); + + RELEASE; + QTRY_VERIFY(!c->isMove()); + QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); + QCOMPARE(c->x(), oldX + 20); +} + } WAYLANTEST_MAIN(KWin::DecorationInputTest)