From 0d992a04930c65ab24902b82d959e15bef15bfc3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Oct 2021 13:30:24 +0900 Subject: [PATCH 1/2] Add failing test showing epilepsy warning is not fading on early exit --- osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index aee15a145c..ba0ee5ac6e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -291,7 +291,7 @@ public void TestEpilepsyWarning(bool warning) AddUntilStep("wait for current", () => loader.IsCurrentScreen()); - AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType().Any() == warning); + AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning); if (warning) { @@ -335,12 +335,17 @@ public void TestEpilepsyWarningEarlyExit() AddUntilStep("wait for current", () => loader.IsCurrentScreen()); - AddUntilStep("wait for epilepsy warning", () => loader.ChildrenOfType().Single().Alpha > 0); + AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0); + AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible); + AddStep("exit early", () => loader.Exit()); + AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden); AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1); } + private EpilepsyWarning getWarning() => loader.ChildrenOfType().SingleOrDefault(); + private class TestPlayerLoader : PlayerLoader { public new VisualSettings VisualSettings => base.VisualSettings; From 59dc04017eac9c55a6e1982fabcca255035e2fcb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Oct 2021 13:30:37 +0900 Subject: [PATCH 2/2] Fix epilepsy warning not being faded out on an early exit from `PlayerLoader` --- osu.Game/Screens/Play/PlayerLoader.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index cf5bff57cf..d852ac2940 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -246,6 +246,9 @@ public override bool OnExiting(IScreen next) cancelLoad(); contentOut(); + // If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed). + epilepsyWarning?.Hide(); + // Ensure the screen doesn't expire until all the outwards fade operations have completed. this.Delay(content_out_duration).FadeOut();