Skip to content

Commit 2275ebb

Browse files
committedApr 24, 2018
[Tests][Server] Add unit test for empty contextual legend
Manually port c217cbb
1 parent 235402d commit 2275ebb

File tree

2 files changed

+3058
-0
lines changed

2 files changed

+3058
-0
lines changed
 

‎tests/src/python/test_qgsserver_wms_getlegendgraphic.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,25 @@ def test_wms_GetLegendGraphic_BBox2(self):
469469
r, h = self._result(self._execute_request(qs))
470470
self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2")
471471

472+
def test_wms_GetLegendGraphic_EmptyLegend(self):
473+
qs = "?" + "&".join(["%s=%s" % i for i in list({
474+
"MAP": self.testdata_path + 'test_project_contextual_legend.qgs',
475+
"SERVICE": "WMS",
476+
"VERSION": "1.1.1",
477+
"REQUEST": "GetLegendGraphic",
478+
"LAYER": "QGIS%20Server%20Hello%20World",
479+
"FORMAT": "image/png",
480+
"HEIGHT": "840",
481+
"WIDTH": "1226",
482+
"BBOX": "10.38450,-49.6370,73.8183,42.9461",
483+
"SRS": "EPSG:4326",
484+
"SCALE": "15466642"
485+
}.items())])
486+
487+
h, r = self._execute_request(qs)
488+
self.assertEqual(-1, h.find(b'Content-Type: text/xml; charset=utf-8'), "Header: %s\nResponse:\n%s" % (h, r))
489+
self.assertNotEqual(-1, h.find(b'Content-Type: image/png'), "Header: %s\nResponse:\n%s" % (h, r))
490+
472491

473492
if __name__ == '__main__':
474493
unittest.main()

‎tests/testdata/qgis_server/test_project_contextual_legend.qgs

Lines changed: 3039 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.