1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Merge pull request #7739 from peppy/fix-rooms-test-scene

Fix rooms test scene not displaying anything
This commit is contained in:
Dean Herbert 2020-02-06 13:12:10 +09:00 committed by GitHub
commit 75eb9ca040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -27,11 +28,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(Type = typeof(IRoomManager))]
private TestRoomManager roomManager = new TestRoomManager();
private RoomsContainer container;
[BackgroundDependencyLoader]
private void load()
{
RoomsContainer container;
Child = container = new RoomsContainer
{
Anchor = Anchor.Centre,
@ -39,9 +40,18 @@ namespace osu.Game.Tests.Visual.Multiplayer
Width = 0.5f,
JoinRequested = joinRequested
};
}
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("clear rooms", () => roomManager.Rooms.Clear());
}
[Test]
public void TestBasicListChanges()
{
AddStep("add rooms", () =>
{
for (int i = 0; i < 3; i++)

View File

@ -47,22 +47,13 @@ namespace osu.Game.Screens.Multi.Lounge.Components
};
}
[BackgroundDependencyLoader]
private void load()
{
rooms.BindTo(roomManager.Rooms);
rooms.ItemsAdded += addRooms;
rooms.ItemsRemoved += removeRooms;
roomManager.RoomsUpdated += updateSorting;
addRooms(rooms);
}
protected override void LoadComplete()
{
filter?.BindValueChanged(f => Filter(f.NewValue), true);
rooms.ItemsAdded += addRooms;
rooms.ItemsRemoved += removeRooms;
roomManager.RoomsUpdated += updateSorting;
rooms.BindTo(roomManager.Rooms);
}
public void Filter(FilterCriteria criteria)
@ -94,8 +85,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
foreach (var r in rooms)
roomFlow.Add(new DrawableRoom(r) { Action = () => selectRoom(r) });
if (filter != null)
Filter(filter.Value);
Filter(filter?.Value);
}
private void removeRooms(IEnumerable<Room> rooms)