mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 17:17:26 +08:00
Add another failing test case for crash
This commit is contained in:
parent
47cb696b69
commit
1a25e9d179
@ -156,5 +156,37 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
AddUntilStep("track changed", () =>
|
AddUntilStep("track changed", () =>
|
||||||
trackChangeQueue.Count == 3 && !trackChangeQueue.ElementAt(1).working.BeatmapInfo.Equals(trackChangeQueue.Last().working.BeatmapInfo));
|
trackChangeQueue.Count == 3 && !trackChangeQueue.ElementAt(1).working.BeatmapInfo.Equals(trackChangeQueue.Last().working.BeatmapInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestShuffleBackAndForth()
|
||||||
|
{
|
||||||
|
Queue<(IWorkingBeatmap working, TrackChangeDirection changeDirection)> trackChangeQueue = null!;
|
||||||
|
|
||||||
|
AddStep("enable shuffle", () => Game.MusicController.Shuffle.Value = true);
|
||||||
|
|
||||||
|
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
||||||
|
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(TestResources.CreateTestBeatmapSetInfo()), 5);
|
||||||
|
AddStep("ensure nonzero track duration", () => Game.Realm.Write(r =>
|
||||||
|
{
|
||||||
|
// this was already supposed to be non-zero (see innards of `TestResources.CreateTestBeatmapSetInfo()`),
|
||||||
|
// but the non-zero value is being overwritten *to* zero by `BeatmapUpdater`.
|
||||||
|
// do a bit of a hack to change it back again - otherwise tracks are going to switch instantly and we won't be able to assert anything sane anymore.
|
||||||
|
foreach (var beatmap in r.All<BeatmapInfo>().Where(b => b.Length == 0))
|
||||||
|
beatmap.Length = 60_000;
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("bind to track change", () =>
|
||||||
|
{
|
||||||
|
trackChangeQueue = new Queue<(IWorkingBeatmap, TrackChangeDirection)>();
|
||||||
|
Game.MusicController.TrackChanged += (working, changeDirection) => trackChangeQueue.Enqueue((working, changeDirection));
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("press next", () => globalActionContainer.TriggerPressed(GlobalAction.MusicNext));
|
||||||
|
AddUntilStep("track changed", () => trackChangeQueue.Count == 1);
|
||||||
|
|
||||||
|
AddStep("press previous", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPrev));
|
||||||
|
AddUntilStep("track changed", () =>
|
||||||
|
trackChangeQueue.Count == 2 && !trackChangeQueue.First().working.BeatmapInfo.Equals(trackChangeQueue.Last().working.BeatmapInfo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user