1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 06:52:59 +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 }); Add(screen = new TestMapPoolScreen { Width = 0.7f });
} }
[SetUp] [SetUpSteps]
public void SetUp() => Schedule(() => public override void SetUpSteps()
{
AddStep("reset state", resetState);
}
private void resetState()
{ {
Ladder.SplitMapPoolByMods.Value = true; Ladder.SplitMapPoolByMods.Value = true;
Ladder.CurrentMatch.Value = new TournamentMatch(); Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First(); Ladder.CurrentMatch.Value = Ladder.Matches.First();
Ladder.CurrentMatch.Value.PicksBans.Clear(); Ladder.CurrentMatch.Value.PicksBans.Clear();
}
[SetUp]
public void SetUp() => Schedule(() =>
{
}); });
[Test] [Test]
@ -48,7 +58,6 @@ namespace osu.Game.Tournament.Tests.Screens
AddStep("reset match", () => AddStep("reset match", () =>
{ {
Ladder.CurrentMatch.Value = new TournamentMatch(); Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
}); });
assertTwoWide(); assertTwoWide();
@ -65,11 +74,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(); addBeatmap();
}); });
AddStep("reset match", () => AddStep("reset state", resetState);
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertTwoWide(); assertTwoWide();
} }
@ -85,11 +90,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(); addBeatmap();
}); });
AddStep("reset match", () => AddStep("reset state", resetState);
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertThreeWide(); assertThreeWide();
} }
@ -105,11 +106,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM"); addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
}); });
AddStep("reset match", () => AddStep("reset state", resetState);
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertTwoWide(); assertTwoWide();
} }
@ -131,11 +128,7 @@ namespace osu.Game.Tournament.Tests.Screens
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM"); addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
}); });
AddStep("reset match", () => AddStep("reset state", resetState);
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertThreeWide(); assertThreeWide();
} }
@ -153,11 +146,7 @@ namespace osu.Game.Tournament.Tests.Screens
AddStep("disable splitting map pool by mods", () => Ladder.SplitMapPoolByMods.Value = false); AddStep("disable splitting map pool by mods", () => Ladder.SplitMapPoolByMods.Value = false);
AddStep("reset match", () => AddStep("reset state", resetState);
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
} }
[Test] [Test]