acdream/tests/AcDream.Core.Tests/Rendering/CameraDiagnosticsTests.cs
Erik 67e64c79cf feat(camera): flip retail chase camera to default-on after visual ship
After visual verification 2026-05-18 (turn lag, coast-and-settle,
slope-tilt, jump tracking with contact-plane projection all working),
make the retail chase camera the default. Legacy ChaseCamera stays
available via the DebugPanel toggle (ACDREAM_RETAIL_CHASE=0 or the
checkbox) pending a follow-up deletion commit.

Env var polarity now matches AlignToSlope: default-on if unset, off
only when explicitly "0".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 09:47:33 +02:00

49 lines
1.9 KiB
C#

using AcDream.Core.Rendering;
using Xunit;
namespace AcDream.Core.Tests.Rendering;
public class CameraDiagnosticsTests
{
// NOTE: These tests assume the env vars ACDREAM_RETAIL_CHASE and
// ACDREAM_CAMERA_ALIGN_SLOPE are NOT set when running the test
// suite. Static class is initialised on first access; values reflect
// the env state at that time.
[Fact]
public void Defaults_AreRetailValues()
{
// Reset to defaults explicitly (test isolation; another test may
// have flipped these earlier in the run).
CameraDiagnostics.TranslationStiffness = 0.45f;
CameraDiagnostics.RotationStiffness = 0.45f;
CameraDiagnostics.MouseLowPassWindowSec = 0.25f;
CameraDiagnostics.CameraAdjustmentSpeed = 40.0f;
CameraDiagnostics.AlignToSlope = true;
CameraDiagnostics.UseRetailChaseCamera = true;
Assert.Equal(0.45f, CameraDiagnostics.TranslationStiffness);
Assert.Equal(0.45f, CameraDiagnostics.RotationStiffness);
Assert.Equal(0.25f, CameraDiagnostics.MouseLowPassWindowSec);
Assert.Equal(40.0f, CameraDiagnostics.CameraAdjustmentSpeed);
Assert.True(CameraDiagnostics.AlignToSlope);
// 2026-05-18 ship: retail chase camera is the default. The
// legacy camera remains opt-in via the DebugPanel toggle until
// the follow-up deletion commit.
Assert.True(CameraDiagnostics.UseRetailChaseCamera);
}
[Fact]
public void Setters_PersistRuntimeChanges()
{
CameraDiagnostics.TranslationStiffness = 0.8f;
CameraDiagnostics.UseRetailChaseCamera = false;
Assert.Equal(0.8f, CameraDiagnostics.TranslationStiffness);
Assert.False(CameraDiagnostics.UseRetailChaseCamera);
// Reset so other tests aren't poisoned.
CameraDiagnostics.TranslationStiffness = 0.45f;
CameraDiagnostics.UseRetailChaseCamera = true;
}
}