1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 21:32:57 +08:00

Clean up carousel tests

This commit is contained in:
Dean Herbert 2019-11-13 19:09:03 +09:00
parent 4adf967801
commit 2cd156f3d4

View File

@ -10,6 +10,7 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -51,11 +52,6 @@ namespace osu.Game.Tests.Visual.SongSelect
private void load(RulesetStore rulesets) private void load(RulesetStore rulesets)
{ {
this.rulesets = rulesets; this.rulesets = rulesets;
Add(carousel = new TestBeatmapCarousel
{
RelativeSizeAxes = Axes.Both,
});
} }
/// <summary> /// <summary>
@ -375,6 +371,8 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test] [Test]
public void TestSelectingFilteredRuleset() public void TestSelectingFilteredRuleset()
{ {
createCarousel();
var testMixed = createTestBeatmapSet(set_count + 1); var testMixed = createTestBeatmapSet(set_count + 1);
AddStep("add mixed ruleset beatmapset", () => AddStep("add mixed ruleset beatmapset", () =>
{ {
@ -429,6 +427,8 @@ namespace osu.Game.Tests.Visual.SongSelect
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null) private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null)
{ {
createCarousel();
if (beatmapSets == null) if (beatmapSets == null)
{ {
beatmapSets = new List<BeatmapSetInfo>(); beatmapSets = new List<BeatmapSetInfo>();
@ -448,6 +448,17 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("Wait for load", () => changed); AddUntilStep("Wait for load", () => changed);
} }
private void createCarousel(Container target = null)
{
AddStep($"Create carousel", () =>
{
(target ?? this).Child = carousel = new TestBeatmapCarousel
{
RelativeSizeAxes = Axes.Both,
};
});
}
private void ensureRandomFetchSuccess() => private void ensureRandomFetchSuccess() =>
AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet); AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);