diff --git a/Tests/Content/Texture.atlas b/Tests/Content/Texture.atlas new file mode 100644 index 0000000..9bc74c8 --- /dev/null +++ b/Tests/Content/Texture.atlas @@ -0,0 +1,16 @@ +SimpleDeskUp +loc 0 0 48 32 +piv 16 16 +SimpleDeskRight +loc 48 0 48 32 +piv 80 16 + +Plant +loc 96 0 16 32 + +LongTableUp +loc 0 32 64 48 +piv 16 48 +LongTableRight +loc 64 32 64 48 +piv 112 48 \ No newline at end of file diff --git a/Tests/Stub/StubContent.cs b/Tests/Stub/StubContent.cs index 601e0b6..bab3541 100644 --- a/Tests/Stub/StubContent.cs +++ b/Tests/Stub/StubContent.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using System.IO; using Microsoft.Xna.Framework.Content; +using NUnit.Framework; namespace Tests.Stub { public class StubContent : ContentManager { @@ -7,6 +9,7 @@ namespace Tests.Stub { private readonly Dictionary assets; public StubContent(Dictionary assets) : base(new StubServices()) { + this.RootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Content"); this.assets = assets; } diff --git a/Tests/TestDataTextureAtlas.cs b/Tests/TestDataTextureAtlas.cs index 8df5f4c..c6f631e 100644 --- a/Tests/TestDataTextureAtlas.cs +++ b/Tests/TestDataTextureAtlas.cs @@ -12,30 +12,10 @@ namespace Tests { [Test] public void Test() { - const string data = @" -SimpleDeskUp -loc 0 0 48 32 -piv 16 16 -SimpleDeskRight -loc 48 0 48 32 -piv 80 16 - -Plant -loc 96 0 16 32 - -LongTableUp -loc 0 32 64 48 -piv 16 48 -LongTableRight -loc 64 32 64 48 -piv 112 48"; - using (var file = new FileInfo("texture.atlas").CreateText()) - file.Write(data); - var content = new StubContent(new Dictionary { - {"texture", new Texture2D(new StubGraphics(), 1, 1)} + {"Texture", new Texture2D(new StubGraphics(), 1, 1)} }); - var atlas = content.LoadTextureAtlas("texture"); + var atlas = content.LoadTextureAtlas("Texture"); Assert.AreEqual(atlas.Regions.Count(), 5); var table = atlas["LongTableUp"]; diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 85a49f6..835cd9b 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net462 + net472 @@ -21,7 +21,9 @@ - + + PreserveNewest +