16 #ifndef QGSRENDERCHECKER_H
17 #define QGSRENDERCHECKER_H
46 QString controlImagePath()
const;
48 QString
report() {
return mReport; };
51 return static_cast<float>( mMismatchCount ) /
52 static_cast<float>( mMatchTarget ) * 100;
64 void setControlName(
const QString &theName );
74 QString imageToHash( QString theImageFile );
76 void setRenderedImage( QString theImageFileName ) { mRenderedImageFile = theImageFileName; }
87 Q_DECL_DEPRECATED
void setMapRenderer(
QgsMapRenderer * thepMapRenderer );
98 void setColorTolerance(
unsigned int theColorTolerance ) { mColorTolerance = theColorTolerance; }
109 bool runTest( QString theTestName,
unsigned int theMismatchCount = 0 );
122 bool compareImages( QString theTestName,
unsigned int theMismatchCount = 0, QString theRenderedImageFile =
"" );
130 bool isKnownAnomaly( QString theDiffImageFile );
135 static void drawBackground( QImage* image );
173 QString mControlName;
174 unsigned int mMismatchCount;
175 unsigned int mColorTolerance;
176 int mElapsedTimeTarget;
178 QString mControlPathPrefix;
179 QString mControlPathSuffix;
180 QVector<QgsDartMeasurement> mDashMessages;
181 bool mBufferDashMessages;
192 inline bool compareWkt( QString a, QString b,
double tolerance = 0.000001 )
194 QgsDebugMsg( QString(
"a:%1 b:%2 tol:%3" ).arg( a ).arg( b ).arg( tolerance ) );
195 QRegExp re(
"-?\\d+(?:\\.\\d+)?(?:[eE]\\d+)?" );
197 QString a0( a ), b0( b );
198 a0.replace( re,
"#" );
199 b0.replace( re,
"#" );
201 QgsDebugMsg( QString(
"a0:%1 b0:%2" ).arg( a0 ).arg( b0 ) );
206 QList<double> al, bl;
209 for ( pos = 0; ( pos = re.indexIn( a, pos ) ) != -1; pos += re.matchedLength() )
211 al << re.cap( 0 ).toDouble();
213 for ( pos = 0; ( pos = re.indexIn( b, pos ) ) != -1; pos += re.matchedLength() )
215 bl << re.cap( 0 ).toDouble();
218 if ( al.size() != bl.size() )
221 for (
int i = 0; i < al.size(); i++ )