mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
Remove tests since they don't work correctly without a test version of MonoGame
This commit is contained in:
parent
0d04629b0a
commit
fa3ddbc74e
9 changed files with 21 additions and 34 deletions
6
MLEM.sln
6
MLEM.sln
|
@ -20,8 +20,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Templates", "MLEM.Temp
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.Android", "Demos.Android\Demos.Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.Android", "Demos.Android\Demos.Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B89824FA-CD6D-430D-8952-CDDDB71EC942}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -68,9 +66,5 @@ Global
|
||||||
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{B89824FA-CD6D-430D-8952-CDDDB71EC942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B89824FA-CD6D-430D-8952-CDDDB71EC942}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B89824FA-CD6D-430D-8952-CDDDB71EC942}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B89824FA-CD6D-430D-8952-CDDDB71EC942}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Cameras;
|
using MLEM.Cameras;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Tests.Stub;
|
using Tests.Stub;
|
||||||
|
@ -9,7 +10,7 @@ namespace Tests {
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConversions([Range(-4, 4, 4F)] float x, [Range(-4, 4, 4F)] float y) {
|
public void TestConversions([Range(-4, 4, 4F)] float x, [Range(-4, 4, 4F)] float y) {
|
||||||
var camera = new Camera(new StubGraphics());
|
var camera = new Camera(new StubGame().GraphicsDevice);
|
||||||
var pos = new Vector2(x, y);
|
var pos = new Vector2(x, y);
|
||||||
var cam = camera.ToCameraPos(pos);
|
var cam = camera.ToCameraPos(pos);
|
||||||
var ret = camera.ToWorldPos(cam);
|
var ret = camera.ToWorldPos(cam);
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Tests {
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFormatting() {
|
public void TestFormatting() {
|
||||||
var formatter = new TextFormatter();
|
var formatter = new TextFormatter();
|
||||||
formatter.AddImage("Test", new TextureRegion(new Texture2D(new StubGraphics(), 1, 1), 0, 8, 24, 24));
|
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.";
|
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);
|
var ret = formatter.Tokenize(new StubFont(), strg);
|
||||||
Assert.AreEqual(ret.Tokens.Length, 13);
|
Assert.AreEqual(ret.Tokens.Length, 13);
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Tests.Stub {
|
||||||
|
|
||||||
private readonly Dictionary<string, object> assets;
|
private readonly Dictionary<string, object> assets;
|
||||||
|
|
||||||
public StubContent(Dictionary<string, object> assets) : base(new StubServices()) {
|
public StubContent(StubGame game, Dictionary<string, object> assets) : base(game.Services) {
|
||||||
this.RootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Content");
|
this.RootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Content");
|
||||||
this.assets = assets;
|
this.assets = assets;
|
||||||
}
|
}
|
||||||
|
|
12
Tests/Stub/StubGame.cs
Normal file
12
Tests/Stub/StubGame.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace Tests.Stub {
|
||||||
|
public class StubGame : Game {
|
||||||
|
|
||||||
|
public StubGame() {
|
||||||
|
new GraphicsDeviceManager(this);
|
||||||
|
this.RunOneFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace Tests.Stub {
|
|
||||||
public class StubGraphics : GraphicsDevice {
|
|
||||||
|
|
||||||
public StubGraphics() :
|
|
||||||
base(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, new PresentationParameters()) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Tests.Stub {
|
|
||||||
public class StubServices : IServiceProvider {
|
|
||||||
|
|
||||||
public object GetService(Type serviceType) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,8 +12,9 @@ namespace Tests {
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test() {
|
public void Test() {
|
||||||
var content = new StubContent(new Dictionary<string, object> {
|
var game = new StubGame();
|
||||||
{"Texture", new Texture2D(new StubGraphics(), 1, 1)}
|
var content = new StubContent(game, new Dictionary<string, object> {
|
||||||
|
{"Texture", new Texture2D(game.GraphicsDevice, 1, 1)}
|
||||||
});
|
});
|
||||||
var atlas = content.LoadTextureAtlas("Texture");
|
var atlas = content.LoadTextureAtlas("Texture");
|
||||||
Assert.AreEqual(atlas.Regions.Count(), 5);
|
Assert.AreEqual(atlas.Regions.Count(), 5);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MonoGame.Framework.WindowsDX" Version="3.8.0.1375-develop" />
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1375-develop" />
|
||||||
<PackageReference Include="nunit" Version="3.12.0" />
|
<PackageReference Include="nunit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||||
|
|
Loading…
Reference in a new issue