mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 01:42:54 +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.Game.Overlays.Comments;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Users;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
@ -24,13 +26,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
var userComment = new Comment
|
|
||||||
{
|
|
||||||
IsVoted = false,
|
|
||||||
UserId = API.LocalUser.Value.Id,
|
|
||||||
VotesCount = 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
var randomComment = new Comment
|
var randomComment = new Comment
|
||||||
{
|
{
|
||||||
IsVoted = false,
|
IsVoted = false,
|
||||||
@ -38,7 +33,11 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
VotesCount = 2,
|
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());
|
AddStep("Click", () => votePill.Click());
|
||||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||||
|
|
||||||
@ -52,6 +51,13 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Comment getUserComment() => new Comment
|
||||||
|
{
|
||||||
|
IsVoted = false,
|
||||||
|
UserId = API.LocalUser.Value.Id,
|
||||||
|
VotesCount = 10,
|
||||||
|
};
|
||||||
|
|
||||||
private void addVotePill(Comment comment)
|
private void addVotePill(Comment comment)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -158,18 +158,18 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
if (Action != null)
|
if (Action == null)
|
||||||
{
|
return;
|
||||||
if (isVoted.Value)
|
|
||||||
{
|
|
||||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
|
||||||
sideNumber.Hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sideNumber.FadeTo(IsHovered ? 1 : 0);
|
|
||||||
|
|
||||||
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()
|
private void onHoverAction()
|
||||||
|
Loading…
Reference in New Issue
Block a user