mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 09:03:00 +08:00
Fix beatmap carousel test failures
This commit is contained in:
parent
a0f8debafe
commit
41d90cd0b5
@ -698,10 +698,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
for (int i = 1; i <= 15; i++)
|
||||
{
|
||||
set.Beatmaps.Add(new BeatmapInfo
|
||||
set.Beatmaps.Add(new BeatmapInfo(new OsuRuleset().RulesetInfo, new BeatmapDifficulty(), new BeatmapMetadata())
|
||||
{
|
||||
DifficultyName = $"Stars: {i}",
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
StarRating = i,
|
||||
});
|
||||
}
|
||||
|
@ -98,10 +98,16 @@ namespace osu.Game.Screens.Select
|
||||
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
|
||||
|
||||
// todo: only used for testing, maybe remove.
|
||||
private bool loadedTestBeatmaps;
|
||||
|
||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||
{
|
||||
get => beatmapSets.Select(g => g.BeatmapSet);
|
||||
set => loadBeatmapSets(value);
|
||||
set
|
||||
{
|
||||
loadedTestBeatmaps = true;
|
||||
loadBeatmapSets(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBeatmapSets(IEnumerable<BeatmapSetInfo> beatmapSets)
|
||||
@ -190,6 +196,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void beatmapSetsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet changes, Exception error)
|
||||
{
|
||||
// If loading test beatmaps, avoid overwriting with realm subscription callbacks.
|
||||
if (loadedTestBeatmaps)
|
||||
return;
|
||||
|
||||
if (changes == null)
|
||||
{
|
||||
// initial load
|
||||
|
Loading…
Reference in New Issue
Block a user