-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
osu.Game.Rulesets.Osu.Tests/Editor/TestSceneContextMenuClose.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Graphics.Cursor; | ||
using osu.Framework.Graphics.UserInterface; | ||
using osu.Framework.Testing; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Rulesets.UI; | ||
using osuTK.Input; | ||
|
||
namespace osu.Game.Rulesets.Osu.Tests.Editor | ||
{ | ||
public partial class TestSceneContextMenuClose : TestSceneOsuEditor | ||
{ | ||
private ContextMenuContainer contextMenuContainer | ||
=> Editor.ChildrenOfType<ContextMenuContainer>().First(); | ||
|
||
|
||
[Test] | ||
public void TestToolChangeClosesMenu() | ||
{ | ||
Playfield playfield = null!; | ||
|
||
AddStep("select circle placement tool", () => InputManager.Key(Key.Number2)); | ||
AddStep("move mouse to top left of playfield", () => | ||
{ | ||
playfield = this.ChildrenOfType<Playfield>().Single(); | ||
var location = (3 * playfield.ScreenSpaceDrawQuad.TopLeft + playfield.ScreenSpaceDrawQuad.BottomRight) / 4; | ||
InputManager.MoveMouseTo(location); | ||
}); | ||
AddStep("place circle", () => InputManager.Click(MouseButton.Left)); | ||
AddStep("right click circle", () => InputManager.Click(MouseButton.Right)); | ||
AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType<OsuContextMenu>().Single().State == MenuState.Open); | ||
AddStep("select slider placement tool", () => InputManager.Key(Key.Number3)); | ||
AddUntilStep("context menu is not visible", () => contextMenuContainer.ChildrenOfType<OsuContextMenu>().Single().State == MenuState.Closed); | ||
} | ||
} | ||
} |