Skip to content

Commit

Permalink
Add unit test for empty contextual legend
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Apr 17, 2018
1 parent bf2ed36 commit c217cbb
Show file tree
Hide file tree
Showing 2 changed files with 3,720 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/python/test_qgsserver.py
Expand Up @@ -893,6 +893,25 @@ def test_wms_GetLegendGraphic_BBox2(self):
r, h = self._result(self.server.handleRequest(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2")

def test_wms_GetLegendGraphic_EmptyLegend(self):
mapPath = self.testdata_path + 'test_project_contextual_legend.qgs'
qs = "&".join(["%s=%s" % i for i in list({
"MAP": urllib.quote(mapPath),
"SERVICE": "WMS",
"VERSION": "1.3.1",
"REQUEST": "GetLegendGraphic",
"LAYER": "QGIS%20Server%20Hello%20World",
"FORMAT": "image/png",
"HEIGHT": "840",
"WIDTH": "1226",
"BBOX": "10.38450,-49.6370,73.8183,42.9461",
"SRS": "EPSG:4326",
"SCALE": "15466642"
}.items())])

r, h = self._result(self.server.handleRequest(qs) )
self.assertTrue( h['Content-Type'] == 'image/png' )

def _result(self, data):
headers = {}
for line in data[0].decode('UTF-8').split("\n"):
Expand Down

0 comments on commit c217cbb

Please sign in to comment.