1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:05:37 +08:00

Add some more asserts

This commit is contained in:
smoogipoo 2021-04-09 18:23:41 +09:00
parent 9ddcd686ac
commit e73f3f52d7

View File

@ -95,8 +95,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
AddStep("send frames", () =>
{
// For user 55, send 100 frames in sets of 1.
// For user 56, send 100 frames in sets of 10.
// For user 55, send frames in sets of 1.
// For user 56, send frames in sets of 10.
for (int i = 0; i < 100; i++)
{
streamingClient.SendFrames(55, i, 1);
@ -109,13 +109,25 @@ namespace osu.Game.Tests.Visual.Multiplayer
assertCombo(55, 1);
assertCombo(56, 10);
// Advance to a point where only user 55's frame changes.
setTime(500);
assertCombo(55, 5);
assertCombo(56, 10);
// Advance to a point where both user's frame changes.
setTime(1100);
assertCombo(55, 11);
assertCombo(56, 20);
// Advance user 56 only to a point where its frame changes.
setTime(56, 2100);
assertCombo(55, 11);
assertCombo(56, 30);
// Advance both users beyond their last frame
setTime(101 * 100);
assertCombo(55, 100);
assertCombo(56, 100);
}
[Test]
@ -131,6 +143,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
clock.CurrentTime = time;
});
private void setTime(int userId, double time)
=> AddStep($"set user {userId} time {time}", () => clocks[userId].CurrentTime = time);
private void assertCombo(int userId, int expectedCombo)
=> AddUntilStep($"player {userId} has {expectedCombo} combo", () => this.ChildrenOfType<GameplayLeaderboardScore>().Single(s => s.User?.Id == userId).Combo.Value == expectedCombo);