Skip to content

Commit 4dbae68

Browse files
author
Hugo Mercier
committed
Add a test for rule based labeling without setting
1 parent 831d1b1 commit 4dbae68

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/src/python/test_qgssymbollayer_createsld.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
QgsFontMarkerSymbolLayer, QgsEllipseSymbolLayer, QgsSimpleLineSymbolLayer,
3333
QgsMarkerLineSymbolLayer, QgsMarkerSymbol, QgsSimpleFillSymbolLayer, QgsSVGFillSymbolLayer,
3434
QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsVectorLayer, QgsVectorLayerSimpleLabeling,
35-
QgsTextBufferSettings, QgsPalLayerSettings, QgsTextBackgroundSettings)
35+
QgsTextBufferSettings, QgsPalLayerSettings, QgsTextBackgroundSettings, QgsRuleBasedLabeling)
3636
from qgis.testing import start_app, unittest
3737
from utilities import unitTestDataPath
3838

@@ -1053,6 +1053,13 @@ def testRuleBasedLabels(self):
10531053
ltValue = gt.childNodes().item(1)
10541054
self.assertEqual("1000000", gtValue.toElement().text())
10551055

1056+
# check that adding a rule without settings does not segfault
1057+
xml1 = dom.toString()
1058+
layer.labeling().rootRule().appendChild(QgsRuleBasedLabeling.Rule(None))
1059+
dom, root = self.layerToSld(layer)
1060+
xml2 = dom.toString()
1061+
self.assertEqual(xml1, xml2)
1062+
10561063
def updateLinePlacementProperties(self, layer, linePlacement, distance, repeat, maxAngleInternal=25, maxAngleExternal=-25):
10571064
settings = layer.labeling().settings()
10581065
settings.placement = linePlacement

0 commit comments

Comments
 (0)