mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 13:47:24 +08:00
fix grid test
This commit is contained in:
parent
d98cc7fe66
commit
bfe78ff3a0
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user