Skip to content
Permalink
Browse files

manual backporting #36153

  • Loading branch information
uprel authored and nyalldawson committed Jun 19, 2020
1 parent 7b4ca4c commit 5c429042cec4dd5329ad22fd2f8b859f42c177b8
@@ -227,6 +227,7 @@ namespace QgsWms
if ( parameters.rule().isEmpty() )
{
QList<QgsLayerTreeNode *> children = tree.children();
QString ruleLabel = parameters.ruleLabel();
for ( QgsLayerTreeNode *node : children )
{
if ( ! QgsLayerTree::isLayer( node ) )
@@ -245,10 +246,11 @@ namespace QgsWms
legendNode->setUserLabel( QStringLiteral( " " ) );
}
}
else if ( !parameters.layerTitleAsBool() && model->layerLegendNodes( nodeLayer, true ).count() )
else if ( ruleLabel.compare( QStringLiteral( "AUTO" ), Qt::CaseInsensitive ) == 0 )
{
for ( QgsLayerTreeModelLegendNode *legendNode : model->layerLegendNodes( nodeLayer ) )
{
//clearing label for single symbol
if ( legendNode->isEmbeddedInParent() )
legendNode->setEmbeddedInParent( false );
}
@@ -310,4 +312,3 @@ namespace QgsWms
return nullptr;
}
} // namespace QgsWms

@@ -278,7 +278,22 @@ def test_wms_getLegendGraphics_rulelabel(self):
}
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))
self._img_diff_error(r, h, "WMS_GetLegendGraphic_rulelabel_notset", 250, QSize(15, 15))

# RULELABEL AUTO for single symbol means it is removed
parms = {
'MAP': self.testdata_path + "test_project.qgs",
'SERVICE': 'WMS',
'VERSION': '1.3.0',
'REQUEST': 'GetLegendGraphic',
'FORMAT': 'image/png',
'LAYER': u'testlayer%20èé',
'LAYERTITLE': 'FALSE',
'RULELABEL': 'AUTO'
}
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_auto", 250, QSize(15, 15))

def test_wms_getLegendGraphics_rule(self):
"""Test that does not return an exception but an image"""
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 5c42904

Please sign in to comment.
You can’t perform that action at this time.