From d5fdd0c0f9bb4a52630e9fead6b27ab44e472ca0 Mon Sep 17 00:00:00 2001 From: wooster0 Date: Tue, 9 Jan 2024 21:44:05 +0900 Subject: [PATCH] make each test bind the handler only once, depending on its need --- .../TestScenePlaylistsResultsScreen.cs | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index 02bd7f950f..727d9da50b 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -69,19 +69,9 @@ namespace osu.Game.Tests.Visual.Playlists }); } - public void SetUpRequestHandler(bool noScores = false) - { - AddStep("set up request handler", () => - { - bindHandler(noScores: noScores); - }); - } - [Test] public void TestShowWithUserScore() { - SetUpRequestHandler(); - AddStep("bind user score info handler", () => bindHandler(userScore: userScore)); createResults(() => userScore); @@ -95,7 +85,7 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestShowNullUserScore() { - SetUpRequestHandler(); + AddStep("bind user score info handler", () => bindHandler()); createResults(); waitForDisplay(); @@ -106,8 +96,6 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestShowUserScoreWithDelay() { - SetUpRequestHandler(); - AddStep("bind user score info handler", () => bindHandler(true, userScore)); createResults(() => userScore); @@ -120,8 +108,6 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestShowNullUserScoreWithDelay() { - SetUpRequestHandler(); - AddStep("bind delayed handler", () => bindHandler(true)); createResults(); @@ -133,13 +119,11 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestFetchWhenScrolledToTheRight() { - SetUpRequestHandler(); + AddStep("bind delayed handler", () => bindHandler(true)); createResults(); waitForDisplay(); - AddStep("bind delayed handler", () => bindHandler(true)); - for (int i = 0; i < 2; i++) { int beforePanelCount = 0; @@ -158,8 +142,6 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestFetchWhenScrolledToTheLeft() { - SetUpRequestHandler(); - AddStep("bind user score info handler", () => bindHandler(userScore: userScore)); createResults(() => userScore); @@ -185,7 +167,7 @@ namespace osu.Game.Tests.Visual.Playlists [Test] public void TestShowWithNoScores() { - SetUpRequestHandler(true); + AddStep("bind user score info handler", () => bindHandler(noScores: true)); createResults(); AddAssert("no scores visible", () => resultsScreen.ScorePanelList.GetScorePanels().Count() == 0); }