summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-04-04 15:41:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-04 16:31:27 +0200
commit19ff7d038fbc7117d2bfddb6f2ad27b1fdd84acb (patch)
tree10fb277614f67ae48b441f186725576b74b47ec7 /src
parentf0dbc6b37e9e9ab5bde07be09ad0dbb68c12c024 (diff)
Increase tolerance for warning about QTest::qSleep() for Windows.
50% is too strict, it clutters the logs. Change-Id: Ib391064f32e39a1192e77d872cd99b7f95a5065a Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Diffstat (limited to 'src')
-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__);