mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
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
|
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 DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||||
|
|
||||||
private APIBeatmapSet[] testCases;
|
private APIBeatmapSet[] testCases;
|
||||||
@ -38,7 +43,6 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
var normal = CreateAPIBeatmapSet(Ruleset.Value);
|
var normal = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
normal.HasVideo = true;
|
normal.HasVideo = true;
|
||||||
normal.HasStoryboard = true;
|
normal.HasStoryboard = true;
|
||||||
normal.OnlineID = 241526;
|
|
||||||
|
|
||||||
var withStatistics = CreateAPIBeatmapSet(Ruleset.Value);
|
var withStatistics = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
withStatistics.Title = withStatistics.TitleUnicode = "play favourite stats";
|
withStatistics.Title = withStatistics.TitleUnicode = "play favourite stats";
|
||||||
@ -106,6 +110,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
explicitFeaturedMap,
|
explicitFeaturedMap,
|
||||||
longName
|
longName
|
||||||
};
|
};
|
||||||
|
|
||||||
|
foreach (var testCase in testCases)
|
||||||
|
testCase.OnlineID = online_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private APIBeatmapSet getUndownloadableBeatmapSet() => new APIBeatmapSet
|
private APIBeatmapSet getUndownloadableBeatmapSet() => new APIBeatmapSet
|
||||||
@ -191,9 +198,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
private void ensureSoleilyRemoved()
|
private void ensureSoleilyRemoved()
|
||||||
{
|
{
|
||||||
AddUntilStep("ensure manager loaded", () => beatmaps != null);
|
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);
|
if (beatmap != null) beatmaps.Delete(beatmap);
|
||||||
});
|
});
|
||||||
|
@ -27,11 +27,17 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
{
|
{
|
||||||
BeatmapCardThumbnail thumbnail = null;
|
BeatmapCardThumbnail thumbnail = null;
|
||||||
|
|
||||||
AddStep("create thumbnail", () => Child = thumbnail = new BeatmapCardThumbnail(CreateAPIBeatmapSet(Ruleset.Value))
|
AddStep("create thumbnail", () =>
|
||||||
|
{
|
||||||
|
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,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(200)
|
Size = new Vector2(200)
|
||||||
|
};
|
||||||
});
|
});
|
||||||
AddStep("enable dim", () => thumbnail.Dimmed.Value = true);
|
AddStep("enable dim", () => thumbnail.Dimmed.Value = true);
|
||||||
AddUntilStep("button visible", () => playButton.IsPresent);
|
AddUntilStep("button visible", () => playButton.IsPresent);
|
||||||
|
Loading…
Reference in New Issue
Block a user