acdream/tests/AcDream.App.Tests/Rendering/Sky/RainAnimationClockTests.cs
Erik f7aa8e0eb7
All checks were successful
CI / linux-portable (push) Successful in 3m41s
CI / windows-gate (push) Successful in 6m49s
CI / release (push) Successful in 3m22s
fix: complete retail parity stability pass
2026-08-28 20:01:39 +02:00

39 lines
1.2 KiB
C#

using System;
using System.Diagnostics;
using System.IO;
using AcDream.App.Rendering.Sky;
using Xunit;
namespace AcDream.App.Tests.Rendering.Sky;
public sealed class RainAnimationClockTests
{
[Fact]
public void AnimationPhaseUsesMonotonicStopwatchTicks()
{
const long start = 1234;
Assert.Equal(
1f,
SkyRenderer.ElapsedAnimationSeconds(start, start + Stopwatch.Frequency));
}
[Fact]
public void RendererDoesNotReadTheAdjustableSystemClock()
{
string source = File.ReadAllText(Path.Combine(
RepositoryRoot(), "src", "AcDream.App", "Rendering", "Sky", "SkyRenderer.cs"));
Assert.Contains("Stopwatch.GetTimestamp()", source, StringComparison.Ordinal);
Assert.DoesNotContain("DateTime.UtcNow", source, StringComparison.Ordinal);
}
private static string RepositoryRoot()
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "AcDream.slnx")))
directory = directory.Parent;
return directory?.FullName
?? throw new InvalidOperationException("Could not locate repository root.");
}
}