mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
Merge pull request #7184 from peppy/improve-test-data-sources
Improve test data sources
This commit is contained in:
commit
4392317d3b
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
using osu.Game.Rulesets.Catch.Mods;
|
using osu.Game.Rulesets.Catch.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
@ -12,9 +13,10 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(CatchModHidden) }).ToList();
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(CatchModHidden) }).ToList();
|
||||||
|
|
||||||
public TestSceneDrawableHitObjectsHidden()
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Mods.Value = new[] { new CatchModHidden() };
|
Mods.Value = new[] { new CatchModHidden() };
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
||||||
|
|
||||||
public TestSceneHitCircleHidden()
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Mods.Value = new[] { new OsuModHidden() };
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
||||||
|
|
||||||
public TestSceneSliderHidden()
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Mods.Value = new[] { new OsuModHidden() };
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[] { typeof(OsuModHidden) }).ToList();
|
||||||
|
|
||||||
public TestSceneSpinnerHidden()
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Mods.Value = new[] { new OsuModHidden() };
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,16 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Overlays.Mods.Sections;
|
using osu.Game.Overlays.Mods.Sections;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mania;
|
||||||
using osu.Game.Rulesets.Mania.Mods;
|
using osu.Game.Rulesets.Mania.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
@ -48,42 +51,48 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
private void load(RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
}
|
||||||
|
|
||||||
Add(modSelect = new TestModSelectOverlay
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
modSelect = new TestModSelectOverlay
|
||||||
Origin = Anchor.BottomCentre,
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
RelativeSizeAxes = Axes.X,
|
||||||
});
|
Origin = Anchor.BottomCentre,
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
},
|
||||||
|
|
||||||
Add(modDisplay = new ModDisplay
|
modDisplay = new ModDisplay
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(0, 25),
|
Position = new Vector2(0, 25),
|
||||||
});
|
Current = { BindTarget = modSelect.SelectedMods }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
modDisplay.Current.UnbindBindings();
|
[SetUpSteps]
|
||||||
modDisplay.Current.BindTo(modSelect.SelectedMods);
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
AddStep("Show", modSelect.Show);
|
AddStep("show", () => modSelect.Show());
|
||||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
|
||||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOsuMods()
|
public void TestOsuMods()
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
changeRuleset(0);
|
||||||
changeRuleset(ruleset);
|
|
||||||
|
|
||||||
var instance = ruleset.CreateInstance();
|
var osu = new OsuRuleset();
|
||||||
|
|
||||||
var easierMods = instance.GetModsFor(ModType.DifficultyReduction);
|
var easierMods = osu.GetModsFor(ModType.DifficultyReduction);
|
||||||
var harderMods = instance.GetModsFor(ModType.DifficultyIncrease);
|
var harderMods = osu.GetModsFor(ModType.DifficultyIncrease);
|
||||||
|
|
||||||
var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail);
|
var noFailMod = osu.GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail);
|
||||||
var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden);
|
var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden);
|
||||||
|
|
||||||
var doubleTimeMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime));
|
var doubleTimeMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime));
|
||||||
@ -97,8 +106,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
testMultiMod(doubleTimeMod);
|
testMultiMod(doubleTimeMod);
|
||||||
testIncompatibleMods(easy, hardRock);
|
testIncompatibleMods(easy, hardRock);
|
||||||
testDeselectAll(easierMods.Where(m => !(m is MultiMod)));
|
testDeselectAll(easierMods.Where(m => !(m is MultiMod)));
|
||||||
testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour);
|
testMultiplierTextColour(noFailMod, () => modSelect.LowMultiplierColour);
|
||||||
testMultiplierTextColour(hiddenMod, modSelect.HighMultiplierColour);
|
testMultiplierTextColour(hiddenMod, () => modSelect.HighMultiplierColour);
|
||||||
|
|
||||||
testUnimplementedMod(spunOutMod);
|
testUnimplementedMod(spunOutMod);
|
||||||
}
|
}
|
||||||
@ -106,37 +115,31 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestManiaMods()
|
public void TestManiaMods()
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
changeRuleset(3);
|
||||||
changeRuleset(ruleset);
|
|
||||||
|
|
||||||
testRankedText(ruleset.CreateInstance().GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom));
|
testRankedText(new ManiaRuleset().GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRulesetChanges()
|
public void TestRulesetChanges()
|
||||||
{
|
{
|
||||||
var rulesetOsu = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
changeRuleset(0);
|
||||||
var rulesetMania = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
|
||||||
|
|
||||||
changeRuleset(null);
|
var noFailMod = new OsuRuleset().GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail);
|
||||||
|
|
||||||
var instance = rulesetOsu.CreateInstance();
|
AddStep("set mods externally", () => { Mods.Value = new[] { noFailMod }; });
|
||||||
var easierMods = instance.GetModsFor(ModType.DifficultyReduction);
|
|
||||||
var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail);
|
|
||||||
|
|
||||||
AddStep("set mods externally", () => { modDisplay.Current.Value = new[] { noFailMod }; });
|
changeRuleset(0);
|
||||||
|
|
||||||
changeRuleset(rulesetOsu);
|
|
||||||
|
|
||||||
AddAssert("ensure mods still selected", () => modDisplay.Current.Value.Single(m => m is OsuModNoFail) != null);
|
AddAssert("ensure mods still selected", () => modDisplay.Current.Value.Single(m => m is OsuModNoFail) != null);
|
||||||
|
|
||||||
changeRuleset(rulesetMania);
|
changeRuleset(3);
|
||||||
|
|
||||||
AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any(m => m is OsuModNoFail));
|
AddAssert("ensure mods not selected", () => modDisplay.Current.Value.Count == 0);
|
||||||
|
|
||||||
changeRuleset(rulesetOsu);
|
changeRuleset(0);
|
||||||
|
|
||||||
AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any());
|
AddAssert("ensure mods not selected", () => modDisplay.Current.Value.Count == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSingleMod(Mod mod)
|
private void testSingleMod(Mod mod)
|
||||||
@ -198,19 +201,19 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
selectNext(mod);
|
selectNext(mod);
|
||||||
|
|
||||||
AddAssert("check for any selection", () => modSelect.SelectedMods.Value.Any());
|
AddAssert("check for any selection", () => modSelect.SelectedMods.Value.Any());
|
||||||
AddStep("deselect all", modSelect.DeselectAllButton.Action.Invoke);
|
AddStep("deselect all", () => modSelect.DeselectAllButton.Action.Invoke());
|
||||||
AddAssert("check for no selection", () => !modSelect.SelectedMods.Value.Any());
|
AddAssert("check for no selection", () => !modSelect.SelectedMods.Value.Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testMultiplierTextColour(Mod mod, Color4 colour)
|
private void testMultiplierTextColour(Mod mod, Func<Color4> getCorrectColour)
|
||||||
{
|
{
|
||||||
checkLabelColor(Color4.White);
|
checkLabelColor(() => Color4.White);
|
||||||
selectNext(mod);
|
selectNext(mod);
|
||||||
AddWaitStep("wait for changing colour", 1);
|
AddWaitStep("wait for changing colour", 1);
|
||||||
checkLabelColor(colour);
|
checkLabelColor(getCorrectColour);
|
||||||
selectPrevious(mod);
|
selectPrevious(mod);
|
||||||
AddWaitStep("wait for changing colour", 1);
|
AddWaitStep("wait for changing colour", 1);
|
||||||
checkLabelColor(Color4.White);
|
checkLabelColor(() => Color4.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testRankedText(Mod mod)
|
private void testRankedText(Mod mod)
|
||||||
@ -235,9 +238,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeRuleset(RulesetInfo ruleset)
|
private void changeRuleset(int? id)
|
||||||
{
|
{
|
||||||
AddStep($"change ruleset to {ruleset}", () => { Ruleset.Value = ruleset; });
|
AddStep($"change ruleset to {(id?.ToString() ?? "none")}", () => { Ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(r => r.ID == id); });
|
||||||
waitForLoad();
|
waitForLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +256,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkLabelColor(Color4 color) => AddAssert("check label has expected colour", () => modSelect.MultiplierLabel.Colour.AverageColour == color);
|
private void checkLabelColor(Func<Color4> getColour) => AddAssert("check label has expected colour", () => modSelect.MultiplierLabel.Colour.AverageColour == getColour());
|
||||||
|
|
||||||
private class TestModSelectOverlay : ModSelectOverlay
|
private class TestModSelectOverlay : ModSelectOverlay
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||||
[Cached]
|
[Cached]
|
||||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
protected Bindable<WorkingBeatmap> Beatmap { get; private set; } // cached via load() method
|
protected Bindable<WorkingBeatmap> Beatmap { get; private set; } // cached via load() method
|
||||||
|
@ -87,12 +87,12 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public virtual float BackgroundParallaxAmount => 1;
|
public virtual float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
|
public virtual bool AllowRateAdjustments => true;
|
||||||
|
|
||||||
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
public Bindable<RulesetInfo> Ruleset { get; private set; }
|
public Bindable<RulesetInfo> Ruleset { get; private set; }
|
||||||
|
|
||||||
public virtual bool AllowRateAdjustments => true;
|
|
||||||
|
|
||||||
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }
|
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
@ -26,16 +26,26 @@ namespace osu.Game.Screens
|
|||||||
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
||||||
|
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
|
{
|
||||||
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
|
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
|
||||||
|
CacheAs(Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
||||||
|
|
||||||
if (Ruleset == null)
|
if (Ruleset == null)
|
||||||
|
{
|
||||||
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
|
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
|
||||||
|
CacheAs(Ruleset);
|
||||||
|
}
|
||||||
|
|
||||||
Mods = parent.Get<LeasedBindable<IReadOnlyList<Mod>>>()?.GetBoundCopy();
|
Mods = parent.Get<LeasedBindable<IReadOnlyList<Mod>>>()?.GetBoundCopy();
|
||||||
|
|
||||||
if (Mods == null)
|
if (Mods == null)
|
||||||
|
{
|
||||||
Cache(Mods = parent.Get<Bindable<IReadOnlyList<Mod>>>().BeginLease(true));
|
Cache(Mods = parent.Get<Bindable<IReadOnlyList<Mod>>>().BeginLease(true));
|
||||||
|
CacheAs(Mods);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ using osu.Framework.Audio.Track;
|
|||||||
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.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;
|
||||||
@ -21,6 +20,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Screens;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
@ -28,21 +28,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public abstract class OsuTestScene : TestScene
|
public abstract class OsuTestScene : TestScene
|
||||||
{
|
{
|
||||||
[Cached(typeof(Bindable<WorkingBeatmap>))]
|
protected Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
[Cached(typeof(IBindable<WorkingBeatmap>))]
|
|
||||||
private NonNullableBindable<WorkingBeatmap> beatmap;
|
|
||||||
|
|
||||||
protected Bindable<WorkingBeatmap> Beatmap => beatmap;
|
protected Bindable<RulesetInfo> Ruleset;
|
||||||
|
|
||||||
[Cached]
|
protected Bindable<IReadOnlyList<Mod>> Mods;
|
||||||
[Cached(typeof(IBindable<RulesetInfo>))]
|
|
||||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
|
||||||
|
|
||||||
[Cached]
|
protected new OsuScreenDependencies Dependencies { get; private set; }
|
||||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
|
||||||
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
|
||||||
|
|
||||||
protected new DependencyContainer Dependencies { get; private set; }
|
|
||||||
|
|
||||||
private readonly Lazy<Storage> localStorage;
|
private readonly Lazy<Storage> localStorage;
|
||||||
protected Storage LocalStorage => localStorage.Value;
|
protected Storage LocalStorage => localStorage.Value;
|
||||||
@ -72,18 +64,16 @@ 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
|
Dependencies = new OsuScreenDependencies(false, base.CreateChildDependencies(parent));
|
||||||
var working = new DummyWorkingBeatmap(parent.Get<AudioManager>(), parent.Get<TextureStore>());
|
|
||||||
|
|
||||||
beatmap = new NonNullableBindable<WorkingBeatmap>(working) { Default = working };
|
Beatmap = Dependencies.Beatmap;
|
||||||
beatmap.BindValueChanged(b => ScheduleAfterChildren(() =>
|
Beatmap.SetDefault();
|
||||||
{
|
|
||||||
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
|
||||||
if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track)
|
|
||||||
b.OldValue.RecycleTrack();
|
|
||||||
}));
|
|
||||||
|
|
||||||
Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
Ruleset = Dependencies.Ruleset;
|
||||||
|
Ruleset.SetDefault();
|
||||||
|
|
||||||
|
Mods = Dependencies.Mods;
|
||||||
|
Mods.SetDefault();
|
||||||
|
|
||||||
if (!UseOnlineAPI)
|
if (!UseOnlineAPI)
|
||||||
{
|
{
|
||||||
@ -135,8 +125,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
if (beatmap?.Value.TrackLoaded == true)
|
if (Beatmap?.Value.TrackLoaded == true)
|
||||||
beatmap.Value.Track.Stop();
|
Beatmap.Value.Track.Stop();
|
||||||
|
|
||||||
if (contextFactory.IsValueCreated)
|
if (contextFactory.IsValueCreated)
|
||||||
contextFactory.Value.ResetDatabase();
|
contextFactory.Value.ResetDatabase();
|
||||||
|
Loading…
Reference in New Issue
Block a user