Adjust testcase to avoid random failures (#4735)

Adjust testcase to avoid random failures

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert
2019-05-09 10:49:07 +09:00
committed by GitHub

View File

@ -107,7 +107,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(10), Spacing = new Vector2(10),
Padding = new MarginPadding { Bottom = 250 } Padding = new MarginPadding { Bottom = 550 }
} }
}; };
@ -132,11 +132,9 @@ namespace osu.Game.Tests.Visual.UserInterface
var loadedBackgrounds = backgrounds.Where(b => b.ContentLoaded); var loadedBackgrounds = backgrounds.Where(b => b.ContentLoaded);
int initialLoadCount = 0; AddUntilStep("some loaded", () => loadedBackgrounds.Any());
AddUntilStep("some loaded", () => (initialLoadCount = loadedBackgrounds.Count()) > 0);
AddStep("scroll to bottom", () => scrollContainer.ScrollToEnd()); AddStep("scroll to bottom", () => scrollContainer.ScrollToEnd());
AddUntilStep("some unloaded", () => loadedBackgrounds.Count() < initialLoadCount); AddUntilStep("all unloaded", () => !loadedBackgrounds.Any());
} }
private class TestUpdateableBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite private class TestUpdateableBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite