diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index 75eb4a043a..71e5e9081c 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -74,6 +74,24 @@ namespace osu.Game.Tests.Database }); } + [Test] + public void TestAccessFileAfterImport() + { + RunTestWithRealmAsync(async (realmFactory, storage) => + { + using var importer = new BeatmapImporter(realmFactory, storage); + using var store = new RealmRulesetStore(realmFactory, storage); + + var imported = await LoadOszIntoStore(importer, realmFactory.Context); + + var beatmap = imported.Beatmaps.First(); + var file = beatmap.File; + + Assert.NotNull(file); + Assert.AreEqual(beatmap.Hash, file!.File.Hash); + }); + } + [Test] public void TestImportThenDelete() { diff --git a/osu.Game/Database/RealmContextFactory.cs b/osu.Game/Database/RealmContextFactory.cs index 0bb46a379a..e773ea9767 100644 --- a/osu.Game/Database/RealmContextFactory.cs +++ b/osu.Game/Database/RealmContextFactory.cs @@ -33,10 +33,10 @@ namespace osu.Game.Database /// /// Version history: - /// 6 First tracked version (~20211018) - /// 7 Changed OnlineID fields to non-nullable to add indexing support (20211018) - /// 8 Rebind scroll adjust keys to not have control modifier (20211029) - /// 9 Converted BeatmapMetadata.Author from string to RealmUser (20211104) + /// 6 ~2021-10-18 First tracked version. + /// 7 2021-10-18 Changed OnlineID fields to non-nullable to add indexing support. + /// 8 2021-10-29 Rebind scroll adjust keys to not have control modifier. + /// 9 2021-11-04 Converted BeatmapMetadata.Author from string to RealmUser. /// private const int schema_version = 9; diff --git a/osu.Game/Models/RealmBeatmap.cs b/osu.Game/Models/RealmBeatmap.cs index 1a25d55d04..4e3f96ee5f 100644 --- a/osu.Game/Models/RealmBeatmap.cs +++ b/osu.Game/Models/RealmBeatmap.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using JetBrains.Annotations; using Newtonsoft.Json; using osu.Framework.Testing; @@ -35,6 +36,9 @@ namespace osu.Game.Models public RealmBeatmapSet? BeatmapSet { get; set; } + [Ignored] + public RealmNamedFileUsage? File => BeatmapSet?.Files.First(f => f.File.Hash == Hash); + public BeatmapSetOnlineStatus Status { get => (BeatmapSetOnlineStatus)StatusInt;