summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 3ab3fcc44c..cbf479f1d2 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2878,7 +2878,12 @@ void QTest::qSleep(int ms)
// requested time.
qint64 requested = 1000000 * (qint64)ms;
qint64 diff = timer.nsecsElapsed() - requested;
- if (diff * 2 > requested || diff * 10 < -requested) {
+#ifndef Q_OS_WIN
+ const qint64 factor = 2; // more than 50% longer
+#else
+ const qint64 factor = 1; // Windows: 50% is quite common, warn about 100%
+#endif
+ if (diff * factor > requested || diff * 10 < -requested) {
QTestLog::warn(qPrintable(
QString::fromLatin1("QTest::qSleep() should have taken %1ns, but actually took %2ns!")
.arg(requested).arg(diff + requested)), __FILE__, __LINE__);