Skip to content

Commit

Permalink
Use multi render test for random marker fill tests
Browse files Browse the repository at this point in the history
(cherry picked from commit b7cd5f2)
nyalldawson committed Aug 8, 2022
1 parent 48b24a4 commit 3b10602
Showing 5 changed files with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/src/python/test_qgsrandommarkersymbollayer.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
QgsRenderContext,
QgsFeature,
QgsMapSettings,
QgsRenderChecker,
QgsMultiRenderChecker,
QgsReadWriteContext,
QgsSymbolLayerUtils,
QgsSimpleMarkerSymbolLayer,
@@ -59,13 +59,15 @@

class TestQgsRandomMarkerSymbolLayer(unittest.TestCase):

def setUp(self):
self.report = "<h1>Python QgsRandomMarkerFillSymbolLayer Tests</h1>\n"
@classmethod
def setUpClass(cls):
cls.report = "<h1>Python QgsRandomMarkerFillSymbolLayer Tests</h1>\n"

def tearDown(self):
@classmethod
def tearDownClass(cls):
report_file_path = "%s/qgistest.html" % QDir.tempPath()
with open(report_file_path, 'a') as report_file:
report_file.write(self.report)
report_file.write(cls.report)

def testSimple(self):
s = QgsFillSymbol()
@@ -327,14 +329,13 @@ def imageCheck(self, name, reference_image, image):
temp_dir = QDir.tempPath() + '/'
file_name = temp_dir + 'symbol_' + name + ".png"
image.save(file_name, "PNG")
checker = QgsRenderChecker()
checker = QgsMultiRenderChecker()
checker.setControlPathPrefix("symbol_randommarkerfill")
checker.setControlName("expected_" + reference_image)
checker.setRenderedImage(file_name)
checker.setColorTolerance(2)
result = checker.compareImages(name, 20)
self.report += checker.report()
print((self.report))
result = checker.runTest(name, 20)
TestQgsRandomMarkerSymbolLayer.report += checker.report()
return result


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3b10602

Please sign in to comment.