diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-09 00:44:24 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-13 14:21:22 +0200 |
commit | b5552bab40f2e165cf7196993ffc83785f4d8264 (patch) | |
tree | 5ca863fc90caacebd7bd5ebd2464d4b18efdd0dc /src/testlib | |
parent | 9cfdd66b6452704349b5f986f31b7f1f03748cb5 (diff) | |
parent | 01ce104a3ee3c8af68f6694840931661666984ab (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Manually changed enum to LibGL in
src/plugins/platforms/xcb/qglxintegration.cpp
Change-Id: If34ee6cce3d1d51fb4bb1fdfa59c30389ea0d207
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtest.h | 10 | ||||
-rw-r--r-- | src/testlib/qtestcase.cpp | 16 |
2 files changed, 8 insertions, 18 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 7c9a7b2b3f..7d2f3cea72 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -201,11 +201,17 @@ inline bool qCompare(QList<T> const &t1, QList<T> const &t2, const char *actual, } for (int i = 0; isOk && i < actualSize; ++i) { if (!(t1.at(i) == t2.at(i))) { + char *val1 = toString(t1.at(i)); + char *val2 = toString(t2.at(i)); + qsnprintf(msg, sizeof(msg), "Compared lists differ at index %d.\n" " Actual (%s): %s\n" - " Expected (%s): %s", i, actual, toString(t1.at(i)), - expected, toString(t2.at(i))); + " Expected (%s): %s", i, actual, val1 ? val1 : "<null>", + expected, val2 ? val2 : "<null>"); isOk = false; + + delete [] val1; + delete [] val2; } } return compare_helper(isOk, msg, 0, 0, actual, expected, file, line); diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index cbf479f1d2..cc58b51743 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2863,8 +2863,6 @@ bool QTest::currentTestFailed() void QTest::qSleep(int ms) { QTEST_ASSERT(ms > 0); - QElapsedTimer timer; - timer.start(); #if defined(Q_OS_WINRT) WaitForSingleObjectEx(GetCurrentThread(), ms, true); @@ -2874,20 +2872,6 @@ void QTest::qSleep(int ms) struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); #endif - // Warn if the elapsed time was more than 50% longer or more than 10% shorter than the - // requested time. - qint64 requested = 1000000 * (qint64)ms; - qint64 diff = timer.nsecsElapsed() - 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__); - } } /*! \internal |