Skip to content

Commit

Permalink
Fix test failure due to TestMetadataClient providing null statistic…
Browse files Browse the repository at this point in the history
…s array
  • Loading branch information
peppy committed Jul 30, 2024
1 parent d75c170 commit 5ebb5ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public partial class TestSceneDailyChallenge : OnlinePlayTestScene
private void load()
{
base.Content.Add(notificationOverlay);
base.Content.Add(metadataClient);
}

[Test]
Expand Down Expand Up @@ -63,7 +64,7 @@ public void TestNotifications()
Name = { Value = "Daily Challenge: June 4, 2024" },
Playlist =
{
new PlaylistItem(CreateAPIBeatmapSet().Beatmaps.First())
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
Expand Down
9 changes: 8 additions & 1 deletion osu.Game/Tests/Visual/Metadata/TestMetadataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ public override Task DailyChallengeUpdated(DailyChallengeInfo? info)
}

public override Task<MultiplayerPlaylistItemStats[]> BeginWatchingMultiplayerRoom(long id)
=> Task.FromResult(new MultiplayerPlaylistItemStats[MultiplayerPlaylistItemStats.TOTAL_SCORE_DISTRIBUTION_BINS]);
{
var stats = new MultiplayerPlaylistItemStats[MultiplayerPlaylistItemStats.TOTAL_SCORE_DISTRIBUTION_BINS];

for (int i = 0; i < stats.Length; i++)
stats[i] = new MultiplayerPlaylistItemStats { PlaylistItemID = i };

return Task.FromResult(stats);
}

public override Task EndWatchingMultiplayerRoom(long id) => Task.CompletedTask;
}
Expand Down

0 comments on commit 5ebb5ad

Please sign in to comment.