@@ -62,27 +62,6 @@ def test_getLegendGraphics(self):
62
62
self .assertEqual (- 1 , h .find (b'Content-Type: text/xml; charset=utf-8' ), "Header: %s\n Response:\n %s" % (h , r ))
63
63
self .assertNotEqual (- 1 , h .find (b'Content-Type: image/png' ), "Header: %s\n Response:\n %s" % (h , r ))
64
64
65
- def test_getLegendGraphics_invalid_parameters (self ):
66
- """Test that does return an exception"""
67
- qs = "?" + "&" .join (["%s=%s" % i for i in list ({
68
- "MAP" : urllib .parse .quote (self .projectPath ),
69
- "SERVICE" : "WMS" ,
70
- "VERSION" : "1.1.1" ,
71
- "REQUEST" : "GetLegendGraphic" ,
72
- "LAYER" : "Country,Hello,db_point" ,
73
- "LAYERTITLE" : "FALSE" ,
74
- "FORMAT" : "image/png" ,
75
- "HEIGHT" : "500" ,
76
- "WIDTH" : "500" ,
77
- "RULE" : "1" ,
78
- "BBOX" : "-151.7,-38.9,51.0,78.0" ,
79
- "CRS" : "EPSG:4326"
80
- }.items ())])
81
-
82
- r , h = self ._result (self ._execute_request (qs ))
83
- err = b"BBOX parameter cannot be combined with RULE" in r
84
- self .assertTrue (err )
85
-
86
65
def test_wms_GetLegendGraphic_LayerSpace (self ):
87
66
qs = "?" + "&" .join (["%s=%s" % i for i in list ({
88
67
"MAP" : urllib .parse .quote (self .projectPath ),
@@ -107,6 +86,27 @@ def test_wms_GetLegendGraphic_LayerSpace(self):
107
86
r , h = self ._result (self ._execute_request (qs ))
108
87
self ._img_diff_error (r , h , "WMS_GetLegendGraphic_LayerSpace" , max_size_diff = QSize (1 , 1 ))
109
88
89
+ def test_wms_getLegendGraphics_invalid_parameters (self ):
90
+ """Test that does return an exception"""
91
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
92
+ "MAP" : urllib .parse .quote (self .projectPath ),
93
+ "SERVICE" : "WMS" ,
94
+ "VERSION" : "1.1.1" ,
95
+ "REQUEST" : "GetLegendGraphic" ,
96
+ "LAYER" : "Country,Hello,db_point" ,
97
+ "LAYERTITLE" : "FALSE" ,
98
+ "FORMAT" : "image/png" ,
99
+ "HEIGHT" : "500" ,
100
+ "WIDTH" : "500" ,
101
+ "RULE" : "1" ,
102
+ "BBOX" : "-151.7,-38.9,51.0,78.0" ,
103
+ "CRS" : "EPSG:4326"
104
+ }.items ())])
105
+
106
+ r , h = self ._result (self ._execute_request (qs ))
107
+ err = b"BBOX parameter cannot be combined with RULE" in r
108
+ self .assertTrue (err )
109
+
110
110
def test_wms_GetLegendGraphic_LayerTitleSpace (self ):
111
111
qs = "?" + "&" .join (["%s=%s" % i for i in list ({
112
112
"MAP" : urllib .parse .quote (self .projectPath ),
@@ -155,7 +155,7 @@ def test_wms_GetLegendGraphic_ShowFeatureCount(self):
155
155
r , h = self ._result (self ._execute_request (qs ))
156
156
self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ShowFeatureCount" , max_size_diff = QSize (1 , 1 ))
157
157
158
- def test_getLegendGraphics_layertitle (self ):
158
+ def test_wms_getLegendGraphics_layertitle (self ):
159
159
"""Test that does not return an exception but an image"""
160
160
161
161
print ("TEST FONT FAMILY: " , self .fontFamily )
@@ -196,7 +196,7 @@ def test_getLegendGraphics_layertitle(self):
196
196
r , h = self ._result (self ._execute_request (qs ))
197
197
self ._img_diff_error (r , h , "WMS_GetLegendGraphic_test_layertitle_false" , 250 , QSize (15 , 15 ))
198
198
199
- def test_getLegendGraphics_rulelabel (self ):
199
+ def test_wms_getLegendGraphics_rulelabel (self ):
200
200
"""Test that does not return an exception but an image"""
201
201
parms = {
202
202
'MAP' : self .testdata_path + "test_project.qgs" ,
@@ -236,7 +236,7 @@ def test_getLegendGraphics_rulelabel(self):
236
236
r , h = self ._result (self ._execute_request (qs ))
237
237
self ._img_diff_error (r , h , "WMS_GetLegendGraphic_rulelabel_false" , 250 , QSize (15 , 15 ))
238
238
239
- def test_getLegendGraphics_rule (self ):
239
+ def test_wms_getLegendGraphics_rule (self ):
240
240
"""Test that does not return an exception but an image"""
241
241
parms = {
242
242
'MAP' : self .testdata_path + "test_project_legend_rule.qgs" ,
@@ -691,6 +691,121 @@ def test_wms_GetLegendGraphic_ScaleSymbol_Max(self):
691
691
r , h = self ._result (self ._execute_request (qs ))
692
692
self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ScaleSymbol_Max" , max_size_diff = QSize (15 , 15 ))
693
693
694
+ def test_wms_GetLegendGraphic_ScaleSymbol_DefaultMapUnitsPerMillimeter (self ):
695
+ # map units per mm on 1:20000000 with SRCHEIGHT=598&SRCWIDTH=1640&BBOX=16.5,-69.7,73.3,86.1 would be around what is set as default: 0.359 map units per mm
696
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
697
+ "MAP" : self .testdata_path + 'test_project_scaledsymbols.qgs' ,
698
+ "SERVICE" : "WMS" ,
699
+ "REQUEST" : "GetLegendGraphic" ,
700
+ "LAYER" : "testlayer" ,
701
+ "FORMAT" : "image/png" ,
702
+ "CRS" : "EPSG:4326"
703
+ }.items ())])
704
+
705
+ r , h = self ._result (self ._execute_request (qs ))
706
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ScaleSymbol_DefaultMapUnitsPerMillimeter" , max_size_diff = QSize (15 , 15 ))
707
+
708
+ def test_wms_GetLegendGraphic_ScaleSymbol_Scaled_2056 (self ):
709
+ # 1:1000 scale on an EPSG:2056 calculating DPI that is around 96
710
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
711
+ "MAP" : self .testdata_path + 'test_project_scaledsymbols_2056.qgs' ,
712
+ "SERVICE" : "WMS" ,
713
+ "REQUEST" : "GetLegendGraphic" ,
714
+ "LAYER" : "testlayer_2056" ,
715
+ "FORMAT" : "image/png" ,
716
+ "SRCHEIGHT" : "600" ,
717
+ "SRCWIDTH" : "1500" ,
718
+ "BBOX" : "2662610.7,1268841.8,2663010.5,1269000.05" ,
719
+ "CRS" : "EPSG:2056"
720
+ }.items ())])
721
+
722
+ r , h = self ._result (self ._execute_request (qs ))
723
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ScaleSymbol_Scaled_2056" , max_size_diff = QSize (15 , 15 ))
724
+
725
+ def test_wms_GetLegendGraphic_ScaleSymbol_DefaultScale_2056 (self ):
726
+ # 1:1000 as default value - it's not exactly the same result than passing the bbox and size because of exact DPI 96 (default)
727
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
728
+ "MAP" : self .testdata_path + 'test_project_scaledsymbols_2056.qgs' ,
729
+ "SERVICE" : "WMS" ,
730
+ "REQUEST" : "GetLegendGraphic" ,
731
+ "LAYER" : "testlayer_2056" ,
732
+ "FORMAT" : "image/png" ,
733
+ "CRS" : "EPSG:2056"
734
+ }.items ())])
735
+
736
+ r , h = self ._result (self ._execute_request (qs ))
737
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ScaleSymbol_DefaultScale_2056" , max_size_diff = QSize (15 , 15 ))
738
+
739
+ def test_wms_GetLegendGraphic_LAYERFONTCOLOR (self ):
740
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
741
+ "MAP" : urllib .parse .quote (self .projectPath ),
742
+ "SERVICE" : "WMS" ,
743
+ "VERSION" : "1.1.1" ,
744
+ "REQUEST" : "GetLegendGraphic" ,
745
+ "LAYER" : "Country,Hello" ,
746
+ "FORMAT" : "image/png" ,
747
+ "HEIGHT" : "500" ,
748
+ "WIDTH" : "500" ,
749
+ "CRS" : "EPSG:3857" ,
750
+ "LAYERFONTCOLOR" : "red"
751
+ }.items ())])
752
+
753
+ r , h = self ._result (self ._execute_request (qs ))
754
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
755
+
756
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR (self ):
757
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
758
+ "MAP" : urllib .parse .quote (self .projectPath ),
759
+ "SERVICE" : "WMS" ,
760
+ "VERSION" : "1.1.1" ,
761
+ "REQUEST" : "GetLegendGraphic" ,
762
+ "LAYER" : "Country,Hello" ,
763
+ "FORMAT" : "image/png" ,
764
+ "HEIGHT" : "500" ,
765
+ "WIDTH" : "500" ,
766
+ "CRS" : "EPSG:3857" ,
767
+ "ITEMFONTCOLOR" : "red" ,
768
+ }.items ())])
769
+
770
+ r , h = self ._result (self ._execute_request (qs ))
771
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
772
+
773
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR (self ):
774
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
775
+ "MAP" : urllib .parse .quote (self .projectPath ),
776
+ "SERVICE" : "WMS" ,
777
+ "VERSION" : "1.1.1" ,
778
+ "REQUEST" : "GetLegendGraphic" ,
779
+ "LAYER" : "Country,Hello" ,
780
+ "FORMAT" : "image/png" ,
781
+ "HEIGHT" : "500" ,
782
+ "WIDTH" : "500" ,
783
+ "CRS" : "EPSG:3857" ,
784
+ "ITEMFONTCOLOR" : "red" ,
785
+ "LAYERFONTCOLOR" : "blue"
786
+ }.items ())])
787
+
788
+ r , h = self ._result (self ._execute_request (qs ))
789
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
790
+
791
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR_hex (self ):
792
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
793
+ "MAP" : urllib .parse .quote (self .projectPath ),
794
+ "SERVICE" : "WMS" ,
795
+ "VERSION" : "1.1.1" ,
796
+ "REQUEST" : "GetLegendGraphic" ,
797
+ "LAYER" : "Country,Hello" ,
798
+ "FORMAT" : "image/png" ,
799
+ "HEIGHT" : "500" ,
800
+ "WIDTH" : "500" ,
801
+ "CRS" : "EPSG:3857" ,
802
+ "ITEMFONTCOLOR" : r"%23FF0000" ,
803
+ "LAYERFONTCOLOR" : r"%230000FF"
804
+ }.items ())])
805
+
806
+ r , h = self ._result (self ._execute_request (qs ))
807
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
808
+
694
809
695
810
if __name__ == '__main__' :
696
811
unittest .main ()
0 commit comments