Subgroup: Layout

Class: QgsLayoutChecker

class qgis.core.QgsLayoutChecker(testName: str, layout: QgsLayout)

Bases: qgis._core.QgsMultiRenderChecker

Constructor for QgsLayoutChecker.

QgsLayoutChecker(QgsLayoutChecker)

Renders a layout to an image and compares with an expected output

New in version 3.0: Methods

setSize Sets the output (reference) image size.
testLayout Runs a render check on the layout, adding results to the specified report.

Signals

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.