mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Adjust test scene to avoid cross-test interference
* Move steps from ctor to a separate basic test. * Wait for barrage to complete in basic test, as not doing so polluted state of other tests. * Reset score processor after every test.
This commit is contained in:
@ -30,15 +30,22 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public class TestSceneHitErrorMeter : OsuTestScene
|
public class TestSceneHitErrorMeter : OsuTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached(typeof(ScoreProcessor))]
|
||||||
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
private TestScoreProcessor scoreProcessor = new TestScoreProcessor();
|
||||||
|
|
||||||
[Cached(typeof(DrawableRuleset))]
|
[Cached(typeof(DrawableRuleset))]
|
||||||
private TestDrawableRuleset drawableRuleset = new TestDrawableRuleset();
|
private TestDrawableRuleset drawableRuleset = new TestDrawableRuleset();
|
||||||
|
|
||||||
public TestSceneHitErrorMeter()
|
[SetUpSteps]
|
||||||
|
public void SetUp()
|
||||||
{
|
{
|
||||||
recreateDisplay(new OsuHitWindows(), 5);
|
AddStep("reset score processor", () => scoreProcessor.Reset());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBasic()
|
||||||
|
{
|
||||||
|
AddStep("create display", () => recreateDisplay(new OsuHitWindows(), 5));
|
||||||
|
|
||||||
AddRepeatStep("New random judgement", () => newJudgement(), 40);
|
AddRepeatStep("New random judgement", () => newJudgement(), 40);
|
||||||
|
|
||||||
@ -46,12 +53,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddRepeatStep("New max positive", () => newJudgement(drawableRuleset.HitWindows.WindowFor(HitResult.Meh)), 20);
|
AddRepeatStep("New max positive", () => newJudgement(drawableRuleset.HitWindows.WindowFor(HitResult.Meh)), 20);
|
||||||
AddStep("New fixed judgement (50ms)", () => newJudgement(50));
|
AddStep("New fixed judgement (50ms)", () => newJudgement(50));
|
||||||
|
|
||||||
|
ScheduledDelegate del = null;
|
||||||
AddStep("Judgement barrage", () =>
|
AddStep("Judgement barrage", () =>
|
||||||
{
|
{
|
||||||
int runCount = 0;
|
int runCount = 0;
|
||||||
|
|
||||||
ScheduledDelegate del = null;
|
|
||||||
|
|
||||||
del = Scheduler.AddDelayed(() =>
|
del = Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
newJudgement(runCount++ / 10f);
|
newJudgement(runCount++ / 10f);
|
||||||
@ -61,6 +67,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
del?.Cancel();
|
del?.Cancel();
|
||||||
}, 10, true);
|
}, 10, true);
|
||||||
});
|
});
|
||||||
|
AddUntilStep("wait for barrage", () => del.Cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -211,5 +218,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public override void CancelResume() => throw new NotImplementedException();
|
public override void CancelResume() => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestScoreProcessor : ScoreProcessor
|
||||||
|
{
|
||||||
|
public void Reset() => base.Reset(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user