Skip to content

Commit

Permalink
Merge pull request #5360 from pblottiere/server_bugfix_ogc_getmap_bbox
Browse files Browse the repository at this point in the history
[server][bugfix] Fix OGC test getmap bbox
  • Loading branch information
pblottiere authored Oct 17, 2017
2 parents 4901f0a + 6447bee commit c645479
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/services/wms/qgswmsparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,12 @@ namespace QgsWms
}
}

if ( d[0] > d[2] || d[1] > d[3] )
{
*error = true;
return extent;
}

extent = QgsRectangle( d[0], d[1], d[2], d[3] );
}
else
Expand Down
38 changes: 38 additions & 0 deletions tests/src/python/test_qgsserver_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,44 @@ def test_wms_getmap_invalid_parameters(self):
err = b"BBOX (\'-16817707,-4710778,5696513,FOO\') cannot be converted into a rectangle" in r
self.assertTrue(err)

# test invalid bbox : xmin > xmax
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "1,0,0,1",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])

r, h = self._result(self._execute_request(qs))
err = b"cannot be converted into a rectangle" in r
self.assertTrue(err)

# test invalid bbox : ymin > ymax
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "0,1,0,0",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])

r, h = self._result(self._execute_request(qs))
err = b"cannot be converted into a rectangle" in r
self.assertTrue(err)

# opacities should be a list of int
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
Expand Down

0 comments on commit c645479

Please sign in to comment.