From ce66bc374f133c7ecad077e463290f321ded47f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jan 2025 15:56:38 +0900 Subject: [PATCH 1/2] Fix `SetupLogging` not being called in game test scenario --- osu.Framework/Testing/TestScene.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Framework/Testing/TestScene.cs b/osu.Framework/Testing/TestScene.cs index 545f59161e..307ffaa82d 100644 --- a/osu.Framework/Testing/TestScene.cs +++ b/osu.Framework/Testing/TestScene.cs @@ -90,6 +90,7 @@ protected void AddGame([NotNull] Game game) exitNestedGame(); nestedGame = game; + nestedGame.SetupLogging(host.Storage, host.CacheStorage); nestedGame.SetHost(host); base.Add(nestedGame); From 6ef2f54d9a31da3cbe7d38e359b1d663086dc381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 22 Jan 2025 08:43:36 +0100 Subject: [PATCH 2/2] Remove redundant setup in template game test scenes --- .../Visual/TestSceneTemplateGameGame.cs | 10 ++-------- .../Visual/TestSceneFlappyDonGame.cs | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/osu.Framework.Templates/templates/template-empty/TemplateGame.Game.Tests/Visual/TestSceneTemplateGameGame.cs b/osu.Framework.Templates/templates/template-empty/TemplateGame.Game.Tests/Visual/TestSceneTemplateGameGame.cs index bdaac3367d..a9f34c6299 100644 --- a/osu.Framework.Templates/templates/template-empty/TemplateGame.Game.Tests/Visual/TestSceneTemplateGameGame.cs +++ b/osu.Framework.Templates/templates/template-empty/TemplateGame.Game.Tests/Visual/TestSceneTemplateGameGame.cs @@ -1,5 +1,4 @@ using osu.Framework.Allocation; -using osu.Framework.Platform; using NUnit.Framework; namespace TemplateGame.Game.Tests.Visual @@ -10,15 +9,10 @@ public partial class TestSceneTemplateGameGame : TemplateGameTestScene // Add visual tests to ensure correct behaviour of your game: https://github.com/ppy/osu-framework/wiki/Development-and-Testing // You can make changes to classes associated with the tests and they will recompile and update immediately. - private TemplateGameGame game; - [BackgroundDependencyLoader] - private void load(GameHost host) + private void load() { - game = new TemplateGameGame(); - game.SetHost(host); - - AddGame(game); + AddGame(new TemplateGameGame()); } } } diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs index dfb9bc7531..3de074c08c 100644 --- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs +++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs @@ -1,5 +1,4 @@ using osu.Framework.Allocation; -using osu.Framework.Platform; using NUnit.Framework; namespace FlappyDon.Game.Tests.Visual @@ -11,14 +10,10 @@ namespace FlappyDon.Game.Tests.Visual [TestFixture] public partial class TestSceneFlappyDonGame : FlappyDonTestScene { - private FlappyDonGame game; - [BackgroundDependencyLoader] - private void load(GameHost host) + private void load() { - game = new FlappyDonGame(); - game.SetHost(host); - AddGame(game); + AddGame(new FlappyDonGame()); } } }