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; };
81 bool runTest( QString theTestName,
unsigned int theMismatchCount = 0 );
94 bool compareImages( QString theTestName,
unsigned int theMismatchCount = 0, QString theRenderedImageFile =
"" );
102 bool isKnownAnomaly( QString theDiffImageFile );
127 inline bool compareWkt( QString a, QString b,
double tolerance = 0.000001 )
129 QgsDebugMsg( QString(
"a:%1 b:%2 tol:%3" ).arg( a ).arg( b ).arg( tolerance ) );
130 QRegExp re(
"-?\\d+(?:\\.\\d+)?(?:[eE]\\d+)?" );
132 QString a0( a ), b0( b );
133 a0.replace( re,
"#" );
134 b0.replace( re,
"#" );
136 QgsDebugMsg( QString(
"a0:%1 b0:%2" ).arg( a0 ).arg( b0 ) );
141 QList<double> al, bl;
144 for ( pos = 0; ( pos = re.indexIn( a, pos ) ) != -1; pos += re.matchedLength() )
146 al << re.cap( 0 ).toDouble();
148 for ( pos = 0; ( pos = re.indexIn( b, pos ) ) != -1; pos += re.matchedLength() )
150 bl << re.cap( 0 ).toDouble();
153 if ( al.size() != bl.size() )
156 for (
int i = 0; i < al.size(); i++ )