@@ -35,8 +35,7 @@ QgsRenderChecker::QgsRenderChecker() :
3535 mExpectedImageFile( " " ),
3636 mMismatchCount( 0 ),
3737 mColorTolerance( 0 ),
38- mElapsedTimeTarget( 0 ),
39- mControlPathPrefix( " " )
38+ mElapsedTimeTarget( 0 )
4039{
4140}
4241
@@ -131,10 +130,8 @@ bool QgsRenderChecker::isKnownAnomaly( QString theDiffImageFile )
131130 .arg ( theDiffImageFile )
132131 .arg ( myImageHash );
133132 // foo CDash
134- QString myMeasureMessage = " <DartMeasurement name=\" Anomaly check"
135- " \" type=\" text/text\" >" + myHashMessage +
136- " </DartMeasurement>" ;
137- qDebug () << myMeasureMessage;
133+ emitDashMessage ( " Anomaly check" , QgsDartMeasurement::Text, myHashMessage );
134+
138135 mReport += " <tr><td colspan=3>" + myHashMessage + " </td></tr>" ;
139136 if ( myImageHash == myAnomalyHash )
140137 {
@@ -150,6 +147,19 @@ bool QgsRenderChecker::isKnownAnomaly( QString theDiffImageFile )
150147 return false ;
151148}
152149
150+ void QgsRenderChecker::emitDashMessage ( const QgsDartMeasurement& dashMessage )
151+ {
152+ if ( mBufferDashMessages )
153+ mDashMessages << dashMessage;
154+ else
155+ dashMessage.send ();
156+ }
157+
158+ void QgsRenderChecker::emitDashMessage ( const QString& name, QgsDartMeasurement::Type type, const QString& value )
159+ {
160+ emitDashMessage ( QgsDartMeasurement ( name, type, value ) );
161+ }
162+
153163bool QgsRenderChecker::runTest ( QString theTestName,
154164 unsigned int theMismatchCount )
155165{
@@ -300,17 +310,18 @@ bool QgsRenderChecker::compareImages( QString theTestName,
300310 " src=\" file://" +
301311 myDiffImageFile +
302312 " \" ></td>\n </tr>\n </table>" ;
313+
314+ QString prefix;
315+ if ( !mControlPathPrefix .isNull () )
316+ {
317+ prefix = QString ( " (prefix %1)" ).arg ( mControlPathPrefix );
318+ }
303319 //
304320 // To get the images into CDash
305321 //
306- QString myDashMessage = " <DartMeasurementFile name=\" Rendered Image " + theTestName + " \" "
307- " type=\" image/png\" >" + mRenderedImageFile +
308- " </DartMeasurementFile>\n "
309- " <DartMeasurementFile name=\" Expected Image " + theTestName + " \" type=\" image/png\" >" +
310- mExpectedImageFile + " </DartMeasurementFile>\n "
311- " <DartMeasurementFile name=\" Difference Image " + theTestName + " \" type=\" image/png\" >" +
312- myDiffImageFile + " </DartMeasurementFile>\n " ;
313- qDebug () << myDashMessage;
322+ emitDashMessage ( " Rendered Image " + theTestName + prefix, QgsDartMeasurement::ImagePng, mRenderedImageFile );
323+ emitDashMessage ( " Expected Image " + theTestName + prefix, QgsDartMeasurement::ImagePng, mExpectedImageFile );
324+ emitDashMessage ( " Difference Image " + theTestName + prefix, QgsDartMeasurement::ImagePng, myDiffImageFile );
314325
315326 //
316327 // Put the same info to debug too
@@ -388,12 +399,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
388399 //
389400 // And send it to CDash
390401 //
391- myDashMessage = " <DartMeasurement name=\" Mismatch Count "
392- " \" type=\" numeric/integer\" >" +
393- QString::number ( mMismatchCount ) + " /" +
394- QString::number ( mMatchTarget ) +
395- " </DartMeasurement>" ;
396- qDebug () << myDashMessage;
402+ emitDashMessage ( " Mismatch Count" , QgsDartMeasurement::Integer, QString ( " %1/%2" ).arg ( mMismatchCount ).arg ( mMatchTarget ) );
397403
398404 bool myAnomalyMatchFlag = isKnownAnomaly ( myDiffImageFile );
399405
@@ -406,17 +412,13 @@ bool QgsRenderChecker::compareImages( QString theTestName,
406412 }
407413 else
408414 {
409- QString myMessage = " Difference image did not match any known anomaly." ;
410415 mReport += " <tr><td colspan=3>"
411416 " </td></tr>" ;
412- QString myMeasureMessage = " <DartMeasurement name=\" No Anomalies Match"
413- " \" type=\" text/text\" >" + myMessage +
414- " If you feel the difference image should be considered an anomaly "
415- " you can do something like this\n "
416- " cp " + myDiffImageFile + " ../tests/testdata/control_images/" + theTestName +
417- " /<imagename>.{wld,png}"
418- " </DartMeasurement>" ;
419- qDebug () << myMeasureMessage;
417+ emitDashMessage ( " No Anomalies Match" , QgsDartMeasurement::Text, " Difference image did not match any known anomaly."
418+ " If you feel the difference image should be considered an anomaly "
419+ " you can do something like this\n "
420+ " cp " + myDiffImageFile + " ../tests/testdata/control_images/" + theTestName +
421+ " /<imagename>.{wld,png}" );
420422 }
421423
422424 if ( mMismatchCount <= theMismatchCount )
0 commit comments