QGIS/python/core/qgsrenderchecker.sip

224 lines
6.2 KiB
Plaintext
Raw Normal View History

2017-05-18 16:39:21 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrenderchecker.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRenderChecker
{
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
This is a helper class for unit tests that need to
write an image and compare it to an expected result
or render time.
2017-05-18 16:39:21 +02:00
%End
%TypeHeaderCode
2017-05-18 16:39:21 +02:00
#include "qgsrenderchecker.h"
%End
public:
QgsRenderChecker();
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsRenderChecker.
%End
QString controlImagePath() const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: str
2017-05-18 16:39:21 +02:00
%End
QString report();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: str
2017-05-18 16:39:21 +02:00
%End
float matchPercent();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: float
2017-05-18 16:39:21 +02:00
%End
unsigned int mismatchCount();
unsigned int matchTarget();
int elapsedTime();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: int
2017-05-18 16:39:21 +02:00
%End
void setElapsedTimeTarget( int target );
void setControlName( const QString &name );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Base directory name for the control image (with control image path
suffixed) the path to the image will be constructed like this:
controlImagePath + '/' + mControlName + '/' + mControlName + '.png'
2017-05-18 16:39:21 +02:00
%End
void setControlPathPrefix( const QString &name );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Prefix where the control images are kept.
This will be appended to controlImagePath
2017-05-18 16:39:21 +02:00
%End
void setControlPathSuffix( const QString &name );
QString imageToHash( const QString &imageFile );
2017-05-18 16:39:21 +02:00
%Docstring
Get an md5 hash that uniquely identifies an image
2017-12-15 10:36:55 -04:00
:rtype: str
2017-05-18 16:39:21 +02:00
%End
void setRenderedImage( const QString &imageFileName );
QString renderedImage();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The path of the rendered image can be retrieved through that method.
Will return the path set with setRenderedImage() or generated in runTest()
:return: The path to the rendered image
:rtype: str
2017-05-18 16:39:21 +02:00
%End
void setMapSettings( const QgsMapSettings &mapSettings );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
2017-05-18 16:39:21 +02:00
.. versionadded:: 2.4
%End
void setColorTolerance( unsigned int colorTolerance );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set tolerance for color components used by runTest() and compareImages().
Default value is 0.
:param colorTolerance: is maximum difference for each color component
including alpha to be considered correct.
2017-05-18 16:39:21 +02:00
.. versionadded:: 2.1
%End
void setSizeTolerance( int xTolerance, int yTolerance );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the largest allowable difference in size between the rendered and the expected image.
:param xTolerance: x tolerance in pixels
:param yTolerance: y tolerance in pixels
2017-05-18 16:39:21 +02:00
.. versionadded:: 2.12
%End
bool runTest( const QString &testName, unsigned int mismatchCount = 0 );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Test using renderer to generate the image to be compared.
:param testName: - to be used as the basis for writing a file to
e.g. /tmp/theTestName.png
:param mismatchCount: - 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.
:rtype: bool
2017-05-18 16:39:21 +02:00
.. note::
make sure to call setExpectedImage and setMapRenderer first
%End
2017-09-25 14:20:39 +10:00
bool compareImages( const QString &testName, unsigned int mismatchCount = 0, const QString &renderedImageFile = QString() );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Test using two arbitrary images (map renderer will not be used)
:param testName: - to be used as the basis for writing a file to
e.g. /tmp/theTestName.png
:param mismatchCount: - 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 renderedImageFile: to optionally override the output filename
\note: make sure to call setExpectedImage and setRenderedImage first.
:rtype: bool
2017-05-18 16:39:21 +02:00
%End
bool isKnownAnomaly( const QString &diffImageFile );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04: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 acceptable. If the render
diff matches one of these anomalies we will still consider it to be
acceptable.
:return: a bool indicating if the diff matched one of the anomaly files
:rtype: bool
2017-05-18 16:39:21 +02:00
%End
2014-01-26 18:35:21 +01:00
static void drawBackground( QImage *image );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Draws a checkboard pattern for image backgrounds, so that opacity is visible
without requiring a transparent background for the image
2017-05-18 16:39:21 +02:00
%End
QString expectedImageFile() const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the path to the expected image file
:return: Path to the expected image file
:rtype: str
2017-05-18 16:39:21 +02:00
%End
void enableDashBuffering( bool enable );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Call this to enable internal buffering of dash messages. You may later call
dashMessages() to get access to the buffered messages. If disabled (default)
dash messages will be sent immediately.
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param enable: Enable or disable buffering
2017-05-18 16:39:21 +02:00
%End
QVector<QgsDartMeasurement> dartMeasurements() const;
%Docstring
2017-12-15 10:36:55 -04:00
Get access to buffered dash messages.
Only will return something if you call enableDashBuffering( true ); before.
:return: buffered dash messages
:rtype: list of QgsDartMeasurement
2017-05-18 16:39:21 +02:00
.. note::
not available in Python bindings
%End
protected:
}; // class QgsRenderChecker
bool compareWkt( const QString &a, const QString &b, double tolerance = 0.000001 );
%Docstring
2017-12-15 10:36:55 -04:00
Compare two WKT strings with some tolerance
:param a: first WKT string
:param b: second WKT string
:param tolerance: tolerance to use (optional, defaults to 0.000001)
:return: bool indicating if the WKT are sufficiently equal
:rtype: bool
2017-05-18 16:39:21 +02:00
%End
2017-05-18 16:39:21 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrenderchecker.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/