mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2026-01-01 09:03:41 +01:00
init commit
This commit is contained in:
3
tests/__init__.py
Normal file
3
tests/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import pytest
|
||||
|
||||
pytest.main(["-x", "tests/unit2"])
|
||||
BIN
tests/test_data/images/tmw_desert_spacing.png
Normal file
BIN
tests/test_data/images/tmw_desert_spacing.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
91
tests/test_data/test_map_image_tile_set.tmx
Normal file
91
tests/test_data/test_map_image_tile_set.tmx
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="10" height="10" tilewidth="32" tileheight="32" infinite="0" nextlayerid="16" nextobjectid="10">
|
||||
<tileset firstgid="1" source="tile_set_image.tsx"/>
|
||||
<layer id="1" name="Tile Layer 1" width="10" height="10">
|
||||
<data encoding="csv">
|
||||
1,2,3,4,5,6,7,8,30,30,
|
||||
9,10,11,12,13,14,15,16,30,30,
|
||||
17,18,19,20,21,22,23,24,30,30,
|
||||
25,26,27,28,29,30,31,32,30,30,
|
||||
33,34,35,36,37,38,39,40,30,30,
|
||||
41,42,43,44,45,46,47,48,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="2" name="Tile Layer 2" width="10" height="10" opacity="0.5">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,46,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,6,7,7,7,7,7,8,0,
|
||||
0,0,14,15,15,15,15,15,16,0,
|
||||
0,0,22,23,23,23,23,23,24,0
|
||||
</data>
|
||||
</layer>
|
||||
<group id="3" name="Group 1">
|
||||
<properties>
|
||||
<property name="bool property" type="bool" value="true"/>
|
||||
</properties>
|
||||
<layer id="5" name="Tile Layer 4" width="10" height="10" offsetx="49" offsety="-50">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,31,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="4" name="Tile Layer 3" width="10" height="10">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
1,2,3,0,0,0,0,0,0,0,
|
||||
9,10,11,0,0,0,0,0,0,0,
|
||||
17,18,19,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
</group>
|
||||
<objectgroup color="#000000" draworder="index" id="6" name="Object Layer 1" opacity="0.9" offsetx="4.66667" offsety="-4.33333">
|
||||
<object id="1" name="rectangle 1" type="rectangle type" x="200.25" y="210.75" width="47.25" height="25" rotation="15"/>
|
||||
<object id="2" name="polygon 1" type="polygon type" x="252.5" y="87.75" rotation="-21">
|
||||
<polygon points="0,0 -41.25,24.25 -11,67.25 25.75,39.75 -9,37.75"/>
|
||||
</object>
|
||||
<object id="3" name="elipse 1" type="elipse type" x="198.75" y="102.5" width="17.75" height="14.25">
|
||||
<ellipse/>
|
||||
</object>
|
||||
<object id="4" name="point 1" type="point type" x="174.25" y="186">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="7" name="insert text 1" type="insert text type" x="11.3958" y="48.5833" width="107.625" height="27.25">
|
||||
<text fontfamily="Sans Serif" pixelsize="17" wrap="1" color="#b40303" italic="1" underline="1" strikeout="1">Hello World</text>
|
||||
</object>
|
||||
<object id="6" name="inserted tile 1" type="inserted tile type" gid="3221225503" x="47.25" y="72.5" width="47" height="53" rotation="31">
|
||||
<properties>
|
||||
<property name="tile property bool" type="bool" value="true"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="8" name="polyline 1" type="polyline type" x="144.667" y="112">
|
||||
<polyline points="0,0 -14.3333,35.6667 15.3333,18.3333"/>
|
||||
</object>
|
||||
<object id="9" name="polygon 2" type="polygon type" x="69.8333" y="168.333">
|
||||
<polygon points="-3.25,-17.25 -15,10.75 20.75,4.5"/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
390
tests/test_data/test_map_infinite.tmx
Normal file
390
tests/test_data/test_map_infinite.tmx
Normal file
@@ -0,0 +1,390 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="8" height="6" tilewidth="32" tileheight="32" infinite="1" nextlayerid="3" nextobjectid="1">
|
||||
<tileset firstgid="1" source="tile_set_image.tsx"/>
|
||||
<layer id="1" name="Tile Layer 1" width="8" height="6">
|
||||
<data encoding="csv">
|
||||
<chunk x="-32" y="-32" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-16" y="-32" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="0" y="-32" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="16" y="-32" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-32" y="-16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-16" y="-16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,1,2,3,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,9,10,11,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,17,18,19
|
||||
</chunk>
|
||||
<chunk x="0" y="-16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
4,5,6,7,8,30,30,30,30,30,30,30,30,30,30,30,
|
||||
12,13,14,15,16,30,30,30,30,30,30,30,30,30,30,30,
|
||||
20,21,22,23,24,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="16" y="-16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-32" y="0" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-16" y="0" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,25,26,27,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,33,34,35,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,41,42,43,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="0" y="0" width="16" height="16">
|
||||
28,29,30,31,32,30,30,30,30,30,30,30,30,30,30,30,
|
||||
36,37,38,39,40,30,30,30,30,30,30,30,30,30,30,30,
|
||||
44,45,46,47,48,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="16" y="0" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-32" y="16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="-16" y="16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="0" y="16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
<chunk x="16" y="16" width="16" height="16">
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,
|
||||
30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30
|
||||
</chunk>
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="2" name="Tile Layer 2" width="8" height="6">
|
||||
<data encoding="csv">
|
||||
<chunk x="-32" y="-16" width="16" height="16">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,21,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,29,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</chunk>
|
||||
<chunk x="16" y="-16" width="16" height="16">
|
||||
0,0,20,21,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,28,29,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</chunk>
|
||||
<chunk x="-16" y="0" width="16" height="16">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
20,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</chunk>
|
||||
<chunk x="16" y="0" width="16" height="16">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
20,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
28,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</chunk>
|
||||
<chunk x="-16" y="16" width="16" height="16">
|
||||
28,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</chunk>
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
23
tests/test_data/test_map_simple.tmx
Normal file
23
tests/test_data/test_map_simple.tmx
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="8" height="6" tilewidth="32" tileheight="32" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<properties>
|
||||
<property name="bool property - false" type="bool" value="false"/>
|
||||
<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="tile_set_image.tsx"/>
|
||||
<layer id="1" name="Tile Layer 1" width="8" height="6">
|
||||
<data encoding="csv">
|
||||
1,2,3,4,5,6,7,8,
|
||||
9,10,11,12,13,14,15,16,
|
||||
17,18,19,20,21,22,23,24,
|
||||
25,26,27,28,29,30,31,32,
|
||||
33,34,35,36,37,38,39,40,
|
||||
41,42,43,44,45,46,47,48
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
4
tests/test_data/tile_set_image.tsx
Normal file
4
tests/test_data/tile_set_image.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.2" tiledversion="1.2.3" 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>
|
||||
83
tests/unit2/test_pytiled_parser.py
Normal file
83
tests/unit2/test_pytiled_parser.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import pytiled_parser
|
||||
|
||||
print(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def test_map_simple():
|
||||
"""
|
||||
TMX with a very simple tileset and some properties.
|
||||
"""
|
||||
map = pytiled_parser.parse_tile_map(Path("../test_data/test_map_simple.tmx"))
|
||||
|
||||
properties = {
|
||||
"bool property - false": False,
|
||||
"bool property - true": True,
|
||||
"color property": (0x49, 0xfc, 0xff, 0xff),
|
||||
"file property": Path("/var/log/syslog"),
|
||||
"float property": 1.23456789,
|
||||
"int property": 13,
|
||||
"string property": "Hello, World!!"
|
||||
}
|
||||
|
||||
assert map.version == "1.2"
|
||||
assert map.tiled_version == "1.2.3"
|
||||
assert map.orientation == "orthogonal"
|
||||
assert map.render_order == "right-down"
|
||||
assert map.width == 8
|
||||
assert map.height == 6
|
||||
assert map.tile_width == 32
|
||||
assert map.tile_height == 32
|
||||
assert map.infinite == False
|
||||
assert map.hex_side_length == None
|
||||
assert map.stagger_axis == None
|
||||
assert map.stagger_index == None
|
||||
assert map.background_color == None
|
||||
assert map.next_layer_id == 2
|
||||
assert map.next_object_id == 1
|
||||
assert map.properties == properties
|
||||
|
||||
assert map.tile_sets[1].name == "tile_set_image"
|
||||
assert map.tile_sets[1].tilewidth == 32
|
||||
assert map.tile_sets[1].tileheight == 32
|
||||
assert map.tile_sets[1].spacing == 1
|
||||
assert map.tile_sets[1].margin == 1
|
||||
assert map.tile_sets[1].tilecount == 48
|
||||
assert map.tile_sets[1].columns == 8
|
||||
assert map.tile_sets[1].tileoffset == None
|
||||
assert map.tile_sets[1].grid == None
|
||||
assert map.tile_sets[1].properties == None
|
||||
assert map.tile_sets[1].terraintypes == None
|
||||
assert map.tile_sets[1].tiles == {}
|
||||
|
||||
# unsure how to get paths to compare propperly
|
||||
assert str(map.tile_sets[1].image.source) == (
|
||||
"images/tmw_desert_spacing.png")
|
||||
assert map.tile_sets[1].image.trans == None
|
||||
assert map.tile_sets[1].image.width == 265
|
||||
assert map.tile_sets[1].image.height == 199
|
||||
|
||||
# assert map.layers ==
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input,expected", [
|
||||
("#001122", (0x00, 0x11, 0x22, 0xff)),
|
||||
("001122", (0x00, 0x11, 0x22, 0xff)),
|
||||
("#FF001122", (0x00, 0x11, 0x22, 0xff)),
|
||||
("FF001122", (0x00, 0x11, 0x22, 0xff)),
|
||||
("FF001122", (0x00, 0x11, 0x22, 0xff)),
|
||||
]
|
||||
)
|
||||
def test_color_parsing(test_input, expected):
|
||||
"""
|
||||
Tiled has a few different types of color representations.
|
||||
"""
|
||||
assert pytiled_parser._parse_color(test_input) == expected
|
||||
Reference in New Issue
Block a user