1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Add test covering initial state propagation

This commit is contained in:
Dean Herbert 2021-02-09 15:46:23 +09:00
parent a08c51f213
commit b87327841d

View File

@ -22,16 +22,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public class TestSceneMultiplayerParticipantsList : MultiplayerTestScene public class TestSceneMultiplayerParticipantsList : MultiplayerTestScene
{ {
[SetUp] [SetUp]
public new void Setup() => Schedule(() => public new void Setup() => Schedule(createNewParticipantsList);
{
Child = new ParticipantsList
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y,
Size = new Vector2(380, 0.7f)
};
});
[Test] [Test]
public void TestAddUser() public void TestAddUser()
@ -92,6 +83,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
checkProgressBarVisibility(true); checkProgressBarVisibility(true);
} }
[Test]
public void TestCorrectInitialState()
{
AddStep("set to downloading map", () => Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
AddStep("recreate list", createNewParticipantsList);
checkProgressBarVisibility(true);
}
[Test] [Test]
public void TestBeatmapDownloadingStates() public void TestBeatmapDownloadingStates()
{ {
@ -212,6 +211,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
} }
} }
private void createNewParticipantsList()
{
Child = new ParticipantsList { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, Size = new Vector2(380, 0.7f) };
}
private void checkProgressBarVisibility(bool visible) => private void checkProgressBarVisibility(bool visible) =>
AddUntilStep($"progress bar {(visible ? "is" : "is not")}visible", () => AddUntilStep($"progress bar {(visible ? "is" : "is not")}visible", () =>
this.ChildrenOfType<ProgressBar>().Single().IsPresent == visible); this.ChildrenOfType<ProgressBar>().Single().IsPresent == visible);