Merge pull request #27033 from frenzibyte/fix-rooms-container-something

Fix selected room bindable being set to null regardless of the removed room
This commit is contained in:
Bartłomiej Dach 2024-02-05 21:04:34 +01:00 committed by GitHub
commit 938bbe38b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -64,6 +64,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("select first room", () => container.Rooms.First().TriggerClick());
AddAssert("first spotlight selected", () => checkRoomSelected(RoomManager.Rooms.First(r => r.Category.Value == RoomCategory.Spotlight)));
AddStep("remove last room", () => RoomManager.RemoveRoom(RoomManager.Rooms.MinBy(r => r.RoomID?.Value)));
AddAssert("first spotlight still selected", () => checkRoomSelected(RoomManager.Rooms.First(r => r.Category.Value == RoomCategory.Spotlight)));
AddStep("remove spotlight room", () => RoomManager.RemoveRoom(RoomManager.Rooms.Single(r => r.Category.Value == RoomCategory.Spotlight)));
AddAssert("selection vacated", () => checkRoomSelected(null));
}
[Test]

View File

@ -152,7 +152,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
roomFlow.RemoveAll(d => d.Room == r, true);
// selection may have a lease due to being in a sub screen.
if (!SelectedRoom.Disabled)
if (SelectedRoom.Value == r && !SelectedRoom.Disabled)
SelectedRoom.Value = null;
}
}