mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
* View box2rotated * Changes * Stash someday * Sync * Grid rotation in a commit * SIMD comment * Minor TryFindGridAt optimisation * More fixes * Optimise rays a tad * Reduce code duplication * Fix anchoring * More fixes woopsie * Eye matching parent * Centre of mass stuffsies * Remove TODO * Add TODO * Revert anchor crash * Fix master merge-in whoopsie * Fixes * Woops * Fixed viewport transform * Re-fix rendering
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using NUnit.Framework;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.UnitTesting.Client.Graphics
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(IEyeManager))]
|
|
public sealed class EyeManagerTest : RobustIntegrationTest
|
|
{
|
|
[Test]
|
|
public async Task TestViewportRotation()
|
|
{
|
|
// At cardinal rotations with a square viewport these should all be the same.
|
|
var client = StartClient();
|
|
await client.WaitIdleAsync();
|
|
|
|
var eyeManager = client.ResolveDependency<IEyeManager>();
|
|
|
|
await client.WaitAssertion(() =>
|
|
{
|
|
// At this stage integration tests aren't pooled so no way I'm making each of these a new test for now.
|
|
foreach (var angle in new[]
|
|
{
|
|
Angle.Zero,
|
|
new Angle(Math.PI / 4),
|
|
new Angle(Math.PI / 2),
|
|
new Angle(Math.PI),
|
|
new Angle(-Math.PI / 4),
|
|
new Angle(-Math.PI / 2),
|
|
new Angle(-Math.PI)
|
|
})
|
|
{
|
|
var worldAABB = eyeManager.GetWorldViewport();
|
|
var worldPort = eyeManager.GetWorldViewbounds();
|
|
|
|
Assert.That(worldAABB.EqualsApprox(worldPort.CalcBoundingBox()), $"Invalid EyeRotation bounds found for {angle}: Expected {worldAABB} and received {worldPort.CalcBoundingBox()}");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|