mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +08:00
Fix input tests not using async loads
This commit is contained in:
parent
8b7cc2eaa2
commit
837b4f4f6c
@ -61,33 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private const double time_during_slide_3 = 3500;
|
private const double time_during_slide_3 = 3500;
|
||||||
private const double time_during_slide_4 = 4000;
|
private const double time_during_slide_4 = 4000;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Scenario:
|
|
||||||
/// - Press a key on the slider head timed correctly
|
|
||||||
/// - Press the other key in the middle of the slider while holding the original key
|
|
||||||
/// - Release the original key used to hit the slider
|
|
||||||
/// Expected Result:
|
|
||||||
/// A passing test case will have the cursor continue tracking on replay frame 3.
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft()
|
|
||||||
{
|
|
||||||
AddStep("Left to both to right test", () =>
|
|
||||||
{
|
|
||||||
var frames = new List<ReplayFrame>
|
|
||||||
{
|
|
||||||
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
|
|
||||||
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 },
|
|
||||||
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 },
|
|
||||||
};
|
|
||||||
|
|
||||||
performTest(frames);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep(() => allJudgedFired, "Wait for test 1");
|
|
||||||
AddAssert("Tracking retained", assertGreatJudge);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scenario:
|
/// Scenario:
|
||||||
/// - Press a key before a slider starts
|
/// - Press a key before a slider starts
|
||||||
@ -115,6 +88,33 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
AddAssert("Tracking lost", assertMehJudge);
|
AddAssert("Tracking lost", assertMehJudge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Scenario:
|
||||||
|
/// - Press a key on the slider head timed correctly
|
||||||
|
/// - Press the other key in the middle of the slider while holding the original key
|
||||||
|
/// - Release the original key used to hit the slider
|
||||||
|
/// Expected Result:
|
||||||
|
/// A passing test case will have the cursor continue tracking on replay frame 3.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft()
|
||||||
|
{
|
||||||
|
AddStep("Left to both to right test", () =>
|
||||||
|
{
|
||||||
|
var frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
|
||||||
|
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 },
|
||||||
|
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 },
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(frames);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep(() => allJudgedFired, "Wait for test 1");
|
||||||
|
AddAssert("Tracking retained", assertGreatJudge);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scenario:
|
/// Scenario:
|
||||||
/// - Press a key on the slider head timed correctly
|
/// - Press a key on the slider head timed correctly
|
||||||
@ -407,13 +407,13 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
AllowResults = false
|
AllowResults = false
|
||||||
};
|
};
|
||||||
|
|
||||||
Child = new OsuInputManager(new RulesetInfo { ID = 0 })
|
LoadComponentAsync(player, p =>
|
||||||
{
|
{
|
||||||
Child = player
|
Child = p;
|
||||||
};
|
|
||||||
|
|
||||||
player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result);
|
p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result);
|
||||||
player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; };
|
p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||||
|
Loading…
Reference in New Issue
Block a user