mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-02-05 08:52:50 +02:00
Add tests for map with rotated/flipped tiles
This commit is contained in:
parent
a1a2e3d373
commit
e68f7c178a
7 changed files with 147 additions and 0 deletions
|
@ -36,6 +36,7 @@ public static partial class TestData
|
||||||
["Serialization/TestData/Map/map_with_custom_type_props/map-with-custom-type-props", (string f) => TestData.MapWithCustomTypeProps(), TestData.MapWithCustomTypePropsCustomTypeDefinitions()],
|
["Serialization/TestData/Map/map_with_custom_type_props/map-with-custom-type-props", (string f) => TestData.MapWithCustomTypeProps(), TestData.MapWithCustomTypePropsCustomTypeDefinitions()],
|
||||||
["Serialization/TestData/Map/map_with_embedded_tileset/map-with-embedded-tileset", (string f) => TestData.MapWithEmbeddedTileset(), Array.Empty<CustomTypeDefinition>()],
|
["Serialization/TestData/Map/map_with_embedded_tileset/map-with-embedded-tileset", (string f) => TestData.MapWithEmbeddedTileset(), Array.Empty<CustomTypeDefinition>()],
|
||||||
["Serialization/TestData/Map/map_with_external_tileset/map-with-external-tileset", (string f) => TestData.MapWithExternalTileset(f), Array.Empty<CustomTypeDefinition>()],
|
["Serialization/TestData/Map/map_with_external_tileset/map-with-external-tileset", (string f) => TestData.MapWithExternalTileset(f), Array.Empty<CustomTypeDefinition>()],
|
||||||
|
["Serialization/TestData/Map/map_with_flippingflags/map-with-flippingflags", (string f) => TestData.MapWithFlippingFlags(f), Array.Empty<CustomTypeDefinition>()],
|
||||||
];
|
];
|
||||||
|
|
||||||
private static CustomTypeDefinition[] typedefs = [
|
private static CustomTypeDefinition[] typedefs = [
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace DotTiled.Tests;
|
||||||
|
|
||||||
|
public partial class TestData
|
||||||
|
{
|
||||||
|
public static Map MapWithFlippingFlags(string fileExt) => new Map
|
||||||
|
{
|
||||||
|
Class = "",
|
||||||
|
Orientation = MapOrientation.Orthogonal,
|
||||||
|
Width = 5,
|
||||||
|
Height = 5,
|
||||||
|
TileWidth = 32,
|
||||||
|
TileHeight = 32,
|
||||||
|
Infinite = false,
|
||||||
|
HexSideLength = null,
|
||||||
|
StaggerAxis = null,
|
||||||
|
StaggerIndex = null,
|
||||||
|
ParallaxOriginX = 0,
|
||||||
|
ParallaxOriginY = 0,
|
||||||
|
RenderOrder = RenderOrder.RightDown,
|
||||||
|
CompressionLevel = -1,
|
||||||
|
BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture),
|
||||||
|
Version = "1.10",
|
||||||
|
TiledVersion = "1.11.0",
|
||||||
|
NextLayerID = 2,
|
||||||
|
NextObjectID = 1,
|
||||||
|
Tilesets = [
|
||||||
|
new Tileset
|
||||||
|
{
|
||||||
|
Version = "1.10",
|
||||||
|
TiledVersion = "1.11.0",
|
||||||
|
FirstGID = 1,
|
||||||
|
Name = "tileset",
|
||||||
|
TileWidth = 32,
|
||||||
|
TileHeight = 32,
|
||||||
|
TileCount = 24,
|
||||||
|
Columns = 8,
|
||||||
|
Source = $"tileset.{(fileExt == "tmx" ? "tsx" : "tsj")}",
|
||||||
|
Image = new Image
|
||||||
|
{
|
||||||
|
Format = ImageFormat.Png,
|
||||||
|
Source = "tileset.png",
|
||||||
|
Width = 256,
|
||||||
|
Height = 96,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
Layers = [
|
||||||
|
new TileLayer
|
||||||
|
{
|
||||||
|
ID = 1,
|
||||||
|
Name = "Tile Layer 1",
|
||||||
|
Width = 5,
|
||||||
|
Height = 5,
|
||||||
|
Data = new Data
|
||||||
|
{
|
||||||
|
Encoding = DataEncoding.Csv,
|
||||||
|
Chunks = null,
|
||||||
|
Compression = null,
|
||||||
|
GlobalTileIDs = [
|
||||||
|
1, 1, 0, 0, 7,
|
||||||
|
1, 1, 0, 0, 7,
|
||||||
|
0, 0, 1, 0, 7,
|
||||||
|
0, 0, 0, 1, 7,
|
||||||
|
21, 21, 21, 21, 1
|
||||||
|
],
|
||||||
|
FlippingFlags = [
|
||||||
|
FlippingFlags.None, FlippingFlags.FlippedDiagonally | FlippingFlags.FlippedHorizontally, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically,
|
||||||
|
FlippingFlags.FlippedDiagonally | FlippingFlags.FlippedVertically, FlippingFlags.FlippedVertically | FlippingFlags.FlippedHorizontally, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically,
|
||||||
|
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically,
|
||||||
|
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically,
|
||||||
|
FlippingFlags.FlippedHorizontally, FlippingFlags.FlippedHorizontally, FlippingFlags.FlippedHorizontally, FlippingFlags.FlippedHorizontally, FlippingFlags.None
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{ "compressionlevel":-1,
|
||||||
|
"height":5,
|
||||||
|
"infinite":false,
|
||||||
|
"layers":[
|
||||||
|
{
|
||||||
|
"data":[1, 2684354561, 0, 0, 1073741831,
|
||||||
|
1610612737, 3221225473, 0, 0, 1073741831,
|
||||||
|
0, 0, 1, 0, 1073741831,
|
||||||
|
0, 0, 0, 1, 1073741831,
|
||||||
|
2147483669, 2147483669, 2147483669, 2147483669, 1],
|
||||||
|
"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":[
|
||||||
|
{
|
||||||
|
"firstgid":1,
|
||||||
|
"source":"tileset.tsj"
|
||||||
|
}],
|
||||||
|
"tilewidth":32,
|
||||||
|
"type":"map",
|
||||||
|
"version":"1.10",
|
||||||
|
"width":5
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?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="0" nextlayerid="2" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="tileset.tsx"/>
|
||||||
|
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||||
|
<data encoding="csv">
|
||||||
|
1,2684354561,0,0,1073741831,
|
||||||
|
1610612737,3221225473,0,0,1073741831,
|
||||||
|
0,0,1,0,1073741831,
|
||||||
|
0,0,0,1,1073741831,
|
||||||
|
2147483669,2147483669,2147483669,2147483669,1
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,14 @@
|
||||||
|
{ "columns":8,
|
||||||
|
"image":"tileset.png",
|
||||||
|
"imageheight":96,
|
||||||
|
"imagewidth":256,
|
||||||
|
"margin":0,
|
||||||
|
"name":"tileset",
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":24,
|
||||||
|
"tiledversion":"1.11.0",
|
||||||
|
"tileheight":32,
|
||||||
|
"tilewidth":32,
|
||||||
|
"type":"tileset",
|
||||||
|
"version":"1.10"
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<tileset version="1.10" tiledversion="1.11.0" name="tileset" tilewidth="32" tileheight="32" tilecount="24" columns="8">
|
||||||
|
<image source="tileset.png" width="256" height="96"/>
|
||||||
|
</tileset>
|
Loading…
Add table
Reference in a new issue