diff options
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index ed26c406a5..04f51cbb03 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -237,6 +237,7 @@ namespace QTest static int keyDelay = -1; static int mouseDelay = -1; static int eventDelay = -1; + static int timeout = -1; static bool noCrashHandler = false; /*! \internal @@ -288,6 +289,18 @@ int Q_TESTLIB_EXPORT defaultKeyDelay() return keyDelay; } +static int defaultTimeout() +{ + if (timeout == -1) { + bool ok = false; + timeout = qEnvironmentVariableIntValue("QTEST_FUNCTION_TIMEOUT", &ok); + + if (!ok || timeout <= 0) + timeout = 5*60*1000; + } + return timeout; +} + Q_TESTLIB_EXPORT bool printAvailableFunctions = false; Q_TESTLIB_EXPORT QStringList testFunctions; Q_TESTLIB_EXPORT QStringList testTags; @@ -865,7 +878,7 @@ public: void beginTest() { QMutexLocker locker(&mutex); - timeout.store(5*60*1000); + timeout.store(defaultTimeout()); waitCondition.wakeAll(); } |