Issue #91: support automatic icon generation.

Use regular expressions to match tags and construct icons using matched
substrings.
This commit is contained in:
Sergey Vartanov 2021-09-26 18:23:22 +03:00
parent 4644d38166
commit 39acfc6ff6
4 changed files with 102 additions and 88 deletions

View file

@ -2,6 +2,7 @@
Test icon generation for nodes.
"""
import pytest
from colour import Color
from map_machine.grid import IconCollection
from map_machine.icon import IconSet
@ -53,8 +54,11 @@ def test_icon() -> None:
Tags that should be visualized with single main icon and without extra
icons.
"""
icon = get_icon({"natural": "tree"})
icon: IconSet = get_icon({"natural": "tree"})
assert not icon.main_icon.is_default()
assert len(icon.main_icon.shape_specifications) == 1
assert icon.main_icon.shape_specifications[0].shape.id_ == "tree"
assert icon.main_icon.shape_specifications[0].color == Color("#98AC64")
assert not icon.extra_icons