Remove unnecessary queue in beatmap difficulty cache tests

This commit is contained in:
Salman Ahmed 2021-08-20 04:37:35 +03:00
parent 48e5199c58
commit 4d9c415e73

View File

@ -32,7 +32,6 @@ namespace osu.Game.Tests.Beatmaps
private TestBeatmapDifficultyCache difficultyCache;
private IBindable<StarDifficulty?> starDifficultyBindable;
private Queue<ValueChangedEvent<StarDifficulty?>> starDifficultyChangesQueue;
[BackgroundDependencyLoader]
private void load(OsuGameBase osu)
@ -49,14 +48,10 @@ namespace osu.Game.Tests.Beatmaps
Child = difficultyCache = new TestBeatmapDifficultyCache();
starDifficultyChangesQueue = new Queue<ValueChangedEvent<StarDifficulty?>>();
starDifficultyBindable = difficultyCache.GetBindableDifficulty(importedSet.Beatmaps.First());
starDifficultyBindable.BindValueChanged(starDifficultyChangesQueue.Enqueue);
});
AddAssert($"star difficulty -> {BASE_STARS}", () =>
starDifficultyChangesQueue.Dequeue().NewValue?.Stars == BASE_STARS &&
starDifficultyChangesQueue.Count == 0);
AddAssert($"star difficulty -> {BASE_STARS}", () => starDifficultyBindable.Value?.Stars == BASE_STARS);
}
[Test]
@ -65,19 +60,13 @@ namespace osu.Game.Tests.Beatmaps
OsuModDoubleTime dt = null;
AddStep("change selected mod to DT", () => SelectedMods.Value = new[] { dt = new OsuModDoubleTime { SpeedChange = { Value = 1.5 } } });
AddAssert($"star difficulty -> {BASE_STARS + 1.5}", () =>
starDifficultyChangesQueue.Dequeue().NewValue?.Stars == BASE_STARS + 1.5 &&
starDifficultyChangesQueue.Count == 0);
AddAssert($"star difficulty -> {BASE_STARS + 1.5}", () => starDifficultyBindable.Value?.Stars == BASE_STARS + 1.5);
AddStep("change DT speed to 1.25", () => dt.SpeedChange.Value = 1.25);
AddAssert($"star difficulty -> {BASE_STARS + 1.25}", () =>
starDifficultyChangesQueue.Dequeue().NewValue?.Stars == BASE_STARS + 1.25 &&
starDifficultyChangesQueue.Count == 0);
AddAssert($"star difficulty -> {BASE_STARS + 1.25}", () => starDifficultyBindable.Value?.Stars == BASE_STARS + 1.25);
AddStep("change selected mod to NC", () => SelectedMods.Value = new[] { new OsuModNightcore { SpeedChange = { Value = 1.75 } } });
AddAssert($"star difficulty -> {BASE_STARS + 1.75}", () =>
starDifficultyChangesQueue.Dequeue().NewValue?.Stars == BASE_STARS + 1.75 &&
starDifficultyChangesQueue.Count == 0);
AddAssert($"star difficulty -> {BASE_STARS + 1.75}", () => starDifficultyBindable.Value?.Stars == BASE_STARS + 1.75);
}
[Test]