@@ -488,6 +488,47 @@ def test_wms_GetLegendGraphic_EmptyLegend(self):
488
488
self .assertEqual (- 1 , h .find (b'Content-Type: text/xml; charset=utf-8' ), "Header: %s\n Response:\n %s" % (h , r ))
489
489
self .assertNotEqual (- 1 , h .find (b'Content-Type: image/png' ), "Header: %s\n Response:\n %s" % (h , r ))
490
490
491
+ def test_wms_GetLegendGraphic_wmsRootName (self ):
492
+ """Test an unreported issue when a wmsRootName short name is set in the service capabilities"""
493
+
494
+ # First test with the project title itself:
495
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
496
+ "MAP" : self .testdata_path + 'test_project_wms_grouped_layers.qgs' ,
497
+ "SERVICE" : "WMS" ,
498
+ "VERSION" : "1.1.1" ,
499
+ "REQUEST" : "GetLegendGraphic" ,
500
+ "LAYER" : "QGIS%20Server%20-%20Grouped%20Layer" ,
501
+ "FORMAT" : "image/png" ,
502
+ "HEIGHT" : "840" ,
503
+ "WIDTH" : "1226" ,
504
+ "BBOX" : "609152,5808188,625492,5814318" ,
505
+ "SRS" : "EPSG:25832" ,
506
+ "SCALE" : "38976"
507
+ }.items ())])
508
+
509
+ h , r = self ._execute_request (qs )
510
+ self .assertEqual (- 1 , h .find (b'Content-Type: text/xml; charset=utf-8' ), "Header: %s\n Response:\n %s" % (h , r ))
511
+ self .assertNotEqual (- 1 , h .find (b'Content-Type: image/png' ), "Header: %s\n Response:\n %s" % (h , r ))
512
+
513
+ # Then test with the wmsRootName short name:
514
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
515
+ "MAP" : self .testdata_path + 'test_project_wms_grouped_layers_wmsroot.qgs' ,
516
+ "SERVICE" : "WMS" ,
517
+ "VERSION" : "1.1.1" ,
518
+ "REQUEST" : "GetLegendGraphic" ,
519
+ "LAYER" : "All_grouped_layers" ,
520
+ "FORMAT" : "image/png" ,
521
+ "HEIGHT" : "840" ,
522
+ "WIDTH" : "1226" ,
523
+ "BBOX" : "609152,5808188,625492,5814318" ,
524
+ "SRS" : "EPSG:25832" ,
525
+ "SCALE" : "38976"
526
+ }.items ())])
527
+
528
+ h , r = self ._execute_request (qs )
529
+ self .assertEqual (- 1 , h .find (b'Content-Type: text/xml; charset=utf-8' ), "Header: %s\n Response:\n %s" % (h , r ))
530
+ self .assertNotEqual (- 1 , h .find (b'Content-Type: image/png' ), "Header: %s\n Response:\n %s" % (h , r ))
531
+
491
532
492
533
if __name__ == '__main__' :
493
534
unittest .main ()
0 commit comments