1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Add test for potential failing case

This commit is contained in:
Andrei Zavatski 2020-04-13 08:38:34 +03:00
parent b4800dd461
commit 99fa145847

View File

@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.UserInterface
[SetUp] [SetUp]
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
{ {
Add(scroll = new OverlayScrollContainer Child = scroll = new OverlayScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = new Container Child = new Container
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Colour = Color4.Gray Colour = Color4.Gray
} }
} }
}); };
invocationCount = 0; invocationCount = 0;
@ -62,6 +62,10 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("scroll to start", () => scroll.ScrollToStart(false)); AddStep("scroll to start", () => scroll.ScrollToStart(false));
AddAssert("button is hidden", () => scroll.Button.State == Visibility.Hidden); AddAssert("button is hidden", () => scroll.Button.State == Visibility.Hidden);
AddStep("scroll to 250", () => scroll.ScrollTo(500));
AddUntilStep("scrolled back to start", () => Precision.AlmostEquals(scroll.Current, 500, 0.1f));
AddAssert("button is visible", () => scroll.Button.State == Visibility.Visible);
} }
[Test] [Test]