4#include <QtTest/private/qabstracttestlogger_p.h>
5#include <QtTest/qtestassert.h>
9#include <QtCore/qbytearray.h>
10#include <QtCore/qstring.h>
120 if (::fopen_s(&
stream, filename,
"wt")) {
122 stream = ::fopen(filename,
"wt");
125 fprintf(stderr,
"Unable to open file for logging: %s\n", filename);
131 ::chmod(filename, 0666);
166 unsigned char *idx =
reinterpret_cast<unsigned char *
>(
str);
168 if (((*idx < 0x20 && *idx !=
'\n' && *idx !=
'\t') || *idx == 0x7f))
186 char *filtered =
new char[strlen(msg) + 1];
187 strcpy(filtered, msg);
190 ::fputs(filtered,
stream);
374 constexpr int MAXSIZE = 1024 * 1024 * 2;
406 }
while (size <= MAXSIZE && str->
reset(
size));
421 const char *testFuctionStart = parts &
TestFunction ?
"(" :
"";
422 const char *testFuctionEnd = parts &
TestFunction ?
")" :
"";
426 const char *tagFiller = (dataTag[0] && globalDataTag[0]) ?
":" :
"";
429 testObject, objectFunctionFiller, testFunction, testFuctionStart,
430 globalDataTag, tagFiller, dataTag, testFuctionEnd);
437 const int max =
buf.size();
438 return max > 0 ? int(
qstrnlen(
buf.constData(), max)) : 0;
440 const int extra =
bufsize(more);
445 const int newsize =
oldsize + extra + 1;
446 if (newsize > MAXSIZE || !accumulator->
resize(newsize))
void outputString(const char *msg)
Convenience method to write msg to the output stream.
virtual ~QAbstractTestLogger()
Destroys the logger object.
virtual void addBenchmarkResult(const QBenchmarkResult &result)=0
This virtual method is called after a benchmark has been run enough times to produce usable data.
bool isLoggingToStdout() const
Returns true if the output stream is standard output.
QAbstractTestLogger(const char *filename)
Constructs the base-class parts of the logger.
virtual void startLogging()
Called before the start of a test run.
virtual void addMessage(QtMsgType, const QMessageLogContext &, const QString &)
This is an overloaded member function, provided for convenience. It differs from the above function o...
MessageTypes
The members whose names begin with Q describe messages that originate in calls, by the test or code u...
void filterUnprintable(char *str) const
Helper utility to blot out unprintable characters in str.
virtual void addBenchmarkResults(const QList< QBenchmarkResult > &result)
virtual void stopLogging()
Called after the end of a test run.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
QChar * data()
Returns a pointer to the data stored in the QString.
static const char * currentTestObjectName()
static const char * currentGlobalDataTag()
static const char * currentDataTag()
static const char * currentTestFunction()
Combined button and popup list for selecting options.
void generateTestIdentifier(QTestCharBuffer *identifier, int parts)
bool appendCharBuffer(QTestCharBuffer *accumulator, const QTestCharBuffer &more)
int qt_asprintf(QTestCharBuffer *str, const char *format,...)
Q_CORE_EXPORT int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
size_t qstrnlen(const char *str, size_t maxlen)
Q_CORE_EXPORT QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &buf)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
#define QTEST_ASSERT(cond)
const char * constData() const