Merge pull request #5084 from pblottiere/server_bugfix_ogc_mode

[server][bugfix] Fixes OGC test on getmap:each-format mode for 1bit/8bit/16bit
This commit is contained in:
Blottiere Paul 2017-09-06 08:14:34 +01:00 committed by GitHub
commit 3b839ceb43
6 changed files with 57 additions and 2 deletions

View File

@ -94,7 +94,7 @@ namespace QgsWms
QRegularExpression::CaseInsensitiveOption );
QRegularExpressionMatch match = modeExpr.match( format );
QString mode = match.captured();
QString mode = match.captured( 1 );
if ( mode.compare( QLatin1String( "16bit" ), Qt::CaseInsensitive ) == 0 )
return PNG16;
if ( mode.compare( QLatin1String( "8bit" ), Qt::CaseInsensitive ) == 0 )

View File

@ -163,7 +163,7 @@ class QgsServerTestBase(unittest.TestCase):
control.setRenderedImage(temp_image)
if max_size_diff.isValid():
control.setSizeTolerance(max_size_diff.width(), max_size_diff.height())
return control.compareImages(control_image), control.report()
return control.compareImages(control_image, max_diff), control.report()
def _img_diff_error(self, response, headers, image, max_diff=10, max_size_diff=QSize()):
self.assertEqual(

View File

@ -176,6 +176,61 @@ class TestQgsServerWMS(QgsServerTestBase):
for request in ('GetCapabilities',):
self.wms_inspire_request_compare(request)
def test_wms_getmap_basic_mode(self):
# 1 bits
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; mode=1bit",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Mode_1bit", 20000)
# 8 bits
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; mode=8bit",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Mode_8bit", 20000)
# 16 bits
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; mode=16bit",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Mode_16bit", 20000)
def test_wms_getmap_basic(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB