diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-12 13:58:03 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-12 14:07:05 +0200 |
commit | 1abea5f5f13b4b8ec2a1c282e643b791cea12f30 (patch) | |
tree | a17bed5434679de1db92777e237c8a878d03e732 /src/testlib | |
parent | a7b85e59931443dd33adeb02c7201c1bd1d7cd1d (diff) |
Partially revert "Inline QTest::qSleep()"
This change partially reverts change
a0e0b51001edfc1c7aea113c472ce995efa833fd.
Replacing the QTest specific sleep function with QThread::msleep()
was not a good idea. The reason is that QThread::msleep() will force
the thread to sleep to x mseconds, even if a signal woke the thread
in the meantime.
This would cause qWaitFor() to not call processEvents(), in some cases,
leading to flakyness and test failures in tests that rely on timing,
such as the animation tests in Qt Qml.
Change-Id: I0ad132cdf32be5813b2e73552d772251fe1d7f89
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtestcase.cpp | 18 | ||||
-rw-r--r-- | src/testlib/qtestcase.h | 1 |
2 files changed, 0 insertions, 19 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index c2b33019b2..0202915e67 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2474,24 +2474,6 @@ bool QTest::currentTestFailed() return QTestResult::currentTestFailed(); } -/*! - Sleeps for \a ms milliseconds, blocking execution of the - test. qSleep() will not do any event processing and leave your test - unresponsive. Network communication might time out while - sleeping. Use \l {QTest::qWait()} to do non-blocking sleeping. - - \a ms must be greater than 0. - - \b {Note:} The qSleep() function calls either \c nanosleep() on - unix or \c Sleep() on windows, so the accuracy of time spent in - qSleep() depends on the operating system. - - Example: - \snippet code/src_qtestlib_qtestcase.cpp 23 - - \sa {QTest::qWait()} -*/ - /*! \internal */ QObject *QTest::testObject() diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 6fe962277a..e6a2b01c95 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -336,7 +336,6 @@ namespace QTest char *val1, char *val2, const char *actual, const char *expected, const char *file, int line); - inline void qSleep(int ms) { QThread::msleep(ms); } Q_TESTLIB_EXPORT void addColumnInternal(int id, const char *name); template <typename T> |