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
1 changed files with 17 additions and 28 deletions

View File

@ -24,14 +24,24 @@ private void load()
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 @@ public void TestFewMaps()
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
assertTwoWide();
@ -65,11 +74,7 @@ public void TestJustEnoughMaps()
addBeatmap();
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertTwoWide();
}
@ -85,11 +90,7 @@ public void TestManyMaps()
addBeatmap();
});
AddStep("reset match", () =>
{
Ladder.CurrentMatch.Value = new TournamentMatch();
Ladder.CurrentMatch.Value = Ladder.Matches.First();
});
AddStep("reset state", resetState);
assertThreeWide();
}
@ -105,11 +106,7 @@ public void TestJustEnoughMods()
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 @@ public void TestManyMods()
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 @@ public void TestSplitMapPoolByMods()
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]