mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:13:22 +08:00
Fix presenting new ruleset and beatmap at once causing wedge display desync
This commit is contained in:
parent
5ec8d49241
commit
5833a7ac91
@ -359,6 +359,68 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmap == null);
|
AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmap == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPresentNewRulesetNewBeatmap()
|
||||||
|
{
|
||||||
|
createSongSelect();
|
||||||
|
changeRuleset(2);
|
||||||
|
|
||||||
|
addRulesetImportStep(2);
|
||||||
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.RulesetID == 2);
|
||||||
|
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
BeatmapInfo target = null;
|
||||||
|
|
||||||
|
AddStep("select beatmap/ruleset externally", () =>
|
||||||
|
{
|
||||||
|
target = manager.GetAllUsableBeatmapSets()
|
||||||
|
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
||||||
|
|
||||||
|
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||||
|
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.Equals(target));
|
||||||
|
|
||||||
|
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
||||||
|
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo == target);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPresentNewBeatmapNewRuleset()
|
||||||
|
{
|
||||||
|
createSongSelect();
|
||||||
|
changeRuleset(2);
|
||||||
|
|
||||||
|
addRulesetImportStep(2);
|
||||||
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.RulesetID == 2);
|
||||||
|
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
BeatmapInfo target = null;
|
||||||
|
|
||||||
|
AddStep("select beatmap/ruleset externally", () =>
|
||||||
|
{
|
||||||
|
target = manager.GetAllUsableBeatmapSets()
|
||||||
|
.Last(b => b.Beatmaps.Any(bi => bi.RulesetID == 0)).Beatmaps.Last();
|
||||||
|
|
||||||
|
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||||
|
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.Equals(target));
|
||||||
|
|
||||||
|
AddUntilStep("has correct ruleset", () => Ruleset.Value.ID == 0);
|
||||||
|
|
||||||
|
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
||||||
|
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo == target);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRulesetChangeResetsMods()
|
public void TestRulesetChangeResetsMods()
|
||||||
{
|
{
|
||||||
|
@ -448,8 +448,10 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Mods.Value = Array.Empty<Mod>();
|
Mods.Value = Array.Empty<Mod>();
|
||||||
|
|
||||||
// required to return once in order to have the carousel in a good state.
|
// the ruleset transfer may cause a deselection of the current beatmap (due to incompatibility).
|
||||||
// if the ruleset changed, the rest of the selection update will happen via updateSelectedRuleset.
|
// this can happen via Carousel.FlushPendingFilterOperations().
|
||||||
|
// to ensure a good state, re-transfer no-debounce values.
|
||||||
|
performUpdateSelected();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user