Initialize certain Qt environment variables in testcases

QtTest has its own logging environment, such as XML output, so we don't
want to have messages formatted differently than expected or sent to an
unexpected place.

Change-Id: If665c9d7121267269e5b2063f49468eb2b9b9d08
Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
Thiago Macieira 2014-08-01 15:39:22 -07:00
parent 85ad88b064
commit 0048127c94

View File

@ -2372,6 +2372,11 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
}
#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT
static void initEnvironment()
{
qputenv("QT_LOGGING_TO_CONSOLE", "1");
}
/*!
Executes tests declared in \a testObject. In addition, the private slots
\c{initTestCase()}, \c{cleanupTestCase()}, \c{init()} and \c{cleanup()}
@ -2412,6 +2417,7 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
int QTest::qExec(QObject *testObject, int argc, char **argv)
{
initEnvironment();
QBenchmarkGlobalData benchmarkData;
QBenchmarkGlobalData::current = &benchmarkData;