Skip to content
Permalink
Browse files

Fix test

  • Loading branch information
nyalldawson committed Dec 16, 2020
1 parent 91d773a commit 33a9f4e197d31bed49e3a1c5cd6288849614fd85
Showing with 3 additions and 2 deletions.
  1. +3 −2 tests/src/python/test_qgscolorramplegendnode.py
@@ -92,7 +92,7 @@ def test_icon(self):
p.drawPixmap(0, 0, pixmap)
p.end()

self.assertTrue(self.imageCheck('color_ramp_legend_node_icon', 'color_ramp_legend_node_icon', im))
self.assertTrue(self.imageCheck('color_ramp_legend_node_icon', 'color_ramp_legend_node_icon', im, 10))

def test_draw(self):
r = QgsGradientColorRamp(QColor(200, 0, 0, 100), QColor(0, 200, 0, 200))
@@ -136,7 +136,7 @@ def test_draw(self):

self.assertTrue(self.imageCheck('color_ramp_legend_node_draw', 'color_ramp_legend_node_draw', image))

def imageCheck(self, name, reference_image, image):
def imageCheck(self, name, reference_image, image, size_tolerance=0):
TestQgsColorRampLegendNode.report += "<h2>Render {}</h2>\n".format(name)
temp_dir = QDir.tempPath() + '/'
file_name = temp_dir + name + ".png"
@@ -146,6 +146,7 @@ def imageCheck(self, name, reference_image, image):
checker.setControlName("expected_" + reference_image)
checker.setRenderedImage(file_name)
checker.setColorTolerance(2)
checker.setSizeTolerance(size_tolerance, size_tolerance)
result = checker.compareImages(name, 20)
TestQgsColorRampLegendNode.report += checker.report()
return result

0 comments on commit 33a9f4e

Please sign in to comment.
You can’t perform that action at this time.