mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Rename "null user" tests to better explain purpose
This commit is contained in:
parent
b0bd39fc49
commit
1bfa1365a0
@ -45,11 +45,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddNullUser()
|
public void TestAddUnresolvedUser()
|
||||||
{
|
{
|
||||||
AddAssert("one unique panel", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 1);
|
AddAssert("one unique panel", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 1);
|
||||||
|
|
||||||
AddStep("add non-resolvable user", () => Client.AddNullUser());
|
AddStep("add non-resolvable user", () => Client.TestAddUnresolvedUser());
|
||||||
AddAssert("null user added", () => Client.Room.AsNonNull().Users.Count(u => u.User == null) == 1);
|
AddAssert("null user added", () => Client.Room.AsNonNull().Users.Count(u => u.User == null) == 1);
|
||||||
|
|
||||||
AddUntilStep("two unique panels", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 2);
|
AddUntilStep("two unique panels", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 2);
|
||||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
return roomUser;
|
return roomUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNullUser() => addUser(new MultiplayerRoomUser(TestUserLookupCache.NULL_USER_ID));
|
public void TestAddUnresolvedUser() => addUser(new MultiplayerRoomUser(TestUserLookupCache.UNRESOLVED_USER_ID));
|
||||||
|
|
||||||
private void addUser(MultiplayerRoomUser user)
|
private void addUser(MultiplayerRoomUser user)
|
||||||
{
|
{
|
||||||
|
@ -14,11 +14,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// A special user ID which <see cref="ComputeValueAsync"/> would return a <see langword="null"/> <see cref="User"/> for.
|
/// A special user ID which <see cref="ComputeValueAsync"/> would return a <see langword="null"/> <see cref="User"/> for.
|
||||||
/// As a simulation to what a regular <see cref="UserLookupCache"/> would return in the case of failing to fetch the user.
|
/// As a simulation to what a regular <see cref="UserLookupCache"/> would return in the case of failing to fetch the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int NULL_USER_ID = -1;
|
public const int UNRESOLVED_USER_ID = -1;
|
||||||
|
|
||||||
protected override Task<User> ComputeValueAsync(int lookup, CancellationToken token = default)
|
protected override Task<User> ComputeValueAsync(int lookup, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (lookup == NULL_USER_ID)
|
if (lookup == UNRESOLVED_USER_ID)
|
||||||
return Task.FromResult((User)null);
|
return Task.FromResult((User)null);
|
||||||
|
|
||||||
return Task.FromResult(new User
|
return Task.FromResult(new User
|
||||||
|
Loading…
Reference in New Issue
Block a user