Skip to content

Commit eb9e2ac

Browse files
committed
Add some tests
1 parent 25accbc commit eb9e2ac

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

tests/src/python/test_qgsserver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _img_diff(self, image, control_image, max_diff, max_size_diff=QSize()):
163163
control.setRenderedImage(temp_image)
164164
if max_size_diff.isValid():
165165
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
166-
return control.compareImages(control_image), control.report()
166+
return control.compareImages(control_image, max_diff), control.report()
167167

168168
def _img_diff_error(self, response, headers, image, max_diff=10, max_size_diff=QSize()):
169169
self.assertEqual(

tests/src/python/test_qgsserver_wms.py

+55
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,61 @@ def test_project_wms_inspire(self):
176176
for request in ('GetCapabilities',):
177177
self.wms_inspire_request_compare(request)
178178

179+
def test_wms_getmap_basic_mode(self):
180+
# 1 bits
181+
qs = "?" + "&".join(["%s=%s" % i for i in list({
182+
"MAP": urllib.parse.quote(self.projectPath),
183+
"SERVICE": "WMS",
184+
"VERSION": "1.1.1",
185+
"REQUEST": "GetMap",
186+
"LAYERS": "Country",
187+
"STYLES": "",
188+
"FORMAT": "image/png; mode=1bit",
189+
"BBOX": "-16817707,-4710778,5696513,14587125",
190+
"HEIGHT": "500",
191+
"WIDTH": "500",
192+
"CRS": "EPSG:3857"
193+
}.items())])
194+
195+
r, h = self._result(self._execute_request(qs))
196+
self._img_diff_error(r, h, "WMS_GetMap_Mode_1bit", 20000)
197+
198+
# 8 bits
199+
qs = "?" + "&".join(["%s=%s" % i for i in list({
200+
"MAP": urllib.parse.quote(self.projectPath),
201+
"SERVICE": "WMS",
202+
"VERSION": "1.1.1",
203+
"REQUEST": "GetMap",
204+
"LAYERS": "Country",
205+
"STYLES": "",
206+
"FORMAT": "image/png; mode=8bit",
207+
"BBOX": "-16817707,-4710778,5696513,14587125",
208+
"HEIGHT": "500",
209+
"WIDTH": "500",
210+
"CRS": "EPSG:3857"
211+
}.items())])
212+
213+
r, h = self._result(self._execute_request(qs))
214+
self._img_diff_error(r, h, "WMS_GetMap_Mode_8bit", 20000)
215+
216+
# 16 bits
217+
qs = "?" + "&".join(["%s=%s" % i for i in list({
218+
"MAP": urllib.parse.quote(self.projectPath),
219+
"SERVICE": "WMS",
220+
"VERSION": "1.1.1",
221+
"REQUEST": "GetMap",
222+
"LAYERS": "Country",
223+
"STYLES": "",
224+
"FORMAT": "image/png; mode=16bit",
225+
"BBOX": "-16817707,-4710778,5696513,14587125",
226+
"HEIGHT": "500",
227+
"WIDTH": "500",
228+
"CRS": "EPSG:3857"
229+
}.items())])
230+
231+
r, h = self._result(self._execute_request(qs))
232+
self._img_diff_error(r, h, "WMS_GetMap_Mode_16bit", 20000)
233+
179234
def test_wms_getmap_basic(self):
180235
qs = "?" + "&".join(["%s=%s" % i for i in list({
181236
"MAP": urllib.parse.quote(self.projectPath),
Loading
Loading
Loading

0 commit comments

Comments
 (0)