Subgroup: Layout
Class: QgsLayoutChecker¶
-
class
qgis.core.
QgsLayoutChecker
¶ Bases:
qgis._core.QgsMultiRenderChecker
Renders a layout to an image and compares with an expected output
New in version 3.0: Methods
controlImagePath
controlImagePath drawBackground
Draws a checkboard pattern for image backgrounds, so that opacity is visible report
Returns a report for this test runTest
Test using renderer to generate the image to be compared. setColorTolerance
Set tolerance for color components used by runTest() Default value is 0. setControlName
Base directory name for the control image (with control image path setControlPathPrefix
setMapSettings
Set the map settings to use to render the image setRenderedImage
Set the path to the rendered image. setSize
Sets the output (reference) image size
.setSizeTolerance
Sets the largest allowable difference in size between the rendered and the expected image. testLayout
Runs a render check on the layout, adding results to the specified report
.Attributes
-
setSize
(self, size: QSize)¶ Sets the output (reference) image
size
.
-
testLayout
(self, report: str, page: int = 0, pixelDiff: int = 0, createReferenceImage: bool = False) → bool¶ Runs a render check on the layout, adding results to the specified
report
.The maximum number of allowable pixels differing from the reference image is specified via the
pixelDiff
argument.A reference image can be created by setting
createReferenceImage
to true in this case the test will always return true.The page number is specified via
page
, where 0 corresponds to the first page in the layout.Returns false if the rendered layout differs from the expected reference image.
-