1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

make each test bind the handler only once, depending on its need

This commit is contained in:
wooster0 2024-01-09 21:44:05 +09:00
parent ea37c70e0b
commit d5fdd0c0f9

View File

@ -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] [Test]
public void TestShowWithUserScore() public void TestShowWithUserScore()
{ {
SetUpRequestHandler();
AddStep("bind user score info handler", () => bindHandler(userScore: userScore)); AddStep("bind user score info handler", () => bindHandler(userScore: userScore));
createResults(() => userScore); createResults(() => userScore);
@ -95,7 +85,7 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestShowNullUserScore() public void TestShowNullUserScore()
{ {
SetUpRequestHandler(); AddStep("bind user score info handler", () => bindHandler());
createResults(); createResults();
waitForDisplay(); waitForDisplay();
@ -106,8 +96,6 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestShowUserScoreWithDelay() public void TestShowUserScoreWithDelay()
{ {
SetUpRequestHandler();
AddStep("bind user score info handler", () => bindHandler(true, userScore)); AddStep("bind user score info handler", () => bindHandler(true, userScore));
createResults(() => userScore); createResults(() => userScore);
@ -120,8 +108,6 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestShowNullUserScoreWithDelay() public void TestShowNullUserScoreWithDelay()
{ {
SetUpRequestHandler();
AddStep("bind delayed handler", () => bindHandler(true)); AddStep("bind delayed handler", () => bindHandler(true));
createResults(); createResults();
@ -133,13 +119,11 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestFetchWhenScrolledToTheRight() public void TestFetchWhenScrolledToTheRight()
{ {
SetUpRequestHandler(); AddStep("bind delayed handler", () => bindHandler(true));
createResults(); createResults();
waitForDisplay(); waitForDisplay();
AddStep("bind delayed handler", () => bindHandler(true));
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int beforePanelCount = 0; int beforePanelCount = 0;
@ -158,8 +142,6 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestFetchWhenScrolledToTheLeft() public void TestFetchWhenScrolledToTheLeft()
{ {
SetUpRequestHandler();
AddStep("bind user score info handler", () => bindHandler(userScore: userScore)); AddStep("bind user score info handler", () => bindHandler(userScore: userScore));
createResults(() => userScore); createResults(() => userScore);
@ -185,7 +167,7 @@ namespace osu.Game.Tests.Visual.Playlists
[Test] [Test]
public void TestShowWithNoScores() public void TestShowWithNoScores()
{ {
SetUpRequestHandler(true); AddStep("bind user score info handler", () => bindHandler(noScores: true));
createResults(); createResults();
AddAssert("no scores visible", () => resultsScreen.ScorePanelList.GetScorePanels().Count() == 0); AddAssert("no scores visible", () => resultsScreen.ScorePanelList.GetScorePanels().Count() == 0);
} }