From aceb8c4cb08804f1f92fd47c6ae603c66c4c7a51 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Feb 2019 21:50:40 +0900 Subject: [PATCH] Fix TestCasePlaySongSelect --- .../Visual/TestCasePlaySongSelect.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index c5cc1776f8..78e90987b1 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -103,22 +103,16 @@ namespace osu.Game.Tests.Visual } [SetUp] - public virtual void SetUp() - { - Schedule(() => - { - manager?.Delete(manager.GetAllUsableBeatmapSets()); - LoadScreen(songSelect = new TestSongSelect()); - AddUntilStep(() => songSelect.IsPresent, "wait for present"); - }); - } + public virtual void SetUp() => + Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); }); [Test] public void TestDummy() { + createSongSelect(); AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); - AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap); + AddUntilStep(() => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap, "dummy shown on wedge"); addManyTestMaps(); AddWaitStep(3); @@ -129,6 +123,7 @@ namespace osu.Game.Tests.Visual [Test] public void TestSorting() { + createSongSelect(); addManyTestMaps(); AddWaitStep(3); @@ -144,6 +139,7 @@ namespace osu.Game.Tests.Visual [Ignore("needs fixing")] public void TestImportUnderDifferentRuleset() { + createSongSelect(); changeRuleset(2); importForRuleset(0); AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection"); @@ -152,6 +148,7 @@ namespace osu.Game.Tests.Visual [Test] public void TestImportUnderCurrentRuleset() { + createSongSelect(); changeRuleset(2); importForRuleset(2); importForRuleset(1); @@ -167,6 +164,7 @@ namespace osu.Game.Tests.Visual [Test] public void TestRulesetChangeResetsMods() { + createSongSelect(); changeRuleset(0); changeMods(new OsuModHardRock()); @@ -196,6 +194,7 @@ namespace osu.Game.Tests.Visual [Test] public void TestStartAfterUnMatchingFilterDoesNotStart() { + createSongSelect(); addManyTestMaps(); AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "has selection"); @@ -223,6 +222,12 @@ namespace osu.Game.Tests.Visual private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id)); + private void createSongSelect() + { + AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect())); + AddUntilStep(() => songSelect.IsCurrentScreen(), "wait for present"); + } + private void addManyTestMaps() { AddStep("import test maps", () =>