From ca14151a0cdd3bc5fa364b2816bcd3b51af4bf3d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 7 Aug 2018 11:01:18 +0200 Subject: [PATCH] tst_qspinbox: include actual emission count in failure message It's useful to know how many times the signal was emitted, because it gives us insight into why the test may have failed, especially when it's difficult to reproduce. Task-number: QTBUG-69492 Change-Id: I94796ed880512b060e0a724c87edde8c3b91bb7c Reviewed-by: Simon Hausmann --- tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 22ca608e34..5a51bab51f 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -1786,7 +1786,8 @@ void tst_QSpinBox::stepModifierPressAndHold() QStyle::CC_SpinBox, &spinBoxStyleOption, subControl, &spin); QTest::mousePress(&spin, Qt::LeftButton, modifiers, buttonRect.center()); - QTRY_VERIFY(spy.length() >= 3); + 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()))); QTest::mouseRelease(&spin, Qt::LeftButton, modifiers, buttonRect.center()); const auto value = spy.last().at(0);