From 733ce4c38272d747c749a985247c8db83f8c6f36 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 20 Jul 2023 22:30:48 +0900 Subject: [PATCH] Fix incorrect dependency caching These are tested framework-side to throw exceptions, but the test is ignored for the source generated version because it quietly allows this scenario. The source gen project should eventually have an analyser for these unsupported cases, or we could consider relaxing this particular case. --- osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs | 7 ++++++- .../Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs | 7 ++++++- .../Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs index 74249007e4..aa89342926 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Gameplay private HUDOverlay hudOverlay = null!; [Cached(typeof(ScoreProcessor))] - private ScoreProcessor scoreProcessor => gameplayState.ScoreProcessor; + private ScoreProcessor scoreProcessor { get; set; } [Cached(typeof(HealthProcessor))] private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); @@ -47,6 +47,11 @@ namespace osu.Game.Tests.Visual.Gameplay private Drawable hideTarget => hudOverlay.ChildrenOfType().First(); private Drawable keyCounterFlow => hudOverlay.ChildrenOfType().First().ChildrenOfType>().Single(); + public TestSceneHUDOverlay() + { + scoreProcessor = gameplayState.ScoreProcessor; + } + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs index 89eb291ab0..81ce088b9d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorMultipleSkins.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Gameplay public partial class TestSceneSkinEditorMultipleSkins : SkinnableTestScene { [Cached(typeof(ScoreProcessor))] - private ScoreProcessor scoreProcessor => gameplayState.ScoreProcessor; + private ScoreProcessor scoreProcessor { get; set; } [Cached(typeof(HealthProcessor))] private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); @@ -37,6 +37,11 @@ namespace osu.Game.Tests.Visual.Gameplay [Cached] public readonly EditorClipboard Clipboard = new EditorClipboard(); + public TestSceneSkinEditorMultipleSkins() + { + scoreProcessor = gameplayState.ScoreProcessor; + } + [SetUpSteps] public void SetUpSteps() { diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs index 162e279403..a8580ebf77 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableHUDOverlay.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.Gameplay private HUDOverlay hudOverlay; [Cached(typeof(ScoreProcessor))] - private ScoreProcessor scoreProcessor => gameplayState.ScoreProcessor; + private ScoreProcessor scoreProcessor { get; set; } [Cached(typeof(HealthProcessor))] private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); @@ -47,6 +47,11 @@ namespace osu.Game.Tests.Visual.Gameplay private Drawable hideTarget => hudOverlay.ChildrenOfType().First(); private Drawable keyCounterFlow => hudOverlay.ChildrenOfType().First().ChildrenOfType>().Single(); + public TestSceneSkinnableHUDOverlay() + { + scoreProcessor = gameplayState.ScoreProcessor; + } + [Test] public void TestComboCounterIncrementing() {