Remove circular dependency in testlib logging
authorJason McDonald <jason.mcdonald@nokia.com>
Thu, 1 Sep 2011 08:24:55 +0000 (18:24 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 2 Sep 2011 04:16:11 +0000 (06:16 +0200)
Remove one of the circular dependencies between QPlainTestLogger and
QTestLog by directly checking whether we're writing to stdout rather
than inferring the same by examining whether the output file name is
null.

Change-Id: I798288482c9e2e071e17a8622e8a8f8d5016dc7e
Reviewed-on: http://codereview.qt.nokia.com/4052
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
src/testlib/qabstracttestlogger_p.h
src/testlib/qplaintestlogger.cpp

index 3ac6787..47f772e 100644 (file)
@@ -98,7 +98,7 @@ public:
 
     void outputString(const char *msg);
 
-private:
+protected:
     FILE *stream;
 };
 
index bd1bc11..6dc2135 100644 (file)
@@ -211,7 +211,7 @@ void QPlainTestLogger::outputMessage(const char *str)
         OutputDebugString((wchar_t*)tmp.utf16());
         strUtf16.remove(0, maxOutputLength);
     } while (!strUtf16.isEmpty());
-    if (QTestLog::outputFileName())
+    if (stream != stdout)
 #elif defined(Q_OS_WIN)
     EnterCriticalSection(&QTest::outputCriticalSection);
     // OutputDebugString is not threadsafe