Changeset 769 for trunk/src/testlib
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/testlib/qplaintestlogger.cpp
r651 r769 182 182 RDebug::Print(format, hbuffer); 183 183 } 184 184 185 } 185 186 else { -
trunk/src/testlib/qtestcase.cpp
r651 r769 965 965 " -xml : Outputs results as XML document\n" 966 966 " -lightxml : Outputs results as stream of XML tags\n" 967 " -flush : Flushes the resu tls\n"967 " -flush : Flushes the resus\n" 968 968 " -o filename: Writes all output into a file\n" 969 969 " -silent : Only outputs warnings and failures\n" … … 1114 1114 } else if (strcmp(argv[i], "-qws") == 0) { 1115 1115 // do nothing 1116 1117 1118 1119 1120 1121 1122 1123 1116 1124 } else if (argv[i][0] == '-') { 1117 1125 printf("Unknown option: '%s'\n\n%s", argv[i], testOptions); … … 1299 1307 QTestResult::setSkipCurrentTest(false); 1300 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1301 1321 /* For each entry in the data table, do: */ 1302 1322 do { 1303 1323 if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) { 1304 1324 foundFunction = true; 1305 QTestDataSetter s( table.isEmpty()? static_cast<QTestData *>(0)1325 QTestDataSetter s( ? static_cast<QTestData *>(0) 1306 1326 : table.testData(curDataIndex)); 1307 1327 -
trunk/src/testlib/qtestlogger.cpp
r651 r769 212 212 failureElement->addAttribute(QTest::AI_Line, buf); 213 213 failureElement->addAttribute(QTest::AI_Description, description); 214 const char* tag = QTestResult::currentDataTag(); 215 if (tag) { 216 failureElement->addAttribute(QTest::AI_Tag, tag); 217 } 214 addTag(failureElement); 218 215 currentLogElement->addLogElement(failureElement); 219 216 } … … 278 275 } 279 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 280 298 void QTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) 281 299 { … … 298 316 case QAbstractTestLogger::QWarning: 299 317 ++qwarnCounter; 300 typeBuf = "qwarn ing";318 typeBuf = "qwarn"; 301 319 break; 302 320 case QAbstractTestLogger::QFatal: … … 319 337 errorElement->addAttribute(QTest::AI_Type, typeBuf); 320 338 errorElement->addAttribute(QTest::AI_Description, message); 339 321 340 322 341 if(file) -
trunk/src/testlib/qtestlogger_p.h
r651 r769 84 84 const char *file = 0, int line = 0); 85 85 void addBenchmarkResult(const QBenchmarkResult &result); 86 86 87 87 88 void addMessage(MessageTypes type, const char *message, -
trunk/src/testlib/qtestxmlstreamer.cpp
r651 r769 112 112 QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); 113 113 114 QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", 114 QTestCharBuffer tagbuf; 115 if (element->attribute(QTest::AI_Tag)) { 116 QTestCharBuffer cdataTag; 117 QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag)); 118 QTest::qt_asprintf(&tagbuf, " <DataTag><![CDATA[%s]]></DataTag>\n", cdataTag.constData()); 119 } 120 121 QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n%s <Description><![CDATA[%s]]></Description>\n</Message>\n", 115 122 element->attributeValue(QTest::AI_Type), 116 123 element->attributeName(QTest::AI_File), … … 118 125 element->attributeName(QTest::AI_Line), 119 126 element->attributeValue(QTest::AI_Line), 127 120 128 cdataDesc.constData()); 121 129 break; … … 150 158 151 159 if (element->elementType() == QTest::LET_TestCase) { 152 QTest::qt_asprintf(formatted, "</TestFunction>\n"); 160 bool failed = false; 161 for (QTestElement* child = element->childElements(); child; child = child->nextElement()) { 162 if ( child->elementType() == QTest::LET_Failure 163 && child->attribute(QTest::AI_Result) 164 && ( !strcmp(child->attributeValue(QTest::AI_Result), "fail") 165 || !strcmp(child->attributeValue(QTest::AI_Result), "xpass")) 166 ) 167 { 168 failed = true; 169 break; 170 } 171 } 172 173 // For passing functions, no Incident has been output yet. 174 // For failing functions, we already output one. 175 // Please note: we are outputting "pass" even if there was an xfail etc. 176 // This is by design (arguably bad design, but dangerous to change now!) 177 if (element->attribute(QTest::AI_Result) && !failed) { 178 QTest::qt_asprintf(formatted, "<Incident type=\"pass\" file=\"\" line=\"0\" />\n</TestFunction>\n"); 179 } 180 else { 181 QTest::qt_asprintf(formatted, "</TestFunction>\n"); 182 } 153 183 } else { 154 184 formatted->data()[0] = '\0'; … … 158 188 void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const 159 189 { 160 if(!element || !formatted) 190 Q_UNUSED(element); 191 if (!formatted) 161 192 return; 162 193 163 if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ 164 QTestCharBuffer buf; 165 QTestCharBuffer quotedFile; 166 QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); 167 168 QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"", 169 element->attributeName(QTest::AI_File), 170 quotedFile.constData(), 171 element->attributeName(QTest::AI_Line), 172 element->attributeValue(QTest::AI_Line)); 173 174 if( !element->childElements() ) { 175 QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", 176 element->attributeValue(QTest::AI_Result), buf.constData()); 177 } else { 178 formatted->data()[0] = '\0'; 179 } 180 } else { 181 formatted->data()[0] = '\0'; 182 } 194 formatted->data()[0] = '\0'; 183 195 } 184 196
Note:
See TracChangeset
for help on using the changeset viewer.