Skip to content

Commit

Permalink
Fix for #118 - allow attributes for LABEL POSITION
Browse files Browse the repository at this point in the history
  • Loading branch information
geographika committed Jan 29, 2021
1 parent 375f1e9 commit 249b776
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
13 changes: 9 additions & 4 deletions mappyfile/schemas/label.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@
}
},
"font": {
"oneOf": [
{
"type": "string"
},
"anyOf": [
{
"type": "string",
"pattern": "^\\[(.*?)\\]$",
"description": "attribute",
"metadata": {
"minVersion": 5.6
}
},
{
"type": "string"
}
]
},
Expand Down Expand Up @@ -234,6 +234,11 @@
{ "enum": [ "auto" ] },
{
"$ref": "position.json"
},
{
"type": "string",
"pattern": "^\\[(.*?)\\]$",
"description": "attribute"
}
]
},
Expand Down
23 changes: 22 additions & 1 deletion tests/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,27 @@ def test_label_position_uc():
assert(output(s, schema_name="label") == exp)


def test_label_attribute_properties():
"""
See https://github.com/geographika/mappyfile/issues/118
Required allowing [property] names to be added for FONT, POSITION
"""

s = """
LABEL
FONT [FONTNAME]
TYPE truetype
COLOR [TXTCLR]
SIZE [FONTSIZE]
ANGLE [TRIKT]
POSITION [MSPOS]
OUTLINECOLOR [OLNCLR]
END
"""
exp = "LABEL FONT [FONTNAME] TYPE TRUETYPE COLOR [TXTCLR] SIZE [FONTSIZE] ANGLE [TRIKT] POSITION [MSPOS] OUTLINECOLOR [OLNCLR] END"
assert(output(s, schema_name="label") == exp)


def test_style_geotransform():
"""
GEOMTRANSFORM "end" (since END is used to end objects in the map file, end must be embedded in quotes)
Expand Down Expand Up @@ -985,6 +1006,6 @@ def run_tests():

if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
test_style_offset_mixed2()
test_label_attribute_properties()
# run_tests()
print("Done!")

0 comments on commit 249b776

Please sign in to comment.