1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Adjust composer tests to new screen layout

`TestSceneHitObjectComposer.TestPlacementFailsWhenClickingButton()` was
attempting to cover the case of the user clicking a toolbox button which
was in front of the playfield, and ensure that the click did not result
in a placement. However, since the paddings in
67f83f246b were added, it is impossible
for a toolbox button to be in front of the playfield in the collapsed
state, which the test was relying on.

The test scenario is still however relevant in the case of the toolbox
being expanded, as in that state the toolbux buttons may very well end
up being in front of the playfield, and they still should not result in
a hitobject being placed. To ensure that this is the case, add a few
extra test steps ensuring that the toolbox is expanded first before
trying to retrieve an overlapping button.
This commit is contained in:
Bartłomiej Dach 2023-05-02 18:35:06 +02:00
parent 67f83f246b
commit 95badb9455
No known key found for this signature in database

View File

@ -108,12 +108,16 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").TriggerClick());
ExpandingToolboxContainer toolboxContainer = null!;
AddStep("move mouse to toolbox", () => InputManager.MoveMouseTo(toolboxContainer = hitObjectComposer.ChildrenOfType<ExpandingToolboxContainer>().First()));
AddUntilStep("toolbox is expanded", () => toolboxContainer.Expanded.Value);
AddUntilStep("wait for toolbox to expand", () => toolboxContainer.LatestTransformEndTime, () => Is.EqualTo(Time.Current));
AddStep("move mouse to overlapping toggle button", () =>
{
var playfield = hitObjectComposer.Playfield.ScreenSpaceDrawQuad;
var button = hitObjectComposer
.ChildrenOfType<ExpandingToolboxContainer>().First()
.ChildrenOfType<DrawableTernaryButton>().First(b => playfield.Contains(b.ScreenSpaceDrawQuad.Centre));
var button = toolboxContainer.ChildrenOfType<DrawableTernaryButton>().First(b => playfield.Contains(b.ScreenSpaceDrawQuad.Centre));
InputManager.MoveMouseTo(button);
});