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

Add test case for dragging selection including slider head

This commit is contained in:
Bartłomiej Dach 2021-12-21 12:34:55 +01:00
parent b311308ada
commit adfadc13f7
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -137,6 +137,49 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddStep("release control", () => InputManager.ReleaseKey(Key.LControl)); AddStep("release control", () => InputManager.ReleaseKey(Key.LControl));
} }
[Test]
public void TestDragMultipleControlPointsIncludingHead()
{
moveMouseToControlPoint(0);
AddStep("click left mouse", () => InputManager.Click(MouseButton.Left));
AddStep("hold control", () => InputManager.PressKey(Key.LControl));
moveMouseToControlPoint(3);
AddStep("click left mouse", () => InputManager.Click(MouseButton.Left));
moveMouseToControlPoint(4);
AddStep("click left mouse", () => InputManager.Click(MouseButton.Left));
moveMouseToControlPoint(3);
AddStep("hold left mouse", () => InputManager.PressButton(MouseButton.Left));
AddAssert("three control point pieces selected", () => this.ChildrenOfType<PathControlPointPiece>().Count(piece => piece.IsSelected.Value) == 3);
addMovementStep(new Vector2(550, 50));
AddStep("release left mouse", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("three control point pieces selected", () => this.ChildrenOfType<PathControlPointPiece>().Count(piece => piece.IsSelected.Value) == 3);
// note: if the head is part of the selection being moved, the entire slider is moved.
// the unselected nodes will therefore change position relative to the slider head.
AddAssert("slider moved", () => Precision.AlmostEquals(slider.Position, new Vector2(256, 192) + new Vector2(150, 50)));
assertControlPointPosition(0, Vector2.Zero);
assertControlPointType(0, PathType.PerfectCurve);
assertControlPointPosition(1, new Vector2(0, 100));
assertControlPointPosition(2, new Vector2(150, -50));
assertControlPointPosition(3, new Vector2(400, 0));
assertControlPointPosition(4, new Vector2(400, 150));
AddStep("release control", () => InputManager.ReleaseKey(Key.LControl));
}
[Test] [Test]
public void TestDragControlPointAlmostLinearlyExterior() public void TestDragControlPointAlmostLinearlyExterior()
{ {