1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08:00

Simplify state reset in test scene

This commit is contained in:
Dean Herbert 2023-12-06 12:03:54 +09:00
parent 73aaa0406a
commit 49ca1ccb22
No known key found for this signature in database

View File

@ -24,14 +24,24 @@ namespace osu.Game.Tournament.Tests.Screens
Add(screen = new TestMapPoolScreen { Width = 0.7f });
}
[SetUp]
public void SetUp() => Schedule(() =>
[SetUpSteps]
public override void SetUpSteps()
{
AddStep("reset state", resetState);
}
private void resetState()
{
Ladder.SplitMapPoolByMods.Value = true;
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
Ladder.CurrentMatch.Value.PicksBans.Clear();
}
[SetUp]
public void SetUp() => Schedule(() =>
{
});
[Test]
@ -48,7 +58,6 @@ namespace osu.Game.Tournament.Tests.Screens
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertTwoWide();
@ -65,11 +74,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap();
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertTwoWide();
}
@ -85,11 +90,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap();
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertThreeWide();
}
@ -105,11 +106,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertTwoWide();
}
@ -131,11 +128,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertThreeWide();
}
@ -153,11 +146,7 @@ namespace osu.Game.Tournament.Tests.Screens
AddStep("disable splitting map pool by mods", () => Ladder.SplitMapPoolByMods.Value = false);
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
}
[Test]