From 5078de3284ace51ab7d823091bd214b931cc1407 Mon Sep 17 00:00:00 2001 From: JuhoErvasti Date: Wed, 4 Dec 2024 09:59:39 +0200 Subject: [PATCH] Add test for loading symbol with extent buffer set --- tests/src/python/test_qgssymbollayerutils.py | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/src/python/test_qgssymbollayerutils.py b/tests/src/python/test_qgssymbollayerutils.py index b4a1127e291a..51e35f3c72fc 100644 --- a/tests/src/python/test_qgssymbollayerutils.py +++ b/tests/src/python/test_qgssymbollayerutils.py @@ -31,6 +31,7 @@ QgsSimpleFillSymbolLayer, QgsSimpleLineSymbolLayer, QgsSingleSymbolRenderer, + QgsSymbol, QgsSymbolLayer, QgsSymbolLayerUtils, QgsUnitTypes, @@ -1253,6 +1254,58 @@ def test_font_marker_load(self): font_marker = QgsSymbolLayerUtils.loadSymbol(elem, QgsReadWriteContext()) self.assertEqual(font_marker.symbolLayers()[0].character(), "()") + def test_extent_buffer_load(self): + doc = QDomDocument() + elem = QDomElement() + + extent_buffer_xml_string = """ + + + + + + + + +""" + + doc.setContent(extent_buffer_xml_string) + elem = doc.documentElement() + symbol = QgsSymbolLayerUtils.loadSymbol(elem, QgsReadWriteContext()) + self.assertEqual(symbol.extentBuffer(), 1000) + + property = symbol.dataDefinedProperties().property(QgsSymbol.Property.ExtentBuffer) + + self.assertTrue(property.isActive()) + self.assertEqual(property.expressionString(), "if(@map_scale <= 25000, 5000, 10000)") + def test_collect_symbol_layer_clip_geometries(self): """ Test logic relating to symbol layer clip geometries.