From 0048127c941e365d69837e9bdd4cf58dc7c085ae Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Aug 2014 15:39:22 -0700 Subject: [PATCH] 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 --- src/testlib/qtestcase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 5d5b298740..67111d1642 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -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;