mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Allow changing ruleset during test
This commit is contained in:
parent
f701c331f2
commit
8fba655d2e
@ -10,6 +10,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -23,7 +24,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager manager { get; set; }
|
private BeatmapManager manager { get; set; }
|
||||||
|
|
||||||
private void createDisplay(Func<WorkingBeatmap> getBeatmap)
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
foreach (var ruleset in rulesets.AvailableRulesets)
|
||||||
|
AddStep($"switch to {ruleset.Name}", () => Ruleset.Value = ruleset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTest(Func<WorkingBeatmap> getBeatmap)
|
||||||
{
|
{
|
||||||
AddStep("setup display", () => Child = display = new BeatmapMetadataDisplay(getBeatmap(), new Bindable<IReadOnlyList<Mod>>(getRandomMods()), Empty())
|
AddStep("setup display", () => Child = display = new BeatmapMetadataDisplay(getBeatmap(), new Bindable<IReadOnlyList<Mod>>(getRandomMods()), Empty())
|
||||||
{
|
{
|
||||||
@ -43,7 +55,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Values("Trial", "Some1's very hardest difficulty")]
|
[Values("Trial", "Some1's very hardest difficulty")]
|
||||||
string version)
|
string version)
|
||||||
{
|
{
|
||||||
createDisplay(() => CreateWorkingBeatmap(new Beatmap
|
createTest(() => CreateWorkingBeatmap(new Beatmap
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
@ -60,7 +72,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestRandomFromDatabase()
|
public void TestRandomFromDatabase()
|
||||||
{
|
{
|
||||||
createDisplay(() =>
|
createTest(() =>
|
||||||
{
|
{
|
||||||
var allBeatmapSets = manager.GetAllUsableBeatmapSets(IncludedDetails.Minimal);
|
var allBeatmapSets = manager.GetAllUsableBeatmapSets(IncludedDetails.Minimal);
|
||||||
if (allBeatmapSets.Count == 0)
|
if (allBeatmapSets.Count == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user