public void GetState_HitWindow() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Seek within MissThreshold", () => Stopwatch.Seek(note.HitTime - Notes.MissThreshold / 2)); AddAssert("Note is in HitWindow state", () => note.State == HoldNoteState.HitWindow); }
public void GetState_NotVisible() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Seek before note is visible", () => Stopwatch.Seek(25)); AddAssert("Note is in NotVisible state", () => note.State == HoldNoteState.NotVisible); }
public void GetState_VisibleBefore() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Seek before MissThreshold", () => Stopwatch.Seek(note.HitTime - Notes.MissThreshold - 50)); AddAssert("Note is in VisibleBefore state", () => note.State == HoldNoteState.VisibleBefore); }
public void GetState_VisibleAfter() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Seek after EndTime", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime / 2)); AddAssert("Note is in VisibleAfter state", () => note.State == HoldNoteState.VisibleAfter); }
public void GetState_During() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Seek between HitTime and EndTime", () => Stopwatch.Seek((note.HitTime + note.EndTime) / 2)); AddAssert("Note is in During state", () => note.State == HoldNoteState.During); }
[TestCase(1260, 40)] // Press and Release entirely within VisibleAfter state public void Score_PressIgnored_IsFullDurationPlusEndPenalty(int timeToPress, int holdDuration) { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); PressAndRelease(timeToPress, holdDuration); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime)); AddAssert("Score is note duration (full miss)", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == 100.0 + Notes.MissThreshold); }
public void UpdateColor_HoldNotesColorCommand_IsGreen() { GameHoldNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.ShowTime - 100, EndTime = Story.Notes.ShowTime + 100 })); AddStep("Apply green HoldNotesColorCommand", () => Story.AddCommand(new HoldNotesColorCommand { StartValue = Color4.Green, EndValue = Color4.Green })); AddAssert("Hold note is green", () => note.InnerColor == Color4.Green); }
public void UpdateColor_HoldNotesAlphaCommand_IsHalf() { GameHoldNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.ShowTime - 100, EndTime = Story.Notes.ShowTime + 100 })); AddStep("Apply half HoldNotesAlphaCommand", () => Story.AddCommand(new HoldNotesAlphaCommand { StartValue = 0.5f, EndValue = 0.5f })); AddAssert("Hold note is half alpha", () => Precision.AlmostEquals(note.Alpha, 0.5f)); }
public void UpdateColor_HoldNotesOutlineThicknessCommand_IsTwoHundredths() { GameHoldNote note = null; AddStep("Add a note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.ShowTime - 100, EndTime = Story.Notes.ShowTime + 100 })); AddStep("Apply 0.02 HoldNotesOutlineThicknessCommand", () => Story.AddCommand(new HoldNotesOutlineThicknessCommand { StartValue = 0.02f, EndValue = 0.02f })); AddAssert("Hold note outline is 0.02 thick", () => Precision.AlmostEquals(note.OutlineThickness, 0.02f)); }
public void OnPress_MultipleHitsInMissThresholdBeforeHitTime_PlaysHitSoundOnce() { GameHoldNote note = null; AddStep("Add notes", () => Story.AddNote(note = new GameHoldNote { HitTime = 0, EndTime = 1000 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); AddStep("Seek before HitTime", () => Stopwatch.Seek(note.HitTime - 1)); AddStep("Hold key", () => InputManager.PressKey(Key.Z)); AddStep("Release key", () => InputManager.ReleaseKey(Key.Z)); AddStep("Hold key", () => InputManager.PressKey(Key.Z)); AddStep("Release key", () => InputManager.ReleaseKey(Key.Z)); AddAssert("Plays hit sound once", () => PlayScreen.ScoreProcessor.Hit.PlayCount == 1); }
[TestCase(1150, 200)] // Press exactly at HitTime, Release when note disappears public void Score_PressInHitWindowReleaseInVisibleAfter_IsOffsetFromHitTime(int timeToPress, int holdDuration) { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); PressAndRelease(timeToPress, holdDuration); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime)); AddAssert("Score is offset from HitTime", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == Story.Notes.FadeInTime + Story.Notes.ShowTime + 50 // Expected HitTime - timeToPress); // Actual HitTime }
public void OnPress_ConsecutiveHoldNotes_PlaysSecondNoteOutOfOrder() { GameHoldNote note = null; AddStep("Add notes", () => { Story.AddNote(new GameHoldNote { HitTime = 0, EndTime = 1000 }); Story.AddNote(note = new GameHoldNote { HitTime = 1001, EndTime = 2000, Coordinates = Vector2.One, EndCoordinates = Vector2.One }); }); AddStep("Move mouse to second note", () => MoveMouseTo(note)); PressAndRelease(1001, 2000); AddAssert("Plays second note out of order", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == 1000 + Notes.MissThreshold); }
public void Score_InvalidKeySwitch_IsFullDuration() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); AddStep("Seek to 100", () => Stopwatch.Seek(100)); AddStep("Press Z", () => InputManager.PressKey(Key.Z)); AddStep("Seek to HitTime", () => Stopwatch.Seek(Story.Notes.FadeInTime + Story.Notes.ShowTime + 50)); AddStep("Press X", () => InputManager.PressKey(Key.X)); AddStep("Release X", () => InputManager.ReleaseKey(Key.X)); AddStep("Seek to EndTime", () => Stopwatch.Seek(note.EndTime)); AddStep("Release Z", () => InputManager.ReleaseKey(Key.Z)); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime)); AddAssert("Score is 100", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == 100); }
public void Score_MultiplePressesInHitWindowOnly_IncludesFirstOffsetFromHitTime() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); PressAndRelease(950, 50); PressAndRelease(1000, 50); PressAndRelease(1050, 50); PressAndRelease(1100, 50); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime)); AddAssert("Score is first Press's offset from HitTime", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == Story.Notes.FadeInTime + Story.Notes.ShowTime + 50 // HitTime - 950 // First HitTime + 100.0); // Hold note duration }
public void Score_OverlappingPresses_HaveNoEffect() { GameHoldNote note = null; AddStep("Add note", () => Story.AddNote(note = new GameHoldNote { HitTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 50, EndTime = Story.Notes.FadeInTime + Story.Notes.ShowTime + 150 })); AddStep("Move mouse to note", () => MoveMouseTo(Story.Notes.Children.First())); AddStep("Seek to HitTime", () => Stopwatch.Seek(Story.Notes.FadeInTime + Story.Notes.ShowTime + 50)); AddStep("Press Z", () => InputManager.PressKey(Key.Z)); AddStep("Seek to HitTime + 5", () => Stopwatch.Seek(note.HitTime + 5)); AddStep("Press X", () => InputManager.PressKey(Key.X)); AddStep("Seek to HitTime + 10", () => Stopwatch.Seek(note.HitTime + 10)); AddStep("Release X", () => InputManager.ReleaseKey(Key.X)); AddStep("Seek to EndTime", () => Stopwatch.Seek(note.EndTime)); AddStep("Release Z", () => InputManager.ReleaseKey(Key.Z)); AddStep("Seek after note is deleted", () => Stopwatch.Seek(note.EndTime + Story.Notes.FadeOutTime)); AddAssert("Score is 0", () => PlayScreen.ScoreProcessor.ScoreStatistics.Score == 0); }