Skip to content

Commit

Permalink
Add test for preserving dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Jun 8, 2020
1 parent 471998c commit a4b26f2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/src/python/test_qgsserver_wms_getmap.py
Expand Up @@ -26,6 +26,7 @@

from qgis.testing import unittest
from qgis.PyQt.QtCore import QSize
from qgis.PyQt.QtGui import QImage

import osgeo.gdal # NOQA

Expand Down Expand Up @@ -239,6 +240,30 @@ def test_wms_getmap_dpi(self):

r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Basic5")
img = QImage.fromData(r, "PNG")
self.assertEqual(img.dotsPerMeterX(), 4409)
self.assertEqual(img.dotsPerMeterY(), 4409)

def test_wms_getmap_dpi_png_8bit(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857",
"DPI": "112.5"
}.items())])

r, h = self._result(self._execute_request(qs))
img = QImage.fromData(r, "PNG")
self.assertEqual(img.dotsPerMeterX(), 4409)
self.assertEqual(img.dotsPerMeterY(), 4409)

def test_wms_getmap_invalid_parameters(self):
# invalid format
Expand Down

0 comments on commit a4b26f2

Please sign in to comment.