mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 07:23:22 +08:00
Pass individual components to DummyWorkingBeatmap, not game
This commit is contained in:
parent
f33a5bc54c
commit
b52276c489
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editor
|
namespace osu.Game.Tests.Visual.Editor
|
||||||
@ -95,7 +96,7 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
Child = graph = new TestWaveformGraph
|
Child = graph = new TestWaveformGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Waveform = new DummyWorkingBeatmap(game).Waveform,
|
Waveform = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).Waveform,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
@ -60,7 +59,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddStep("set name", () => Room.Name.Value = "Room name");
|
AddStep("set name", () => Room.Name.Value = "Room name");
|
||||||
AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
|
AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
|
||||||
|
|
||||||
AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap(game).BeatmapInfo }));
|
AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = CreateBeatmap(Ruleset.Value).BeatmapInfo }));
|
||||||
AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value);
|
AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value);
|
||||||
|
|
||||||
AddStep("clear name", () => Room.Name.Value = "");
|
AddStep("clear name", () => Room.Name.Value = "");
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Size = new Vector2(550f, 450f),
|
Size = new Vector2(550f, 450f),
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game)
|
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game)
|
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game)
|
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game)
|
AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game)
|
AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
@ -16,9 +17,9 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public class DummyWorkingBeatmap : WorkingBeatmap
|
public class DummyWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
private readonly OsuGameBase game;
|
private readonly TextureStore textures;
|
||||||
|
|
||||||
public DummyWorkingBeatmap(OsuGameBase game)
|
public DummyWorkingBeatmap(AudioManager audio, TextureStore textures)
|
||||||
: base(new BeatmapInfo
|
: base(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
@ -34,16 +35,16 @@ namespace osu.Game.Beatmaps
|
|||||||
OverallDifficulty = 0,
|
OverallDifficulty = 0,
|
||||||
},
|
},
|
||||||
Ruleset = new DummyRulesetInfo()
|
Ruleset = new DummyRulesetInfo()
|
||||||
}, game.Audio)
|
}, audio)
|
||||||
{
|
{
|
||||||
this.game = game;
|
this.textures = textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => new Beatmap();
|
protected override IBeatmap GetBeatmap() => new Beatmap();
|
||||||
|
|
||||||
protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");
|
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override Track GetTrack() => game?.Audio?.Tracks.GetVirtual(1000);
|
protected override Track GetTrack() => GetVirtualTrack(Beatmap);
|
||||||
|
|
||||||
private class DummyRulesetInfo : RulesetInfo
|
private class DummyRulesetInfo : RulesetInfo
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
dependencies.CacheAs<IAPIProvider>(API);
|
dependencies.CacheAs<IAPIProvider>(API);
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||||
|
|
||||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -45,9 +46,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
||||||
beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap(parent.Get<OsuGameBase>()))
|
var working = new DummyWorkingBeatmap(parent.Get<AudioManager>(), parent.Get<TextureStore>());
|
||||||
|
|
||||||
|
beatmap = new OsuTestBeatmap(working)
|
||||||
{
|
{
|
||||||
Default = new DummyWorkingBeatmap(parent.Get<OsuGameBase>())
|
Default = working
|
||||||
};
|
};
|
||||||
|
|
||||||
return Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
return Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
@ -63,7 +66,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected virtual IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset);
|
protected virtual IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset);
|
||||||
|
|
||||||
protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset = null) =>
|
protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset) =>
|
||||||
CreateWorkingBeatmap(CreateBeatmap(ruleset));
|
CreateWorkingBeatmap(CreateBeatmap(ruleset));
|
||||||
|
|
||||||
protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) =>
|
protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user