using AcDream.Core.World; using Xunit; namespace AcDream.Core.Tests.World; public sealed class TeleportAnimSequencerTests { // --- Task 1.1: type presence --- [Fact] public void Enums_HaveExpectedValues() { Assert.Equal(0, (int)TeleportAnimState.Off); Assert.Equal(1, (int)TeleportAnimState.WorldFadeOut); Assert.Equal(2, (int)TeleportAnimState.TunnelFadeIn); Assert.Equal(3, (int)TeleportAnimState.Tunnel); Assert.Equal(4, (int)TeleportAnimState.TunnelContinue); Assert.Equal(5, (int)TeleportAnimState.TunnelFadeOut); Assert.Equal(6, (int)TeleportAnimState.WorldFadeIn); _ = TeleportEntryKind.Portal; _ = TeleportEntryKind.Login; _ = TeleportEntryKind.Death; _ = TeleportEntryKind.Logout; _ = TeleportAnimEvent.PlayEnterSound; _ = TeleportAnimEvent.PlayExitSound; _ = TeleportAnimEvent.Place; _ = TeleportAnimEvent.FireLoginComplete; _ = TeleportAnimEvent.EnterTunnel; } [Fact] public void Snapshot_DefaultsAreOff_ClearAlpha() { var snap = new TeleportAnimSnapshot( TeleportAnimState.Off, FadeAlpha: 0f, ShowTunnel: false, ShowPleaseWait: false); Assert.Equal(TeleportAnimState.Off, snap.State); Assert.Equal(0f, snap.FadeAlpha); Assert.False(snap.ShowTunnel); Assert.False(snap.ShowPleaseWait); } // --- Task 1.2: Begin(), IsActive, initial state --- [Theory] [InlineData(TeleportEntryKind.Portal, TeleportAnimState.Tunnel)] [InlineData(TeleportEntryKind.Login, TeleportAnimState.Tunnel)] [InlineData(TeleportEntryKind.Death, TeleportAnimState.Tunnel)] [InlineData(TeleportEntryKind.Logout, TeleportAnimState.WorldFadeOut)] public void Begin_SetsCorrectStartState(TeleportEntryKind kind, TeleportAnimState expectedStart) { var seq = new TeleportAnimSequencer(); Assert.False(seq.IsActive); seq.Begin(kind); Assert.True(seq.IsActive); Assert.Equal(expectedStart, seq.State); } [Fact] public void Begin_EmitsPlayEnterSoundOnFirstTick() { // PlayEnterSound is edge-triggered on the first Tick after Begin. var seq = new TeleportAnimSequencer(); seq.Begin(TeleportEntryKind.Portal); var (_, events) = seq.Tick(dt: 0f, worldReady: false); Assert.Contains(TeleportAnimEvent.PlayEnterSound, events); } }