mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-27 22:59:48 +01:00
tests: implemented multiple tileset tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pytiled_parser import tileset
|
||||
|
||||
expected = tileset.TileSet(
|
||||
columns=8,
|
||||
image=Path(r"..\/..\/maps\/images\/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
image_width=265,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tile_set_image",
|
||||
tile_count=48,
|
||||
tiled_version="1.3.1",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version=1.2,
|
||||
)
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
{ "columns":8,
|
||||
"image":"..\/images\/tmw_desert_spacing.png",
|
||||
"editorsettings":
|
||||
{
|
||||
"export":
|
||||
{
|
||||
"format":"",
|
||||
"target":"."
|
||||
}
|
||||
},
|
||||
"image":"..\/..\/maps\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tile_set_image",
|
||||
"spacing":1,
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.3.1",
|
||||
"tiledversion":"1.3.5",
|
||||
"tileheight":32,
|
||||
"tilewidth":32,
|
||||
"type":"tileset",
|
||||
"version":1.2
|
||||
}
|
||||
}
|
||||
20
tests/test_data/tilesets/image_background_color/expected.py
Normal file
20
tests/test_data/tilesets/image_background_color/expected.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color
|
||||
|
||||
expected = tileset.TileSet(
|
||||
columns=8,
|
||||
image=Path(r"..\/..\/maps\/images\/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
image_width=265,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tile_set_image",
|
||||
tile_count=48,
|
||||
tiled_version="1.3.1",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version=1.2,
|
||||
background_color=Color("#5500ff"),
|
||||
)
|
||||
23
tests/test_data/tilesets/image_background_color/tileset.json
Normal file
23
tests/test_data/tilesets/image_background_color/tileset.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{ "backgroundcolor":"#5500ff",
|
||||
"columns":8,
|
||||
"editorsettings":
|
||||
{
|
||||
"export":
|
||||
{
|
||||
"format":"",
|
||||
"target":"..\/image"
|
||||
}
|
||||
},
|
||||
"image":"..\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tile_set_image",
|
||||
"spacing":1,
|
||||
"tilecount":0,
|
||||
"tiledversion":"1.3.5",
|
||||
"tileheight":32,
|
||||
"tilewidth":32,
|
||||
"type":"tileset",
|
||||
"version":1.2
|
||||
}
|
||||
@@ -1,12 +1,20 @@
|
||||
{ "columns":8,
|
||||
"image":"..\/images\/tmw_desert_spacing.png",
|
||||
"editorsettings":
|
||||
{
|
||||
"export":
|
||||
{
|
||||
"format":"",
|
||||
"target":"."
|
||||
}
|
||||
},
|
||||
"image":"..\/..\/maps\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tile_set_image",
|
||||
"spacing":1,
|
||||
"tilecount":5,
|
||||
"tiledversion":"1.3.1",
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.3.5",
|
||||
"tileheight":32,
|
||||
"tiles":[
|
||||
{
|
||||
@@ -189,4 +197,4 @@
|
||||
"tilewidth":32,
|
||||
"type":"tileset",
|
||||
"version":1.2
|
||||
}
|
||||
}
|
||||
48
tests/test_data/tilesets/image_properties/tileset.json
Normal file
48
tests/test_data/tilesets/image_properties/tileset.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{ "columns":8,
|
||||
"editorsettings":
|
||||
{
|
||||
"export":
|
||||
{
|
||||
"format":"",
|
||||
"target":"..\/image"
|
||||
}
|
||||
},
|
||||
"image":"..\/..\/maps\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tile_set_image",
|
||||
"properties":[
|
||||
{
|
||||
"name":"bool property",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"color property",
|
||||
"type":"color",
|
||||
"value":"#ff0000ff"
|
||||
},
|
||||
{
|
||||
"name":"float property",
|
||||
"type":"float",
|
||||
"value":5.6
|
||||
},
|
||||
{
|
||||
"name":"int property",
|
||||
"type":"int",
|
||||
"value":5
|
||||
},
|
||||
{
|
||||
"name":"string property",
|
||||
"type":"string",
|
||||
"value":"testing"
|
||||
}],
|
||||
"spacing":1,
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.3.5",
|
||||
"tileheight":32,
|
||||
"tilewidth":32,
|
||||
"type":"tileset",
|
||||
"version":1.2
|
||||
}
|
||||
20
tests/test_data/tilesets/image_transparent_color/expected.py
Normal file
20
tests/test_data/tilesets/image_transparent_color/expected.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color
|
||||
|
||||
expected = tileset.TileSet(
|
||||
columns=8,
|
||||
image=Path(r"..\/..\/maps\/images\/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
image_width=265,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tile_set_image",
|
||||
tile_count=48,
|
||||
tiled_version="1.3.1",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version=1.2,
|
||||
transparent_color=Color("#ff00ff"),
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
{ "columns":8,
|
||||
"image":"..\/..\/maps\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tileset",
|
||||
"spacing":1,
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.3.5",
|
||||
"tileheight":32,
|
||||
"tilewidth":32,
|
||||
"transparentcolor":"#ff00ff",
|
||||
"type":"tileset",
|
||||
"version":1.2
|
||||
}
|
||||
Reference in New Issue
Block a user