@@ -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,76 @@ 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_LAYERFONTCOLOR (self ):
695
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
696
+ "MAP" : urllib .parse .quote (self .projectPath ),
697
+ "SERVICE" : "WMS" ,
698
+ "VERSION" : "1.1.1" ,
699
+ "REQUEST" : "GetLegendGraphic" ,
700
+ "LAYER" : "Country,Hello" ,
701
+ "FORMAT" : "image/png" ,
702
+ "HEIGHT" : "500" ,
703
+ "WIDTH" : "500" ,
704
+ "CRS" : "EPSG:3857" ,
705
+ "LAYERFONTCOLOR" : "red"
706
+ }.items ())])
707
+
708
+ r , h = self ._result (self ._execute_request (qs ))
709
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
710
+
711
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR (self ):
712
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
713
+ "MAP" : urllib .parse .quote (self .projectPath ),
714
+ "SERVICE" : "WMS" ,
715
+ "VERSION" : "1.1.1" ,
716
+ "REQUEST" : "GetLegendGraphic" ,
717
+ "LAYER" : "Country,Hello" ,
718
+ "FORMAT" : "image/png" ,
719
+ "HEIGHT" : "500" ,
720
+ "WIDTH" : "500" ,
721
+ "CRS" : "EPSG:3857" ,
722
+ "ITEMFONTCOLOR" : "red" ,
723
+ }.items ())])
724
+
725
+ r , h = self ._result (self ._execute_request (qs ))
726
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
727
+
728
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR (self ):
729
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
730
+ "MAP" : urllib .parse .quote (self .projectPath ),
731
+ "SERVICE" : "WMS" ,
732
+ "VERSION" : "1.1.1" ,
733
+ "REQUEST" : "GetLegendGraphic" ,
734
+ "LAYER" : "Country,Hello" ,
735
+ "FORMAT" : "image/png" ,
736
+ "HEIGHT" : "500" ,
737
+ "WIDTH" : "500" ,
738
+ "CRS" : "EPSG:3857" ,
739
+ "ITEMFONTCOLOR" : "red" ,
740
+ "LAYERFONTCOLOR" : "blue"
741
+ }.items ())])
742
+
743
+ r , h = self ._result (self ._execute_request (qs ))
744
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
745
+
746
+ def test_wms_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR_hex (self ):
747
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
748
+ "MAP" : urllib .parse .quote (self .projectPath ),
749
+ "SERVICE" : "WMS" ,
750
+ "VERSION" : "1.1.1" ,
751
+ "REQUEST" : "GetLegendGraphic" ,
752
+ "LAYER" : "Country,Hello" ,
753
+ "FORMAT" : "image/png" ,
754
+ "HEIGHT" : "500" ,
755
+ "WIDTH" : "500" ,
756
+ "CRS" : "EPSG:3857" ,
757
+ "ITEMFONTCOLOR" : r"%23FF0000" ,
758
+ "LAYERFONTCOLOR" : r"%230000FF"
759
+ }.items ())])
760
+
761
+ r , h = self ._result (self ._execute_request (qs ))
762
+ self ._img_diff_error (r , h , "WMS_GetLegendGraphic_ITEMFONTCOLOR_and_LAYERFONTCOLOR" , max_size_diff = QSize (10 , 2 ))
763
+
694
764
695
765
if __name__ == '__main__' :
696
766
unittest .main ()
0 commit comments