mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-30 08:08:55 +01:00
More test coverage improvements
This commit is contained in:
45
tests/test_data/map_tests/cross_format_tileset/expected.py
Normal file
45
tests/test_data/map_tests/cross_format_tileset/expected.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pytiled_parser import common_types, tiled_map, tileset
|
||||
|
||||
EXPECTED = tiled_map.TiledMap(
|
||||
infinite=False,
|
||||
layers=[],
|
||||
map_size=common_types.Size(8, 6),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
background_color=common_types.Color(255, 0, 4, 255),
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(Path(__file__).parent / "../../images/tmw_desert_spacing.png")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tile_set_image",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
properties={
|
||||
"bool property - true": True,
|
||||
"color property": common_types.Color(73, 252, 255, 255),
|
||||
"file property": Path("../../../../../../var/log/syslog"),
|
||||
"float property": 1.23456789,
|
||||
"int property": 13,
|
||||
"string property": "Hello, World!!",
|
||||
},
|
||||
)
|
||||
52
tests/test_data/map_tests/cross_format_tileset/map.json
Normal file
52
tests/test_data/map_tests/cross_format_tileset/map.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{ "backgroundcolor":"#ff0004",
|
||||
"compressionlevel":0,
|
||||
"height":6,
|
||||
"infinite":false,
|
||||
"layers":[],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"properties":[
|
||||
{
|
||||
"name":"bool property - true",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"color property",
|
||||
"type":"color",
|
||||
"value":"#ff49fcff"
|
||||
},
|
||||
{
|
||||
"name":"file property",
|
||||
"type":"file",
|
||||
"value":"..\/..\/..\/..\/..\/..\/var\/log\/syslog"
|
||||
},
|
||||
{
|
||||
"name":"float property",
|
||||
"type":"float",
|
||||
"value":1.23456789
|
||||
},
|
||||
{
|
||||
"name":"int property",
|
||||
"type":"int",
|
||||
"value":13
|
||||
},
|
||||
{
|
||||
"name":"string property",
|
||||
"type":"string",
|
||||
"value":"Hello, World!!"
|
||||
}],
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.6.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"tileset.tsx"
|
||||
}],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.6",
|
||||
"width":8
|
||||
}
|
||||
12
tests/test_data/map_tests/cross_format_tileset/map.tmx
Normal file
12
tests/test_data/map_tests/cross_format_tileset/map.tmx
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.5" tiledversion="1.7.0" orientation="orthogonal" renderorder="right-down" compressionlevel="0" width="8" height="6" tilewidth="32" tileheight="32" infinite="0" backgroundcolor="#ff0004" nextlayerid="2" nextobjectid="1">
|
||||
<properties>
|
||||
<property name="bool property - true" type="bool" value="true"/>
|
||||
<property name="color property" type="color" value="#ff49fcff"/>
|
||||
<property name="file property" type="file" value="../../../../../../var/log/syslog"/>
|
||||
<property name="float property" type="float" value="1.23456789"/>
|
||||
<property name="int property" type="int" value="13"/>
|
||||
<property name="string property" value="Hello, World!!"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tileset.json"/>
|
||||
</map>
|
||||
14
tests/test_data/map_tests/cross_format_tileset/tileset.json
Normal file
14
tests/test_data/map_tests/cross_format_tileset/tileset.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{ "columns":8,
|
||||
"image":"..\/..\/images\/tmw_desert_spacing.png",
|
||||
"imageheight":199,
|
||||
"imagewidth":265,
|
||||
"margin":1,
|
||||
"name":"tile_set_image",
|
||||
"spacing":1,
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.6.0",
|
||||
"tileheight":32,
|
||||
"tilewidth":32,
|
||||
"type":"tileset",
|
||||
"version":"1.6"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.6" tiledversion="1.6.0" name="tile_set_image" tilewidth="32" tileheight="32" spacing="1" margin="1" tilecount="48" columns="8">
|
||||
<image source="../../images/tmw_desert_spacing.png" width="265" height="199"/>
|
||||
</tileset>
|
||||
52
tests/test_data/map_tests/json_invalid_tileset/map.json
Normal file
52
tests/test_data/map_tests/json_invalid_tileset/map.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{ "backgroundcolor":"#ff0004",
|
||||
"compressionlevel":0,
|
||||
"height":6,
|
||||
"infinite":false,
|
||||
"layers":[],
|
||||
"nextlayerid":2,
|
||||
"nextobjectid":1,
|
||||
"orientation":"orthogonal",
|
||||
"properties":[
|
||||
{
|
||||
"name":"bool property - true",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
},
|
||||
{
|
||||
"name":"color property",
|
||||
"type":"color",
|
||||
"value":"#ff49fcff"
|
||||
},
|
||||
{
|
||||
"name":"file property",
|
||||
"type":"file",
|
||||
"value":"..\/..\/..\/..\/..\/..\/var\/log\/syslog"
|
||||
},
|
||||
{
|
||||
"name":"float property",
|
||||
"type":"float",
|
||||
"value":1.23456789
|
||||
},
|
||||
{
|
||||
"name":"int property",
|
||||
"type":"int",
|
||||
"value":13
|
||||
},
|
||||
{
|
||||
"name":"string property",
|
||||
"type":"string",
|
||||
"value":"Hello, World!!"
|
||||
}],
|
||||
"renderorder":"right-down",
|
||||
"tiledversion":"1.6.0",
|
||||
"tileheight":32,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"tileset.garbage"
|
||||
}],
|
||||
"tilewidth":32,
|
||||
"type":"map",
|
||||
"version":"1.6",
|
||||
"width":8
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|||thisisgarbage|||||itwillbreak|||butthatswhatwewant||
|
||||
Reference in New Issue
Block a user