diff options
Diffstat (limited to 'src/testlib/qtestlightxmlstreamer.cpp')
-rw-r--r-- | src/testlib/qtestlightxmlstreamer.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp index e176201..b84f531 100644 --- a/src/testlib/qtestlightxmlstreamer.cpp +++ b/src/testlib/qtestlightxmlstreamer.cpp @@ -59,7 +59,7 @@ QTestLightXmlStreamer::QTestLightXmlStreamer() QTestLightXmlStreamer::~QTestLightXmlStreamer() {} -void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -67,14 +67,14 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form switch(element->elementType()){ case QTest::LET_TestCase: { QTestCharBuffer quotedTf; - QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name)); + QXmlTestLogger::xmlQuote("edTf, element->attributeValue(QTest::AI_Name)); QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); break; } case QTest::LET_Failure: { QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n", cdataDesc.constData()); @@ -84,8 +84,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form // assuming type and attribute names don't need quoting QTestCharBuffer quotedFile; QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", element->attributeValue(QTest::AI_Type), @@ -100,8 +100,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form // assuming value and iterations don't need quoting QTestCharBuffer quotedMetric; QTestCharBuffer quotedTag; - QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric)); - QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag)); + QXmlTestLogger::xmlQuote("edMetric, element->attributeValue(QTest::AI_Metric)); + QXmlTestLogger::xmlQuote("edTag, element->attributeValue(QTest::AI_Tag)); QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", element->attributeName(QTest::AI_Metric), @@ -115,11 +115,11 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form break; } default: - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } } -void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -129,47 +129,47 @@ void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **format QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n"); else QTest::qt_asprintf(formatted, "</TestFunction>\n"); + } else { + formatted->data()[0] = '\0'; } - else - QTest::qt_asprintf(formatted, ""); } -void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; - if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ - QTestCharBuffer buf; - QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - - QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"", - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line)); - - if( !element->childElements() ) - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - else - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - }else{ - QTest::qt_asprintf(formatted, ""); + if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)) { + QTestCharBuffer buf; + QTestCharBuffer quotedFile; + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); + + QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"", + element->attributeName(QTest::AI_File), + quotedFile.constData(), + element->attributeName(QTest::AI_Line), + element->attributeValue(QTest::AI_Line)); + + if( !element->childElements() ) + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); + else + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); + } else { + formatted->data()[0] = '\0'; } } void QTestLightXmlStreamer::output(QTestElement *element) const { QTestCharBuffer buf; - QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", + QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", qVersion(), QTEST_VERSION_STR ); - outputString(buf); + outputString(buf.constData()); - QTest::qt_asprintf(buf, "</Environment>\n"); - outputString(buf); + QTest::qt_asprintf(&buf, "</Environment>\n"); + outputString(buf.constData()); QTestBasicStreamer::output(element); } |