mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Fix failing tests
This commit is contained in:
parent
040afff670
commit
0674862b6c
@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets;
|
||||
@ -36,7 +37,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
|
||||
|
||||
assertSpritesFromSkin(false);
|
||||
AddAssert("sprite didn't find texture", () =>
|
||||
sprites.All(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Texture == null)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -48,9 +50,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
|
||||
|
||||
assertSpritesFromSkin(true);
|
||||
// Only checking for at least one sprite that succeeded, as not all skins in this test provide the hitcircleoverlay texture.
|
||||
AddAssert("sprite found texture", () =>
|
||||
sprites.Any(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Texture != null)));
|
||||
|
||||
AddAssert("skinnable sprite has correct size", () => sprites.Any(s => Precision.AlmostEquals(s.ChildrenOfType<SkinnableSprite>().Single().Size, new Vector2(128, 128))));
|
||||
AddAssert("skinnable sprite has correct size", () =>
|
||||
sprites.Any(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Size == new Vector2(128))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -104,9 +109,5 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
s.LifetimeStart = double.MinValue;
|
||||
s.LifetimeEnd = double.MaxValue;
|
||||
});
|
||||
|
||||
private void assertSpritesFromSkin(bool fromSkin) =>
|
||||
AddAssert($"sprites are {(fromSkin ? "from skin" : "from storyboard")}",
|
||||
() => sprites.All(sprite => sprite.ChildrenOfType<SkinnableSprite>().Any() == fromSkin));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user