Kni.Extended (#892)

* KNI projects

* update actions

fixes MSBUILD : error MSB1011: Specify which project or solution file to
use because this folder contains more than one project or solution file.

* remove test for issue #633

* build tests

* KNI TypeReaders

* KNI/XNA compatible code

* GetRuntimeReader from runtime types

* remove MockGameWindow
This commit is contained in:
Nikos Kastellanos
2024-06-24 05:38:20 +03:00
committed by GitHub
parent 8850875fb4
commit 2bbdc38b51
35 changed files with 657 additions and 84 deletions
@@ -22,28 +22,5 @@ namespace MonoGame.Extended.Tests.Content
Assert.True(ContentReaderExtensions.ShortenRelativePath(input) == expectedoutput);
}
// Test added for issue #633
// https://github.com/craftworkgames/MonoGame.Extended/issues/633
//
// Issue states that the input string from a json file is parsed in correctly by the content reader.
// Adding this test to ensure that GetRelativeAssetName is parsed correctly.
[Theory]
[InlineData("test.tex.png", "test.tex")]
public void ContentReaderExtensions_GetRelativeAssetName(string input, string expected)
{
var contentReaderType = typeof(Microsoft.Xna.Framework.Content.ContentReader).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).First();
var contentReader = (Microsoft.Xna.Framework.Content.ContentReader)contentReaderType.Invoke(new object[]
{
null, // manager: parameter
new MemoryStream(), // stream: parameter
$"{expected}.xnb", // assetName: parameter
0, // version: parameter
null // recordDisposableObject: parameter
});
var actual = contentReader.GetRelativeAssetName(input);
Assert.Equal(expected, actual);
}
}
}
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\source\MonoGame.Extended\KNI.Extended.csproj" />
<ProjectReference Include="..\..\source\MonoGame.Extended.Particles\KNI.Extended.Particles.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\" />
</ItemGroup>
<ItemGroup>
<None Update="BitmapFonts\files\**\*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
@@ -1,42 +0,0 @@
using System;
using System.Drawing;
using Microsoft.Xna.Framework;
using Point = Microsoft.Xna.Framework.Point;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
namespace MonoGame.Extended.Tests
{
public class MockGameWindow : GameWindow
{
public override bool AllowUserResizing { get; set; }
public override Rectangle ClientBounds { get; }
public override Point Position { get; set; }
public override DisplayOrientation CurrentOrientation { get; }
public override IntPtr Handle { get; }
public override string ScreenDeviceName { get; }
public MockGameWindow()
{
}
public override void BeginScreenDeviceChange(bool willBeFullScreen)
{
}
public override void EndScreenDeviceChange(string screenDeviceName, int clientWidth, int clientHeight)
{
}
protected override void SetSupportedOrientations(DisplayOrientation orientations)
{
}
protected override void SetTitle(string title)
{
}
#if __MonoCS__
public override Icon Icon { get; set; }
#endif
}
}