mirror of https://github.com/ppy/osu
Use api.IsLoggedIn
This commit is contained in:
parent
1f3b209a6c
commit
4330507da8
|
@ -10,6 +10,7 @@
|
|||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Online.API;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
|
@ -21,6 +22,11 @@ public class TestSceneVotePill : OsuTestScene
|
|||
typeof(VotePill)
|
||||
};
|
||||
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
private VotePill votePill;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -33,7 +39,7 @@ private void load()
|
|||
VotesCount = 2,
|
||||
};
|
||||
|
||||
AddStep("Log in", () => API.LocalUser.Value = new User
|
||||
AddStep("Log in", () => api.LocalUser.Value = new User
|
||||
{
|
||||
Id = RNG.Next(2, 100000)
|
||||
});
|
||||
|
@ -45,7 +51,7 @@ private void load()
|
|||
AddStep("Click", () => votePill.Click());
|
||||
AddAssert("Loading", () => votePill.IsLoading);
|
||||
|
||||
AddStep("Log out", API.Logout);
|
||||
AddStep("Log out", api.Logout);
|
||||
AddStep("Random comment", () => addVotePill(randomComment));
|
||||
AddStep("Click", () => votePill.Click());
|
||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||
|
@ -54,7 +60,7 @@ private void load()
|
|||
private Comment getUserComment() => new Comment
|
||||
{
|
||||
IsVoted = false,
|
||||
UserId = API.LocalUser.Value.Id,
|
||||
UserId = api.LocalUser.Value.Id,
|
||||
VotesCount = 10,
|
||||
};
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ private void load(OsuColour colours)
|
|||
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
||||
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
||||
|
||||
if (api.LocalUser.Value.Id != comment.UserId && api.LocalUser.Value.Id != 1)
|
||||
if (api.LocalUser.Value.Id != comment.UserId && api.IsLoggedIn)
|
||||
Action = onAction;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue