diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-08-24 17:14:21 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-29 03:40:27 +0200 |
commit | 865c27460e9779e7e4cafea84db843c3c5b26765 (patch) | |
tree | afd0c83b0c88679ab405ef5de98d710fd9d36cb7 /src/testlib/qabstracttestlogger.cpp | |
parent | 14c2d4700cf62e8f0a58f206525ab651aad8464c (diff) |
Remove circular dependency in testlib logging code
Pass the output file name from the QTestLog to the test logger when
commencing logging rather than having the logger call back into the
QTestLog.
Change-Id: Id484635f9fcfca08a66c92f3442887e9473b6f9b
Reviewed-on: http://codereview.qt.nokia.com/3454
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'src/testlib/qabstracttestlogger.cpp')
-rw-r--r-- | src/testlib/qabstracttestlogger.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp index 735ad0122a..1e95471e70 100644 --- a/src/testlib/qabstracttestlogger.cpp +++ b/src/testlib/qabstracttestlogger.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "QtTest/private/qabstracttestlogger_p.h" -#include "QtTest/private/qtestlog_p.h" #include "QtTest/qtestassert.h" #include "QtCore/qbytearray.h" @@ -81,22 +80,21 @@ bool QAbstractTestLogger::isTtyOutput() } -void QAbstractTestLogger::startLogging() +void QAbstractTestLogger::startLogging(const char *filename) { QTEST_ASSERT(!QTest::stream); - const char *out = QTestLog::outputFileName(); - if (!out) { + if (!filename) { QTest::stream = stdout; return; } #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) - if (::fopen_s(&QTest::stream, out, "wt")) { + if (::fopen_s(&QTest::stream, filename, "wt")) { #else - QTest::stream = ::fopen(out, "wt"); + QTest::stream = ::fopen(filename, "wt"); if (!QTest::stream) { #endif - printf("Unable to open file for logging: %s", out); + printf("Unable to open file for logging: %s", filename); ::exit(1); } } |