Skip to content

Commit

Permalink
Add failing test showing hold for menu not working when HUD is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 30, 2022
1 parent f5e1134 commit 8399261
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
Expand Down Expand Up @@ -148,6 +149,41 @@ public void TestChangeHUDVisibilityOnHiddenKeyCounter()
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
}

[Test]
public void TestHoldForMenuDoesWorkWhenHidden()
{
bool activated = false;

HoldForMenuButton getHoldForMenu() => hudOverlay.ChildrenOfType<HoldForMenuButton>().Single();

createNew();

AddStep("bind action", () =>
{
activated = false;
var holdForMenu = getHoldForMenu();
holdForMenu.Action += () => activated = true;
});

AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);

AddStep("attempt activate", () =>
{
InputManager.MoveMouseTo(getHoldForMenu().OfType<HoldToConfirmContainer>().Single());
InputManager.PressButton(MouseButton.Left);
});

AddUntilStep("activated", () => activated);

AddStep("release mouse button", () =>
{
InputManager.ReleaseButton(MouseButton.Left);
});
}

[Test]
public void TestInputDoesntWorkWhenHUDHidden()
{
Expand Down

0 comments on commit 8399261

Please sign in to comment.