|
32 | 32 | QgsFontMarkerSymbolLayer, QgsEllipseSymbolLayer, QgsSimpleLineSymbolLayer, |
33 | 33 | QgsMarkerLineSymbolLayer, QgsMarkerSymbol, QgsSimpleFillSymbolLayer, QgsSVGFillSymbolLayer, |
34 | 34 | QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsVectorLayer, QgsVectorLayerSimpleLabeling, |
35 | | - QgsTextBufferSettings, QgsPalLayerSettings, QgsTextBackgroundSettings) |
| 35 | + QgsTextBufferSettings, QgsPalLayerSettings, QgsTextBackgroundSettings, QgsRuleBasedLabeling) |
36 | 36 | from qgis.testing import start_app, unittest |
37 | 37 | from utilities import unitTestDataPath |
38 | 38 |
|
@@ -1053,6 +1053,13 @@ def testRuleBasedLabels(self): |
1053 | 1053 | ltValue = gt.childNodes().item(1) |
1054 | 1054 | self.assertEqual("1000000", gtValue.toElement().text()) |
1055 | 1055 |
|
| 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 | + |
1056 | 1063 | def updateLinePlacementProperties(self, layer, linePlacement, distance, repeat, maxAngleInternal=25, maxAngleExternal=-25): |
1057 | 1064 | settings = layer.labeling().settings() |
1058 | 1065 | settings.placement = linePlacement |
|
0 commit comments