Fix tests not running more than once

This commit is contained in:
Dean Herbert 2019-02-19 14:28:53 +09:00
parent 39b203375f
commit 5f792fbacc
1 changed files with 20 additions and 20 deletions

View File

@ -317,32 +317,32 @@ private void performTest(List<ReplayFrame> frames)
// Likely requires some discussion regarding how first frame inputs should be handled. // Likely requires some discussion regarding how first frame inputs should be handled.
frames.Insert(0, new OsuReplayFrame()); frames.Insert(0, new OsuReplayFrame());
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } })
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false
};
p.OnLoadComplete += _ =>
{
p.ScoreProcessor.NewJudgement += result =>
{
if (currentPlayer == p) judgementResults.Add(result);
};
p.ScoreProcessor.AllJudged += () =>
{
if (currentPlayer == p) allJudgedFired = true;
};
};
AddStep("load player", () => AddStep("load player", () =>
{ {
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } })
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false
};
p.OnLoadComplete += _ =>
{
p.ScoreProcessor.NewJudgement += result =>
{
if (currentPlayer == p) judgementResults.Add(result);
};
p.ScoreProcessor.AllJudged += () =>
{
if (currentPlayer == p) allJudgedFired = true;
};
};
LoadScreen(currentPlayer = p); LoadScreen(currentPlayer = p);
allJudgedFired = false; allJudgedFired = false;
judgementResults = new List<JudgementResult>(); judgementResults = new List<JudgementResult>();
}); });
AddUntilStep(() => p.IsLoaded, "Wait until player is loaded"); AddUntilStep(() => currentPlayer.IsLoaded, "Wait until player is loaded");
AddUntilStep(() => allJudgedFired, "Wait for all judged"); AddUntilStep(() => allJudgedFired, "Wait for all judged");
} }