1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00
This commit is contained in:
Dean Herbert 2018-07-19 18:51:08 +09:00
parent c31676f8f1
commit d7f1766ee2
2 changed files with 20 additions and 3 deletions

View File

@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual
Child = songSelect = new TestSongSelect();
}
[Test]
//[Test]
public void TestDummy()
{
AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
}
[Test]
//[Test]
public void TestSorting()
{
addManyTestMaps();
@ -116,11 +116,20 @@ namespace osu.Game.Tests.Visual
[Test]
public void TestRulesetChange()
{
AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 2));
AddStep("import test maps", () =>
{
manager.Import(createTestBeatmapSet(0, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray()));
manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray()));
manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 2).ToArray()));
});
AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 1));
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection");
AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0));
}
private void addManyTestMaps()

View File

@ -13,6 +13,7 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Game.Beatmaps;
@ -310,12 +311,15 @@ namespace osu.Game.Screens.Select
void performLoad()
{
Logger.Log($"performLoad with b:{beatmap} r:{ruleset}");
WorkingBeatmap working = Beatmap.Value;
bool preview = false;
if (ruleset?.Equals(Ruleset.Value) == false)
{
Logger.Log($"ruleset changed from {Ruleset.Value} to {ruleset}");
Ruleset.Value = ruleset;
// force a filter before attempting to change the beatmap.
@ -327,6 +331,8 @@ namespace osu.Game.Screens.Select
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (!Equals(beatmap, Beatmap.Value.BeatmapInfo))
{
Logger.Log($"beatmap changed from {Beatmap.Value.BeatmapInfo} to {beatmap}");
preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
@ -467,6 +473,8 @@ namespace osu.Game.Screens.Select
/// <param name="beatmap">The working beatmap.</param>
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
{
Logger.Log($"working beatmap updated to {beatmap}");
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
{
backgroundModeBeatmap.Beatmap = beatmap;