More tests

This commit is contained in:
Daniel Cronqvist 2024-08-14 20:29:55 +02:00
parent 653e5b5326
commit aecd97bd7d
8 changed files with 159 additions and 88 deletions

View file

@ -17,6 +17,8 @@ public static partial class DotTiledAssert
AssertEqual(expected.Template, actual.Template, nameof(Object.Template));
AssertProperties(expected.Properties, actual.Properties);
Assert.True(expected.GetType() == actual.GetType(), $"Expected object type {expected.GetType()} but got {actual.GetType()}");
AssertObject((dynamic)expected, (dynamic)actual);
}

View file

@ -92,7 +92,12 @@ public partial class TestData
new Vector2(0, 0),
new Vector2(104,20),
new Vector2(35.6667f, 32.3333f)
]
],
Template = fileExt == "tmx" ? "poly.tx" : "poly.tj",
Properties = new Dictionary<string, IProperty>
{
["templateprop"] = new StringProperty { Name = "templateprop", Value = "helo there" }
}
},
new TileObject
{

View file

@ -11,15 +11,15 @@
"name":"Objects",
"objects":[
{
"height":31.3333333333333,
"height":31.3333,
"id":1,
"name":"Object 1",
"rotation":0,
"type":"",
"visible":true,
"width":31.3333333333333,
"x":25.6666666666667,
"y":28.6666666666667
"width":31.3333,
"x":25.6667,
"y":28.6667
},
{
"height":0,
@ -30,44 +30,26 @@
"type":"",
"visible":true,
"width":0,
"x":117.666666666667,
"y":48.6666666666667
"x":117.667,
"y":48.6667
},
{
"ellipse":true,
"height":34.6666666666667,
"height":34.6667,
"id":4,
"name":"Circle1",
"rotation":0,
"type":"",
"visible":true,
"width":34.6666666666667,
"width":34.6667,
"x":77,
"y":72.3333333333333
"y":72.3333
},
{
"height":0,
"id":5,
"name":"Poly",
"polygon":[
{
"x":0,
"y":0
},
{
"x":104,
"y":20
},
{
"x":35.6666666666667,
"y":32.3333333333333
}],
"rotation":0,
"type":"",
"visible":true,
"width":0,
"x":20.6666666666667,
"y":114.666666666667
"template":"poly.tj",
"x":20.6667,
"y":114.667
},
{
"gid":7,
@ -79,7 +61,7 @@
"visible":true,
"width":64,
"x":-35,
"y":110.333333333333
"y":110.333
}],
"opacity":1,
"type":"objectgroup",

View file

@ -10,9 +10,7 @@
<object id="4" name="Circle1" x="77" y="72.3333" width="34.6667" height="34.6667">
<ellipse/>
</object>
<object id="5" name="Poly" x="20.6667" y="114.667">
<polygon points="0,0 104,20 35.6667,32.3333"/>
</object>
<object id="5" template="poly.tx" x="20.6667" y="114.667"/>
<object id="6" name="TileObj" gid="7" x="-35" y="110.333" width="64" height="146"/>
</objectgroup>
<group id="5" name="Sub">

View file

@ -0,0 +1,31 @@
{ "object":
{
"height":0,
"id":5,
"name":"Poly",
"polygon":[
{
"x":0,
"y":0
},
{
"x":104,
"y":20
},
{
"x":35.6667,
"y":32.3333
}],
"properties":[
{
"name":"templateprop",
"type":"string",
"value":"helo there"
}],
"rotation":0,
"type":"",
"visible":true,
"width":0
},
"type":"template"
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<object name="Poly">
<properties>
<property name="templateprop" value="helo there"/>
</properties>
<polygon points="0,0 104,20 35.6667,32.3333"/>
</object>
</template>