1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-09 02:24:10 +08:00

Remove assert from online test

This commit is contained in:
Andrei Zavatski 2020-03-17 22:34:46 +03:00
parent 4d376636c3
commit e951979a12
2 changed files with 10 additions and 18 deletions

View File

@ -10,7 +10,6 @@ using osu.Game.Users;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using NUnit.Framework; using NUnit.Framework;
using System.Linq;
using osu.Game.Online.API; using osu.Game.Online.API;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
@ -32,7 +31,7 @@ namespace osu.Game.Tests.Visual.Online
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
private TestFriendsLayout layout; private FriendsLayout layout;
[SetUp] [SetUp]
public void Setup() => Schedule(() => public void Setup() => Schedule(() =>
@ -40,21 +39,19 @@ namespace osu.Game.Tests.Visual.Online
Child = new BasicScrollContainer Child = new BasicScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = layout = new TestFriendsLayout() Child = layout = new FriendsLayout()
}; };
}); });
[Test] [Test]
public void TestOnline() public void TestOffline()
{ {
// Skip online test if user is not logged-in AddStep("Populate", () => layout.Users = getUsers());
AddUntilStep("Users loaded", () => !api.IsLoggedIn || (layout?.StatusControl.Items.Any() ?? false));
} }
[Test] [Test]
public void TestPopulate() public void TestOnline()
{ {
AddStep("Populate", () => layout.Users = getUsers());
} }
private List<User> getUsers() => new List<User> private List<User> getUsers() => new List<User>
@ -89,10 +86,5 @@ namespace osu.Game.Tests.Visual.Online
LastVisit = DateTimeOffset.Now LastVisit = DateTimeOffset.Now
} }
}; };
private class TestFriendsLayout : FriendsLayout
{
public FriendsOnlineStatusControl StatusControl => OnlineStatusControl;
}
} }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
users = value; users = value;
OnlineStatusControl.Populate(value); onlineStatusControl.Populate(value);
} }
} }
@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
private Drawable currentContent; private Drawable currentContent;
protected readonly FriendsOnlineStatusControl OnlineStatusControl; private readonly FriendsOnlineStatusControl onlineStatusControl;
private readonly Box background; private readonly Box background;
private readonly Box controlBackground; private readonly Box controlBackground;
private readonly UserListToolbar userListToolbar; private readonly UserListToolbar userListToolbar;
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
Top = 20, Top = 20,
Horizontal = 45 Horizontal = 45
}, },
Child = OnlineStatusControl = new FriendsOnlineStatusControl(), Child = onlineStatusControl = new FriendsOnlineStatusControl(),
} }
} }
}, },
@ -149,7 +149,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
{ {
base.LoadComplete(); base.LoadComplete();
OnlineStatusControl.Current.BindValueChanged(_ => recreatePanels()); onlineStatusControl.Current.BindValueChanged(_ => recreatePanels());
userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels()); userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels());
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels()); userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
if (itemsPlaceholder.Any()) if (itemsPlaceholder.Any())
loading.Show(); loading.Show();
var groupedUsers = OnlineStatusControl.Current.Value?.Users ?? new List<User>(); var groupedUsers = onlineStatusControl.Current.Value?.Users ?? new List<User>();
var sortedUsers = sortUsers(groupedUsers); var sortedUsers = sortUsers(groupedUsers);