mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
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:
commit
3b839ceb43
@ -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 )
|
||||
|
@ -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(
|
||||
|
@ -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),
|
||||
|
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_16bit/WMS_GetMap_Mode_16bit.png
vendored
Normal file
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_16bit/WMS_GetMap_Mode_16bit.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 979 KiB |
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_1bit/WMS_GetMap_Mode_1bit.png
vendored
Normal file
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_1bit/WMS_GetMap_Mode_1bit.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_8bit/WMS_GetMap_Mode_8bit.png
vendored
Normal file
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Mode_8bit/WMS_GetMap_Mode_8bit.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 KiB |
Loading…
x
Reference in New Issue
Block a user