Skip to content
Permalink
Browse files

Fix broken server tests

These tests had lots of issues, including some inappropriate mask images
which nullified the tests!
  • Loading branch information
nyalldawson committed May 1, 2020
1 parent 00df371 commit a934f0f605978a7ad76ec1f8cac8980a8575f6e5
@@ -40,7 +40,7 @@

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

control = QgsRenderChecker()
control = QgsMultiRenderChecker()
control.setControlPathPrefix("qgis_server")
control.setControlName(control_image)
control.setRenderedImage(temp_image)
if max_size_diff.isValid():
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
return control.compareImages(control_image, max_diff), control.report()
return control.runTest(control_image, max_diff), control.report()

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

@@ -35,7 +35,7 @@
import subprocess

from test_qgsserver import QgsServerTestBase
from qgis.core import QgsProject, QgsRenderChecker
from qgis.core import QgsProject, QgsRenderChecker, QgsMultiRenderChecker
from qgis.server import QgsServerRequest
from utilities import getExecutablePath, unitTestDataPath

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

control = QgsRenderChecker()
control = QgsMultiRenderChecker()
control.setControlPathPrefix("qgis_server")
control.setControlName(control_image)
control.setRenderedImage(temp_image)
if max_size_diff.isValid():
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
return control.compareImages(control_image, max_diff), control.report()
return control.runTest(control_image, max_diff), control.report()

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit a934f0f

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