This commit is contained in:
kimk05 2025-05-31 05:29:04 +00:00 committed by GitHub
commit f7eb92deb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,38 @@
namespace DotTiled.Tests;
public partial class TestData
{
public static Map MapWithInfiniteAndEmptyChunks() => new Map
{
Class = "",
Orientation = MapOrientation.Orthogonal,
Width = 5,
Height = 5,
TileWidth = 32,
TileHeight = 32,
Infinite = true,
ParallaxOriginX = 0,
ParallaxOriginY = 0,
RenderOrder = RenderOrder.RightDown,
CompressionLevel = -1,
BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 },
Version = "1.10",
TiledVersion = "1.11.0",
NextLayerID = 2,
NextObjectID = 1,
Layers = [
new TileLayer
{
ID = 1,
Name = "Tile Layer 1",
Width = 5,
Height = 5,
Data = new Data
{
Encoding = DataEncoding.Csv,
Chunks = new Optional<Chunk[]>(Array.Empty<Chunk>())
}
}
]
};
}

View file

@ -0,0 +1,28 @@
{ "compressionlevel":-1,
"height":5,
"infinite":true,
"layers":[
{
"chunks":[],
"height":5,
"id":1,
"name":"Tile Layer 1",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":5,
"x":0,
"y":0
}],
"nextlayerid":2,
"nextobjectid":1,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.11.0",
"tileheight":32,
"tilesets":[],
"tilewidth":32,
"type":"map",
"version":"1.10",
"width":5
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="1" nextlayerid="2" nextobjectid="1">
<layer id="1" name="Tile Layer 1" width="5" height="5">
<data encoding="csv"/>
</layer>
</map>

View file

@ -51,6 +51,7 @@ public static partial class TestData
[GetMapPath("map-with-deep-props"), (string f) => MapWithDeepProps(), MapWithDeepPropsCustomTypeDefinitions()], [GetMapPath("map-with-deep-props"), (string f) => MapWithDeepProps(), MapWithDeepPropsCustomTypeDefinitions()],
[GetMapPath("map-with-class"), (string f) => MapWithClass(), MapWithClassCustomTypeDefinitions()], [GetMapPath("map-with-class"), (string f) => MapWithClass(), MapWithClassCustomTypeDefinitions()],
[GetMapPath("map-with-class-and-props"), (string f) => MapWithClassAndProps(), MapWithClassAndPropsCustomTypeDefinitions()], [GetMapPath("map-with-class-and-props"), (string f) => MapWithClassAndProps(), MapWithClassAndPropsCustomTypeDefinitions()],
[GetMapPath("map-with-infinite-and-empty-chunks"), (string f) => MapWithInfiniteAndEmptyChunks(), Array.Empty<ICustomTypeDefinition>()],
[GetMapPath("map-override-object-bug"), (string f) => MapOverrideObjectBug(f), MapOverrideObjectBugCustomTypeDefinitions()], [GetMapPath("map-override-object-bug"), (string f) => MapOverrideObjectBug(f), MapOverrideObjectBugCustomTypeDefinitions()],
]; ];
} }

View file

@ -74,7 +74,10 @@ internal static class ExtensionsXmlReader
var list = new List<T>(); var list = new List<T>();
if (reader.IsEmptyElement) if (reader.IsEmptyElement)
{
reader.ReadStartElement(wrapper);
return list; return list;
}
reader.ReadStartElement(wrapper); reader.ReadStartElement(wrapper);
while (reader.IsStartElement(elementName)) while (reader.IsStartElement(elementName))