Add debugging output to help diagnose cause of tst_qspinbox failure

I've tried to reproduce the failures in the CI a couple of times now,
but it keeps passing. Let's leave some debug output in the test so
that if/when it does fail, we might know a bit more about why it does
so.

Task-number: QTBUG-69492
Change-Id: I5b39ac692e9026ce4b25cd13d342b11e061b777b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Nathan Collins <nathan.collins@kdab.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Mitch Curtis 2018-08-07 11:06:35 +02:00
parent 32f1bf0cac
commit 37bb907a92

View File

@ -1775,6 +1775,10 @@ void tst_QSpinBox::stepModifierPressAndHold()
spin.setStyle(stepModifierStyle.data());
QSignalSpy spy(&spin, QOverload<int>::of(&SpinBox::valueChanged));
// TODO: remove debug output when QTBUG-69492 is fixed
connect(&spin, QOverload<int>::of(&SpinBox::valueChanged), [=]() {
qDebug() << QTime::currentTime() << "valueChanged emitted";
});
spin.show();
QVERIFY(QTest::qWaitForWindowActive(&spin));
@ -1785,6 +1789,9 @@ void tst_QSpinBox::stepModifierPressAndHold()
const QRect buttonRect = spin.style()->subControlRect(
QStyle::CC_SpinBox, &spinBoxStyleOption, subControl, &spin);
// TODO: remove debug output when QTBUG-69492 is fixed
qDebug() << "QGuiApplication::focusWindow():" << QGuiApplication::focusWindow();
qDebug() << "QGuiApplication::topLevelWindows():" << QGuiApplication::topLevelWindows();
QTest::mousePress(&spin, Qt::LeftButton, modifiers, buttonRect.center());
QTRY_VERIFY2(spy.length() >= 3, qPrintable(QString::fromLatin1(
"Expected valueChanged() to be emitted 3 or more times, but it was only emitted %1 times").arg(spy.length())));