mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 15:53:21 +08:00
Add helper property to access a realm beatmap's beatmap file
This commit is contained in:
parent
ff13a98077
commit
1cdfa6d9a0
@ -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()
|
||||
{
|
||||
|
@ -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,8 @@ namespace osu.Game.Models
|
||||
|
||||
public RealmBeatmapSet? BeatmapSet { get; set; }
|
||||
|
||||
public RealmNamedFileUsage? File => BeatmapSet?.Files.First(f => f.File.Hash == Hash);
|
||||
|
||||
public BeatmapSetOnlineStatus Status
|
||||
{
|
||||
get => (BeatmapSetOnlineStatus)StatusInt;
|
||||
|
Loading…
Reference in New Issue
Block a user