mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
92 lines
3.2 KiB
Plaintext
92 lines
3.2 KiB
Plaintext
/***************************************************************************
|
|
qgsmultirenderchecker.sip
|
|
--------------------------------------
|
|
Date : 6.11.2014
|
|
Copyright : (C) 2014 Matthias Kuhn
|
|
Email : matthias at opengis dot ch
|
|
***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
|
|
class QgsMultiRenderChecker
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsmultirenderchecker.h>
|
|
%End
|
|
public:
|
|
QgsMultiRenderChecker();
|
|
|
|
/**
|
|
* 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'
|
|
*/
|
|
void setControlName( const QString& name );
|
|
|
|
void setControlPathPrefix( const QString& prefix );
|
|
|
|
/**
|
|
* Set the path to the rendered image. If this is not set or set to QString::Null, an image
|
|
* will be rendered based on the provided mapsettings
|
|
*
|
|
* @param renderedImagePath A path to the rendered image with which control images will be compared
|
|
*/
|
|
void setRenderedImage( const QString& renderedImagePath );
|
|
|
|
/**
|
|
* Set the map settings to use to render the image
|
|
*
|
|
* @param mapSettings The map settings
|
|
*/
|
|
void setMapSettings( const QgsMapSettings& mapSettings );
|
|
|
|
/**
|
|
* Set tolerance for color components used by runTest()
|
|
* Default value is 0.
|
|
*
|
|
* @param colorTolerance The maximum difference for each color component
|
|
* including alpha to be considered correct.
|
|
*/
|
|
void setColorTolerance( unsigned int colorTolerance );
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* @note make sure to call setExpectedImage and setMapSettings first
|
|
*/
|
|
bool runTest( const QString& testName, unsigned int mismatchCount = 0 );
|
|
|
|
/**
|
|
* Returns a report for this test
|
|
*
|
|
* @return A report
|
|
*/
|
|
QString report() const;
|
|
|
|
/**
|
|
* @brief controlImagePath
|
|
* @return
|
|
*/
|
|
QString controlImagePath() const;
|
|
|
|
/** Draws a checkboard pattern for image backgrounds, so that transparency is visible
|
|
* without requiring a transparent background for the image
|
|
*/
|
|
static void drawBackground( QImage* image );
|
|
};
|
|
|