Update usages of APIUser to RealmUser

This commit is contained in:
Dean Herbert 2021-11-22 15:52:55 +09:00
parent 213d89b479
commit fda529de26
6 changed files with 25 additions and 15 deletions

View File

@ -3,7 +3,7 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Models;
namespace osu.Game.Tests.Beatmaps
{
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps
{
Artist = "artist",
Title = "title",
Author = new APIUser { Username = "creator" }
Author = new RealmUser { Username = "creator" }
}
};
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps
{
Artist = "artist",
Title = "title",
Author = new APIUser { Username = "creator" }
Author = new RealmUser { Username = "creator" }
},
DifficultyName = "difficulty"
};

View File

@ -17,7 +17,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Database;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Models;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
@ -305,7 +305,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
Metadata = new BeatmapMetadata
{
Artist = "Artist",
Author = new APIUser { Username = "Creator name here" },
Author = new RealmUser { Username = "Creator name here" },
Title = "Long title used to check background colour",
},
BeatmapSet = new BeatmapSetInfo()

View File

@ -12,7 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Models;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test]
public void TestMapWithKnownMapper()
{
var author = new APIUser { Username = "mapper_name" };
var author = new RealmUser { Username = "mapper_name" };
AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(author))));
}
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
AddStep("show excess mods score", () =>
{
var author = new APIUser { Username = "mapper_name" };
var author = new RealmUser { Username = "mapper_name" };
var score = TestResources.CreateTestScoreInfo(createTestBeatmap(author));
score.Mods = score.BeatmapInfo.Ruleset.CreateInstance().CreateAllMods().ToArray();
@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Ranking
[Test]
public void TestMapWithUnknownMapper()
{
AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(new APIUser()))));
AddStep("show example score", () => showPanel(TestResources.CreateTestScoreInfo(createTestBeatmap(new RealmUser()))));
AddAssert("mapped by text not present", () =>
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text.ToString(), "mapped", "by")));
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Ranking
var ruleset = new OsuRuleset();
var mods = new Mod[] { ruleset.GetAutoplayMod() };
var beatmap = createTestBeatmap(new APIUser());
var beatmap = createTestBeatmap(new RealmUser());
var score = TestResources.CreateTestScoreInfo(beatmap);
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Ranking
private void showPanel(ScoreInfo score) =>
Child = new ExpandedPanelMiddleContentContainer(score);
private BeatmapInfo createTestBeatmap([NotNull] APIUser author)
private BeatmapInfo createTestBeatmap([NotNull] RealmUser author)
{
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)).BeatmapInfo;

View File

@ -17,6 +17,7 @@ using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Models;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
@ -65,7 +66,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
Title = "TestSong",
Artist = "TestArtist",
Author = new APIUser
Author = new RealmUser
{
Username = "TestAuthor"
},

View File

@ -18,6 +18,7 @@ using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.IO;
using osu.Game.IO.Archives;
using osu.Game.Models;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Notifications;
@ -73,7 +74,11 @@ namespace osu.Game.Beatmaps
{
var metadata = new BeatmapMetadata
{
Author = user,
Author = new RealmUser
{
OnlineID = user.OnlineID,
Username = user.Username,
}
};
var set = new BeatmapSetInfo

View File

@ -7,6 +7,7 @@ using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.Models;
#nullable enable
@ -123,8 +124,11 @@ namespace osu.Game.Online.API.Requests.Responses
TitleUnicode = TitleUnicode,
Artist = Artist,
ArtistUnicode = ArtistUnicode,
AuthorID = AuthorID,
Author = Author,
Author = new RealmUser
{
OnlineID = Author.OnlineID,
Username = Author.Username
},
Source = Source,
Tags = Tags,
};