1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +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.Framework.Allocation;
using NUnit.Framework;
using System.Linq;
using osu.Game.Online.API;
namespace osu.Game.Tests.Visual.Online
@ -32,7 +31,7 @@ namespace osu.Game.Tests.Visual.Online
[Resolved]
private IAPIProvider api { get; set; }
private TestFriendsLayout layout;
private FriendsLayout layout;
[SetUp]
public void Setup() => Schedule(() =>
@ -40,21 +39,19 @@ namespace osu.Game.Tests.Visual.Online
Child = new BasicScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = layout = new TestFriendsLayout()
Child = layout = new FriendsLayout()
};
});
[Test]
public void TestOnline()
public void TestOffline()
{
// Skip online test if user is not logged-in
AddUntilStep("Users loaded", () => !api.IsLoggedIn || (layout?.StatusControl.Items.Any() ?? false));
AddStep("Populate", () => layout.Users = getUsers());
}
[Test]
public void TestPopulate()
public void TestOnline()
{
AddStep("Populate", () => layout.Users = getUsers());
}
private List<User> getUsers() => new List<User>
@ -89,10 +86,5 @@ namespace osu.Game.Tests.Visual.Online
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;
OnlineStatusControl.Populate(value);
onlineStatusControl.Populate(value);
}
}
@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
private Drawable currentContent;
protected readonly FriendsOnlineStatusControl OnlineStatusControl;
private readonly FriendsOnlineStatusControl onlineStatusControl;
private readonly Box background;
private readonly Box controlBackground;
private readonly UserListToolbar userListToolbar;
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
Top = 20,
Horizontal = 45
},
Child = OnlineStatusControl = new FriendsOnlineStatusControl(),
Child = onlineStatusControl = new FriendsOnlineStatusControl(),
}
}
},
@ -149,7 +149,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
{
base.LoadComplete();
OnlineStatusControl.Current.BindValueChanged(_ => recreatePanels());
onlineStatusControl.Current.BindValueChanged(_ => recreatePanels());
userListToolbar.DisplayStyle.BindValueChanged(_ => recreatePanels());
userListToolbar.SortCriteria.BindValueChanged(_ => recreatePanels());
@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
if (itemsPlaceholder.Any())
loading.Show();
var groupedUsers = OnlineStatusControl.Current.Value?.Users ?? new List<User>();
var groupedUsers = onlineStatusControl.Current.Value?.Users ?? new List<User>();
var sortedUsers = sortUsers(groupedUsers);