1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:35:35 +08:00

Add test coverage of zoom-then-scroll

This commit is contained in:
Dean Herbert 2020-11-03 17:22:45 +09:00
parent ff4dcf065a
commit ff2b01fa6f

View File

@ -101,6 +101,24 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Release alt", () => InputManager.ReleaseKey(Key.AltLeft));
}
[Test]
public void TestMouseZoomInThenScroll()
{
reset();
// Scroll in at 0.25
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
AddStep("Press alt down", () => InputManager.PressKey(Key.AltLeft));
AddStep("Zoom by 3", () => InputManager.ScrollBy(new Vector2(0, 3)));
AddStep("Release alt", () => InputManager.ReleaseKey(Key.AltLeft));
AddStep("Scroll far left", () => InputManager.ScrollBy(new Vector2(0, 30)));
AddUntilStep("Scroll is at start", () => Precision.AlmostEquals(scrollQuad.TopLeft.X, boxQuad.TopLeft.X, 1));
AddStep("Scroll far right", () => InputManager.ScrollBy(new Vector2(0, -300)));
AddUntilStep("Scroll is at end", () => Precision.AlmostEquals(scrollQuad.TopRight.X, boxQuad.TopRight.X, 1));
}
[Test]
public void TestMouseZoomInTwiceOutTwice()
{