|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +"""QGIS Unit tests for QgsServer WMS. |
| 3 | +
|
| 4 | +From build dir, run: ctest -R PyQgsServerWMS -V |
| 5 | +
|
| 6 | +
|
| 7 | +.. note:: This program is free software; you can redistribute it and/or modify |
| 8 | +it under the terms of the GNU General Public License as published by |
| 9 | +the Free Software Foundation; either version 2 of the License, or |
| 10 | +(at your option) any later version. |
| 11 | +
|
| 12 | +""" |
| 13 | +__author__ = 'Alessandro Pasotti' |
| 14 | +__date__ = '25/05/2015' |
| 15 | +__copyright__ = 'Copyright 2015, The QGIS Project' |
| 16 | +# This will get replaced with a git SHA1 when you do a git archive |
| 17 | +__revision__ = '$Format:%H$' |
| 18 | + |
| 19 | +import os |
| 20 | + |
| 21 | +# Needed on Qt 5 so that the serialization of XML is consistent among all executions |
| 22 | +os.environ['QT_HASH_SEED'] = '1' |
| 23 | + |
| 24 | +import re |
| 25 | +import urllib.request |
| 26 | +import urllib.parse |
| 27 | +import urllib.error |
| 28 | + |
| 29 | +from qgis.testing import unittest |
| 30 | +from qgis.PyQt.QtCore import QSize |
| 31 | + |
| 32 | +import osgeo.gdal # NOQA |
| 33 | + |
| 34 | +from test_qgsserver import QgsServerTestBase |
| 35 | +from qgis.core import QgsProject |
| 36 | + |
| 37 | +# Strip path and content length because path may vary |
| 38 | +RE_STRIP_UNCHECKABLE = b'MAP=[^"]+|Content-Length: \d+' |
| 39 | +RE_ATTRIBUTES = b'[^>\s]+=[^>\s]+' |
| 40 | + |
| 41 | + |
| 42 | +class TestQgsServerWMSGetLegendGraphic(QgsServerTestBase): |
| 43 | + |
| 44 | + """QGIS Server WMS Tests for GetLegendGraphic request""" |
| 45 | + |
| 46 | + def test_getLegendGraphics(self): |
| 47 | + """Test that does not return an exception but an image""" |
| 48 | + parms = { |
| 49 | + 'MAP': self.testdata_path + "test_project.qgs", |
| 50 | + 'SERVICE': 'WMS', |
| 51 | + 'VERSION': '1.3.0', |
| 52 | + 'REQUEST': 'GetLegendGraphic', |
| 53 | + 'FORMAT': 'image/png', |
| 54 | + # 'WIDTH': '20', # optional |
| 55 | + # 'HEIGHT': '20', # optional |
| 56 | + 'LAYER': 'testlayer%20èé', |
| 57 | + } |
| 58 | + qs = '?' + '&'.join(["%s=%s" % (k, v) for k, v in parms.items()]) |
| 59 | + h, r = self._execute_request(qs) |
| 60 | + self.assertEqual(-1, h.find(b'Content-Type: text/xml; charset=utf-8'), "Header: %s\nResponse:\n%s" % (h, r)) |
| 61 | + self.assertNotEqual(-1, h.find(b'Content-Type: image/png'), "Header: %s\nResponse:\n%s" % (h, r)) |
| 62 | + |
| 63 | + def test_getLegendGraphics_invalid_parameters(self): |
| 64 | + """Test that does return an exception""" |
| 65 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 66 | + "MAP": urllib.parse.quote(self.projectPath), |
| 67 | + "SERVICE": "WMS", |
| 68 | + "VERSION": "1.1.1", |
| 69 | + "REQUEST": "GetLegendGraphic", |
| 70 | + "LAYER": "Country,Hello,db_point", |
| 71 | + "LAYERTITLE": "FALSE", |
| 72 | + "FORMAT": "image/png", |
| 73 | + "HEIGHT": "500", |
| 74 | + "WIDTH": "500", |
| 75 | + "RULE": "1", |
| 76 | + "BBOX": "-151.7,-38.9,51.0,78.0", |
| 77 | + "CRS": "EPSG:4326" |
| 78 | + }.items())]) |
| 79 | + |
| 80 | + r, h = self._result(self._execute_request(qs)) |
| 81 | + err = b"BBOX parameter cannot be combined with RULE" in r |
| 82 | + self.assertTrue(err) |
| 83 | + |
| 84 | + def test_wms_GetLegendGraphic_LayerSpace(self): |
| 85 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 86 | + "MAP": urllib.parse.quote(self.projectPath), |
| 87 | + "SERVICE": "WMS", |
| 88 | + "VERSION": "1.1.1", |
| 89 | + "REQUEST": "GetLegendGraphic", |
| 90 | + "LAYER": "Country,Hello", |
| 91 | + "FORMAT": "image/png", |
| 92 | + # "HEIGHT": "500", |
| 93 | + # "WIDTH": "500", |
| 94 | + "LAYERSPACE": "50.0", |
| 95 | + "LAYERFONTBOLD": "TRUE", |
| 96 | + "LAYERFONTSIZE": "30", |
| 97 | + "ITEMFONTBOLD": "TRUE", |
| 98 | + "ITEMFONTSIZE": "20", |
| 99 | + "LAYERFONTFAMILY": self.fontFamily, |
| 100 | + "ITEMFONTFAMILY": self.fontFamily, |
| 101 | + "LAYERTITLE": "TRUE", |
| 102 | + "CRS": "EPSG:3857" |
| 103 | + }.items())]) |
| 104 | + |
| 105 | + r, h = self._result(self._execute_request(qs)) |
| 106 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_LayerSpace") |
| 107 | + |
| 108 | + def test_wms_GetLegendGraphic_ShowFeatureCount(self): |
| 109 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 110 | + "MAP": urllib.parse.quote(self.projectPath), |
| 111 | + "SERVICE": "WMS", |
| 112 | + "VERSION": "1.1.1", |
| 113 | + "REQUEST": "GetLegendGraphic", |
| 114 | + "LAYER": "Country,Hello", |
| 115 | + "FORMAT": "image/png", |
| 116 | + # "HEIGHT": "500", |
| 117 | + # "WIDTH": "500", |
| 118 | + "LAYERTITLE": "TRUE", |
| 119 | + "LAYERFONTBOLD": "TRUE", |
| 120 | + "LAYERFONTSIZE": "30", |
| 121 | + "LAYERFONTFAMILY": self.fontFamily, |
| 122 | + "ITEMFONTFAMILY": self.fontFamily, |
| 123 | + "ITEMFONTBOLD": "TRUE", |
| 124 | + "ITEMFONTSIZE": "20", |
| 125 | + "SHOWFEATURECOUNT": "TRUE", |
| 126 | + "CRS": "EPSG:3857" |
| 127 | + }.items())]) |
| 128 | + |
| 129 | + r, h = self._result(self._execute_request(qs)) |
| 130 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_ShowFeatureCount", max_size_diff=QSize(1, 1)) |
| 131 | + |
| 132 | + def test_getLegendGraphics_layertitle(self): |
| 133 | + """Test that does not return an exception but an image""" |
| 134 | + |
| 135 | + print("TEST FONT FAMILY: ", self.fontFamily) |
| 136 | + |
| 137 | + parms = { |
| 138 | + 'MAP': self.testdata_path + "test_project.qgs", |
| 139 | + 'SERVICE': 'WMS', |
| 140 | + 'VERSION': '1.3.0', |
| 141 | + 'REQUEST': 'GetLegendGraphic', |
| 142 | + 'FORMAT': 'image/png', |
| 143 | + # 'WIDTH': '20', # optional |
| 144 | + # 'HEIGHT': '20', # optional |
| 145 | + 'LAYER': u'testlayer%20èé', |
| 146 | + 'LAYERFONTBOLD': 'TRUE', |
| 147 | + 'LAYERFONTSIZE': '30', |
| 148 | + 'ITEMFONTBOLD': 'TRUE', |
| 149 | + 'LAYERFONTFAMILY': self.fontFamily, |
| 150 | + 'ITEMFONTFAMILY': self.fontFamily, |
| 151 | + 'ITEMFONTSIZE': '20', |
| 152 | + 'LAYERTITLE': 'TRUE', |
| 153 | + } |
| 154 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 155 | + r, h = self._result(self._execute_request(qs)) |
| 156 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_test", 250, QSize(15, 15)) |
| 157 | + |
| 158 | + parms = { |
| 159 | + 'MAP': self.testdata_path + "test_project.qgs", |
| 160 | + 'SERVICE': 'WMS', |
| 161 | + 'VERSION': '1.3.0', |
| 162 | + 'REQUEST': 'GetLegendGraphic', |
| 163 | + 'FORMAT': 'image/png', |
| 164 | + # 'WIDTH': '20', # optional |
| 165 | + # 'HEIGHT': '20', # optional |
| 166 | + 'LAYER': u'testlayer%20èé', |
| 167 | + 'LAYERTITLE': 'FALSE', |
| 168 | + } |
| 169 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 170 | + r, h = self._result(self._execute_request(qs)) |
| 171 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_test_layertitle_false", 250, QSize(15, 15)) |
| 172 | + |
| 173 | + def test_getLegendGraphics_rulelabel(self): |
| 174 | + """Test that does not return an exception but an image""" |
| 175 | + parms = { |
| 176 | + 'MAP': self.testdata_path + "test_project.qgs", |
| 177 | + 'SERVICE': 'WMS', |
| 178 | + 'VERSION': '1.3.0', |
| 179 | + 'REQUEST': 'GetLegendGraphic', |
| 180 | + 'FORMAT': 'image/png', |
| 181 | + 'LAYER': u'testlayer%20èé', |
| 182 | + 'LAYERFONTBOLD': 'TRUE', |
| 183 | + 'LAYERFONTSIZE': '30', |
| 184 | + 'LAYERFONTFAMILY': self.fontFamily, |
| 185 | + 'ITEMFONTFAMILY': self.fontFamily, |
| 186 | + 'ITEMFONTBOLD': 'TRUE', |
| 187 | + 'ITEMFONTSIZE': '20', |
| 188 | + 'RULELABEL': 'TRUE', |
| 189 | + } |
| 190 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 191 | + r, h = self._result(self._execute_request(qs)) |
| 192 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_test", 250, QSize(15, 15)) |
| 193 | + |
| 194 | + parms = { |
| 195 | + 'MAP': self.testdata_path + "test_project.qgs", |
| 196 | + 'SERVICE': 'WMS', |
| 197 | + 'VERSION': '1.3.0', |
| 198 | + 'REQUEST': 'GetLegendGraphic', |
| 199 | + 'FORMAT': 'image/png', |
| 200 | + 'LAYER': u'testlayer%20èé', |
| 201 | + 'LAYERFONTBOLD': 'TRUE', |
| 202 | + 'LAYERFONTSIZE': '30', |
| 203 | + 'ITEMFONTBOLD': 'TRUE', |
| 204 | + 'ITEMFONTSIZE': '20', |
| 205 | + 'LAYERFONTFAMILY': self.fontFamily, |
| 206 | + 'ITEMFONTFAMILY': self.fontFamily, |
| 207 | + 'RULELABEL': 'FALSE', |
| 208 | + } |
| 209 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 210 | + r, h = self._result(self._execute_request(qs)) |
| 211 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_false", 250, QSize(15, 15)) |
| 212 | + |
| 213 | + def test_getLegendGraphics_rule(self): |
| 214 | + """Test that does not return an exception but an image""" |
| 215 | + parms = { |
| 216 | + 'MAP': self.testdata_path + "test_project_legend_rule.qgs", |
| 217 | + 'SERVICE': 'WMS', |
| 218 | + 'VERSION': '1.3.0', |
| 219 | + 'REQUEST': 'GetLegendGraphic', |
| 220 | + 'FORMAT': 'image/png', |
| 221 | + 'LAYER': u'testlayer%20èé', |
| 222 | + 'WIDTH': '20', |
| 223 | + 'HEIGHT': '20', |
| 224 | + 'RULE': 'rule0', |
| 225 | + } |
| 226 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 227 | + r, h = self._result(self._execute_request(qs)) |
| 228 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_rule0", 250, QSize(15, 15)) |
| 229 | + |
| 230 | + parms = { |
| 231 | + 'MAP': self.testdata_path + "test_project_legend_rule.qgs", |
| 232 | + 'SERVICE': 'WMS', |
| 233 | + 'VERSION': '1.3.0', |
| 234 | + 'REQUEST': 'GetLegendGraphic', |
| 235 | + 'FORMAT': 'image/png', |
| 236 | + 'LAYER': u'testlayer%20èé', |
| 237 | + 'WIDTH': '20', |
| 238 | + 'HEIGHT': '20', |
| 239 | + 'RULE': 'rule1', |
| 240 | + } |
| 241 | + qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()]) |
| 242 | + r, h = self._result(self._execute_request(qs)) |
| 243 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_rule1", 250, QSize(15, 15)) |
| 244 | + |
| 245 | + def test_wms_GetLegendGraphic_Basic(self): |
| 246 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 247 | + "MAP": urllib.parse.quote(self.projectPath), |
| 248 | + "SERVICE": "WMS", |
| 249 | + "VERSION": "1.1.1", |
| 250 | + "REQUEST": "GetLegendGraphic", |
| 251 | + "LAYER": "Country,Hello", |
| 252 | + "LAYERTITLE": "FALSE", |
| 253 | + "FORMAT": "image/png", |
| 254 | + "HEIGHT": "500", |
| 255 | + "WIDTH": "500", |
| 256 | + "CRS": "EPSG:3857" |
| 257 | + }.items())]) |
| 258 | + |
| 259 | + r, h = self._result(self._execute_request(qs)) |
| 260 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_Basic") |
| 261 | + |
| 262 | + def test_wms_GetLegendGraphic_Transparent(self): |
| 263 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 264 | + "MAP": urllib.parse.quote(self.projectPath), |
| 265 | + "SERVICE": "WMS", |
| 266 | + "VERSION": "1.1.1", |
| 267 | + "REQUEST": "GetLegendGraphic", |
| 268 | + "LAYER": "Country,Hello", |
| 269 | + "LAYERTITLE": "FALSE", |
| 270 | + "FORMAT": "image/png", |
| 271 | + "HEIGHT": "500", |
| 272 | + "WIDTH": "500", |
| 273 | + "CRS": "EPSG:3857", |
| 274 | + "TRANSPARENT": "TRUE" |
| 275 | + }.items())]) |
| 276 | + |
| 277 | + r, h = self._result(self._execute_request(qs)) |
| 278 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_Transparent") |
| 279 | + |
| 280 | + def test_wms_GetLegendGraphic_Background(self): |
| 281 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 282 | + "MAP": urllib.parse.quote(self.projectPath), |
| 283 | + "SERVICE": "WMS", |
| 284 | + "VERSION": "1.1.1", |
| 285 | + "REQUEST": "GetLegendGraphic", |
| 286 | + "LAYER": "Country,Hello", |
| 287 | + "LAYERTITLE": "FALSE", |
| 288 | + "FORMAT": "image/png", |
| 289 | + "HEIGHT": "500", |
| 290 | + "WIDTH": "500", |
| 291 | + "CRS": "EPSG:3857", |
| 292 | + "BGCOLOR": "green" |
| 293 | + }.items())]) |
| 294 | + |
| 295 | + r, h = self._result(self._execute_request(qs)) |
| 296 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_Background") |
| 297 | + |
| 298 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 299 | + "MAP": urllib.parse.quote(self.projectPath), |
| 300 | + "SERVICE": "WMS", |
| 301 | + "VERSION": "1.1.1", |
| 302 | + "REQUEST": "GetLegendGraphic", |
| 303 | + "LAYER": "Country,Hello", |
| 304 | + "LAYERTITLE": "FALSE", |
| 305 | + "FORMAT": "image/png", |
| 306 | + "HEIGHT": "500", |
| 307 | + "WIDTH": "500", |
| 308 | + "CRS": "EPSG:3857", |
| 309 | + "BGCOLOR": "0x008000" |
| 310 | + }.items())]) |
| 311 | + |
| 312 | + r, h = self._result(self._execute_request(qs)) |
| 313 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_Background_Hex") |
| 314 | + |
| 315 | + def test_wms_GetLegendGraphic_BoxSpace(self): |
| 316 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 317 | + "MAP": urllib.parse.quote(self.projectPath), |
| 318 | + "SERVICE": "WMS", |
| 319 | + "VERSION": "1.1.1", |
| 320 | + "REQUEST": "GetLegendGraphic", |
| 321 | + "LAYER": "Country,Hello", |
| 322 | + "LAYERTITLE": "FALSE", |
| 323 | + "BOXSPACE": "100", |
| 324 | + "FORMAT": "image/png", |
| 325 | + "HEIGHT": "500", |
| 326 | + "WIDTH": "500", |
| 327 | + "CRS": "EPSG:3857" |
| 328 | + }.items())]) |
| 329 | + |
| 330 | + r, h = self._result(self._execute_request(qs)) |
| 331 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_BoxSpace") |
| 332 | + |
| 333 | + def test_wms_GetLegendGraphic_SymbolSpace(self): |
| 334 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 335 | + "MAP": urllib.parse.quote(self.projectPath), |
| 336 | + "SERVICE": "WMS", |
| 337 | + "VERSION": "1.1.1", |
| 338 | + "REQUEST": "GetLegendGraphic", |
| 339 | + "LAYER": "Country,Hello", |
| 340 | + "LAYERTITLE": "FALSE", |
| 341 | + "SYMBOLSPACE": "100", |
| 342 | + "FORMAT": "image/png", |
| 343 | + "HEIGHT": "500", |
| 344 | + "WIDTH": "500", |
| 345 | + "CRS": "EPSG:3857" |
| 346 | + }.items())]) |
| 347 | + |
| 348 | + r, h = self._result(self._execute_request(qs)) |
| 349 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_SymbolSpace") |
| 350 | + |
| 351 | + def test_wms_GetLegendGraphic_IconLabelSpace(self): |
| 352 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 353 | + "MAP": urllib.parse.quote(self.projectPath), |
| 354 | + "SERVICE": "WMS", |
| 355 | + "VERSION": "1.1.1", |
| 356 | + "REQUEST": "GetLegendGraphic", |
| 357 | + "LAYER": "Country,Hello", |
| 358 | + "LAYERTITLE": "FALSE", |
| 359 | + "ICONLABELSPACE": "100", |
| 360 | + "FORMAT": "image/png", |
| 361 | + "HEIGHT": "500", |
| 362 | + "WIDTH": "500", |
| 363 | + "CRS": "EPSG:3857" |
| 364 | + }.items())]) |
| 365 | + |
| 366 | + r, h = self._result(self._execute_request(qs)) |
| 367 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_IconLabelSpace") |
| 368 | + |
| 369 | + def test_wms_GetLegendGraphic_SymbolSize(self): |
| 370 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 371 | + "MAP": urllib.parse.quote(self.projectPath), |
| 372 | + "SERVICE": "WMS", |
| 373 | + "VERSION": "1.1.1", |
| 374 | + "REQUEST": "GetLegendGraphic", |
| 375 | + "LAYER": "Country,Hello", |
| 376 | + "LAYERTITLE": "FALSE", |
| 377 | + "SYMBOLWIDTH": "50", |
| 378 | + "SYMBOLHEIGHT": "30", |
| 379 | + "FORMAT": "image/png", |
| 380 | + "HEIGHT": "500", |
| 381 | + "WIDTH": "500", |
| 382 | + "CRS": "EPSG:3857" |
| 383 | + }.items())]) |
| 384 | + |
| 385 | + r, h = self._result(self._execute_request(qs)) |
| 386 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_SymbolSize") |
| 387 | + |
| 388 | + def test_wms_GetLegendGraphic_LayerFont(self): |
| 389 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 390 | + "MAP": urllib.parse.quote(self.projectPath), |
| 391 | + "SERVICE": "WMS", |
| 392 | + "VERSION": "1.1.1", |
| 393 | + "REQUEST": "GetLegendGraphic", |
| 394 | + "LAYER": "Country,Hello", |
| 395 | + "LAYERTITLE": "TRUE", |
| 396 | + "LAYERFONTBOLD": "TRUE", |
| 397 | + "LAYERFONTITALIC": "TRUE", |
| 398 | + "LAYERFONTSIZE": "30", |
| 399 | + "ITEMFONTBOLD": "TRUE", |
| 400 | + "ITEMFONTSIZE": "20", |
| 401 | + "LAYERFONTFAMILY": self.fontFamily, |
| 402 | + "ITEMFONTFAMILY": self.fontFamily, |
| 403 | + "FORMAT": "image/png", |
| 404 | + "HEIGHT": "500", |
| 405 | + "WIDTH": "500", |
| 406 | + "CRS": "EPSG:3857" |
| 407 | + }.items())]) |
| 408 | + |
| 409 | + r, h = self._result(self._execute_request(qs)) |
| 410 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_LayerFont", max_size_diff=QSize(1, 1)) |
| 411 | + |
| 412 | + def test_wms_GetLegendGraphic_ItemFont(self): |
| 413 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 414 | + "MAP": urllib.parse.quote(self.projectPath), |
| 415 | + "SERVICE": "WMS", |
| 416 | + "VERSION": "1.1.1", |
| 417 | + "REQUEST": "GetLegendGraphic", |
| 418 | + "LAYER": "Country,Hello", |
| 419 | + "LAYERTITLE": "TRUE", |
| 420 | + "LAYERFONTBOLD": "TRUE", |
| 421 | + "LAYERFONTSIZE": "30", |
| 422 | + "ITEMFONTBOLD": "TRUE", |
| 423 | + "ITEMFONTITALIC": "TRUE", |
| 424 | + "ITEMFONTSIZE": "20", |
| 425 | + "LAYERFONTFAMILY": self.fontFamily, |
| 426 | + "ITEMFONTFAMILY": self.fontFamily, |
| 427 | + "FORMAT": "image/png", |
| 428 | + "HEIGHT": "500", |
| 429 | + "WIDTH": "500", |
| 430 | + "CRS": "EPSG:3857" |
| 431 | + }.items())]) |
| 432 | + |
| 433 | + r, h = self._result(self._execute_request(qs)) |
| 434 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_ItemFont", max_size_diff=QSize(1, 1)) |
| 435 | + |
| 436 | + def test_wms_GetLegendGraphic_BBox(self): |
| 437 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 438 | + "MAP": urllib.parse.quote(self.projectPath), |
| 439 | + "SERVICE": "WMS", |
| 440 | + "VERSION": "1.1.1", |
| 441 | + "REQUEST": "GetLegendGraphic", |
| 442 | + "LAYER": "Country,Hello,db_point", |
| 443 | + "LAYERTITLE": "FALSE", |
| 444 | + "FORMAT": "image/png", |
| 445 | + "HEIGHT": "500", |
| 446 | + "WIDTH": "500", |
| 447 | + "BBOX": "-151.7,-38.9,51.0,78.0", |
| 448 | + "CRS": "EPSG:4326" |
| 449 | + }.items())]) |
| 450 | + |
| 451 | + r, h = self._result(self._execute_request(qs)) |
| 452 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox") |
| 453 | + |
| 454 | + def test_wms_GetLegendGraphic_BBox2(self): |
| 455 | + qs = "?" + "&".join(["%s=%s" % i for i in list({ |
| 456 | + "MAP": urllib.parse.quote(self.projectPath), |
| 457 | + "SERVICE": "WMS", |
| 458 | + "VERSION": "1.1.1", |
| 459 | + "REQUEST": "GetLegendGraphic", |
| 460 | + "LAYER": "Country,Hello,db_point", |
| 461 | + "LAYERTITLE": "FALSE", |
| 462 | + "FORMAT": "image/png", |
| 463 | + "HEIGHT": "500", |
| 464 | + "WIDTH": "500", |
| 465 | + "BBOX": "-76.08,-6.4,-19.38,38.04", |
| 466 | + "SRS": "EPSG:4326" |
| 467 | + }.items())]) |
| 468 | + |
| 469 | + r, h = self._result(self._execute_request(qs)) |
| 470 | + self._img_diff_error(r, h, "WMS_GetLegendGraphic_BBox2") |
| 471 | + |
| 472 | + |
| 473 | +if __name__ == '__main__': |
| 474 | + unittest.main() |
0 commit comments