mirror of https://github.com/ppy/osu
Add test coverage of scroll failing
This commit is contained in:
parent
67e952150f
commit
757596fffa
|
@ -80,6 +80,24 @@ public void SetUpSteps()
|
|||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCorrectScrollToWhenContentLoads()
|
||||
{
|
||||
AddRepeatStep("add many sections", () => append(1f), 3);
|
||||
|
||||
AddStep("add section with delayed load content", () =>
|
||||
{
|
||||
container.Add(new TestDelayedLoadSection("delayed"));
|
||||
});
|
||||
|
||||
AddStep("add final section", () => append(0.5f));
|
||||
|
||||
AddStep("scroll to final section", () => container.ScrollTo(container.Children.Last()));
|
||||
|
||||
AddUntilStep("correct section selected", () => container.SelectedSection.Value == container.Children.Last());
|
||||
AddUntilStep("wait for scroll to section", () => container.ScreenSpaceDrawQuad.AABBFloat.Contains(container.Children.Last().ScreenSpaceDrawQuad.AABBFloat));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelection()
|
||||
{
|
||||
|
@ -196,6 +214,33 @@ private void triggerUserScroll(float direction)
|
|||
InputManager.ScrollVerticalBy(direction);
|
||||
}
|
||||
|
||||
private partial class TestDelayedLoadSection : TestSection
|
||||
{
|
||||
public TestDelayedLoadSection(string label)
|
||||
: base(label)
|
||||
{
|
||||
BackgroundColour = default_colour;
|
||||
Width = 300;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Box box;
|
||||
|
||||
Add(box = new Box
|
||||
{
|
||||
Alpha = 0.01f,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
});
|
||||
|
||||
// Emulate an operation that will be inhibited by IsMaskedAway.
|
||||
box.ResizeHeightTo(2000, 50);
|
||||
}
|
||||
}
|
||||
|
||||
private partial class TestSection : TestBox
|
||||
{
|
||||
public bool Selected
|
||||
|
|
Loading…
Reference in New Issue