Merge pull request #32383 from signedav/test_rulelabel
Display Rulelabel when requested in GetLegendGraphics
@ -275,7 +275,6 @@ namespace QgsWms
|
||||
|
||||
// layer titles - hidden or not
|
||||
QgsLegendRenderer::setNodeLegendStyle( nodeLayer, parameters.layerTitleAsBool() ? QgsLegendStyle::Subgroup : QgsLegendStyle::Hidden );
|
||||
|
||||
// rule item titles
|
||||
if ( !parameters.ruleLabelAsBool() )
|
||||
{
|
||||
@ -285,7 +284,7 @@ namespace QgsWms
|
||||
legendNode->setUserLabel( QStringLiteral( " " ) );
|
||||
}
|
||||
}
|
||||
else if ( !parameters.layerTitleAsBool() )
|
||||
else if ( !parameters.layerTitleAsBool() && model->layerLegendNodes( nodeLayer, true ).count() )
|
||||
{
|
||||
for ( QgsLayerTreeModelLegendNode *legendNode : model->layerLegendNodes( nodeLayer ) )
|
||||
{
|
||||
|
@ -333,6 +333,7 @@ class TestQgsServerCacheManager(QgsServerTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
|
@ -93,6 +93,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello,db_point",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -174,11 +175,34 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
'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',
|
||||
@ -189,6 +213,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
# '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))
|
||||
@ -205,15 +230,15 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
'LAYER': u'testlayer%20èé',
|
||||
'LAYERFONTBOLD': 'TRUE',
|
||||
'LAYERFONTSIZE': '30',
|
||||
'LAYERFONTFAMILY': self.fontFamily,
|
||||
'ITEMFONTFAMILY': self.fontFamily,
|
||||
'ITEMFONTBOLD': 'TRUE',
|
||||
'ITEMFONTSIZE': '20',
|
||||
'RULELABEL': 'TRUE',
|
||||
'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_test", 250, QSize(15, 15))
|
||||
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_false", 250, QSize(15, 15))
|
||||
|
||||
parms = {
|
||||
'MAP': self.testdata_path + "test_project.qgs",
|
||||
@ -228,11 +253,32 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
'ITEMFONTSIZE': '20',
|
||||
'LAYERFONTFAMILY': self.fontFamily,
|
||||
'ITEMFONTFAMILY': self.fontFamily,
|
||||
'RULELABEL': 'FALSE',
|
||||
'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_rulelabel_false", 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',
|
||||
'VERSION': '1.3.0',
|
||||
'REQUEST': 'GetLegendGraphic',
|
||||
'FORMAT': 'image/png',
|
||||
'LAYER': u'testlayer%20èé',
|
||||
'LAYERFONTBOLD': 'TRUE',
|
||||
'LAYERFONTSIZE': '30',
|
||||
'ITEMFONTBOLD': 'TRUE',
|
||||
'ITEMFONTSIZE': '20',
|
||||
'LAYERFONTFAMILY': self.fontFamily,
|
||||
'ITEMFONTFAMILY': self.fontFamily,
|
||||
'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_true", 250, QSize(15, 15))
|
||||
|
||||
def test_wms_getLegendGraphics_rule(self):
|
||||
"""Test that does not return an exception but an image"""
|
||||
@ -274,6 +320,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -291,6 +338,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -309,6 +357,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -326,6 +375,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -344,6 +394,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"BOXSPACE": "100",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
@ -362,6 +413,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"SYMBOLSPACE": "100",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
@ -380,6 +432,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"ICONLABELSPACE": "100",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
@ -398,6 +451,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"SYMBOLWIDTH": "50",
|
||||
"SYMBOLHEIGHT": "30",
|
||||
"FORMAT": "image/png",
|
||||
@ -465,6 +519,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello,db_point",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"SRCHEIGHT": "500",
|
||||
"SRCWIDTH": "500",
|
||||
@ -483,6 +538,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello,db_point",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"SRCHEIGHT": "500",
|
||||
"SRCWIDTH": "500",
|
||||
@ -501,6 +557,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello,db_point",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
@ -519,6 +576,7 @@ class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
|
||||
"REQUEST": "GetLegendGraphic",
|
||||
"LAYER": "Country,Hello,db_point",
|
||||
"LAYERTITLE": "FALSE",
|
||||
"RULELABEL": "FALSE",
|
||||
"FORMAT": "image/png",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
|
Before Width: | Height: | Size: 849 B After Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 834 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 388 B |