mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Add fallback for cases where beatmap has no author/title/artist specified
This commit is contained in:
@ -17,6 +17,8 @@ namespace osu.Game.Tests.Models
|
||||
{
|
||||
private static readonly object[][] test_cases =
|
||||
{
|
||||
new object[] { makeNoMetadataMockBeatmapSet(), "unknown artist - unknown title" },
|
||||
new object[] { makeNoAuthorMockBeatmapSet(), "artist - title" },
|
||||
new object[] { makeMockBeatmapSet(), "artist - title (author)" },
|
||||
new object[] { makeMockBeatmap(), "artist - title (author) [difficulty]" },
|
||||
new object[] { makeMockMetadata(), "artist - title (author)" },
|
||||
@ -29,6 +31,26 @@ namespace osu.Game.Tests.Models
|
||||
[TestCaseSource(nameof(test_cases))]
|
||||
public void TestDisplayString(object model, string expected) => Assert.That(model.GetDisplayString(), Is.EqualTo(expected));
|
||||
|
||||
private static IBeatmapSetInfo makeNoAuthorMockBeatmapSet()
|
||||
{
|
||||
var mock = new Mock<IBeatmapSetInfo>();
|
||||
|
||||
mock.Setup(m => m.Metadata.Artist).Returns("artist");
|
||||
mock.Setup(m => m.Metadata.Title).Returns("title");
|
||||
mock.Setup(m => m.Metadata.Author.Username).Returns(string.Empty);
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
private static IBeatmapSetInfo makeNoMetadataMockBeatmapSet()
|
||||
{
|
||||
var mock = new Mock<IBeatmapSetInfo>();
|
||||
|
||||
mock.Setup(m => m.Metadata).Returns(new BeatmapMetadata());
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
private static IBeatmapSetInfo makeMockBeatmapSet()
|
||||
{
|
||||
var mock = new Mock<IBeatmapSetInfo>();
|
||||
|
Reference in New Issue
Block a user