Skip to content

Commit 72116ad

Browse files
committed
tests: All map tests working
1 parent 923149c commit 72116ad

26 files changed

+361
-2
lines changed

tests/test_cross_template/map.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{ "backgroundcolor":"#ff0004",
2+
"compressionlevel":0,
3+
"height":6,
4+
"infinite":false,
5+
"layers":[
6+
{
7+
"draworder":"topdown",
8+
"id":2,
9+
"name":"Object Layer 1",
10+
"objects":[
11+
{
12+
"id":2,
13+
"template":"template-rectangle.tx",
14+
"x":98.4987608686521,
15+
"y":46.2385012811358
16+
}],
17+
"opacity":1,
18+
"type":"objectgroup",
19+
"visible":true,
20+
"x":0,
21+
"y":0
22+
}],
23+
"nextlayerid":3,
24+
"nextobjectid":8,
25+
"orientation":"orthogonal",
26+
"properties":[
27+
{
28+
"name":"bool property - true",
29+
"type":"bool",
30+
"value":true
31+
},
32+
{
33+
"name":"color property",
34+
"type":"color",
35+
"value":"#ff49fcff"
36+
},
37+
{
38+
"name":"file property",
39+
"type":"file",
40+
"value":"..\/..\/..\/..\/..\/..\/var\/log\/syslog"
41+
},
42+
{
43+
"name":"float property",
44+
"type":"float",
45+
"value":1.23456789
46+
},
47+
{
48+
"name":"int property",
49+
"type":"int",
50+
"value":13
51+
},
52+
{
53+
"name":"string property",
54+
"type":"string",
55+
"value":"Hello, World!!"
56+
}],
57+
"renderorder":"right-down",
58+
"tiledversion":"1.7.1",
59+
"tileheight":32,
60+
"tilesets":[
61+
{
62+
"firstgid":1,
63+
"source":"tileset.json"
64+
},
65+
{
66+
"firstgid":49,
67+
"source":"tile_set_image_for_template.json"
68+
}],
69+
"tilewidth":32,
70+
"type":"map",
71+
"version":"1.6",
72+
"width":8
73+
}

tests/test_cross_template/map.tmx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<properties>
4+
<property name="bool property - true" type="bool" value="true"/>
5+
<property name="color property" type="color" value="#ff49fcff"/>
6+
<property name="file property" type="file" value="../../../../../../var/log/syslog"/>
7+
<property name="float property" type="float" value="1.23456789"/>
8+
<property name="int property" type="int" value="13"/>
9+
<property name="string property" value="Hello, World!!"/>
10+
</properties>
11+
<tileset firstgid="1" source="tileset.tsx"/>
12+
<tileset firstgid="49" source="tile_set_image_for_template.tsx"/>
13+
<objectgroup id="2" name="Object Layer 1">
14+
<object id="2" template="template-rectangle.json" x="98.4988" y="46.2385"/>
15+
</objectgroup>
16+
</map>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ "object":
2+
{
3+
"height":38.2811778048473,
4+
"id":1,
5+
"name":"",
6+
"rotation":0,
7+
"type":"",
8+
"visible":true,
9+
"width":63.6585878103079
10+
},
11+
"type":"template"
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<template>
3+
<object width="63.6586" height="38.2812"/>
4+
</template>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
from pytiled_parser import parse_map
7+
8+
9+
def test_cross_template_tmx_json():
10+
with pytest.raises(NotImplementedError):
11+
parse_map(Path(os.path.dirname(os.path.abspath(__file__))) / "map.tmx")
12+
13+
14+
def test_cross_template_json_tmx():
15+
with pytest.raises(NotImplementedError):
16+
parse_map(Path(os.path.dirname(os.path.abspath(__file__))) / "map.json")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ "columns":1,
2+
"image":"..\/..\/images\/tile_04.png",
3+
"imageheight":32,
4+
"imagewidth":32,
5+
"margin":0,
6+
"name":"tile_set_image_for_template",
7+
"spacing":0,
8+
"tilecount":1,
9+
"tiledversion":"1.7.1",
10+
"tileheight":32,
11+
"tilewidth":32,
12+
"type":"tileset",
13+
"version":"1.6"
14+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tileset version="1.5" tiledversion="1.7.0" name="tile_set_image_for_template" tilewidth="32" tileheight="32" tilecount="1" columns="1">
3+
<image source="../../images/tile_04.png" width="32" height="32"/>
4+
</tileset>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ "columns":8,
2+
"image":"..\/test_data\/images\/tmw_desert_spacing.png",
3+
"imageheight":199,
4+
"imagewidth":265,
5+
"margin":1,
6+
"name":"tile_set_image",
7+
"spacing":1,
8+
"tilecount":48,
9+
"tiledversion":"1.6.0",
10+
"tileheight":32,
11+
"tilewidth":32,
12+
"type":"tileset",
13+
"version":"1.6"
14+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tileset version="1.5" tiledversion="1.7.0" name="tile_set_image" tilewidth="32" tileheight="32" spacing="1" margin="1" tilecount="48" columns="8">
3+
<image source="../../images/tmw_desert_spacing.png" width="265" height="199"/>
4+
</tileset>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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" nextlayerid="2" nextobjectid="1">
3+
<tileset firstgid="1" name="tileset" tilewidth="32" tileheight="32" spacing="1" margin="1" tilecount="48" columns="8">
4+
<image source="../../images/tmw_desert_spacing.png" width="265" height="199"/>
5+
</tileset>
6+
</map>

0 commit comments

Comments
 (0)