@@ -106,6 +106,8 @@ def setUpClass(cls):
106
106
cls ._TestMapSettings = None
107
107
cls ._Mismatch = 0
108
108
cls ._Mismatches = dict ()
109
+ cls ._ColorTol = 0
110
+ cls ._ColorTols = dict ()
109
111
110
112
# initialize class MapRegistry, Canvas, MapRenderer, Map and PAL
111
113
# noinspection PyArgumentList
@@ -368,12 +370,13 @@ def saveControlImage(self, tmpimg=''):
368
370
if not os .path .exists (imgpath ):
369
371
raise OSError ('Control image not created: {0}' .format (imgpath ))
370
372
371
- def renderCheck (self , mismatch = 0 , imgpath = '' , grpprefix = '' ):
373
+ def renderCheck (self , mismatch = 0 , colortol = 0 , imgpath = '' , grpprefix = '' ):
372
374
"""Check rendered map canvas or existing image against control image
373
375
374
- mismatch: number of pixels different from control, and still valid check
375
- imgpath: existing image; if present, skips rendering canvas
376
- grpprefix: compare test image/rendering against different test group
376
+ :mismatch: number of pixels different from control, and still valid
377
+ :colortol: maximum difference for each color component including alpha
378
+ :imgpath: existing image; if present, skips rendering canvas
379
+ :grpprefix: compare test image/rendering against different test group
377
380
"""
378
381
if not grpprefix :
379
382
grpprefix = self ._TestGroupPrefix
@@ -383,6 +386,7 @@ def renderCheck(self, mismatch=0, imgpath='', grpprefix=''):
383
386
chk = QgsRenderChecker ()
384
387
chk .setControlPathPrefix ('expected_' + grpprefix )
385
388
chk .setControlName (self ._Test )
389
+ chk .setColorTolerance (colortol )
386
390
chk .setMapSettings (self ._MapSettings )
387
391
# noinspection PyUnusedLocal
388
392
res = False
0 commit comments