2021-07-04 22:09:23 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2021-10-05 13:41:14 +08:00
|
|
|
|
#nullable disable
|
2022-06-17 15:37:17 +08:00
|
|
|
|
|
2021-07-04 22:09:23 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Localisation
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class BeatmapMetadataRomanisationTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
2021-07-04 22:31:08 +08:00
|
|
|
|
public void TestRomanisation()
|
2021-07-04 22:09:23 +08:00
|
|
|
|
{
|
2021-07-04 22:31:08 +08:00
|
|
|
|
var metadata = new BeatmapMetadata
|
2021-07-04 22:09:23 +08:00
|
|
|
|
{
|
2021-07-04 22:31:08 +08:00
|
|
|
|
Artist = "Romanised Artist",
|
|
|
|
|
ArtistUnicode = "Unicode Artist",
|
|
|
|
|
Title = "Romanised title",
|
|
|
|
|
TitleUnicode = "Unicode Title"
|
2021-07-04 22:09:23 +08:00
|
|
|
|
};
|
2021-10-05 13:41:14 +08:00
|
|
|
|
var romanisableString = metadata.GetDisplayTitleRomanisable();
|
2021-07-04 22:31:08 +08:00
|
|
|
|
|
|
|
|
|
Assert.AreEqual(metadata.ToString(), romanisableString.Romanised);
|
|
|
|
|
Assert.AreEqual($"{metadata.ArtistUnicode} - {metadata.TitleUnicode}", romanisableString.Original);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestRomanisationNoUnicode()
|
|
|
|
|
{
|
|
|
|
|
var metadata = new BeatmapMetadata
|
|
|
|
|
{
|
|
|
|
|
Artist = "Romanised Artist",
|
|
|
|
|
Title = "Romanised title"
|
|
|
|
|
};
|
2021-10-05 13:41:14 +08:00
|
|
|
|
var romanisableString = metadata.GetDisplayTitleRomanisable();
|
2021-07-04 22:09:23 +08:00
|
|
|
|
|
|
|
|
|
Assert.AreEqual(romanisableString.Romanised, romanisableString.Original);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|