From 837b4f4f6cd50222a367216f931173ef2b12f2ca Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 15:52:20 +0900 Subject: [PATCH] Fix input tests not using async loads --- .../TestCaseSliderInput.cs | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index a7fc705b30..9ce1599fb4 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -61,33 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; - /// - /// 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. - /// - [Test] - public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() - { - AddStep("Left to both to right test", () => - { - var frames = new List - { - 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); - } - /// /// Scenario: /// - Press a key before a slider starts @@ -115,6 +88,33 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking lost", assertMehJudge); } + /// + /// 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. + /// + [Test] + public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() + { + AddStep("Left to both to right test", () => + { + var frames = new List + { + 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); + } + /// /// Scenario: /// - Press a key on the slider head timed correctly @@ -407,13 +407,13 @@ namespace osu.Game.Rulesets.Osu.Tests AllowResults = false }; - Child = new OsuInputManager(new RulesetInfo { ID = 0 }) + LoadComponentAsync(player, p => { - Child = player - }; + Child = p; - player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); - player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); + p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + }); } private class ScoreAccessibleReplayPlayer : ReplayPlayer