1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +08:00

Restructure tests not to call each other

Bit weird to have tests call other tests. Private helper methods is
better, if unavoidable.
This commit is contained in:
Bartłomiej Dach 2022-11-22 20:28:41 +01:00
parent db34fa99b1
commit 5a5b0ed4ef
No known key found for this signature in database
2 changed files with 40 additions and 46 deletions

View File

@ -26,8 +26,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
};
[Test]
public void TestDrumroll()
public void TestDrumroll([Values] bool withKiai)
{
AddStep("set up beatmap", () => setUpBeatmap(withKiai));
AddStep("Drum roll", () => SetContents(_ =>
{
var hoc = new ScrollingHitObjectContainer();
@ -57,14 +59,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
}));
}
[Test]
public void TestDrumrollKiai()
{
AddStep("Create beatmap", createBeatmap);
TestDrumroll();
}
private DrumRoll createDrumRollAtCurrentTime(bool strong = false)
{
var drumroll = new DrumRoll
@ -82,12 +76,14 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
return drumroll;
}
private void createBeatmap()
private void setUpBeatmap(bool withKiai)
{
var controlPointInfo = new ControlPointInfo();
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
if (withKiai)
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{

View File

@ -22,7 +22,37 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
private GameplayState gameplayState = TestGameplayState.Create(new TaikoRuleset());
[Test]
public void TestHits()
public void TestHits([Values] bool withKiai)
{
AddStep("Create beatmap", () => setUpBeatmap(withKiai));
addHitSteps();
}
[Test]
public void TestHitAnimationSlow()
{
AddStep("Create beatmap", () => setUpBeatmap(false));
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 50);
addHitSteps();
}
[Test]
public void TestHitAnimationFast()
{
AddStep("Create beatmap", () => setUpBeatmap(false));
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 150);
addHitSteps();
}
private void addHitSteps()
{
AddStep("Centre hit", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime())
{
@ -49,38 +79,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
}));
}
[Test]
public void TestHitKiai()
{
AddStep("Create beatmap", () => createBeatmap(true));
TestHits();
}
[Test]
public void TestHitAnimationSlow()
{
AddStep("Create beatmap", () => createBeatmap(false));
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 50);
TestHits();
}
[Test]
public void TestHitAnimationFast()
{
AddStep("Create beatmap", () => createBeatmap(false));
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 150);
TestHits();
}
private Hit createHitAtCurrentTime(bool strong = false, bool rim = false)
{
var hit = new Hit
@ -95,13 +93,13 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
return hit;
}
private void createBeatmap(bool includeKiai)
private void setUpBeatmap(bool withKiai)
{
var controlPointInfo = new ControlPointInfo();
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
if (includeKiai)
if (withKiai)
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
Beatmap.Value = CreateWorkingBeatmap(new Beatmap