Fix test failures

This commit is contained in:
Dan Balasescu 2022-08-02 20:18:45 +09:00
parent b4e55f7309
commit 5a1c05918f
3 changed files with 21 additions and 10 deletions

View File

@ -93,7 +93,7 @@ public void TestTexturePriorities(string[] textureFilenames, string priorityLook
Child = piece = new TestLegacyMainCirclePiece(priorityLookup),
};
var sprites = this.ChildrenOfType<Sprite>().DistinctBy(s => s.Texture.AssetName).ToArray();
var sprites = this.ChildrenOfType<Sprite>().Where(s => !string.IsNullOrEmpty(s.Texture.AssetName)).DistinctBy(s => s.Texture.AssetName).ToArray();
Debug.Assert(sprites.Length <= 2);
});

View File

@ -25,6 +25,9 @@ namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneCursorTrail : OsuTestScene
{
[Resolved]
private IRenderer renderer { get; set; }
[Test]
public void TestSmoothCursorTrail()
{
@ -44,7 +47,7 @@ public void TestLegacySmoothCursorTrail()
{
createTest(() =>
{
var skinContainer = new LegacySkinContainer(false);
var skinContainer = new LegacySkinContainer(renderer, false);
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
skinContainer.Child = legacyCursorTrail;
@ -58,7 +61,7 @@ public void TestLegacyDisjointCursorTrail()
{
createTest(() =>
{
var skinContainer = new LegacySkinContainer(true);
var skinContainer = new LegacySkinContainer(renderer, true);
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
skinContainer.Child = legacyCursorTrail;
@ -82,13 +85,12 @@ private void createTest(Func<Drawable> createContent) => AddStep("create trail",
[Cached(typeof(ISkinSource))]
private class LegacySkinContainer : Container, ISkinSource
{
[Resolved]
private IRenderer renderer { get; set; }
private readonly IRenderer renderer;
private readonly bool disjoint;
public LegacySkinContainer(bool disjoint)
public LegacySkinContainer(IRenderer renderer, bool disjoint)
{
this.renderer = renderer;
this.disjoint = disjoint;
RelativeSizeAxes = Axes.Both;

View File

@ -43,10 +43,19 @@ public class TestSceneSeasonalBackgroundLoader : ScreenTestScene
"Backgrounds/bg3"
};
[BackgroundDependencyLoader]
private void load(IRenderer renderer, LargeTextureStore wrappedStore)
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
textureStore = new LookupLoggingTextureStore(dependencies.Get<IRenderer>());
dependencies.CacheAs(typeof(LargeTextureStore), textureStore);
return dependencies;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore wrappedStore)
{
textureStore = new LookupLoggingTextureStore(renderer);
textureStore.AddStore(wrappedStore);
Child = new DependencyProvidingContainer