Skip to content
Permalink
Browse files

Add test for preserving dpi

  • Loading branch information
m-kuhn authored and nyalldawson committed Jun 8, 2020
1 parent 471998c commit a4b26f23b08cd26c55b7af44d4fc5780921f5828
Showing with 25 additions and 0 deletions.
  1. +25 −0 tests/src/python/test_qgsserver_wms_getmap.py
@@ -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

@@ -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

0 comments on commit a4b26f2

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