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

fix grid test

This commit is contained in:
OliBomby 2023-12-31 19:53:32 +01:00
parent d98cc7fe66
commit bfe78ff3a0

View File

@ -168,26 +168,21 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
} }
[Test] [Test]
public void TestGridSizeToggling() public void TestGridTypeToggling()
{ {
AddStep("enable rectangular grid", () => InputManager.Key(Key.T)); AddStep("enable rectangular grid", () => InputManager.Key(Key.T));
AddUntilStep("rectangular grid visible", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Any()); AddUntilStep("rectangular grid visible", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Any());
gridSizeIs(4); gridActive<RectangularPositionSnapGrid>(true);
nextGridSizeIs(8); nextGridTypeIs<TriangularPositionSnapGrid>();
nextGridSizeIs(16); nextGridTypeIs<CircularPositionSnapGrid>();
nextGridSizeIs(32); nextGridTypeIs<RectangularPositionSnapGrid>();
nextGridSizeIs(4);
} }
private void nextGridSizeIs(int size) private void nextGridTypeIs<T>() where T : PositionSnapGrid
{ {
AddStep("toggle to next grid size", () => InputManager.Key(Key.G)); AddStep("toggle to next grid type", () => InputManager.Key(Key.G));
gridSizeIs(size); gridActive<T>(true);
} }
private void gridSizeIs(int size)
=> AddAssert($"grid size is {size}", () => this.ChildrenOfType<RectangularPositionSnapGrid>().Single().Spacing.Value == new Vector2(size)
&& EditorBeatmap.BeatmapInfo.GridSize == size);
} }
} }