|
31 | 31 | QgsSimpleFillSymbolLayer,
|
32 | 32 | QgsSimpleLineSymbolLayer,
|
33 | 33 | QgsSingleSymbolRenderer,
|
| 34 | + QgsSymbol, |
34 | 35 | QgsSymbolLayer,
|
35 | 36 | QgsSymbolLayerUtils,
|
36 | 37 | QgsUnitTypes,
|
@@ -1253,6 +1254,58 @@ def test_font_marker_load(self):
|
1253 | 1254 | font_marker = QgsSymbolLayerUtils.loadSymbol(elem, QgsReadWriteContext())
|
1254 | 1255 | self.assertEqual(font_marker.symbolLayers()[0].character(), "()")
|
1255 | 1256 |
|
| 1257 | + def test_extent_buffer_load(self): |
| 1258 | + doc = QDomDocument() |
| 1259 | + elem = QDomElement() |
| 1260 | + |
| 1261 | + extent_buffer_xml_string = """<symbol is_animated="0" name="0" type="fill" alpha="1" clip_to_extent="1" force_rhr="0" frame_rate="10" extent_buffer="1000"> |
| 1262 | + <data_defined_properties> |
| 1263 | + <Option type="Map"> |
| 1264 | + <Option value="" name="name" type="QString"/> |
| 1265 | + <Option name="properties" type="Map"> |
| 1266 | + <Option name="extent_buffer" type="Map"> |
| 1267 | + <Option value="true" name="active" type="bool"/> |
| 1268 | + <Option value="if(@map_scale <= 25000, 5000, 10000)" name="expression" type="QString"/> |
| 1269 | + <Option value="3" name="type" type="int"/> |
| 1270 | + </Option> |
| 1271 | + </Option> |
| 1272 | + <Option value="collection" name="type" type="QString"/> |
| 1273 | + </Option> |
| 1274 | + </data_defined_properties> |
| 1275 | + <layer pass="0" id="{2aefc556-4eb1-4f56-b96b-e1dea6b58f69}" locked="0" class="FontMarker" enabled="1"> |
| 1276 | + <Option type="Map"> |
| 1277 | + <Option value="0" type="QString" name="angle"/> |
| 1278 | + <Option value="~!_#!#_!~40~!_#!#_!~~!_#!#_!~41~!_#!#_!~" type="QString" name="chr"/> |
| 1279 | + <Option value="0,0,255,255" type="QString" name="color"/> |
| 1280 | + <Option value="Arial" type="QString" name="font"/> |
| 1281 | + <Option value="Italic" type="QString" name="font_style"/> |
| 1282 | + <Option value="1" type="QString" name="horizontal_anchor_point"/> |
| 1283 | + <Option value="miter" type="QString" name="joinstyle"/> |
| 1284 | + <Option value="0,0" type="QString" name="offset"/> |
| 1285 | + <Option value="3x:0,0,0,0,0,0" type="QString" name="offset_map_unit_scale"/> |
| 1286 | + <Option value="Point" type="QString" name="offset_unit"/> |
| 1287 | + <Option value="255,255,255,255" type="QString" name="outline_color"/> |
| 1288 | + <Option value="0" type="QString" name="outline_width"/> |
| 1289 | + <Option value="3x:0,0,0,0,0,0" type="QString" name="outline_width_map_unit_scale"/> |
| 1290 | + <Option value="MM" type="QString" name="outline_width_unit"/> |
| 1291 | + <Option value="42.4" type="QString" name="size"/> |
| 1292 | + <Option value="3x:0,0,0,0,0,0" type="QString" name="size_map_unit_scale"/> |
| 1293 | + <Option value="Point" type="QString" name="size_unit"/> |
| 1294 | + <Option value="1" type="QString" name="vertical_anchor_point"/> |
| 1295 | + </Option> |
| 1296 | + </layer> |
| 1297 | +</symbol>""" |
| 1298 | + |
| 1299 | + doc.setContent(extent_buffer_xml_string) |
| 1300 | + elem = doc.documentElement() |
| 1301 | + symbol = QgsSymbolLayerUtils.loadSymbol(elem, QgsReadWriteContext()) |
| 1302 | + self.assertEqual(symbol.extentBuffer(), 1000) |
| 1303 | + |
| 1304 | + property = symbol.dataDefinedProperties().property(QgsSymbol.Property.ExtentBuffer) |
| 1305 | + |
| 1306 | + self.assertTrue(property.isActive()) |
| 1307 | + self.assertEqual(property.expressionString(), "if(@map_scale <= 25000, 5000, 10000)") |
| 1308 | + |
1256 | 1309 | def test_collect_symbol_layer_clip_geometries(self):
|
1257 | 1310 | """
|
1258 | 1311 | Test logic relating to symbol layer clip geometries.
|
|
0 commit comments