16 #ifndef QGSRENDERCHECKER_H
17 #define QGSRENDERCHECKER_H
45 QString controlImagePath()
const;
47 QString
report() {
return mReport; };
50 return static_cast<float>( mMismatchCount ) /
51 static_cast<float>( mMatchTarget ) * 100;
62 void setControlName(
const QString theName );
68 QString imageToHash( QString theImageFile );
70 void setRenderedImage( QString theImageFileName ) { mRenderedImageFile = theImageFileName; }
72 Q_DECL_DEPRECATED
void setMapRenderer(
QgsMapRenderer * thepMapRenderer );
83 void setColorTolerance(
unsigned int theColorTolerance ) { mColorTolerance = theColorTolerance; }
94 bool runTest( QString theTestName,
unsigned int theMismatchCount = 0 );
107 bool compareImages( QString theTestName,
unsigned int theMismatchCount = 0, QString theRenderedImageFile =
"" );
115 bool isKnownAnomaly( QString theDiffImageFile );
117 QString expectedImageFile() {
return mExpectedImageFile; };
127 QString mControlName;
128 unsigned int mMismatchCount;
129 unsigned int mColorTolerance;
130 int mElapsedTimeTarget;
132 QString mControlPathPrefix;
144 inline bool compareWkt( QString a, QString b,
double tolerance = 0.000001 )
146 QgsDebugMsg( QString(
"a:%1 b:%2 tol:%3" ).arg( a ).arg( b ).arg( tolerance ) );
147 QRegExp re(
"-?\\d+(?:\\.\\d+)?(?:[eE]\\d+)?" );
149 QString a0( a ), b0( b );
150 a0.replace( re,
"#" );
151 b0.replace( re,
"#" );
153 QgsDebugMsg( QString(
"a0:%1 b0:%2" ).arg( a0 ).arg( b0 ) );
158 QList<double> al, bl;
161 for ( pos = 0; ( pos = re.indexIn( a, pos ) ) != -1; pos += re.matchedLength() )
163 al << re.cap( 0 ).toDouble();
165 for ( pos = 0; ( pos = re.indexIn( b, pos ) ) != -1; pos += re.matchedLength() )
167 bl << re.cap( 0 ).toDouble();
170 if ( al.size() != bl.size() )
173 for (
int i = 0; i < al.size(); i++ )