From 02514d4228e15196ba946fb64c8b844a41863514 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 31 Dec 2017 12:33:58 +0900 Subject: [PATCH] Update tests to account for correct beatmap displaying on details area --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 13 ++++++++++--- osu.Game/Screens/Select/PlaySongSelect.cs | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 18e40db064..3be4a18ec5 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -51,11 +51,12 @@ namespace osu.Game.Tests.Visual private class TestSongSelect : PlaySongSelect { public WorkingBeatmap CurrentBeatmap => Beatmap.Value; + public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap; public new BeatmapCarousel Carousel => base.Carousel; } [BackgroundDependencyLoader] - private void load(BeatmapManager baseManager) + private void load(OsuGameBase game) { TestSongSelect songSelect = null; @@ -69,12 +70,16 @@ namespace osu.Game.Tests.Visual dependencies.Cache(rulesets = new RulesetStore(contextFactory)); dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) { - DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) + DefaultBeatmap = defaultBeatmap = game.Beatmap.Default }); void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => { - if (deleteMaps) manager.DeleteAll(); + if (deleteMaps) + { + manager.DeleteAll(); + game.Beatmap.SetDefault(); + } if (songSelect != null) { @@ -91,6 +96,8 @@ namespace osu.Game.Tests.Visual AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); + AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap); + AddStep("import test maps", () => { for (int i = 0; i < 100; i += 10) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 87b3485dc1..a3997640ba 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { private OsuScreen player; private readonly ModSelectOverlay modSelect; - private readonly BeatmapDetailArea beatmapDetails; + protected readonly BeatmapDetailArea BeatmapDetails; private bool removeAutoModOnResume; public PlaySongSelect() @@ -35,13 +35,13 @@ namespace osu.Game.Screens.Select Anchor = Anchor.BottomCentre, }); - LeftContent.Add(beatmapDetails = new BeatmapDetailArea + LeftContent.Add(BeatmapDetails = new BeatmapDetailArea { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 10, Right = 5 }, }); - beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s)); + BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s)); } private SampleChannel sampleConfirm; @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Select beatmap.Mods.BindTo(modSelect.SelectedMods); - beatmapDetails.Beatmap = beatmap; + BeatmapDetails.Beatmap = beatmap; if (beatmap.Track != null) beatmap.Track.Looping = true;