1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 19:27:26 +08:00

Wait for track reset in tests

Add a wait step in tests for the "now playing" overlay to make sure
the current track was restarted before trying to call PreviousTrack()
again.
This commit is contained in:
Bartłomiej Dach 2019-11-06 22:43:13 +01:00
parent 70feab8316
commit 963215ccbe

View File

@ -4,6 +4,7 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets.Osu;
@ -55,6 +56,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000);
AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart);
AddUntilStep("Wait for current time to update", () => Precision.AlmostEquals(currentBeatmap.Track.CurrentTime, 0));
AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value);
AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart);
}