From bfbb985ed5d283114dbe37e6a42a3c19a61cd0d2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 17 Dec 2014 13:47:19 +0100 Subject: Add some debug information to tst_qwindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test still fails sporadically at a new place, so this adds some debug information when it fails to may help us identify what is going wrong. Change-Id: Ife0f171299ef7e800a2d808602e76ca2f3885964 Reviewed-by: Jørgen Lind --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/gui') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 2b28f0a1d4..a5442968c6 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -154,6 +154,7 @@ public: void reset() { m_received.clear(); + m_framePositionsOnMove.clear(); } bool event(QEvent *event) @@ -162,6 +163,8 @@ public: m_order << event->type(); if (event->type() == QEvent::Expose) m_exposeRegion = static_cast(event)->region(); + else if (event->type() == QEvent::Move) + m_framePositionsOnMove << framePosition(); return QWindow::event(event); } @@ -181,6 +184,7 @@ public: return m_exposeRegion; } + QVector m_framePositionsOnMove; private: QHash m_received; QVector m_order; @@ -304,9 +308,17 @@ void tst_QWindow::positioning() QPoint framePos = QPlatformScreen::platformScreenForWindow(&window)->availableGeometry().center(); window.reset(); + const QPoint oldFramePos = window.framePosition(); window.setFramePosition(framePos); QTRY_VERIFY(window.received(QEvent::Move)); + if (window.framePosition() != framePos) { + qDebug() << "About to fail auto-test. Here is some additional information:"; + qDebug() << "window.framePosition() == " << window.framePosition(); + qDebug() << "old frame position == " << oldFramePos; + qDebug() << "We received " << window.received(QEvent::Move) << " move events"; + qDebug() << "frame positions after each move event:" << window.m_framePositionsOnMove; + } QTRY_COMPARE(framePos, window.framePosition()); QTRY_COMPARE(originalMargins, window.frameMargins()); QCOMPARE(window.position(), window.framePosition() + QPoint(originalMargins.left(), originalMargins.top())); -- cgit v1.2.3