[autotest] Move window through decoration

Interestingly just trigger the move and instant release doesn't move
the window.
This commit is contained in:
Martin Gräßlin 2016-02-04 15:07:03 +01:00
parent a9f48ec62c
commit 66c77bcd31

View file

@ -58,6 +58,7 @@ private Q_SLOTS:
void testAxis(); void testAxis();
void testDoubleClick(); void testDoubleClick();
void testHover(); void testHover();
void testPressToMove();
private: private:
AbstractClient *showWindow(); AbstractClient *showWindow();
@ -326,6 +327,48 @@ void DecorationInputTest::testHover()
QCOMPARE(c->cursor(), Qt::ArrowCursor); 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) WAYLANTEST_MAIN(KWin::DecorationInputTest)