Revert "Minor refactoring"

This reverts commit 3d42cc1f91.
This commit is contained in:
Andrei Zavatski
2021-01-22 22:49:49 +03:00
parent 3d42cc1f91
commit e9d10bb6e7
2 changed files with 46 additions and 26 deletions

View File

@ -7,6 +7,7 @@ using osu.Game.Overlays.Comments;
using osu.Game.Online.API.Requests.Responses;
using osu.Framework.Allocation;
using osu.Game.Overlays;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Tests.Visual.Online
@ -20,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private LoginOverlay login;
private VotePill votePill;
private TestPill votePill;
private readonly Container pillContainer;
public TestSceneVotePill()
@ -43,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Hide login overlay", () => login.Hide());
AddStep("Log in", logIn);
AddStep("User comment", () => addVotePill(getUserComment()));
AddAssert("Is disabled", () => !votePill.Enabled.Value);
AddAssert("Background is transparent", () => votePill.Background.Alpha == 0);
AddStep("Click", () => votePill.Click());
AddAssert("Not loading", () => !votePill.IsLoading);
}
@ -54,7 +55,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Hide login overlay", () => login.Hide());
AddStep("Log in", logIn);
AddStep("Random comment", () => addVotePill(getRandomComment()));
AddAssert("Is enabled", () => votePill.Enabled.Value);
AddAssert("Background is visible", () => votePill.Background.Alpha == 1);
AddStep("Click", () => votePill.Click());
AddAssert("Loading", () => votePill.IsLoading);
}
@ -88,11 +89,21 @@ namespace osu.Game.Tests.Visual.Online
private void addVotePill(Comment comment)
{
pillContainer.Clear();
pillContainer.Child = votePill = new VotePill(comment)
pillContainer.Child = votePill = new TestPill(comment)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
}
private class TestPill : VotePill
{
public new Box Background => base.Background;
public TestPill(Comment comment)
: base(comment)
{
}
}
}
}