mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
removed test files
This commit is contained in:
parent
5d19b8f674
commit
d2f38e9fbf
10 changed files with 0 additions and 232 deletions
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -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("<testmacro>"), (f, m, r) => "<test1>");
|
|
||||||
formatter.Macros.Add(new Regex("<test1>"), (f, m, r) => "<test2>blue");
|
|
||||||
formatter.Macros.Add(new Regex("<test2>"), (f, m, r) => "<c Blue>");
|
|
||||||
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 <testmacro> text</c>.";
|
|
||||||
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 <c Blue>blue text</c>.";
|
|
||||||
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 <i Test> is simply dummy text of the <i Test> printing and typesetting <i Test> industry. Lorem Ipsum has been the industry's standard dummy text <i Test> ever since the <i Test> 1500s, when <i Test><i Test><i Test><i Test><i Test><i Test><i Test> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<string, object> assets;
|
|
||||||
|
|
||||||
public StubContent(StubGame game, Dictionary<string, object> assets) : base(game.Services) {
|
|
||||||
this.RootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Content");
|
|
||||||
this.assets = assets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override T Load<T>(string assetName) {
|
|
||||||
return (T) this.assets[assetName];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
|
|
||||||
namespace Tests.Stub {
|
|
||||||
public class StubGame : Game {
|
|
||||||
|
|
||||||
public StubGame() {
|
|
||||||
new GraphicsDeviceManager(this);
|
|
||||||
this.RunOneFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<string, object> {
|
|
||||||
{"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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1375-develop" />
|
|
||||||
<PackageReference Include="nunit" Version="3.12.0" />
|
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MLEM.Data\MLEM.Data.csproj" />
|
|
||||||
<ProjectReference Include="..\MLEM.Extended\MLEM.Extended.csproj" />
|
|
||||||
<ProjectReference Include="..\MLEM.Startup\MLEM.Startup.csproj" />
|
|
||||||
<ProjectReference Include="..\MLEM.Templates\MLEM.Templates.csproj" />
|
|
||||||
<ProjectReference Include="..\MLEM.Ui\MLEM.Ui.csproj" />
|
|
||||||
<ProjectReference Include="..\MLEM\MLEM.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Content\**">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -1,6 +1,5 @@
|
||||||
#addin Cake.DocFx&version=0.13.1
|
#addin Cake.DocFx&version=0.13.1
|
||||||
#tool docfx.console&version=2.51.0
|
#tool docfx.console&version=2.51.0
|
||||||
#tool NUnit.ConsoleRunner&version=3.11.1
|
|
||||||
|
|
||||||
// this is the upcoming version, for prereleases
|
// this is the upcoming version, for prereleases
|
||||||
var version = Argument("version", "4.1.0");
|
var version = Argument("version", "4.1.0");
|
||||||
|
|
Loading…
Reference in a new issue