Initial import
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
||||
from tilemapper import battlemap, tileset
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def manager():
|
||||
return tileset.TileSetManager(Path(__file__).parent / "fixtures")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_map():
|
||||
return dedent(
|
||||
"""
|
||||
........ 1
|
||||
........ ........ 2
|
||||
........ ........
|
||||
.......L...D... D
|
||||
........ .... ...
|
||||
........ ...d ...
|
||||
.
|
||||
.........S. 3
|
||||
5 . .
|
||||
....S... ...d.... 4
|
||||
........ ........
|
||||
........ ........
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def test_tileset_loader(manager):
|
||||
assert manager.console_map.name in manager.available
|
||||
|
||||
|
||||
def test_renderer(manager, sample_map):
|
||||
test_map = battlemap.BattleMap("test map", source=StringIO(sample_map), tileset=manager.console_map)
|
||||
test_map.load()
|
||||
assert test_map.width == 21
|
||||
assert test_map.height == 12
|
||||
assert test_map.source_data == sample_map.strip("\n")
|
||||
assert str(test_map) == sample_map.strip("\n")
|
||||
Reference in New Issue
Block a user