16#ifndef QGSMULTIRENDERCHECKER_H
17#define QGSMULTIRENDERCHECKER_H
88 void setRenderedImage(
const QString &renderedImagePath ) { mRenderedImage = renderedImagePath; }
118 void setSizeTolerance(
int xTolerance,
int yTolerance ) { mMaxSizeDifferenceX = xTolerance; mMaxSizeDifferenceY = yTolerance; }
133 bool runTest(
const QString &testName,
unsigned int mismatchCount = 0 );
142 QString report()
const;
152 QString markdownReport()
const;
157 QString controlImagePath()
const;
167 QString mSourceFunction;
168 int mSourceLine = -1;
170 bool mResult =
false;
172 QString mReportHeader;
175 QString mMarkdownReportHeader;
176 QString mMarkdownReport;
178 QString mRenderedImage;
179 QString mControlName;
180 QString mControlPathPrefix;
181 unsigned int mColorTolerance = 0;
182 int mMaxSizeDifferenceX = 0;
183 int mMaxSizeDifferenceY = 0;
185 bool mExpectFail =
false;
187 bool mIsCiRun =
false;
204 QgsLayoutChecker(
const QString &testName, QgsLayout *layout );
209 void setSize( QSize size ) { mSize = size; }
230 bool testLayout( QString &report
SIP_OUT,
int page = 0,
int pixelDiff = 0,
bool createReferenceImage =
false );
233 QgsLayoutChecker() =
delete;
236 QgsLayout *mLayout =
nullptr;
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Contains configuration for rendering maps.
Allows checking rendered images against comparison images.
void setControlName(const QString &name)
Base directory name for the control image (with control image path suffixed) the path to the image wi...
void setRenderedImage(const QString &renderedImagePath)
Set the path to the rendered image.
static void drawBackground(QImage *image)
Draws a checkboard pattern for image backgrounds, so that opacity is visible without requiring a tran...
void setControlPathPrefix(const QString &prefix)
Sets the path prefix where the control images are kept.
virtual ~QgsMultiRenderChecker()=default
void setColorTolerance(unsigned int colorTolerance)
Set tolerance for color components used by runTest() Default value is 0.
void setFileFunctionLine(const QString &file, const QString &function, int line)
Sets the source file, function and line from where the test originates.
void setExpectFail(bool expectFail)
Sets whether the comparison is expected to fail.
void setSizeTolerance(int xTolerance, int yTolerance)
Sets the largest allowable difference in size between the rendered and the expected image.
QgsMultiRenderChecker()
Constructor for QgsMultiRenderChecker.
static void drawBackground(QImage *image)
Draws a checkboard pattern for image backgrounds, so that opacity is visible without requiring a tran...