QAbstractTestLogger Class Reference

#include <qabstracttestlogger_p.h>

Inheritance diagram for QAbstractTestLogger:

Inheritance graph
[legend]
List of all members.

Detailed Description

Definition at line 38 of file qabstracttestlogger_p.h.

Public Types

enum  IncidentTypes
enum  MessageTypes

Public Member Functions

 QAbstractTestLogger ()
virtual ~QAbstractTestLogger ()
virtual void startLogging ()
virtual void stopLogging ()
virtual void enterTestFunction (const char *function)=0
virtual void leaveTestFunction ()=0
virtual void addIncident (IncidentTypes type, const char *description, const char *file=0, int line=0)=0
virtual void addMessage (MessageTypes type, const char *message, const char *file=0, int line=0)=0

Static Public Member Functions

static void outputString (const char *msg)
static bool isTtyOutput ()


Member Enumeration Documentation

enum QAbstractTestLogger::IncidentTypes

Definition at line 41 of file qabstracttestlogger_p.h.

00041                        {
00042         Pass,
00043         XFail,
00044         Fail,
00045         XPass
00046     };

enum QAbstractTestLogger::MessageTypes

Definition at line 48 of file qabstracttestlogger_p.h.

00048                       {
00049         Warn,
00050         QWarning,
00051         QDebug,
00052         QSystem,
00053         QFatal,
00054         Skip,
00055         Info
00056     };


Constructor & Destructor Documentation

QAbstractTestLogger::QAbstractTestLogger (  )  [inline]

Definition at line 58 of file qabstracttestlogger_p.h.

00058 {}

virtual QAbstractTestLogger::~QAbstractTestLogger (  )  [inline, virtual]

Definition at line 59 of file qabstracttestlogger_p.h.

00059 {}


Member Function Documentation

void QAbstractTestLogger::startLogging (  )  [virtual]

Definition at line 60 of file qabstracttestlogger.cpp.

References QTestLog::outputFileName(), printf, QTEST_ASSERT, and QTest::stream.

Referenced by QTestLog::startLogging(), QPlainTestLogger::startLogging(), and QXmlTestLogger::startLogging().

00061 {
00062     QTEST_ASSERT(!QTest::stream);
00063 
00064     const char *out = QTestLog::outputFileName();
00065     if (!out) {
00066         QTest::stream = stdout;
00067         return;
00068     }
00069 #if defined(_MSC_VER) && _MSC_VER >= 1400
00070     if (::fopen_s(&QTest::stream, out, "wt")) {
00071 #else
00072     QTest::stream = ::fopen(out, "wt");
00073     if (!QTest::stream) {
00074 #endif
00075         printf("Unable to open file for logging: %s", out);
00076         ::exit(1);
00077     }
00078 }

Here is the call graph for this function:

void QAbstractTestLogger::stopLogging (  )  [virtual]

Definition at line 80 of file qabstracttestlogger.cpp.

References QTEST_ASSERT, and QTest::stream.

Referenced by QPlainTestLogger::stopLogging(), QXmlTestLogger::stopLogging(), and QTestLog::stopLogging().

00081 {
00082     QTEST_ASSERT(QTest::stream);
00083     if (QTest::stream != stdout)
00084         fclose(QTest::stream);
00085     QTest::stream = 0;
00086 }

virtual void QAbstractTestLogger::enterTestFunction ( const char *  function  )  [pure virtual]

Referenced by QTestLog::enterTestFunction().

virtual void QAbstractTestLogger::leaveTestFunction (  )  [pure virtual]

Referenced by QTestLog::leaveTestFunction().

virtual void QAbstractTestLogger::addIncident ( IncidentTypes  type,
const char *  description,
const char *  file = 0,
int  line = 0 
) [pure virtual]

Referenced by QTestLog::addFail(), QTestLog::addPass(), QTestLog::addXFail(), and QTestLog::addXPass().

virtual void QAbstractTestLogger::addMessage ( MessageTypes  type,
const char *  message,
const char *  file = 0,
int  line = 0 
) [pure virtual]

Referenced by QTestLog::addSkip(), QTestLog::info(), QTest::messageHandler(), QTestLog::printUnhandledIgnoreMessages(), and QTestLog::warn().

void QAbstractTestLogger::outputString ( const char *  msg  )  [static]

Definition at line 40 of file qabstracttestlogger.cpp.

References QTEST_ASSERT, and QTest::stream.

Referenced by QXmlTestLogger::addIncident(), QXmlTestLogger::addMessage(), QXmlTestLogger::enterTestFunction(), QXmlTestLogger::leaveTestFunction(), QTest::outputMessage(), QXmlTestLogger::startLogging(), and QXmlTestLogger::stopLogging().

00041 {
00042     QTEST_ASSERT(QTest::stream);
00043 
00044     ::fputs(msg, QTest::stream);
00045     ::fflush(QTest::stream);
00046 }

bool QAbstractTestLogger::isTtyOutput (  )  [static]

Definition at line 48 of file qabstracttestlogger.cpp.

References QTEST_ASSERT, and QTest::stream.

00049 {
00050     QTEST_ASSERT(QTest::stream);
00051 
00052 #ifdef Q_OS_WIN
00053     return true;
00054 #else
00055     static bool ttyoutput = isatty(fileno(QTest::stream));
00056     return ttyoutput;
00057 #endif
00058 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 16:45:01 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1