From eb8c5292d5db823f1f99947ca936d3e8d3e722f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 13 Nov 2021 13:50:57 +0100 Subject: [PATCH] Ensure editor background is dimmed after return from gameplay test --- .../Visual/Editing/TestSceneEditorTestGameplay.cs | 7 +++++++ osu.Game/Screens/Edit/Editor.cs | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs index e311c7a7ec..f52a764708 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorTestGameplay.cs @@ -10,10 +10,12 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Screens.Edit.GameplayTest; using osu.Game.Tests.Beatmaps.IO; +using osuTK.Graphics; using osuTK.Input; namespace osu.Game.Tests.Visual.Editing @@ -59,6 +61,11 @@ namespace osu.Game.Tests.Visual.Editing AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null); AddStep("exit player", () => editorPlayer.Exit()); AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor); + AddUntilStep("background has correct params", () => + { + var background = this.ChildrenOfType().Single(); + return background.Colour == Color4.DarkGray && background.BlurAmount.Value == 0; + }); } [Test] diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2c758eaf41..d97838e86d 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -487,7 +487,18 @@ namespace osu.Game.Screens.Edit public override void OnEntering(IScreen last) { base.OnEntering(last); + dimBackground(); + resetTrack(true); + } + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + dimBackground(); + } + + private void dimBackground() + { ApplyToBackground(b => { // todo: temporary. we want to be applying dim using the UserDimContainer eventually. @@ -496,8 +507,6 @@ namespace osu.Game.Screens.Edit b.IgnoreUserSettings.Value = true; b.BlurAmount.Value = 0; }); - - resetTrack(true); } public override bool OnExiting(IScreen next)