// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual.Gameplay { public class TestSceneFailAnimation : TestSceneAllRulesetPlayers { protected override Player CreatePlayer(Ruleset ruleset) { SelectedMods.Value = Array.Empty(); return new FailPlayer(); } [Test] public void TestOsuWithoutRedTint() { AddStep("Disable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false)); TestOsu(); AddStep("Enable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true)); } protected override void AddCheckSteps() { AddUntilStep("wait for fail", () => Player.HasFailed); AddUntilStep("wait for fail overlay", () => ((FailPlayer)Player).FailOverlay.State.Value == Visibility.Visible); } private class FailPlayer : TestPlayer { public new FailOverlay FailOverlay => base.FailOverlay; public FailPlayer() : base(false, false) { } protected override void LoadComplete() { base.LoadComplete(); HealthProcessor.FailConditions += (_, __) => true; } } } }