Update sets of BeatmapSet.Metadata to instead create a Beatmap

This commit is contained in:
Dean Herbert
2021-11-22 14:29:46 +09:00
parent e6f6558ddf
commit 37673f4cf8
2 changed files with 25 additions and 11 deletions

View File

@ -5,6 +5,7 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Models;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -20,13 +21,19 @@ namespace osu.Game.Tests.Online
private static readonly BeatmapSetInfo test_db_model = new BeatmapSetInfo private static readonly BeatmapSetInfo test_db_model = new BeatmapSetInfo
{ {
OnlineID = 1, OnlineID = 1,
Metadata = new BeatmapMetadata Beatmaps =
{ {
Artist = "test author", new BeatmapInfo
Title = "test title",
Author = new APIUser
{ {
Username = "mapper" Metadata = new BeatmapMetadata
{
Artist = "test author",
Title = "test title",
Author = new RealmUser
{
Username = "mapper"
}
}
} }
} }
}; };

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -409,10 +410,10 @@ namespace osu.Game.Tests.Visual.SongSelect
var set = TestResources.CreateTestBeatmapSetInfo(); var set = TestResources.CreateTestBeatmapSetInfo();
if (i == 4) if (i == 4)
set.Metadata.Artist = zzz_string; set.Beatmaps.ForEach(b => b.Metadata.Artist = zzz_string);
if (i == 16) if (i == 16)
set.Metadata.AuthorString = zzz_string; set.Beatmaps.ForEach(b => b.Metadata.AuthorString = zzz_string);
sets.Add(set); sets.Add(set);
} }
@ -432,13 +433,19 @@ namespace osu.Game.Tests.Visual.SongSelect
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
// index + 1 because we are using OnlineID which should never be zero.
var set = TestResources.CreateTestBeatmapSetInfo(); var set = TestResources.CreateTestBeatmapSetInfo();
set.Metadata.Artist = "same artist";
set.Metadata.Title = "same title"; // only need to set the first as they are a shared reference.
var beatmap = set.Beatmaps.First();
beatmap.Metadata.Artist = "same artist";
beatmap.Metadata.Title = "same title";
sets.Add(set); sets.Add(set);
} }
int idOffset = sets.First().OnlineID ?? 0; int idOffset = sets.First().OnlineID;
loadBeatmaps(sets); loadBeatmaps(sets);
@ -674,7 +681,7 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("Restore different ruleset filter", () => AddStep("Restore different ruleset filter", () =>
{ {
carousel.Filter(new FilterCriteria { Ruleset = rulesets.GetRuleset(1) }, false); carousel.Filter(new FilterCriteria { Ruleset = rulesets.GetRuleset(1) }, false);
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.OnlineID ?? -1); eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
}); });
AddAssert("selection changed", () => !carousel.SelectedBeatmapInfo.Equals(manySets.First().Beatmaps.First())); AddAssert("selection changed", () => !carousel.SelectedBeatmapInfo.Equals(manySets.First().Beatmaps.First()));