tests(map): Expanded map test coverage

This commit is contained in:
Darren Eberly
2020-08-19 22:58:12 -04:00
parent 3cd4e73d5f
commit c452c50b2f
12 changed files with 420 additions and 6 deletions

View File

@@ -0,0 +1,147 @@
from pathlib import Path
from pytiled_parser import common_types, layer, map, tileset
EXPECTED = map.Map(
hex_side_length=6,
stagger_axis="y",
stagger_index="odd",
infinite=False,
layers=[
layer.TileLayer(
name="Tile Layer 1",
opacity=1,
visible=True,
size=common_types.Size(10, 10),
id=1,
data=[
3,
3,
3,
3,
9,
9,
9,
9,
17,
17,
3,
3,
3,
9,
9,
9,
9,
17,
17,
17,
3,
3,
3,
9,
9,
9,
9,
9,
17,
17,
3,
3,
1,
7,
9,
9,
9,
15,
17,
17,
1,
1,
12,
5,
7,
7,
7,
15,
15,
15,
12,
1,
5,
5,
7,
7,
7,
15,
15,
15,
2,
2,
5,
5,
5,
5,
4,
14,
14,
14,
2,
2,
5,
5,
5,
4,
14,
14,
14,
14,
2,
2,
2,
5,
5,
5,
4,
14,
14,
14,
2,
2,
2,
2,
5,
5,
4,
4,
14,
14,
],
)
],
map_size=common_types.Size(10, 10),
next_layer_id=2,
next_object_id=1,
orientation="hexagonal",
render_order="right-down",
tiled_version="1.4.1",
tile_size=common_types.Size(14, 12),
version=1.4,
tilesets={
1: tileset.TileSet(
columns=5,
image=Path("../../images/hexmini.png"),
image_width=106,
image_height=72,
margin=0,
spacing=0,
name="tileset",
tile_count=20,
tiled_version="1.4.1",
tile_height=18,
tile_width=18,
version=1.4,
type="tileset",
tile_offset=common_types.OrderedPair(0, 1),
)
},
)

View File

@@ -0,0 +1,35 @@
{ "compressionlevel":-1,
"height":10,
"hexsidelength":6,
"infinite":false,
"layers":[
{
"data":[3, 3, 3, 3, 9, 9, 9, 9, 17, 17, 3, 3, 3, 9, 9, 9, 9, 17, 17, 17, 3, 3, 3, 9, 9, 9, 9, 9, 17, 17, 3, 3, 1, 7, 9, 9, 9, 15, 17, 17, 1, 1, 12, 5, 7, 7, 7, 15, 15, 15, 12, 1, 5, 5, 7, 7, 7, 15, 15, 15, 2, 2, 5, 5, 5, 5, 4, 14, 14, 14, 2, 2, 5, 5, 5, 4, 14, 14, 14, 14, 2, 2, 2, 5, 5, 5, 4, 14, 14, 14, 2, 2, 2, 2, 5, 5, 4, 4, 14, 14],
"height":10,
"id":1,
"name":"Tile Layer 1",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":10,
"x":0,
"y":0
}],
"nextlayerid":2,
"nextobjectid":1,
"orientation":"hexagonal",
"renderorder":"right-down",
"staggeraxis":"y",
"staggerindex":"odd",
"tiledversion":"1.4.1",
"tileheight":12,
"tilesets":[
{
"firstgid":1,
"source":"tileset.json"
}],
"tilewidth":14,
"type":"map",
"version":1.4,
"width":10
}

View File

@@ -0,0 +1,19 @@
{ "columns":5,
"image":"..\/..\/images\/hexmini.png",
"imageheight":72,
"imagewidth":106,
"margin":0,
"name":"tileset",
"spacing":0,
"tilecount":20,
"tiledversion":"1.4.1",
"tileheight":18,
"tileoffset":
{
"x":0,
"y":1
},
"tilewidth":18,
"type":"tileset",
"version":1.4
}