Merge pull request #18649 from frenzibyte/selection-context-outside-bounds

Fix context menus not appearing when clicking outside of editor playfield's bounds
This commit is contained in:
Dean Herbert
2022-06-15 17:08:09 +09:00
committed by GitHub
6 changed files with 30 additions and 12 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
@ -61,6 +62,21 @@ namespace osu.Game.Tests.Visual.Editing
AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType<OsuContextMenu>().Single().State == MenuState.Open);
}
[Test]
public void TestSelectAndShowContextMenuOutsideBounds()
{
var addedObject = new HitCircle { StartTime = 100, Position = OsuPlayfield.BASE_SIZE };
AddStep("add hitobject", () => EditorBeatmap.Add(addedObject));
AddStep("descale blueprint container", () => this.ChildrenOfType<HitObjectComposer>().Single().Scale = new Vector2(0.5f));
AddStep("move mouse to bottom-right", () => InputManager.MoveMouseTo(blueprintContainer.ToScreenSpace(blueprintContainer.LayoutRectangle.BottomRight + new Vector2(10))));
AddStep("right click", () => InputManager.Click(MouseButton.Right));
AddUntilStep("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject);
AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType<OsuContextMenu>().Single().State == MenuState.Open);
}
[Test]
public void TestNudgeSelection()
{