Skip to content

Commit

Permalink
labelAttribute should be an array
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 9, 2024
1 parent 8586dc2 commit f3e78ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion felt/core/fsl_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ def label_settings_to_fsl(settings: QgsPalLayerSettings,

res = {
'config': {
'labelAttribute': settings.fieldName
'labelAttribute': [settings.fieldName]
},
'label': converted_format
}
Expand Down
14 changes: 9 additions & 5 deletions felt/test/test_fsl_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,22 +1627,24 @@ def test_label_settings(self):
label_settings.isExpression = False
self.assertEqual(
FslConverter.label_settings_to_fsl(label_settings, context),
{'config': {'labelAttribute': 'my_field'},
{'config': {'labelAttribute': ['my_field']},
'label': {'color': 'rgba(255, 0, 0, 0.3)',
'fontSize': 13,
'fontStyle': 'normal',
'fontWeight': 400,
'haloColor': 'rgba(0, 0, 0, 0)',
'haloWidth': 4,
'letterSpacing': 0.0,
'lineHeight': 1.0}}
'lineHeight': 1.0,
'maxZoom': 24,
'minZoom': 1}}
)

# with line wrap
label_settings.autoWrapLength = 15
self.assertEqual(
FslConverter.label_settings_to_fsl(label_settings, context),
{'config': {'labelAttribute': 'my_field'},
{'config': {'labelAttribute': ['my_field']},
'label': {'color': 'rgba(255, 0, 0, 0.3)',
'fontSize': 13,
'fontStyle': 'normal',
Expand All @@ -1651,7 +1653,9 @@ def test_label_settings(self):
'haloWidth': 4,
'letterSpacing': 0.0,
'lineHeight': 1.0,
'maxLineChars': 15}}
'maxLineChars': 15,
'maxZoom': 24,
'minZoom': 1}}
)
label_settings.autoWrapLength = 0

Expand All @@ -1661,7 +1665,7 @@ def test_label_settings(self):
label_settings.maximumScale = 34512
self.assertEqual(
FslConverter.label_settings_to_fsl(label_settings, context),
{'config': {'labelAttribute': 'my_field'},
{'config': {'labelAttribute': ['my_field']},
'label': {'color': 'rgba(255, 0, 0, 0.3)',
'fontSize': 13,
'fontStyle': 'normal',
Expand Down

0 comments on commit f3e78ab

Please sign in to comment.