1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Add failing test for incorrect composer selection

This commit is contained in:
Bartłomiej Dach 2021-09-26 15:08:43 +02:00
parent 671fe77213
commit 4aadff3fd7
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -7,9 +7,13 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Tests.Beatmaps;
using osuTK;
@ -66,5 +70,36 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("selection is unchanged", () => EditorBeatmap.SelectedHitObjects.Single() == firstSlider);
}
[Test]
public void TestOverlappingObjectsWithSameStartTime()
{
AddStep("add overlapping circles", () =>
{
EditorBeatmap.Add(createHitCircle(50, OsuPlayfield.BASE_SIZE / 2));
EditorBeatmap.Add(createHitCircle(50, OsuPlayfield.BASE_SIZE / 2 + new Vector2(-10, -20)));
EditorBeatmap.Add(createHitCircle(50, OsuPlayfield.BASE_SIZE / 2 + new Vector2(10, -20)));
});
AddStep("click at centre of playfield", () =>
{
var hitObjectContainer = Editor.ChildrenOfType<HitObjectContainer>().Single();
var centre = hitObjectContainer.ToScreenSpace(OsuPlayfield.BASE_SIZE / 2);
InputManager.MoveMouseTo(centre);
InputManager.Click(MouseButton.Left);
});
AddAssert("frontmost object selected", () =>
{
var hasCombo = Editor.ChildrenOfType<HitCircleSelectionBlueprint>().Single(b => b.IsSelected).Item as IHasComboInformation;
return hasCombo?.IndexInCurrentCombo == 0;
});
}
private HitCircle createHitCircle(double startTime, Vector2 position) => new HitCircle
{
StartTime = startTime,
Position = position,
};
}
}