mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-08 22:26:02 +03:00
Move test data and current tests into UnitTests
This commit is contained in:
parent
0a77a9fec7
commit
d23eec4433
67 changed files with 55 additions and 65 deletions
|
@ -0,0 +1,139 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace DotTiled.Tests;
|
||||
|
||||
public partial class TestData
|
||||
{
|
||||
public static Map MapExternalTilesetWangset(string fileExt) => new Map
|
||||
{
|
||||
Class = "",
|
||||
Orientation = MapOrientation.Orthogonal,
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
TileWidth = 24,
|
||||
TileHeight = 24,
|
||||
Infinite = false,
|
||||
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 = 24,
|
||||
TileHeight = 24,
|
||||
TileCount = 48,
|
||||
Columns = 10,
|
||||
Source = $"wangset-tileset.{(fileExt == "tmx" ? "tsx" : "tsj")}",
|
||||
Transformations = new Transformations
|
||||
{
|
||||
HFlip = true,
|
||||
VFlip = true,
|
||||
Rotate = false,
|
||||
PreferUntransformed = false
|
||||
},
|
||||
Grid = new Grid
|
||||
{
|
||||
Orientation = GridOrientation.Orthogonal,
|
||||
Width = 32,
|
||||
Height = 32
|
||||
},
|
||||
Image = new Image
|
||||
{
|
||||
Format = ImageFormat.Png,
|
||||
Source = "tileset.png",
|
||||
Width = 256,
|
||||
Height = 96,
|
||||
},
|
||||
Wangsets = [
|
||||
new Wangset
|
||||
{
|
||||
Name = "test-terrain",
|
||||
Tile = -1,
|
||||
WangColors = [
|
||||
new WangColor
|
||||
{
|
||||
Name = "Water",
|
||||
Color = Color.Parse("#ff0000", CultureInfo.InvariantCulture),
|
||||
Tile = 0,
|
||||
Probability = 1
|
||||
},
|
||||
new WangColor
|
||||
{
|
||||
Name = "Grass",
|
||||
Color = Color.Parse("#00ff00", CultureInfo.InvariantCulture),
|
||||
Tile = -1,
|
||||
Probability = 1
|
||||
},
|
||||
new WangColor
|
||||
{
|
||||
Name = "Stone",
|
||||
Color = Color.Parse("#0000ff", CultureInfo.InvariantCulture),
|
||||
Tile = 29,
|
||||
Probability = 1
|
||||
}
|
||||
],
|
||||
WangTiles = [
|
||||
new WangTile
|
||||
{
|
||||
TileID = 0,
|
||||
WangID = [1,1,0,0,0,1,1,1]
|
||||
},
|
||||
new WangTile
|
||||
{
|
||||
TileID = 1,
|
||||
WangID = [1,1,1,1,0,0,0,1]
|
||||
},
|
||||
new WangTile
|
||||
{
|
||||
TileID = 10,
|
||||
WangID = [0,0,0,1,1,1,1,1]
|
||||
},
|
||||
new WangTile
|
||||
{
|
||||
TileID = 11,
|
||||
WangID = [0,1,1,1,1,1,0,0]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
Layers = [
|
||||
new TileLayer
|
||||
{
|
||||
ID = 1,
|
||||
Name = "Tile Layer 1",
|
||||
Width = 5,
|
||||
Height = 5,
|
||||
Data = new Data
|
||||
{
|
||||
Encoding = DataEncoding.Csv,
|
||||
GlobalTileIDs = new Optional<uint[]>([
|
||||
2, 2, 12, 11, 0,
|
||||
1, 12, 1, 11, 0,
|
||||
2, 1, 0, 1, 0,
|
||||
12, 11, 12, 2, 0,
|
||||
0, 0, 0, 0, 0
|
||||
]),
|
||||
FlippingFlags = new Optional<FlippingFlags[]>([
|
||||
FlippingFlags.FlippedHorizontally, FlippingFlags.None, FlippingFlags.FlippedHorizontally, FlippingFlags.FlippedHorizontally, FlippingFlags.None,
|
||||
FlippingFlags.FlippedVertically, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically | FlippingFlags.FlippedHorizontally, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedVertically | FlippingFlags.FlippedHorizontally, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.FlippedHorizontally, FlippingFlags.None,
|
||||
FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None, FlippingFlags.None
|
||||
])
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{ "compressionlevel":-1,
|
||||
"height":5,
|
||||
"infinite":false,
|
||||
"layers":[
|
||||
{
|
||||
"data":[2147483650, 2, 2147483660, 2147483659, 0,
|
||||
1073741825, 12, 1, 3221225483, 0,
|
||||
2, 1, 0, 3221225473, 0,
|
||||
12, 11, 12, 2147483650, 0,
|
||||
0, 0, 0, 0, 0],
|
||||
"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":24,
|
||||
"tilesets":[
|
||||
{
|
||||
"firstgid":1,
|
||||
"source":"wangset-tileset.tsj"
|
||||
}],
|
||||
"tilewidth":24,
|
||||
"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="24" tileheight="24" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" source="wangset-tileset.tsx"/>
|
||||
<layer id="1" name="Tile Layer 1" width="5" height="5">
|
||||
<data encoding="csv">
|
||||
2147483650,2,2147483660,2147483659,0,
|
||||
1073741825,12,1,3221225483,0,
|
||||
2,1,0,3221225473,0,
|
||||
12,11,12,2147483650,0,
|
||||
0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,69 @@
|
|||
{ "columns":10,
|
||||
"grid":
|
||||
{
|
||||
"height":32,
|
||||
"orientation":"orthogonal",
|
||||
"width":32
|
||||
},
|
||||
"image":"tileset.png",
|
||||
"imageheight":96,
|
||||
"imagewidth":256,
|
||||
"margin":0,
|
||||
"name":"tileset",
|
||||
"spacing":0,
|
||||
"tilecount":48,
|
||||
"tiledversion":"1.11.0",
|
||||
"tileheight":24,
|
||||
"tilewidth":24,
|
||||
"transformations":
|
||||
{
|
||||
"hflip":true,
|
||||
"preferuntransformed":false,
|
||||
"rotate":false,
|
||||
"vflip":true
|
||||
},
|
||||
"type":"tileset",
|
||||
"version":"1.10",
|
||||
"wangsets":[
|
||||
{
|
||||
"colors":[
|
||||
{
|
||||
"color":"#ff0000",
|
||||
"name":"Water",
|
||||
"probability":1,
|
||||
"tile":0
|
||||
},
|
||||
{
|
||||
"color":"#00ff00",
|
||||
"name":"Grass",
|
||||
"probability":1,
|
||||
"tile":-1
|
||||
},
|
||||
{
|
||||
"color":"#0000ff",
|
||||
"name":"Stone",
|
||||
"probability":1,
|
||||
"tile":29
|
||||
}],
|
||||
"name":"test-terrain",
|
||||
"tile":-1,
|
||||
"type":"mixed",
|
||||
"wangtiles":[
|
||||
{
|
||||
"tileid":0,
|
||||
"wangid":[1, 1, 0, 0, 0, 1, 1, 1]
|
||||
},
|
||||
{
|
||||
"tileid":1,
|
||||
"wangid":[1, 1, 1, 1, 0, 0, 0, 1]
|
||||
},
|
||||
{
|
||||
"tileid":10,
|
||||
"wangid":[0, 0, 0, 1, 1, 1, 1, 1]
|
||||
},
|
||||
{
|
||||
"tileid":11,
|
||||
"wangid":[0, 1, 1, 1, 1, 1, 0, 0]
|
||||
}]
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.11.0" name="tileset" tilewidth="24" tileheight="24" tilecount="48" columns="10">
|
||||
<grid orientation="orthogonal" width="32" height="32"/>
|
||||
<transformations hflip="1" vflip="1" rotate="0" preferuntransformed="0"/>
|
||||
<image source="tileset.png" width="256" height="96"/>
|
||||
<wangsets>
|
||||
<wangset name="test-terrain" type="mixed" tile="-1">
|
||||
<wangcolor name="Water" color="#ff0000" tile="0" probability="1"/>
|
||||
<wangcolor name="Grass" color="#00ff00" tile="-1" probability="1"/>
|
||||
<wangcolor name="Stone" color="#0000ff" tile="29" probability="1"/>
|
||||
<wangtile tileid="0" wangid="1,1,0,0,0,1,1,1"/>
|
||||
<wangtile tileid="1" wangid="1,1,1,1,0,0,0,1"/>
|
||||
<wangtile tileid="10" wangid="0,0,0,1,1,1,1,1"/>
|
||||
<wangtile tileid="11" wangid="0,1,1,1,1,1,0,0"/>
|
||||
</wangset>
|
||||
</wangsets>
|
||||
</tileset>
|
Loading…
Add table
Add a link
Reference in a new issue