Skip to content

Commit

Permalink
Add further test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Aug 20, 2024
1 parent 2a49167 commit 2ecf5ec
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions osu.Game.Tests/Visual/Gameplay/TestScenePauseInputHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public partial class TestScenePauseInputHandling : PlayerTestScene
{
Position = OsuPlayfield.BASE_SIZE / 2,
StartTime = 10000,
},
new HitCircle
{
Position = OsuPlayfield.BASE_SIZE / 2,
StartTime = 15000,
}
}
};
Expand Down Expand Up @@ -261,7 +266,7 @@ public void TestManiaHeldInputRemainHeldAfterResume()
}

[Test]
public void TestOsuRegisterInputFromPressingOrangeCursorButPressIsBlocked()
public void TestOsuHitCircleNotReceivingInputOnResume()
{
KeyCounter counter = null!;

Expand All @@ -287,7 +292,7 @@ public void TestOsuRegisterInputFromPressingOrangeCursorButPressIsBlocked()
}

[Test]
public void TestOsuRegisterInputFromPressingOrangeCursorButPressIsBlocked_PauseWhileHolding()
public void TestOsuHitCircleNotReceivingInputOnResume_PauseWhileHoldingSameKey()
{
KeyCounter counter = null!;

Expand Down Expand Up @@ -318,6 +323,32 @@ public void TestOsuRegisterInputFromPressingOrangeCursorButPressIsBlocked_PauseW
checkKey(() => counter, 2, false);
}

[Test]
public void TestOsuHitCircleNotReceivingInputOnResume_PauseWhileHoldingOtherKey()
{
loadPlayer(() => new OsuRuleset());

AddStep("press X", () => InputManager.PressKey(Key.X));
AddAssert("circle hit", () => Player.ScoreProcessor.HighestCombo.Value, () => Is.EqualTo(1));

seekTo(5000);

AddStep("pause", () => Player.Pause());
AddStep("release X", () => InputManager.ReleaseKey(Key.X));

AddStep("resume", () => Player.Resume());
AddStep("go to resume cursor", () => InputManager.MoveMouseTo(this.ChildrenOfType<OsuResumeOverlay.OsuClickToResumeCursor>().Single()));
AddStep("press Z to resume", () => InputManager.PressKey(Key.Z));
AddStep("release Z", () => InputManager.ReleaseKey(Key.Z));

AddAssert("circle not hit", () => Player.ScoreProcessor.HighestCombo.Value, () => Is.EqualTo(1));

AddStep("press X", () => InputManager.PressKey(Key.X));
AddStep("release X", () => InputManager.ReleaseKey(Key.X));

AddAssert("circle hit", () => Player.ScoreProcessor.HighestCombo.Value, () => Is.EqualTo(2));
}

private void loadPlayer(Func<Ruleset> createRuleset)
{
AddStep("set ruleset", () => currentRuleset = createRuleset());
Expand Down

0 comments on commit 2ecf5ec

Please sign in to comment.