1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Merge pull request #16697 from peppy/fix-score-import-wrong-ruleset

Fix `SongSelect` incorrectly exposing decoupled ruleset to child screens
This commit is contained in:
Bartłomiej Dach 2022-01-29 13:31:35 +01:00 committed by GitHub
commit 0fc29c0e08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@ using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.Navigation
{
@ -92,6 +93,9 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestFromSongSelect([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
var firstImport = importScore(1);
presentAndConfirm(firstImport, type);
@ -102,6 +106,9 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestFromSongSelectDifferentRuleset([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
var firstImport = importScore(1);
presentAndConfirm(firstImport, type);

View File

@ -619,6 +619,10 @@ namespace osu.Game.Screens.Select
public override void OnSuspending(IScreen next)
{
// Handle the case where FinaliseSelection is never called (ie. when a screen is pushed externally).
// Without this, it's possible for a transfer to happen while we are not the current screen.
transferRulesetValue();
ModSelect.SelectedMods.UnbindFrom(selectedMods);
ModSelect.Hide();