Skip to content

Commit a934f0f

Browse files
committedMay 3, 2020
Fix broken server tests
These tests had lots of issues, including some inappropriate mask images which nullified the tests!
1 parent 00df371 commit a934f0f

File tree

12 files changed

+6
-6
lines changed

12 files changed

+6
-6
lines changed
 

‎tests/src/python/test_qgsserver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
from io import StringIO
4242
from qgis.server import QgsServer, QgsServerRequest, QgsBufferServerRequest, QgsBufferServerResponse
43-
from qgis.core import QgsRenderChecker, QgsApplication, QgsFontUtils
43+
from qgis.core import QgsRenderChecker, QgsApplication, QgsFontUtils, QgsMultiRenderChecker
4444
from qgis.testing import unittest
4545
from qgis.PyQt.QtCore import QSize
4646
from utilities import unitTestDataPath
@@ -188,13 +188,13 @@ def _img_diff(self, image, control_image, max_diff, max_size_diff=QSize(), outpu
188188
if outputJpg:
189189
return (True, "QgsRenderChecker can't be used for JPG images")
190190

191-
control = QgsRenderChecker()
191+
control = QgsMultiRenderChecker()
192192
control.setControlPathPrefix("qgis_server")
193193
control.setControlName(control_image)
194194
control.setRenderedImage(temp_image)
195195
if max_size_diff.isValid():
196196
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
197-
return control.compareImages(control_image, max_diff), control.report()
197+
return control.runTest(control_image, max_diff), control.report()
198198

199199
def _img_diff_error(self, response, headers, image, max_diff=100, max_size_diff=QSize(), unittest_data_path='control_images', outputJpg=False):
200200

‎tests/src/python/test_qgsserver_wms_getprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import subprocess
3636

3737
from test_qgsserver import QgsServerTestBase
38-
from qgis.core import QgsProject, QgsRenderChecker
38+
from qgis.core import QgsProject, QgsRenderChecker, QgsMultiRenderChecker
3939
from qgis.server import QgsServerRequest
4040
from utilities import getExecutablePath, unitTestDataPath
4141

@@ -105,13 +105,13 @@ def _pdf_diff(self, pdf, control_image, max_diff, max_size_diff=QSize(), dpi=96)
105105
temp_image = os.path.join(tempfile.gettempdir(), "%s_result.png" % control_image)
106106
self._pdf_to_png(temp_pdf, temp_image, dpi=dpi, page=1)
107107

108-
control = QgsRenderChecker()
108+
control = QgsMultiRenderChecker()
109109
control.setControlPathPrefix("qgis_server")
110110
control.setControlName(control_image)
111111
control.setRenderedImage(temp_image)
112112
if max_size_diff.isValid():
113113
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
114-
return control.compareImages(control_image, max_diff), control.report()
114+
return control.runTest(control_image, max_diff), control.report()
115115

116116
def _pdf_diff_error(self, response, headers, image, max_diff=100, max_size_diff=QSize(), unittest_data_path='control_images', dpi=96):
117117

Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.