From 7aca0f4a1d31cef5f119047d115545c2d7bcb8af Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 8 Feb 2019 16:02:14 +0900 Subject: [PATCH] Fix failing test cases --- .../Visual/TestCaseLoungeRoomsContainer.cs | 14 ++++---------- .../Visual/TestCaseMatchSettingsOverlay.cs | 9 ++------- osu.Game/Tests/Visual/MultiplayerTestCase.cs | 18 ++++++------------ 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs index 6fa15a5917..c87b91003b 100644 --- a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs @@ -16,7 +16,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual { - public class TestCaseLoungeRoomsContainer : OsuTestCase + public class TestCaseLoungeRoomsContainer : MultiplayerTestCase { public override IReadOnlyList RequiredTypes => new[] { @@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0)); AddStep("select first room", () => container.Rooms.First().Action?.Invoke()); - AddAssert("first room selected", () => roomManager.CurrentRoom.Value == roomManager.Rooms.First()); + AddAssert("first room selected", () => Room == roomManager.Rooms.First()); AddStep("join first room", () => container.Rooms.First().Action?.Invoke()); AddAssert("first room joined", () => roomManager.Rooms.First().Status.Value is JoinedRoomStatus); @@ -73,15 +73,13 @@ namespace osu.Game.Tests.Visual { public event Action RoomsUpdated { - add => throw new NotImplementedException(); - remove => throw new NotImplementedException(); + add { } + remove { } } public readonly BindableList Rooms = new BindableList(); IBindableList IRoomManager.Rooms => Rooms; - public Bindable CurrentRoom { get; } = new Bindable(); - public void CreateRoom(Room room, Action onSuccess = null, Action onError = null) => Rooms.Add(room); public void JoinRoom(Room room, Action onSuccess = null, Action onError = null) @@ -91,10 +89,6 @@ namespace osu.Game.Tests.Visual public void PartRoom() { } - - public void Filter(FilterCriteria criteria) - { - } } private class JoinedRoomStatus : RoomStatus diff --git a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs index bb29770c56..317707a77e 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs @@ -13,7 +13,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi; -using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Match.Components; namespace osu.Game.Tests.Visual @@ -133,14 +132,12 @@ namespace osu.Game.Tests.Visual public event Action RoomsUpdated { - add => throw new NotImplementedException(); - remove => throw new NotImplementedException(); + add { } + remove { } } public IBindableList Rooms { get; } = null; - public Bindable CurrentRoom { get; } = new Bindable(); - public void CreateRoom(Room room, Action onSuccess = null, Action onError = null) { if (CreateRequested == null) @@ -155,8 +152,6 @@ namespace osu.Game.Tests.Visual public void JoinRoom(Room room, Action onSuccess = null, Action onError = null) => throw new NotImplementedException(); public void PartRoom() => throw new NotImplementedException(); - - public void Filter(FilterCriteria criteria) => throw new NotImplementedException(); } } } diff --git a/osu.Game/Tests/Visual/MultiplayerTestCase.cs b/osu.Game/Tests/Visual/MultiplayerTestCase.cs index 5ed4f012c6..6efdddbfee 100644 --- a/osu.Game/Tests/Visual/MultiplayerTestCase.cs +++ b/osu.Game/Tests/Visual/MultiplayerTestCase.cs @@ -2,26 +2,20 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Online.Multiplayer; namespace osu.Game.Tests.Visual { public class MultiplayerTestCase : OsuTestCase { - private Room room; + [Cached] + private readonly Bindable currentRoom = new Bindable(new Room()); protected Room Room { - get => room; - set - { - if (room == value) - return; - room = value; - - if (dependencies != null) - dependencies.Model.Value = value; - } + get => currentRoom; + set => currentRoom.Value = value; } private CachedModelDependencyContainer dependencies; @@ -29,7 +23,7 @@ namespace osu.Game.Tests.Visual protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { dependencies = new CachedModelDependencyContainer(base.CreateChildDependencies(parent)); - dependencies.Model.Value = room; + dependencies.Model.BindTo(currentRoom); return dependencies; } }