2012-09-04 20:31:59 +02:00
|
|
|
|
|
|
|
/** Render checker for tests in python */
|
|
|
|
|
|
|
|
class QgsRenderChecker
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsrenderchecker.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsRenderChecker();
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! Destructor
|
2012-09-04 20:31:59 +02:00
|
|
|
~QgsRenderChecker();
|
|
|
|
|
|
|
|
QString controlImagePath() const;
|
|
|
|
|
|
|
|
QString report();
|
|
|
|
float matchPercent();
|
|
|
|
unsigned int mismatchCount();
|
|
|
|
unsigned int matchTarget();
|
2014-01-26 18:35:21 +01:00
|
|
|
//only records time for actual render part
|
2012-09-04 20:31:59 +02:00
|
|
|
int elapsedTime();
|
2014-01-26 18:35:21 +01:00
|
|
|
void setElapsedTimeTarget( int theTarget );
|
2012-09-04 20:31:59 +02:00
|
|
|
void setControlName( const QString theName );
|
|
|
|
|
|
|
|
void setControlPathPrefix( const QString theName );
|
|
|
|
|
|
|
|
QString imageToHash( QString theImageFile );
|
|
|
|
|
|
|
|
void setRenderedImage( QString theImageFileName );
|
2014-01-26 18:35:21 +01:00
|
|
|
void setMapRenderer( QgsMapRenderer *thepMapRenderer );
|
|
|
|
/**
|
|
|
|
* Test using renderer to generate the image to be compared.
|
|
|
|
* @param theTestName - to be used as the basis for writing a file to
|
|
|
|
* e.g. /tmp/theTestName.png
|
|
|
|
* @param theMismatchCount - defaults to 0 - the number of pixels that
|
|
|
|
* are allowed to be different from the control image. In some cases
|
|
|
|
* rendering may be non-deterministic. This parameter allows you to account
|
|
|
|
* for that by providing a tolerance.
|
|
|
|
* @note make sure to call setExpectedImage and setMapRenderer first
|
|
|
|
*/
|
2012-09-04 20:31:59 +02:00
|
|
|
bool runTest( QString theTestName, unsigned int theMismatchCount = 0 );
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
/**
|
|
|
|
* Test using two arbitary images (map renderer will not be used)
|
|
|
|
* @param theTestName - to be used as the basis for writing a file to
|
|
|
|
* e.g. /tmp/theTestName.png
|
|
|
|
* @param theMismatchCount - defaults to 0 - the number of pixels that
|
|
|
|
* are allowed to be different from the control image. In some cases
|
|
|
|
* rendering may be non-deterministic. This parameter allows you to account
|
|
|
|
* for that by providing a tolerance.
|
|
|
|
* @param theRenderedImageFile to optionally override the output filename
|
|
|
|
* @note: make sure to call setExpectedImage and setRenderedImage first.
|
|
|
|
*/
|
2012-09-04 20:31:59 +02:00
|
|
|
bool compareImages( QString theTestName, unsigned int theMismatchCount = 0, QString theRenderedImageFile = "" );
|
2014-01-26 18:35:21 +01:00
|
|
|
/** Get a list of all the anomalies. An anomaly is a rendered difference
|
|
|
|
* file where there is some red pixel content (indicating a render check
|
|
|
|
* mismatch), but where the output was still acceptible. If the render
|
|
|
|
* diff matches one of these anomalies we will still consider it to be
|
|
|
|
* acceptible.
|
|
|
|
* @return a bool indicating if the diff matched one of the anomaly files
|
|
|
|
*/
|
2012-09-04 20:31:59 +02:00
|
|
|
bool isKnownAnomaly( QString theDiffImageFile );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2013-12-29 09:41:00 +11:00
|
|
|
QString expectedImageFile();
|
|
|
|
|
2012-09-04 20:31:59 +02:00
|
|
|
};
|