summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r--src/testlib/qtestlog.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index aa56e6c..bcb1c1b 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -46,7 +46,6 @@
#include "QtTest/private/qabstracttestlogger_p.h"
#include "QtTest/private/qplaintestlogger_p.h"
#include "QtTest/private/qxmltestlogger_p.h"
-
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
@@ -54,6 +53,9 @@
#include <string.h>
#include <limits.h>
+
+#include "qtestlogger_p.h"
+
QT_BEGIN_NAMESPACE
namespace QTest {
@@ -83,6 +85,7 @@ namespace QTest {
static IgnoreResultList *ignoreResultList = 0;
static QTestLog::LogMode logMode = QTestLog::Plain;
+ static QTestLog::FlushMode flushMode = QTestLog::NoFlush;
static int verbosity = 0;
static int maxWarnings = 2002;
@@ -270,15 +273,24 @@ void QTestLog::startLogging()
QTEST_ASSERT(!QTest::testLogger);
switch (QTest::logMode) {
- case QTestLog::Plain:
- QTest::testLogger = new QPlainTestLogger();
- break;
- case QTestLog::XML:
- QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
- break;
- case QTestLog::LightXML:
- QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
- }
+ case QTestLog::Plain:
+ QTest::testLogger = new QPlainTestLogger;
+ break;
+ case QTestLog::XML:{
+ if(QTest::flushMode == QTestLog::FLushOn)
+ QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete);
+ else
+ QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML);
+ break;
+ }case QTestLog::LightXML:{
+ if(QTest::flushMode == QTestLog::FLushOn)
+ QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light);
+ else
+ QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml);
+ break;
+ }case QTestLog::XunitXML:
+ QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml);
+ }
QTest::testLogger->startLogging();
@@ -361,4 +373,9 @@ void QTestLog::setMaxWarnings(int m)
QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2;
}
+void QTestLog::setFlushMode(FlushMode mode)
+{
+ QTest::flushMode = mode;
+}
+
QT_END_NAMESPACE