1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:42:54 +08:00

Fix overlay not refreshed in TestSceneBeatmapSetOverlay

This commit is contained in:
ekrctb 2021-09-09 12:39:40 +09:00
parent 8745d299dc
commit 210640af09

View File

@ -11,6 +11,7 @@ using osu.Game.Users;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Utils;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
{ {
@ -240,7 +241,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("show explicit map", () => AddStep("show explicit map", () =>
{ {
var beatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet; var beatmapSet = getBeatmapSet();
beatmapSet.OnlineInfo.HasExplicitContent = true; beatmapSet.OnlineInfo.HasExplicitContent = true;
overlay.ShowBeatmapSet(beatmapSet); overlay.ShowBeatmapSet(beatmapSet);
}); });
@ -251,7 +252,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddStep("show featured map", () => AddStep("show featured map", () =>
{ {
var beatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet; var beatmapSet = getBeatmapSet();
beatmapSet.OnlineInfo.TrackId = 1; beatmapSet.OnlineInfo.TrackId = 1;
overlay.ShowBeatmapSet(beatmapSet); overlay.ShowBeatmapSet(beatmapSet);
}); });
@ -319,6 +320,14 @@ namespace osu.Game.Tests.Visual.Online
}; };
} }
private BeatmapSetInfo getBeatmapSet()
{
var beatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet;
// Overlay doesn't reload if the same beatmap set is set.
beatmapSet.OnlineBeatmapSetID = RNG.Next();
return beatmapSet;
}
private void downloadAssert(bool shown) private void downloadAssert(bool shown)
{ {
AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.HeaderContent.DownloadButtonsVisible == shown); AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.HeaderContent.DownloadButtonsVisible == shown);