Skip to content

Commit c217cbb

Browse files
committed
Add unit test for empty contextual legend
1 parent bf2ed36 commit c217cbb

File tree

2 files changed

+3720
-0
lines changed

2 files changed

+3720
-0
lines changed

tests/src/python/test_qgsserver.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,25 @@ def test_wms_GetLegendGraphic_BBox2(self):
893893
r, h = self._result(self.server.handleRequest(qs))
894894
self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2")
895895

896+
def test_wms_GetLegendGraphic_EmptyLegend(self):
897+
mapPath = self.testdata_path + 'test_project_contextual_legend.qgs'
898+
qs = "&".join(["%s=%s" % i for i in list({
899+
"MAP": urllib.quote(mapPath),
900+
"SERVICE": "WMS",
901+
"VERSION": "1.3.1",
902+
"REQUEST": "GetLegendGraphic",
903+
"LAYER": "QGIS%20Server%20Hello%20World",
904+
"FORMAT": "image/png",
905+
"HEIGHT": "840",
906+
"WIDTH": "1226",
907+
"BBOX": "10.38450,-49.6370,73.8183,42.9461",
908+
"SRS": "EPSG:4326",
909+
"SCALE": "15466642"
910+
}.items())])
911+
912+
r, h = self._result(self.server.handleRequest(qs) )
913+
self.assertTrue( h['Content-Type'] == 'image/png' )
914+
896915
def _result(self, data):
897916
headers = {}
898917
for line in data[0].decode('UTF-8').split("\n"):

0 commit comments

Comments
 (0)