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 );
72 void setControlPathSuffix(
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(
const QString& theTestName,
unsigned int theMismatchCount = 0 );
131 bool compareImages(
const QString& theTestName,
unsigned int theMismatchCount = 0,
const QString& theRenderedImageFile =
"" );
139 bool isKnownAnomaly(
const 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 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.
QString expectedImageFile() const
Returns the path to the expected image file.
QString renderedImage()
The path of the rendered image can be retrieved through that method.
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)
Compare two doubles (but allow some difference)
The QgsMapSettings class contains configuration for rendering of the map.
int matchedLength() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
void setRenderedImage(const QString &theImageFileName)
~QgsRenderChecker()
Destructor.
unsigned int mMatchTarget
bool compareWkt(const QString &a, const QString &b, double tolerance=0.000001)
Compare two WKT strings with some tolerance.
unsigned int matchTarget()
QString & replace(int position, int n, QChar after)
QString mRenderedImageFile
QVector< QgsDartMeasurement > dartMeasurements() const
Get access to buffered dash messages.
void setControlPathPrefix(const QString &theName)
Prefix where the control images are kept.
QString mExpectedImageFile
unsigned int mismatchCount()
void setElapsedTimeTarget(int theTarget)