1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Apply suggestions

This commit is contained in:
Andrei Zavatski 2019-10-31 02:10:00 +03:00
parent d90545227c
commit 4730453083
2 changed files with 24 additions and 18 deletions

View File

@ -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();

View File

@ -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()