@@ -1109,6 +1109,76 @@ def test_wms_getmap_annotations(self):
1109
1109
self ._img_diff_error (r , h , "WMS_GetMap_Annotations" )
1110
1110
1111
1111
def test_wms_getmap_sld (self ):
1112
+ import socketserver
1113
+ import threading
1114
+ import http .server
1115
+
1116
+ # Bring up a simple HTTP server
1117
+ os .chdir (unitTestDataPath () + '' )
1118
+ handler = http .server .SimpleHTTPRequestHandler
1119
+
1120
+ httpd = socketserver .TCPServer (('localhost' , 0 ), handler )
1121
+ port = httpd .server_address [1 ]
1122
+
1123
+ httpd_thread = threading .Thread (target = httpd .serve_forever )
1124
+ httpd_thread .setDaemon (True )
1125
+ httpd_thread .start ()
1126
+
1127
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
1128
+ "MAP" : urllib .parse .quote (self .projectPath ),
1129
+ "SERVICE" : "WMS" ,
1130
+ "VERSION" : "1.1.1" ,
1131
+ "REQUEST" : "GetMap" ,
1132
+ "LAYERS" : "Country,db_point" ,
1133
+ "STYLES" : "" ,
1134
+ "FORMAT" : "image/png" ,
1135
+ "BBOX" : "-16817707,-4710778,5696513,14587125" ,
1136
+ "HEIGHT" : "500" ,
1137
+ "WIDTH" : "500" ,
1138
+ "CRS" : "EPSG:3857"
1139
+ }.items ())])
1140
+
1141
+ r , h = self ._result (self ._execute_request (qs ))
1142
+ self ._img_diff_error (r , h , "WMS_GetMap_SLDRestored" )
1143
+
1144
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
1145
+ "MAP" : urllib .parse .quote (self .projectPath ),
1146
+ "REQUEST" : "GetMap" ,
1147
+ "VERSION" : "1.1.1" ,
1148
+ "SERVICE" : "WMS" ,
1149
+ "SLD" : "http://localhost:" + str (port ) + "/qgis_local_server/db_point.sld" ,
1150
+ "BBOX" : "-16817707,-4710778,5696513,14587125" ,
1151
+ "WIDTH" : "500" ,
1152
+ "HEIGHT" : "500" ,
1153
+ "LAYERS" : "db_point" ,
1154
+ "STYLES" : "" ,
1155
+ "FORMAT" : "image/png" ,
1156
+ "CRS" : "EPSG:3857"
1157
+ }.items ())])
1158
+
1159
+ r , h = self ._result (self ._execute_request (qs ))
1160
+ self ._img_diff_error (r , h , "WMS_GetMap_SLD" )
1161
+
1162
+ qs = "?" + "&" .join (["%s=%s" % i for i in list ({
1163
+ "MAP" : urllib .parse .quote (self .projectPath ),
1164
+ "SERVICE" : "WMS" ,
1165
+ "VERSION" : "1.1.1" ,
1166
+ "REQUEST" : "GetMap" ,
1167
+ "LAYERS" : "Country,db_point" ,
1168
+ "STYLES" : "" ,
1169
+ "FORMAT" : "image/png" ,
1170
+ "BBOX" : "-16817707,-4710778,5696513,14587125" ,
1171
+ "HEIGHT" : "500" ,
1172
+ "WIDTH" : "500" ,
1173
+ "CRS" : "EPSG:3857"
1174
+ }.items ())])
1175
+
1176
+ r , h = self ._result (self ._execute_request (qs ))
1177
+ self ._img_diff_error (r , h , "WMS_GetMap_SLDRestored" )
1178
+
1179
+ httpd .server_close ()
1180
+
1181
+ def test_wms_getmap_sld_body (self ):
1112
1182
qs = "?" + "&" .join (["%s=%s" % i for i in list ({
1113
1183
"MAP" : urllib .parse .quote (self .projectPath ),
1114
1184
"SERVICE" : "WMS" ,
0 commit comments