tests: All map tests working

This commit is contained in:
Darren Eberly
2021-12-21 21:50:42 -05:00
parent 923149c0a4
commit 72116adce6
26 changed files with 361 additions and 2 deletions

View File

@@ -0,0 +1,73 @@
{ "backgroundcolor":"#ff0004",
"compressionlevel":0,
"height":6,
"infinite":false,
"layers":[
{
"draworder":"topdown",
"id":2,
"name":"Object Layer 1",
"objects":[
{
"id":2,
"template":"template-rectangle.tx",
"x":98.4987608686521,
"y":46.2385012811358
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}],
"nextlayerid":3,
"nextobjectid":8,
"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.7.1",
"tileheight":32,
"tilesets":[
{
"firstgid":1,
"source":"tileset.json"
},
{
"firstgid":49,
"source":"tile_set_image_for_template.json"
}],
"tilewidth":32,
"type":"map",
"version":"1.6",
"width":8
}

View File

@@ -0,0 +1,16 @@
<?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="3" nextobjectid="8">
<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.tsx"/>
<tileset firstgid="49" source="tile_set_image_for_template.tsx"/>
<objectgroup id="2" name="Object Layer 1">
<object id="2" template="template-rectangle.json" x="98.4988" y="46.2385"/>
</objectgroup>
</map>

View File

@@ -0,0 +1,12 @@
{ "object":
{
"height":38.2811778048473,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":63.6585878103079
},
"type":"template"
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<object width="63.6586" height="38.2812"/>
</template>

View File

@@ -0,0 +1,16 @@
import os
from pathlib import Path
import pytest
from pytiled_parser import parse_map
def test_cross_template_tmx_json():
with pytest.raises(NotImplementedError):
parse_map(Path(os.path.dirname(os.path.abspath(__file__))) / "map.tmx")
def test_cross_template_json_tmx():
with pytest.raises(NotImplementedError):
parse_map(Path(os.path.dirname(os.path.abspath(__file__))) / "map.json")

View File

@@ -0,0 +1,14 @@
{ "columns":1,
"image":"..\/..\/images\/tile_04.png",
"imageheight":32,
"imagewidth":32,
"margin":0,
"name":"tile_set_image_for_template",
"spacing":0,
"tilecount":1,
"tiledversion":"1.7.1",
"tileheight":32,
"tilewidth":32,
"type":"tileset",
"version":"1.6"
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.5" tiledversion="1.7.0" name="tile_set_image_for_template" tilewidth="32" tileheight="32" tilecount="1" columns="1">
<image source="../../images/tile_04.png" width="32" height="32"/>
</tileset>

View File

@@ -0,0 +1,14 @@
{ "columns":8,
"image":"..\/test_data\/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"
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.5" tiledversion="1.7.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>