Update README.md to include project description, developer documentation links, and license information.
CI / build-test (push) Successful in 1m6s
CI / build-test (push) Successful in 1m6s
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using MrGameEng.Graphics;
|
||||
using Xunit;
|
||||
|
||||
namespace MrGameEng.Graphics.Tests;
|
||||
|
||||
public class SortKeyTests
|
||||
{
|
||||
[Fact]
|
||||
public void LayerDominatesDepthAndTexture()
|
||||
{
|
||||
var lowLayer = SpriteSortKey.Make(0, 1000f, textureKey: 5);
|
||||
var highLayer = SpriteSortKey.Make(1, -1000f, textureKey: 1);
|
||||
|
||||
Assert.True(lowLayer < highLayer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DepthDominatesTexture_WithinLayer()
|
||||
{
|
||||
var behind = SpriteSortKey.Make(3, -5f, textureKey: 999);
|
||||
var inFront = SpriteSortKey.Make(3, 5f, textureKey: 1);
|
||||
|
||||
Assert.True(behind < inFront);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(-100f, -1f)]
|
||||
[InlineData(-1f, 0f)]
|
||||
[InlineData(0f, 1f)]
|
||||
[InlineData(1f, 100f)]
|
||||
[InlineData(-0.5f, 0.5f)]
|
||||
public void DepthBits_PreserveFloatOrder(float smaller, float larger)
|
||||
{
|
||||
Assert.True(SpriteSortKey.DepthToSortableBits(smaller) < SpriteSortKey.DepthToSortableBits(larger));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EqualLayerAndDepth_GroupByTexture()
|
||||
{
|
||||
var a1 = SpriteSortKey.Make(2, 1f, textureKey: 7);
|
||||
var b = SpriteSortKey.Make(2, 1f, textureKey: 9);
|
||||
var a2 = SpriteSortKey.Make(2, 1f, textureKey: 7);
|
||||
|
||||
Assert.Equal(a1, a2);
|
||||
Assert.NotEqual(a1, b);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user