16 #ifndef QGSRENDERCHECKER_H
17 #define QGSRENDERCHECKER_H
44 QString controlImagePath()
const;
46 QString
report() {
return mReport; };
49 return static_cast<float>( mMismatchCount ) /
50 static_cast<float>( mMatchTarget ) * 100;
61 void setControlName(
const QString theName );
67 QString imageToHash( QString theImageFile );
69 void setRenderedImage( QString theImageFileName ) { mRenderedImageFile = theImageFileName; }
78 void setColorTolerance(
unsigned int theColorTolerance ) { mColorTolerance = theColorTolerance; }
89 bool runTest( QString theTestName,
unsigned int theMismatchCount = 0 );
102 bool compareImages( QString theTestName,
unsigned int theMismatchCount = 0, QString theRenderedImageFile =
"" );
110 bool isKnownAnomaly( QString theDiffImageFile );
112 QString expectedImageFile() {
return mExpectedImageFile; };
141 inline bool compareWkt( QString a, QString b,
double tolerance = 0.000001 )
143 QgsDebugMsg( QString(
"a:%1 b:%2 tol:%3" ).arg( a ).arg( b ).arg( tolerance ) );
144 QRegExp re(
"-?\\d+(?:\\.\\d+)?(?:[eE]\\d+)?" );
146 QString a0( a ), b0( b );
147 a0.replace( re,
"#" );
148 b0.replace( re,
"#" );
150 QgsDebugMsg( QString(
"a0:%1 b0:%2" ).arg( a0 ).arg( b0 ) );
155 QList<double> al, bl;
158 for ( pos = 0; ( pos = re.indexIn( a, pos ) ) != -1; pos += re.matchedLength() )
160 al << re.cap( 0 ).toDouble();
162 for ( pos = 0; ( pos = re.indexIn( b, pos ) ) != -1; pos += re.matchedLength() )
164 bl << re.cap( 0 ).toDouble();
167 if ( al.size() != bl.size() )
170 for (
int i = 0; i < al.size(); i++ )