From d2f38e9fbfd3a042b0554473158402da15eb7fc2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 31 Jul 2020 18:53:22 +0200 Subject: [PATCH] removed test files --- Tests/CameraTests.cs | 21 -------------------- Tests/Content/Texture.atlas | 16 ---------------- Tests/FormattingTests.cs | 36 ----------------------------------- Tests/NumberTests.cs | 32 ------------------------------- Tests/Stub/StubContent.cs | 21 -------------------- Tests/Stub/StubFont.cs | 36 ----------------------------------- Tests/Stub/StubGame.cs | 12 ------------ Tests/TestDataTextureAtlas.cs | 28 --------------------------- Tests/Tests.csproj | 29 ---------------------------- build.cake | 1 - 10 files changed, 232 deletions(-) delete mode 100644 Tests/CameraTests.cs delete mode 100644 Tests/Content/Texture.atlas delete mode 100644 Tests/FormattingTests.cs delete mode 100644 Tests/NumberTests.cs delete mode 100644 Tests/Stub/StubContent.cs delete mode 100644 Tests/Stub/StubFont.cs delete mode 100644 Tests/Stub/StubGame.cs delete mode 100644 Tests/TestDataTextureAtlas.cs delete mode 100644 Tests/Tests.csproj diff --git a/Tests/CameraTests.cs b/Tests/CameraTests.cs deleted file mode 100644 index e8583db..0000000 --- a/Tests/CameraTests.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Numerics; -using Microsoft.Xna.Framework.Graphics; -using MLEM.Cameras; -using NUnit.Framework; -using Tests.Stub; -using Vector2 = Microsoft.Xna.Framework.Vector2; - -namespace Tests { - public class CameraTests { - - [Test] - public void TestConversions([Range(-4, 4, 4F)] float x, [Range(-4, 4, 4F)] float y) { - var camera = new Camera(new StubGame().GraphicsDevice); - var pos = new Vector2(x, y); - var cam = camera.ToCameraPos(pos); - var ret = camera.ToWorldPos(cam); - Assert.AreEqual(pos, ret); - } - - } -} \ No newline at end of file diff --git a/Tests/Content/Texture.atlas b/Tests/Content/Texture.atlas deleted file mode 100644 index 9bc74c8..0000000 --- a/Tests/Content/Texture.atlas +++ /dev/null @@ -1,16 +0,0 @@ -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/FormattingTests.cs b/Tests/FormattingTests.cs deleted file mode 100644 index b2f8106..0000000 --- a/Tests/FormattingTests.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Text.RegularExpressions; -using Microsoft.Xna.Framework.Graphics; -using MLEM.Font; -using MLEM.Formatting; -using MLEM.Formatting.Codes; -using MLEM.Textures; -using NUnit.Framework; -using Tests.Stub; - -namespace Tests { - public class FormattingTests { - - [Test] - public void TestMacros() { - var formatter = new TextFormatter(); - formatter.Macros.Add(new Regex(""), (f, m, r) => ""); - formatter.Macros.Add(new Regex(""), (f, m, r) => "blue"); - formatter.Macros.Add(new Regex(""), (f, m, r) => ""); - const string strg = "This text uses a bunch of non-breaking~spaces to see if macros work. Additionally, it uses a macro that resolves into a bunch of other macros and then, at the end, into text."; - const string goal = "This text uses a bunch of non-breaking\u00A0spaces to see if macros work. Additionally, it uses a macro that resolves into a bunch of other macros and then, at the end, into blue text."; - Assert.AreEqual(formatter.ResolveMacros(strg), goal); - } - - [Test] - public void TestFormatting() { - var formatter = new TextFormatter(); - formatter.AddImage("Test", new TextureRegion(new Texture2D(new StubGame().GraphicsDevice, 1, 1), 0, 8, 24, 24)); - const string strg = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."; - var ret = formatter.Tokenize(new StubFont(), strg); - Assert.AreEqual(ret.Tokens.Length, 13); - Assert.AreEqual(ret.DisplayString, "Lorem Ipsum \uF8FF is simply dummy text of the \uF8FF printing and typesetting \uF8FF industry. Lorem Ipsum has been the industry's standard dummy text \uF8FF ever since the \uF8FF 1500s, when \uF8FF\uF8FF\uF8FF\uF8FF\uF8FF\uF8FF\uF8FF an unknown printer took a galley of type and scrambled it to make a type specimen book."); - Assert.AreEqual(ret.AllCodes.Length, 12); - } - - } -} \ No newline at end of file diff --git a/Tests/NumberTests.cs b/Tests/NumberTests.cs deleted file mode 100644 index 280877a..0000000 --- a/Tests/NumberTests.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Xna.Framework; -using MLEM.Extensions; -using MonoGame.Extended; -using NUnit.Framework; - -namespace Tests { - public class NumberTests { - - [Test] - public void TestRounding() { - Assert.AreEqual(1.25F.Floor(), 1); - Assert.AreEqual(-1.25F.Floor(), -1); - - Assert.AreEqual(1.25F.Ceil(), 2); - Assert.AreEqual(-1.25F.Ceil(), -2); - } - - [Test] - public void TestEquals() { - Assert.IsTrue(0.25F.Equals(0.26F, 0.01F)); - Assert.IsFalse(0.25F.Equals(0.26F, 0.009F)); - } - - [Test] - public void TestMatrixOps() { - var matrix = Matrix.CreateRotationX(2) * Matrix.CreateScale(2.5F); - Assert.AreEqual(matrix.Scale(), new Vector3(2.5F)); - Assert.AreEqual(matrix.Rotation(), Quaternion.CreateFromAxisAngle(Vector3.UnitX, 2)); - } - - } -} \ No newline at end of file diff --git a/Tests/Stub/StubContent.cs b/Tests/Stub/StubContent.cs deleted file mode 100644 index 61e2957..0000000 --- a/Tests/Stub/StubContent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework.Content; -using NUnit.Framework; - -namespace Tests.Stub { - public class StubContent : ContentManager { - - private readonly Dictionary assets; - - public StubContent(StubGame game, Dictionary assets) : base(game.Services) { - this.RootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Content"); - this.assets = assets; - } - - public override T Load(string assetName) { - return (T) this.assets[assetName]; - } - - } -} \ No newline at end of file diff --git a/Tests/Stub/StubFont.cs b/Tests/Stub/StubFont.cs deleted file mode 100644 index a1ce2b5..0000000 --- a/Tests/Stub/StubFont.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using MLEM.Font; - -namespace Tests.Stub { - public class StubFont : GenericFont { - - public override GenericFont Bold { get; } = null; - public override GenericFont Italic { get; } = null; - public override float LineHeight { get; } = 1; - - public override void DrawString(SpriteBatch batch, string text, Vector2 position, Color color) { - } - - public override void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) { - } - - public override void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) { - } - - public override void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color) { - } - - public override void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) { - } - - public override void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) { - } - - protected override Vector2 MeasureChar(char c) { - return Vector2.One; - } - - } -} \ No newline at end of file diff --git a/Tests/Stub/StubGame.cs b/Tests/Stub/StubGame.cs deleted file mode 100644 index 07b39d9..0000000 --- a/Tests/Stub/StubGame.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.Xna.Framework; - -namespace Tests.Stub { - public class StubGame : Game { - - public StubGame() { - new GraphicsDeviceManager(this); - this.RunOneFrame(); - } - - } -} \ No newline at end of file diff --git a/Tests/TestDataTextureAtlas.cs b/Tests/TestDataTextureAtlas.cs deleted file mode 100644 index ca0c06d..0000000 --- a/Tests/TestDataTextureAtlas.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using MLEM.Textures; -using NUnit.Framework; -using Tests.Stub; - -namespace Tests { - public class TestDataTextureAtlas { - - [Test] - public void Test() { - var game = new StubGame(); - var content = new StubContent(game, new Dictionary { - {"Texture", new Texture2D(game.GraphicsDevice, 1, 1)} - }); - var atlas = content.LoadTextureAtlas("Texture"); - Assert.AreEqual(atlas.Regions.Count(), 5); - - var table = atlas["LongTableUp"]; - Assert.AreEqual(table.Area, new Rectangle(0, 32, 64, 48)); - Assert.AreEqual(table.PivotPixels, new Vector2(16, 48 - 32)); - } - - } -} \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj deleted file mode 100644 index 91535f7..0000000 --- a/Tests/Tests.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - netcoreapp3.0 - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - diff --git a/build.cake b/build.cake index 4323db3..93120b8 100644 --- a/build.cake +++ b/build.cake @@ -1,6 +1,5 @@ #addin Cake.DocFx&version=0.13.1 #tool docfx.console&version=2.51.0 -#tool NUnit.ConsoleRunner&version=3.11.1 // this is the upcoming version, for prereleases var version = Argument("version", "4.1.0");