16 #ifndef QGSRENDERCHECKER_H
17 #define QGSRENDERCHECKER_H
46 QString controlImagePath()
const;
52 return static_cast<float>( mMismatchCount ) /
53 static_cast<float>( mMatchTarget ) * 100;
65 void setControlName(
const QString &theName );
88 Q_DECL_DEPRECATED
void setMapRenderer(
QgsMapRenderer * thepMapRenderer );
99 void setColorTolerance(
unsigned int theColorTolerance ) { mColorTolerance = theColorTolerance; }
106 void setSizeTolerance(
int xTolerance,
int yTolerance ) { mMaxSizeDifferenceX = xTolerance; mMaxSizeDifferenceY = yTolerance; }
118 bool runTest(
QString theTestName,
unsigned int theMismatchCount = 0 );
131 bool compareImages(
QString theTestName,
unsigned int theMismatchCount = 0,
QString theRenderedImageFile =
"" );
139 bool isKnownAnomaly(
QString theDiffImageFile );
144 static void drawBackground(
QImage* image );
183 unsigned int mMismatchCount;
184 unsigned int mColorTolerance;
185 int mMaxSizeDifferenceX;
186 int mMaxSizeDifferenceY;
187 int mElapsedTimeTarget;
192 bool mBufferDashMessages;
206 QRegExp re(
"-?\\d+(?:\\.\\d+)?(?:[eE]\\d+)?" );
209 a0.replace( re,
"#" );
232 for (
int i = 0; i < al.
size(); i++ )
void setControlPathSuffix(const QString &theName)
void setColorTolerance(unsigned int theColorTolerance)
Set tolerance for color components used by runTest() and compareImages().
QString cap(int nth) const
void enableDashBuffering(bool enable)
Call this to enable internal buffering of dash messages.
This is a helper class for unit tests that need to write an image and compare it to an expected resul...
A non GUI class for rendering a map layer set onto a QPainter.
double toDouble(bool *ok) const
void setSizeTolerance(int xTolerance, int yTolerance)
Sets the largest allowable difference in size between the rendered and the expected image...
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
The QgsMapSettings class contains configuration for rendering of the map.
int matchedLength() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
~QgsRenderChecker()
Destructor.
unsigned int mMatchTarget
const QString & renderedImage()
The path of the rendered image can be retrieved through that method.
unsigned int matchTarget()
QString & replace(int position, int n, QChar after)
QString mRenderedImageFile
void setControlPathPrefix(const QString &theName)
Prefix where the control images are kept.
void setRenderedImage(QString theImageFileName)
QString mExpectedImageFile
unsigned int mismatchCount()
const QVector< QgsDartMeasurement > & dartMeasurements() const
Get access to buffered dash messages.
const QString & expectedImageFile() const
Returns the path to the expected image file.
void setElapsedTimeTarget(int theTarget)
bool compareWkt(QString a, QString b, double tolerance=0.000001)
Compare two WKT strings with some tolerance.