mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:13:18 +08:00
Apply suggestions
This commit is contained in:
parent
d90545227c
commit
4730453083
@ -8,6 +8,8 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Comments;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.MathUtils;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -24,13 +26,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var userComment = new Comment
|
||||
{
|
||||
IsVoted = false,
|
||||
UserId = API.LocalUser.Value.Id,
|
||||
VotesCount = 10,
|
||||
};
|
||||
|
||||
var randomComment = new Comment
|
||||
{
|
||||
IsVoted = false,
|
||||
@ -38,7 +33,11 @@ namespace osu.Game.Tests.Visual.Online
|
||||
VotesCount = 2,
|
||||
};
|
||||
|
||||
AddStep("User comment", () => addVotePill(userComment));
|
||||
AddStep("Log in", () => API.LocalUser.Value = new User
|
||||
{
|
||||
Id = RNG.Next(2, 100000)
|
||||
});
|
||||
AddStep("User comment", () => addVotePill(getUserComment()));
|
||||
AddStep("Click", () => votePill.Click());
|
||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||
|
||||
@ -52,6 +51,13 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||
}
|
||||
|
||||
private Comment getUserComment() => new Comment
|
||||
{
|
||||
IsVoted = false,
|
||||
UserId = API.LocalUser.Value.Id,
|
||||
VotesCount = 10,
|
||||
};
|
||||
|
||||
private void addVotePill(Comment comment)
|
||||
{
|
||||
Clear();
|
||||
|
@ -158,18 +158,18 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
if (Action != null)
|
||||
{
|
||||
if (isVoted.Value)
|
||||
{
|
||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
||||
sideNumber.Hide();
|
||||
}
|
||||
else
|
||||
sideNumber.FadeTo(IsHovered ? 1 : 0);
|
||||
if (Action == null)
|
||||
return;
|
||||
|
||||
borderContainer.BorderThickness = IsHovered ? 3 : 0;
|
||||
if (isVoted.Value)
|
||||
{
|
||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
||||
sideNumber.Hide();
|
||||
}
|
||||
else
|
||||
sideNumber.FadeTo(IsHovered ? 1 : 0);
|
||||
|
||||
borderContainer.BorderThickness = IsHovered ? 3 : 0;
|
||||
}
|
||||
|
||||
private void onHoverAction()
|
||||
|
Loading…
Reference in New Issue
Block a user