Skip to content

Commit

Permalink
Tests with RULELABEL and LAYERTITLE
Browse files Browse the repository at this point in the history
And fix related tests
  • Loading branch information
signedav committed Nov 28, 2019
1 parent 74a7931 commit 71581a4
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/src/python/test_qgsserver_cachemanager.py
Expand Up @@ -333,6 +333,7 @@ def test_getlegendgraphic(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand Down
65 changes: 61 additions & 4 deletions tests/src/python/test_qgsserver_wms_getlegendgraphic.py
Expand Up @@ -93,6 +93,7 @@ def test_wms_getLegendGraphics_invalid_parameters(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello,db_point",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand Down Expand Up @@ -174,11 +175,34 @@ def test_wms_getLegendGraphics_layertitle(self):
'ITEMFONTFAMILY': self.fontFamily,
'ITEMFONTSIZE': '20',
'LAYERTITLE': 'TRUE',
'RULELABEL': 'TRUE'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_test", 250, QSize(15, 15))

# no set of LAYERTITLE and RULELABEL means they are true
parms = {
'MAP': self.testdata_path + "test_project.qgs",
'SERVICE': 'WMS',
'VERSION': '1.3.0',
'REQUEST': 'GetLegendGraphic',
'FORMAT': 'image/png',
# 'WIDTH': '20', # optional
# 'HEIGHT': '20', # optional
'LAYER': u'testlayer%20èé',
'LAYERFONTBOLD': 'TRUE',
'LAYERFONTSIZE': '30',
'ITEMFONTBOLD': 'TRUE',
'LAYERFONTFAMILY': self.fontFamily,
'ITEMFONTFAMILY': self.fontFamily,
'ITEMFONTSIZE': '20'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))

self._img_diff_error(r, h, "WMS_GetLegendGraphic_test", 250, QSize(15, 15))

parms = {
'MAP': self.testdata_path + "test_project.qgs",
'SERVICE': 'WMS',
Expand All @@ -189,6 +213,7 @@ def test_wms_getLegendGraphics_layertitle(self):
# 'HEIGHT': '20', # optional
'LAYER': u'testlayer%20èé',
'LAYERTITLE': 'FALSE',
'RULELABEL': 'FALSE'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))
Expand All @@ -205,16 +230,37 @@ def test_wms_getLegendGraphics_rulelabel(self):
'LAYER': u'testlayer%20èé',
'LAYERFONTBOLD': 'TRUE',
'LAYERFONTSIZE': '30',
'ITEMFONTBOLD': 'TRUE',
'ITEMFONTSIZE': '20',
'LAYERFONTFAMILY': self.fontFamily,
'ITEMFONTFAMILY': self.fontFamily,
'RULELABEL': 'FALSE'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_false", 250, QSize(15, 15))

parms = {
'MAP': self.testdata_path + "test_project.qgs",
'SERVICE': 'WMS',
'VERSION': '1.3.0',
'REQUEST': 'GetLegendGraphic',
'FORMAT': 'image/png',
'LAYER': u'testlayer%20èé',
'LAYERFONTBOLD': 'TRUE',
'LAYERFONTSIZE': '30',
'ITEMFONTBOLD': 'TRUE',
'ITEMFONTSIZE': '20',
'RULELABEL': 'TRUE',
'LAYERFONTFAMILY': self.fontFamily,
'ITEMFONTFAMILY': self.fontFamily,
'LAYERTITLE': 'FALSE',
'RULELABEL': 'TRUE'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_test", 250, QSize(15, 15))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_true", 250, QSize(15, 15))

# no set of RULELABEL means it is true
parms = {
'MAP': self.testdata_path + "test_project.qgs",
'SERVICE': 'WMS',
Expand All @@ -228,11 +274,11 @@ def test_wms_getLegendGraphics_rulelabel(self):
'ITEMFONTSIZE': '20',
'LAYERFONTFAMILY': self.fontFamily,
'ITEMFONTFAMILY': self.fontFamily,
'RULELABEL': 'FALSE',
'LAYERTITLE': 'FALSE'
}
qs = '?' + '&'.join([u"%s=%s" % (k, v) for k, v in parms.items()])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_false", 250, QSize(15, 15))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_true", 250, QSize(15, 15))

def test_wms_getLegendGraphics_rule(self):
"""Test that does not return an exception but an image"""
Expand Down Expand Up @@ -274,6 +320,7 @@ def test_wms_GetLegendGraphic_Basic(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand All @@ -291,6 +338,7 @@ def test_wms_GetLegendGraphic_Transparent(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand All @@ -309,6 +357,7 @@ def test_wms_GetLegendGraphic_Background(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand Down Expand Up @@ -344,6 +393,7 @@ def test_wms_GetLegendGraphic_BoxSpace(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"BOXSPACE": "100",
"FORMAT": "image/png",
"HEIGHT": "500",
Expand All @@ -362,6 +412,7 @@ def test_wms_GetLegendGraphic_SymbolSpace(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"SYMBOLSPACE": "100",
"FORMAT": "image/png",
"HEIGHT": "500",
Expand All @@ -380,6 +431,7 @@ def test_wms_GetLegendGraphic_IconLabelSpace(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"ICONLABELSPACE": "100",
"FORMAT": "image/png",
"HEIGHT": "500",
Expand All @@ -398,6 +450,7 @@ def test_wms_GetLegendGraphic_SymbolSize(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"SYMBOLWIDTH": "50",
"SYMBOLHEIGHT": "30",
"FORMAT": "image/png",
Expand Down Expand Up @@ -465,6 +518,7 @@ def test_wms_GetLegendGraphic_BBox(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello,db_point",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"SRCHEIGHT": "500",
"SRCWIDTH": "500",
Expand All @@ -483,6 +537,7 @@ def test_wms_GetLegendGraphic_BBox2(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello,db_point",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"SRCHEIGHT": "500",
"SRCWIDTH": "500",
Expand All @@ -501,6 +556,7 @@ def test_wms_GetLegendGraphic_BBox_Fallback(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello,db_point",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand All @@ -519,6 +575,7 @@ def test_wms_GetLegendGraphic_BBox2_Fallback(self):
"REQUEST": "GetLegendGraphic",
"LAYER": "Country,Hello,db_point",
"LAYERTITLE": "FALSE",
"RULELABEL": "FALSE",
"FORMAT": "image/png",
"HEIGHT": "500",
"WIDTH": "500",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 71581a4

Please sign in to comment.