summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-08-01 15:39:22 -0700
committerThiago Macieira <thiago.macieira@intel.com>2014-09-23 17:44:56 +0200
commit0048127c941e365d69837e9bdd4cf58dc7c085ae (patch)
treef33d1dd8bb2c8586693df5620c7de3989208dbcf /src/testlib
parent85ad88b06485451b018cef2a5bddae4410d91a35 (diff)
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>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp6
1 files changed, 6 insertions, 0 deletions
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;