From 1a92e5ad1960d4962433e0225b436908610bf9d5 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Fri, 1 Nov 2024 19:24:58 +0800 Subject: [PATCH] remove CreateAPIRelationFromAPIUser --- .../Gameplay/TestSceneGameplayLeaderboard.cs | 8 ++++++- .../Online/TestSceneDashboardOverlay.cs | 22 ++++++++++++------- .../Online/TestSceneUserProfileHeader.cs | 17 +++++++++++--- osu.Game/Tests/Visual/OsuTestScene.cs | 9 -------- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs index 135c1fd50c..1787230117 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs @@ -155,7 +155,13 @@ namespace osu.Game.Tests.Visual.Gameplay var api = (DummyAPIAccess)API; api.Friends.Clear(); - api.Friends.Add(CreateAPIRelationFromAPIUser(friend)); + api.Friends.Add(new APIRelation + { + Mutual = true, + RelationType = RelationType.Friend, + TargetID = friend.OnlineID, + TargetUser = friend + }); }); int playerNumber = 1; diff --git a/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs index f2ea084f40..fb54e936bc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDashboardOverlay.cs @@ -30,15 +30,21 @@ namespace osu.Game.Tests.Visual.Online if (supportLevel > 3) supportLevel = 0; - ((DummyAPIAccess)API).Friends.Add(CreateAPIRelationFromAPIUser(new APIUser + ((DummyAPIAccess)API).Friends.Add(new APIRelation { - Username = @"peppy", - Id = 2, - Colour = "99EB47", - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", - IsSupporter = supportLevel > 0, - SupportLevel = supportLevel - })); + TargetID = 2, + RelationType = RelationType.Friend, + Mutual = true, + TargetUser = new APIUser + { + Username = @"peppy", + Id = 2, + Colour = "99EB47", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", + IsSupporter = supportLevel > 0, + SupportLevel = supportLevel + } + }); } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 725da655c3..9c368f6d73 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -431,7 +431,13 @@ namespace osu.Game.Tests.Visual.Online if (req.TargetId != nonFriend.OnlineID) return false; - var apiRelation = CreateAPIRelationFromAPIUser(nonFriend); + var apiRelation = new APIRelation + { + TargetID = nonFriend.OnlineID, + Mutual = true, + RelationType = RelationType.Friend, + TargetUser = nonFriend + }; Task.Run(() => { @@ -465,8 +471,13 @@ namespace osu.Game.Tests.Visual.Online if (req.TargetId != nonFriend.OnlineID) return false; - var apiRelation = CreateAPIRelationFromAPIUser(nonFriend); - apiRelation.Mutual = false; + var apiRelation = new APIRelation + { + TargetID = nonFriend.OnlineID, + Mutual = false, + RelationType = RelationType.Friend, + TargetUser = nonFriend + }; Task.Run(() => { diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 853c5d5f5c..09cfe5ecad 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -317,15 +317,6 @@ namespace osu.Game.Tests.Visual return result; } - public static APIRelation CreateAPIRelationFromAPIUser(APIUser user) => - new APIRelation - { - Mutual = true, - RelationType = RelationType.Friend, - TargetID = user.OnlineID, - TargetUser = user - }; - protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset) => CreateWorkingBeatmap(CreateBeatmap(ruleset));