1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 03:55:30 +08:00

Fix test failures

This commit is contained in:
Bartłomiej Dach 2024-10-01 11:12:56 +02:00
parent 0409edccce
commit 44b982864c
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View File

@ -230,23 +230,26 @@ namespace osu.Game.Tests.Editing
[Test]
public void TestUseCurrentSnap()
{
ExpandableButton getCurrentSnapButton() => composer.ChildrenOfType<EditorToolboxGroup>().Single(g => g.Name == "snapping")
.ChildrenOfType<ExpandableButton>().Single();
AddStep("add objects to beatmap", () =>
{
editorBeatmap.Add(new HitCircle { StartTime = 1000 });
editorBeatmap.Add(new HitCircle { Position = new Vector2(100), StartTime = 2000 });
});
AddStep("hover use current snap button", () => InputManager.MoveMouseTo(composer.ChildrenOfType<ExpandableButton>().Single()));
AddUntilStep("use current snap expanded", () => composer.ChildrenOfType<ExpandableButton>().Single().Expanded.Value, () => Is.True);
AddStep("hover use current snap button", () => InputManager.MoveMouseTo(getCurrentSnapButton()));
AddUntilStep("use current snap expanded", () => getCurrentSnapButton().Expanded.Value, () => Is.True);
AddStep("seek before first object", () => EditorClock.Seek(0));
AddUntilStep("use current snap not available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.False);
AddUntilStep("use current snap not available", () => getCurrentSnapButton().Enabled.Value, () => Is.False);
AddStep("seek to between objects", () => EditorClock.Seek(1500));
AddUntilStep("use current snap available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.True);
AddUntilStep("use current snap available", () => getCurrentSnapButton().Enabled.Value, () => Is.True);
AddStep("seek after last object", () => EditorClock.Seek(2500));
AddUntilStep("use current snap not available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.False);
AddUntilStep("use current snap not available", () => getCurrentSnapButton().Enabled.Value, () => Is.False);
}
private void assertSnapDistance(float expectedDistance, HitObject? referenceObject, bool includeSliderVelocity)

View File

@ -74,6 +74,7 @@ namespace osu.Game.Rulesets.Edit
toolboxContainer.Add(toolboxGroup = new EditorToolboxGroup("snapping")
{
Name = "snapping",
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
Children = new Drawable[]
{