44 #include <QtCore/qglobal.h> 46 #include "QtTest/private/qxmltestlogger_p.h" 47 #include "QtTest/private/qtestresult_p.h" 48 #include "QtTest/private/qbenchmark_p.h" 49 #include "QtTest/private/qbenchmarkmetric_p.h" 50 #include "QtTest/qtestcase.h" 96 :xmlmode(mode), randomSeed(0), hasRandomSeed(false)
114 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" 115 "<TestCase name=\"%s\">\n", quotedTc.
constData());
122 " <QtVersion>%s</QtVersion>\n" 124 " <RandomSeed>%d</RandomSeed>\n" 129 " <QtVersion>%s</QtVersion>\n" 149 xmlQuote("edFunction,
function);
164 return !str || !str[0];
171 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\" />\n";
173 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 174 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" 178 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 179 " <Description><![CDATA[%s%s%s%s]]></Description>\n" 182 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 183 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" 184 " <Description><![CDATA[%s]]></Description>\n" 191 return "<BenchmarkResult metric=\"%s\" tag=\"%s\" value=\"%s\" iterations=\"%d\" />\n";
198 return "<Message type=\"%s\" file=\"%s\" line=\"%d\" />\n";
200 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 201 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" 205 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 206 " <Description><![CDATA[%s%s%s%s]]></Description>\n" 209 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 210 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" 211 " <Description><![CDATA[%s]]></Description>\n" 219 const char *file,
int line)
224 const char *filler = (tag && gtag) ?
":" :
"";
235 xmlCdata(&cdataDescription, description);
270 const char *file,
int line)
275 const char *filler = (tag && gtag) ?
":" :
"";
286 xmlCdata(&cdataDescription, message);
307 if (n == 0)
return 0;
309 char *dest = destBuf->
data();
314 char*
end = dest + n;
319 #define MAP_ENTITY(chr, ent) \ 321 if (dest + sizeof(ent) < end) { \ 323 dest += sizeof(ent) - 1; \ 327 return (dest+sizeof(ent)-begin); \ 369 char *dest = destBuf->
data();
371 if (!src || n == 1) {
376 static char const CDATA_END[] =
"]]>";
377 static char const CDATA_END_ESCAPED[] =
"]]]><![CDATA[]>";
380 char*
end = dest + n;
387 if (!strncmp(src, CDATA_END,
sizeof(CDATA_END)-1)) {
388 if (dest +
sizeof(CDATA_END_ESCAPED) < end) {
389 strcpy(dest, CDATA_END_ESCAPED);
390 src +=
sizeof(CDATA_END)-1;
391 dest +=
sizeof(CDATA_END_ESCAPED) - 1;
395 return (dest+
sizeof(CDATA_END_ESCAPED)-begin);
418 static const int MAXSIZE = 1024*1024*2;
420 int size = str->
size();
425 res = func(str, src, size);
426 str->
data()[size - 1] =
'\0';
433 if (size > MAXSIZE) {
436 if (!str->
reset(size))
QTest::QBenchmarkMetric metric
static const char * xmlIncidentType2String(QAbstractTestLogger::IncidentTypes type)
static void outputString(const char *msg)
static const char * xmlMessageType2String(QAbstractTestLogger::MessageTypes type)
#define QT_END_NAMESPACE
This macro expands to.
void registerRandomSeed(unsigned int seed)
void enterTestFunction(const char *function)
QXmlTestLogger(XmlMode mode=Complete)
int qt_asprintf(QTestCharBuffer *str, const char *format,...)
void addBenchmarkResult(const QBenchmarkResult &result)
static int xmlCdata(QTestCharBuffer *dest, char const *src)
int allocateStringFn(QTestCharBuffer *str, char const *src, StringFormatFunction func)
static const char * incidentFormatString(bool noDescription, bool noTag)
Q_CORE_EXPORT const char * qVersion()
virtual void stopLogging()
#define QT_BEGIN_NAMESPACE
This macro expands to.
static const char * currentTestObjectName()
static bool isEmpty(const char *str)
void addIncident(IncidentTypes type, const char *description, const char *file=0, int line=0)
const char * constData() const
#define QTEST_VERSION_STR
void addMessage(MessageTypes type, const char *message, const char *file=0, int line=0)
const char * constData() const
Returns a pointer to the data stored in the byte array.
static const char * currentGlobalDataTag()
int(* StringFormatFunction)(QTestCharBuffer *, char const *, size_t)
static const char * benchmarkResultFormatString()
static const char * messageFormatString(bool noDescription, bool noTag)
const char * benchmarkMetricName(QBenchmarkMetric metric)
static int xmlQuote(QTestCharBuffer *dest, char const *src)
#define MAP_ENTITY(chr, ent)
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
static const char * currentDataTag()
virtual void startLogging()
QBenchmarkContext context
static const KeyPair *const end
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...
The QTest namespace contains all the functions and declarations that are related to the QTestLib tool...