mirror of https://github.com/ppy/osu
Use constant online IDs in tests to avoid preview not working randomly
This commit is contained in:
parent
b739b6a725
commit
1907b42f82
|
@ -23,6 +23,11 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||
{
|
||||
public class TestSceneBeatmapCard : OsuTestScene
|
||||
{
|
||||
/// <summary>
|
||||
/// All cards on this scene use a common online ID to ensure that map download, preview tracks, etc. can be tested manually with online sources.
|
||||
/// </summary>
|
||||
private const int online_id = 163112;
|
||||
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
private APIBeatmapSet[] testCases;
|
||||
|
@ -38,7 +43,6 @@ private void load()
|
|||
var normal = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
normal.HasVideo = true;
|
||||
normal.HasStoryboard = true;
|
||||
normal.OnlineID = 241526;
|
||||
|
||||
var withStatistics = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
withStatistics.Title = withStatistics.TitleUnicode = "play favourite stats";
|
||||
|
@ -106,6 +110,9 @@ private void load()
|
|||
explicitFeaturedMap,
|
||||
longName
|
||||
};
|
||||
|
||||
foreach (var testCase in testCases)
|
||||
testCase.OnlineID = online_id;
|
||||
}
|
||||
|
||||
private APIBeatmapSet getUndownloadableBeatmapSet() => new APIBeatmapSet
|
||||
|
@ -191,9 +198,9 @@ public void SetUpSteps()
|
|||
private void ensureSoleilyRemoved()
|
||||
{
|
||||
AddUntilStep("ensure manager loaded", () => beatmaps != null);
|
||||
AddStep("remove soleily", () =>
|
||||
AddStep("remove map", () =>
|
||||
{
|
||||
var beatmap = beatmaps.QueryBeatmapSet(b => b.OnlineID == 241526);
|
||||
var beatmap = beatmaps.QueryBeatmapSet(b => b.OnlineID == online_id);
|
||||
|
||||
if (beatmap != null) beatmaps.Delete(beatmap);
|
||||
});
|
||||
|
|
|
@ -27,11 +27,17 @@ public void TestThumbnailPreview()
|
|||
{
|
||||
BeatmapCardThumbnail thumbnail = null;
|
||||
|
||||
AddStep("create thumbnail", () => Child = thumbnail = new BeatmapCardThumbnail(CreateAPIBeatmapSet(Ruleset.Value))
|
||||
AddStep("create thumbnail", () =>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200)
|
||||
var beatmapSet = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
beatmapSet.OnlineID = 241526; // ID hardcoded to ensure that the preview track exists online.
|
||||
|
||||
Child = thumbnail = new BeatmapCardThumbnail(beatmapSet)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200)
|
||||
};
|
||||
});
|
||||
AddStep("enable dim", () => thumbnail.Dimmed.Value = true);
|
||||
AddUntilStep("button visible", () => playButton.IsPresent);
|
||||
|
|
Loading…
Reference in New Issue