Add some debug information to tst_qwindow
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 <jorgen.lind@theqtcompany.com>
This commit is contained in:
parent
7f6c4390ec
commit
bfbb985ed5
@ -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<QExposeEvent *>(event)->region();
|
||||
else if (event->type() == QEvent::Move)
|
||||
m_framePositionsOnMove << framePosition();
|
||||
|
||||
return QWindow::event(event);
|
||||
}
|
||||
@ -181,6 +184,7 @@ public:
|
||||
return m_exposeRegion;
|
||||
}
|
||||
|
||||
QVector<QPoint> m_framePositionsOnMove;
|
||||
private:
|
||||
QHash<QEvent::Type, int> m_received;
|
||||
QVector<QEvent::Type> 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()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user