Minor refactoring

This commit is contained in:
Andrei Zavatski
2021-01-22 22:27:26 +03:00
parent 20161aea6a
commit 3d42cc1f91
2 changed files with 26 additions and 46 deletions

View File

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